5#ifndef DUNE_INTERFACE_HH
6#define DUNE_INTERFACE_HH
87 template<
class R,
class T1,
class T2,
class Op,
bool send>
136 indices_ =
new std::size_t[
size];
154 void add(std::size_t index)
157 indices_[size_++]=index;
161 : size_(0), maxSize_(0), indices_(0)
176 for(std::size_t
i=0;
i< size_; ++
i)
177 if(indices_[
i]!=
o.indices_[
i])
194 std::size_t* indices_;
216 typedef std::map<int,std::pair<InterfaceInformation,InterfaceInformation> >
InformationMap;
234 template<
typename R,
typename T1,
typename T2>
280 if(interfaces_.size()!=
o.interfaces_.
size())
282 typedef InformationMap::const_iterator
MIter;
285 m!=interfaces_.end(); ++
m, ++
om)
287 if(
om->first!=
m->first)
289 if(
om->second.first!=
om->second.first)
291 if(
om->second.second!=
om->second.second)
329 class InformationBuilder
336 void reserve(
int proc,
int size)
339 interfaces_[
proc].first.reserve(size);
341 interfaces_[
proc].second.reserve(size);
343 void add(
int proc, std::size_t local)
346 interfaces_[
proc].first.add(local);
348 interfaces_[
proc].second.add(local);
357 template<
class R,
class T1,
class T2,
class Op,
bool send>
365 typedef typename RemoteIndices::RemoteIndexMap::const_iterator const_iterator;
379 process->second.second->end();
401 process->second.second->end();
436 typedef InformationMap::const_iterator const_iterator;
437 const const_iterator end=interfaces_.end();
443 std::cout<<rank<<
": send for process "<<
infoPair->first<<
": ";
446 std::cout<<
info[
i]<<
" ";
447 std::cout<<std::endl;
450 std::cout<<rank<<
": receive for process "<<
infoPair->first<<
": ";
453 std::cout<<
info[
i]<<
" ";
454 std::cout<<std::endl;
460 template<
typename R,
typename T1,
typename T2>
466 assert(interfaces_.empty());
481 typedef InformationMap::iterator const_iterator;
494 typedef InformationMap::iterator iterator;
495 typedef InformationMap::const_iterator const_iterator;
496 const const_iterator end = interfaces_.end();
513 typedef InfoMap::const_iterator
Iter;
517 os<<
i->first<<
": [ source=[";
518 for(std::size_t
j=0;
j <
i->second.first.
size(); ++
j)
519 os<<
i->second.first[
j]<<
" ";
520 os<<
"] size="<<
i->second.first.
size()<<
", target=[";
521 for(std::size_t
j=0;
j <
i->second.second.
size(); ++
j)
522 os<<
i->second.second[
j]<<
" ";
523 os<<
"] size="<<
i->second.second.
size()<<
"\n";
Classes for building sets out of enumeration values.
Classes describing a distributed indexset.
iterator begin()
Get an iterator that is positioned at the first element.
Definition arraylist.hh:517
size_type size() const
Get the number of elements in the list.
Definition arraylist.hh:472
iterator end()
Get a random access iterator positioned after the last element.
Definition arraylist.hh:529
std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition bigunsignedint.hh:278
#define DUNE_THROW(E, m)
Definition exceptions.hh:218
void buildInterface(const R &remoteIndices, const T1 &sourceFlags, const T2 &destFlags, Op &functor) const
Builds the interface between remote processes.
Definition parallel/interface.hh:358
void build(const R &remoteIndices, const T1 &sourceFlags, const T2 &destFlags)
Builds the interface.
Definition parallel/interface.hh:461
void print() const
Print the interface to std::out for debugging.
Definition parallel/interface.hh:434
const InformationMap & interfaces() const
Get information about the interfaces.
Definition parallel/interface.hh:424
MPI_Comm communicator() const
Get the MPI Communicator.
Definition parallel/interface.hh:417
void strip()
Definition parallel/interface.hh:479
virtual ~Interface()
Destructor.
Definition parallel/interface.hh:504
void free()
Frees memory allocated during the build.
Definition parallel/interface.hh:492
Dune namespace.
Definition alignedallocator.hh:13
A dynamically growing random access list.
Definition arraylist.hh:62
Default exception if a function was called while the object is not in a valid state for that function...
Definition exceptions.hh:281
Base class of all classes representing a communication interface.
Definition parallel/interface.hh:35
virtual ~InterfaceBuilder()
Definition parallel/interface.hh:40
InterfaceBuilder()
Not for public use.
Definition parallel/interface.hh:47
Definition parallel/interface.hh:38
Information describing an interface.
Definition parallel/interface.hh:101
bool operator!=(const InterfaceInformation &o) const
Definition parallel/interface.hh:167
void free()
Definition parallel/interface.hh:143
void add(std::size_t index)
Add a new index to the interface.
Definition parallel/interface.hh:154
virtual ~InterfaceInformation()
Definition parallel/interface.hh:164
std::size_t & operator[](size_t i)
Get the local index for an entry.
Definition parallel/interface.hh:116
bool operator==(const InterfaceInformation &o) const
Definition parallel/interface.hh:172
InterfaceInformation()
Definition parallel/interface.hh:160
size_t size() const
Get the number of entries in the interface.
Definition parallel/interface.hh:108
void reserve(size_t size)
Reserve space for a number of entries.
Definition parallel/interface.hh:134
std::size_t operator[](size_t i) const
Get the local index for an entry.
Definition parallel/interface.hh:125
Communication interface between remote and local indices.
Definition parallel/interface.hh:209
bool operator!=(const Interface &o) const
Definition parallel/interface.hh:271
MPI_Comm communicator_
The MPI communicator we use.
Definition parallel/interface.hh:316
std::map< int, std::pair< InterfaceInformation, InterfaceInformation > > InformationMap
The type of the map form process number to InterfaceInformation for sending and receiving to and from...
Definition parallel/interface.hh:216
Interface()
Definition parallel/interface.hh:262
bool operator==(const Interface &o) const
Definition parallel/interface.hh:276
Interface(MPI_Comm comm)
Definition parallel/interface.hh:258
The indices present on remote processes.
Definition remoteindices.hh:189