1 #ifndef DUNE_FEM_COMMINDEXMAP_HH 2 #define DUNE_FEM_COMMINDEXMAP_HH 19 typedef int IndexType ;
51 template <
class GlobalKey>
52 void insert(
const std :: vector< GlobalKey > &idx )
54 const size_t size = idx.size();
55 size_t count = indices_.
size();
59 assert( indices_.
size() == (count +
size) );
62 for(
size_t i = 0; i <
size; ++i, ++count )
64 assert( idx[ i ] >= 0 );
65 indices_[ count ] = idx[ i ];
70 template <
class GlobalKey>
71 void set(
const std :: set< GlobalKey > &idxSet )
78 typedef typename std :: set< GlobalKey > :: const_iterator iterator;
79 const iterator end = idxSet.end();
80 for(iterator it = idxSet.begin(); it != end; ++it, ++count)
82 indices_[count] = *it;
89 return indices_.
size();
93 void print( std :: ostream &s,
int rank )
const 96 s <<
"Start print: size = " << size << std :: endl;
97 for(
size_t i = 0; i <
size; ++i )
98 s << rank <<
" idx[ " << i <<
" ] = " << indices_[ i ] << std :: endl;
99 s <<
"End of Array" << std :: endl;
103 template <
class CommBuffer>
106 const size_t idxSize = indices_.
size();
107 buffer.write( idxSize );
109 for(
size_t i=0; i<idxSize; ++i)
112 buffer.write( indices_[i] );
117 template <
class CommBuffer>
121 buffer.read( idxSize );
123 indices_.
resize( idxSize );
124 for(
size_t i=0; i<idxSize; ++i)
126 buffer.read( indices_[i] );
149 #endif // #ifndef DUNE_FEM_COMMINDEXMAP_HH
size_t size() const
return number of enties of array
Definition: arrays.hh:213
void resize(size_t nsize)
Definition: arrays.hh:491
size_t size() const
return size of map
Definition: commindexmap.hh:87
void print(std::ostream &s, int rank) const
print map for debugging only
Definition: commindexmap.hh:93
void insert(const std::vector< GlobalKey > &idx)
Definition: commindexmap.hh:52
void clear()
clear index map
Definition: commindexmap.hh:44
Definition: coordinate.hh:4
const IndexType & operator[](const size_t i) const
return index map for entry i
Definition: commindexmap.hh:37
void reserve(size_t mSize)
Definition: arrays.hh:517
void setMemoryFactor(const double memFactor)
set memory factor
Definition: arrays.hh:465
Definition: commindexmap.hh:17
void resize(size_t size)
resize map with size size
Definition: commindexmap.hh:133
CommunicationIndexMap()
constructor creating empty map
Definition: commindexmap.hh:25
void reserve(size_t size)
Definition: commindexmap.hh:138
void writeToBuffer(CommBuffer &buffer) const
write all indices to buffer
Definition: commindexmap.hh:104
void readFromBuffer(CommBuffer &buffer)
read all indices from buffer
Definition: commindexmap.hh:118