Dune Core Modules (2.9.0)

Dune::Torus< Communication, d > Class Template Reference

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

Classes

class  ProcListIterator
 

Public Types

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

Public Member Functions

 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 iTupeldims () 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 \(3^d-1\)
 
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 More...
 
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
 

Detailed Description

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 \(3^d-1\) neighbors, but several of these logical neighbors might be identical)
  • Provide means to partition a grid to the torus.

Member Function Documentation

◆ partition()

template<class Communication , int d>
double Dune::Torus< Communication, 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

References Dune::Torus< Communication, d >::coord(), Dune::Torus< Communication, d >::rank(), Dune::Torus< Communication, d >::rank_to_coord(), and Dune::Communication< Communicator >::size().

Referenced by Dune::YaspGrid< dim, Coordinates >::YaspGrid().


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 18, 22:30, 2024)