dune-grid  2.6-git
Classes | Public Types | Public Member Functions | List of all members
Dune::Torus< CollectiveCommunication, d > Class Template Reference

#include <dune/grid/yaspgrid/torus.hh>

Inheritance diagram for Dune::Torus< CollectiveCommunication, d >:
Inheritance graph

Classes

class  ProcListIterator
 

Public Types

typedef std::array< int, d > iTupel
 type used to pass tupels in and out More...
 

Public Member Functions

 Torus ()
 constructor making uninitialized object More...
 
 Torus (CollectiveCommunication comm, int tag, iTupel size, const YLoadBalance< d > *lb)
 make partitioner from communicator and coarse mesh size More...
 
int rank () const
 return own rank More...
 
iTupel coord () const
 return own coordinates More...
 
int procs () const
 return number of processes More...
 
const iTupeldims () const
 return dimensions of torus More...
 
int dims (int i) const
 return dimensions of torus in direction i More...
 
CollectiveCommunication comm () const
 return communicator More...
 
int tag () const
 return tag used by torus More...
 
bool inside (iTupel c) const
 return true if coordinate is inside torus More...
 
iTupel rank_to_coord (int rank) const
 map rank to coordinate in torus using lexicographic ordering More...
 
int coord_to_rank (iTupel coord) const
 map coordinate in torus to rank using lexicographic ordering More...
 
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) More...
 
int color (const iTupel &coord) const
 assign color to given coordinate More...
 
int color (int rank) const
 assign color to given rank More...
 
int neighbors () const
 return the number of neighbors, which is $3^d-1$ More...
 
bool is_neighbor (iTupel delta, std::bitset< d > periodic) const
 return true if neighbor with given delta is a neighbor under the given periodicity More...
 
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 More...
 
ProcListIterator sendbegin () const
 first process in send list More...
 
ProcListIterator sendend () const
 end of send list More...
 
ProcListIterator recvbegin () const
 first process in receive list More...
 
ProcListIterator recvend () const
 last process in receive list More...
 
void send (int rank, void *buffer, int size) const
 store a send request; buffers are sent in order; handles also local requests with memcpy More...
 
void recv (int rank, void *buffer, int size) const
 store a receive request; buffers are received in order; handles also local requests with memcpy More...
 
void exchange () const
 exchange messages stored in request buffers; clear request buffers afterwards More...
 
double global_max (double x) const
 global max More...
 
void print (std::ostream &s) const
 print contents of torus object More...
 

Detailed Description

template<class CollectiveCommunication, int d>
class Dune::Torus< CollectiveCommunication, d >

Torus provides all the functionality to handle a toroidal communication structure:

Member Typedef Documentation

◆ iTupel

template<class CollectiveCommunication , int d>
typedef std::array<int, d> Dune::Torus< CollectiveCommunication, d >::iTupel

type used to pass tupels in and out

Constructor & Destructor Documentation

◆ Torus() [1/2]

template<class CollectiveCommunication , int d>
Dune::Torus< CollectiveCommunication, d >::Torus ( )
inline

constructor making uninitialized object

◆ Torus() [2/2]

template<class CollectiveCommunication , int d>
Dune::Torus< CollectiveCommunication, d >::Torus ( CollectiveCommunication  comm,
int  tag,
iTupel  size,
const YLoadBalance< d > *  lb 
)
inline

make partitioner from communicator and coarse mesh size

Member Function Documentation

◆ color() [1/2]

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::color ( const iTupel coord) const
inline

assign color to given coordinate

◆ color() [2/2]

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::color ( int  rank) const
inline

assign color to given rank

◆ comm()

template<class CollectiveCommunication , int d>
CollectiveCommunication Dune::Torus< CollectiveCommunication, d >::comm ( ) const
inline

return communicator

◆ coord()

template<class CollectiveCommunication , int d>
iTupel Dune::Torus< CollectiveCommunication, d >::coord ( ) const
inline

return own coordinates

◆ coord_to_rank()

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::coord_to_rank ( iTupel  coord) const
inline

map coordinate in torus to rank using lexicographic ordering

◆ dims() [1/2]

template<class CollectiveCommunication , int d>
const iTupel& Dune::Torus< CollectiveCommunication, d >::dims ( ) const
inline

return dimensions of torus

◆ dims() [2/2]

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::dims ( int  i) const
inline

return dimensions of torus in direction i

◆ exchange()

template<class CollectiveCommunication , int d>
void Dune::Torus< CollectiveCommunication, d >::exchange ( ) const
inline

exchange messages stored in request buffers; clear request buffers afterwards

◆ global_max()

template<class CollectiveCommunication , int d>
double Dune::Torus< CollectiveCommunication, d >::global_max ( double  x) const
inline

global max

◆ inside()

template<class CollectiveCommunication , int d>
bool Dune::Torus< CollectiveCommunication, d >::inside ( iTupel  c) const
inline

return true if coordinate is inside torus

◆ is_neighbor()

template<class CollectiveCommunication , int d>
bool Dune::Torus< CollectiveCommunication, d >::is_neighbor ( iTupel  delta,
std::bitset< d >  periodic 
) const
inline

return true if neighbor with given delta is a neighbor under the given periodicity

◆ neighbors()

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::neighbors ( ) const
inline

return the number of neighbors, which is $3^d-1$

◆ partition()

template<class CollectiveCommunication , int d>
double Dune::Torus< CollectiveCommunication, d >::partition ( int  rank,
iTupel  origin_in,
iTupel  size_in,
iTupel origin_out,
iTupel size_out 
) const
inline

partition the given grid onto the torus and return the piece of the process with given rank; returns load imbalance

Parameters
rankrank of our processor
origin_inglobal origin
size_inglobal size
origin_outorigin of this processors interior
size_outsize of this processors interior

◆ print()

template<class CollectiveCommunication , int d>
void Dune::Torus< CollectiveCommunication, d >::print ( std::ostream &  s) const
inline

print contents of torus object

◆ procs()

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::procs ( ) const
inline

return number of processes

◆ rank()

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::rank ( ) const
inline

return own rank

◆ rank_relative()

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::rank_relative ( int  rank,
int  dir,
int  cnt 
) const
inline

return rank of process where its coordinate in direction dir has offset cnt (handles periodic case)

◆ rank_to_coord()

template<class CollectiveCommunication , int d>
iTupel Dune::Torus< CollectiveCommunication, d >::rank_to_coord ( int  rank) const
inline

map rank to coordinate in torus using lexicographic ordering

◆ recv()

template<class CollectiveCommunication , int d>
void Dune::Torus< CollectiveCommunication, d >::recv ( int  rank,
void *  buffer,
int  size 
) const
inline

store a receive request; buffers are received in order; handles also local requests with memcpy

◆ recvbegin()

template<class CollectiveCommunication , int d>
ProcListIterator Dune::Torus< CollectiveCommunication, d >::recvbegin ( ) const
inline

first process in receive list

◆ recvend()

template<class CollectiveCommunication , int d>
ProcListIterator Dune::Torus< CollectiveCommunication, d >::recvend ( ) const
inline

last process in receive list

◆ send()

template<class CollectiveCommunication , int d>
void Dune::Torus< CollectiveCommunication, d >::send ( int  rank,
void *  buffer,
int  size 
) const
inline

store a send request; buffers are sent in order; handles also local requests with memcpy

◆ sendbegin()

template<class CollectiveCommunication , int d>
ProcListIterator Dune::Torus< CollectiveCommunication, d >::sendbegin ( ) const
inline

first process in send list

◆ sendend()

template<class CollectiveCommunication , int d>
ProcListIterator Dune::Torus< CollectiveCommunication, d >::sendend ( ) const
inline

end of send list

◆ tag()

template<class CollectiveCommunication , int d>
int Dune::Torus< CollectiveCommunication, d >::tag ( ) const
inline

return tag used by torus


The documentation for this class was generated from the following file: