Torus ()
constructor making uninitialized object
Torus (Communication comm , int tag , iTupel size, int overlap, const Yasp::Partitioning < d > *partitioner)
make partitioner from communicator and coarse mesh size
int rank () const
return own rank
iTupel coord () const
return own coordinates
int procs () const
return number of processes
const iTupel & dims () const
return dimensions of torus
int dims (int i) const
return dimensions of torus in direction i
Communication comm () const
return communicator
int tag () const
return tag used by torus
bool inside (iTupel c) const
return true if coordinate is inside torus
iTupel rank_to_coord (int rank ) const
map rank to coordinate in torus using lexicographic ordering
int coord_to_rank (iTupel coord ) const
map coordinate in torus to rank using lexicographic ordering
int rank_relative (int rank , int dir, int cnt) const
return rank of process where its coordinate in direction dir has offset cnt (handles periodic case)
int color (const iTupel &coord ) const
assign color to given coordinate
int color (int rank ) const
assign color to given rank
int neighbors () const
return the number of neighbors, which is
bool is_neighbor (iTupel delta, std::bitset< d > periodic) const
return true if neighbor with given delta is a neighbor under the given periodicity
double partition (int rank , iTupel origin_in, iTupel size_in, iTupel &origin_out, iTupel &size_out) const
partition the given grid onto the torus and return the piece of the process with given rank; returns load imbalance
ProcListIterator sendbegin () const
first process in send list
ProcListIterator sendend () const
end of send list
ProcListIterator recvbegin () const
first process in receive list
ProcListIterator recvend () const
last process in receive list
void send (int rank , void *buffer, int size) const
store a send request; buffers are sent in order; handles also local requests with memcpy
void recv (int rank , void *buffer, int size) const
store a receive request; buffers are received in order; handles also local requests with memcpy
void exchange () const
exchange messages stored in request buffers; clear request buffers afterwards
double global_max (double x) const
global max
void print (std::ostream &s) const
print contents of torus object
template<class Communication, int d>
class Dune::Torus< Communication, d >
Torus provides all the functionality to handle a toroidal communication structure:
Map a set of processes (given by an MPI communicator) to a torus of dimension d. The "optimal" torus dimensions are determined by a coarse mesh. The maximum side length is minimized.
Provide lists of neighboring processes and a method for nearest neighbor exchange using asynchronous communication with MPI. The periodic case is handled where one process might have to exchange several messages with the same process. (Logically, a process has always neighbors, but several of these logical neighbors might be identical)
Provide means to partition a grid to the torus.