1#ifndef DUNE_FEM_COMMINDEXMAP_HH
2#define DUNE_FEM_COMMINDEXMAP_HH
17 typedef int IndexType ;
46 template <
class GlobalKey>
47 void insert(
const std :: vector< GlobalKey > &idx )
49 const size_t size = idx.size();
50 size_t count = indices_.
size();
54 assert( indices_.
size() == (count +
size) );
57 for(
size_t i = 0; i <
size; ++i, ++count )
59 assert( idx[ i ] >= 0 );
60 indices_[ count ] = idx[ i ];
65 template <
class GlobalKey>
66 void set(
const std :: set< GlobalKey > &idxSet )
73 typedef typename std :: set< GlobalKey > :: const_iterator iterator;
74 const iterator end = idxSet.end();
75 for(iterator it = idxSet.begin(); it != end; ++it, ++count)
77 indices_[count] = *it;
84 return indices_.
size();
88 void print( std :: ostream &s,
int rank )
const
91 s <<
"Start print: size = " <<
size << std :: endl;
92 for(
size_t i = 0; i <
size; ++i )
93 s << rank <<
" idx[ " << i <<
" ] = " << indices_[ i ] << std :: endl;
94 s <<
"End of Array" << std :: endl;
98 template <
class CommBuffer>
101 const size_t idxSize = indices_.
size();
102 buffer.write( idxSize );
104 for(
size_t i=0; i<idxSize; ++i)
107 buffer.write( indices_[i] );
112 template <
class CommBuffer>
116 buffer.read( idxSize );
118 indices_.
resize( idxSize );
119 for(
size_t i=0; i<idxSize; ++i)
121 buffer.read( indices_[i] );
Definition: bindguard.hh:11
Definition: commindexmap.hh:16
const IndexType & operator[](const size_t i) const
return index map for entry i
Definition: commindexmap.hh:32
CommunicationIndexMap(const CommunicationIndexMap &)=delete
void clear()
clear index map
Definition: commindexmap.hh:39
void print(std ::ostream &s, int rank) const
print map for debugging only
Definition: commindexmap.hh:88
size_t size() const
return size of map
Definition: commindexmap.hh:82
void set(const std ::set< GlobalKey > &idxSet)
insert sorted set of indices
Definition: commindexmap.hh:66
void resize(size_t size)
resize map with size size
Definition: commindexmap.hh:128
void writeToBuffer(CommBuffer &buffer) const
write all indices to buffer
Definition: commindexmap.hh:99
void readFromBuffer(CommBuffer &buffer)
read all indices from buffer
Definition: commindexmap.hh:113
void reserve(size_t size)
Definition: commindexmap.hh:133
void insert(const std ::vector< GlobalKey > &idx)
Definition: commindexmap.hh:47
CommunicationIndexMap()
constructor creating empty map
Definition: commindexmap.hh:23
size_type size() const
return size of array
Definition: dynamicarray.hh:170
void setMemoryFactor(double memFactor)
set memory factor
Definition: dynamicarray.hh:296
void reserve(size_type mSize)
Definition: dynamicarray.hh:371
void resize(size_type nsize)
Definition: dynamicarray.hh:334