Domi
Multi-dimensional, distributed data structures
 All Classes Files Functions Variables Typedefs Friends
List of all members
Domi::MDComm Class Reference

Multi-dimensional communicator object. More...

#include <Domi_MDComm.hpp>

Public Types

Teuchos::Array typedefs
typedef Teuchos::Array< int >
::size_type 
size_type
 

Public Member Functions

Constructors and Destructor
 MDComm (const Teuchos::ArrayView< const int > &commDims, const Teuchos::ArrayView< const int > &periodic=Teuchos::ArrayView< const int >())
 Constructor with default Teuchos comm and axis sizes. More...
 
 MDComm (const Teuchos::RCP< const Teuchos::Comm< int > > teuchosComm, const Teuchos::ArrayView< const int > &commDims, const Teuchos::ArrayView< const int > &periodic=Teuchos::ArrayView< const int >())
 Constructor with Teuchos Comm and axis sizes. More...
 
 MDComm (Teuchos::ParameterList &plist)
 Constructor with ParameterList. More...
 
 MDComm (const Teuchos::RCP< const Teuchos::Comm< int > > teuchosComm, Teuchos::ParameterList &plist)
 Constructor with Teuchos Comm and ParameterList. More...
 
 MDComm (int numDims)
 Constructor with number of dimensions. More...
 
 MDComm (const Teuchos::RCP< const Teuchos::Comm< int > > teuchosComm, int numDims)
 Constructor with number of dimensions. More...
 
 MDComm (int numDims, const Teuchos::ArrayView< const int > &commDims, const Teuchos::ArrayView< const int > &periodic=Teuchos::ArrayView< const int >())
 Constructor with number of dimensions and axis sizes. More...
 
 MDComm (const Teuchos::RCP< const Teuchos::Comm< int > > teuchosComm, int numDims, const Teuchos::ArrayView< const int > &commDims, const Teuchos::ArrayView< const int > &periodic=Teuchos::ArrayView< const int >())
 Constructor with Teuchos Comm, number of dimensions and axis sizes. More...
 
 MDComm (const MDComm &parent, int axis, int axisRank)
 Axis rank sub-communicator constructor. More...
 
 MDComm (const MDComm &parent, int axis, const Slice &slice)
 Slice sub-communicator constructor. More...
 
 MDComm (const MDComm &parent, const Teuchos::ArrayView< Slice > &slices)
 Array of Slices sub-communicator constructor. More...
 
 MDComm (const MDComm &source)
 Copy constructor. More...
 
 ~MDComm ()
 
MDCommoperator= (const MDComm &source)
 Assignment operator. More...
 
Accessor methods
bool onSubcommunicator () const
 Query whether this processor is on the sub-communicator. More...
 
Teuchos::RCP< const
Teuchos::Comm< int > > 
getTeuchosComm () const
 Get the Teuchos communicator. More...
 
int numDims () const
 Get the number of dimensions. More...
 
Teuchos::Array< int > getCommDims () const
 Get the communicator sizes along each axis. More...
 
int getCommDim (int axis) const
 Get the communicator size along the given axis. More...
 
bool isPeriodic (int axis) const
 Return the periodic flag for the given axis. More...
 
int getCommIndex (int axis) const
 Get the comm index along the given axis. More...
 
int getLowerNeighbor (int axis) const
 Get the rank of the lower neighbor. More...
 
int getUpperNeighbor (int axis) const
 Get the rank of the upper neighbor. More...
 
Axis communicator methods
Teuchos::ArrayView
< Teuchos::RCP< const MDComm > > 
getAxisComms () const
 Return array of all axis communicators. More...
 
Teuchos::RCP< const MDCommgetAxisComm (int axis) const
 Return an axis communicator for the given axis. More...
 

Static Public Attributes

MDComm layout
static const Layout commLayout
 

Detailed Description

Multi-dimensional communicator object.

The MDComm is a relatively simple class that contains a Teuchos::RCP<const Teuchos::Comm<int> > and arranges the processor ranks of that communicator in a multi-dimensional grid suitable for decomposing a multi-dimensional data structure.

To construct an MDComm, the user provides the number of dimensions, an array of sizes along each axis, or both. The user can request the constructor to compute some of the decomposition by making the axis sizes list shorter than the number of dimensions, or by providing axis sizes that are negative. Currently, the algorithm assigns all remaining processors to the first unspecified axis size, and assigns all the rest to be one.

An MDComm can also be constructed that is a slice of a parent MDComm. Such an object is constructed by providing an RCP of the parent and an array of Slices that define the sub-communicator. When you construct a sub-communicator, you run the risk of calling methods of the MDComm object or of objects built on top of the MDComm object from processors that are not a part of the sub-communicator. You can always check whether this is safe with the

bool onSubcommunicator() const;

method.

The MDComm class provides two methods that return the processor rank of neighboring processors in the grid of arrays:

int getLowerNeighbor(int axis) const;
int getUpperNeighbor(int axis) const;

This should be sufficient to provide the necessary processor ranks for conducting communication padding updates.

Constructor & Destructor Documentation

Domi::MDComm::MDComm ( const Teuchos::ArrayView< const int > &  commDims,
const Teuchos::ArrayView< const int > &  periodic = Teuchos::ArrayView< const int >() 
)

Constructor with default Teuchos comm and axis sizes.

Parameters
commDims[in] An array containing the sizes of the MDComm along each axis. The size of commDims determines the number of dimensions. Negative values will be converted to positive such that the product of the resulting axis sizes will equal the number of processors in the Teuchos communicator.
periodic[in] An array of ints which are simple flags denoting whether each axis is periodic. If this array is shorter than the size of commDims, the unspecified axes are assumed to be zero (false).

This constructor uses the Teuchos::DefaultComm communicator

Domi::MDComm::MDComm ( const Teuchos::RCP< const Teuchos::Comm< int > >  teuchosComm,
const Teuchos::ArrayView< const int > &  commDims,
const Teuchos::ArrayView< const int > &  periodic = Teuchos::ArrayView< const int >() 
)

Constructor with Teuchos Comm and axis sizes.

Parameters
teuchosComm[in] The Teuchos Communicator
commDims[in] An array containing the sizes of the MDComm along each axis. The size of commDims determines the number of dimensions. Negative values will be converted to positive such that the product of the resulting axis sizes will equal the number of processors in the Teuchos communicator.
periodic[in] An array of ints which are simple flags denoting whether each axis is periodic. If this array is shorter than the size of commDims, the unspecified axes are assumed to be zero (false).
Domi::MDComm::MDComm ( Teuchos::ParameterList &  plist)

Constructor with ParameterList.

Parameters
plist[in] ParameterList with construction information

This constructor uses the Teuchos::DefaultComm

Domi::MDComm::MDComm ( const Teuchos::RCP< const Teuchos::Comm< int > >  teuchosComm,
Teuchos::ParameterList &  plist 
)

Constructor with Teuchos Comm and ParameterList.

Parameters
teuchosComm[in] The Teuchos Communicator
plist[in] ParameterList with construction information
Domi::MDComm::MDComm ( int  numDims)

Constructor with number of dimensions.

Parameters
numDims[in] The number of dimensions in the MDComm. Currently, all of the processors are allocated to the first axis, and the other axes are assigned a size of one.

This constructor uses the Teuchos::DefaultComm

Domi::MDComm::MDComm ( const Teuchos::RCP< const Teuchos::Comm< int > >  teuchosComm,
int  numDims 
)

Constructor with number of dimensions.

Parameters
teuchosComm[in] The Teuchos Communicator
numDims[in] The number of dimensions in the MDComm. Currently, all of the processors are allocated to the first axis, and the other axes are assigned a size of one.
Domi::MDComm::MDComm ( int  numDims,
const Teuchos::ArrayView< const int > &  commDims,
const Teuchos::ArrayView< const int > &  periodic = Teuchos::ArrayView< const int >() 
)

Constructor with number of dimensions and axis sizes.

Parameters
numDims[in] The number of dimensions in the MDComm.
commDims[in] An array containing the sizes of the MDComm along each axis. If the size of commDims is less than numDims, then the missing values are treated as unspecified. Negative values will also be treated as unspecified. Unspecified values will be converted to positive such that the product of the resulting axis sizes will equal the number of processors in the Teuchos communicator.
periodic[in] An array of ints which are simple flags denoting whether each axis is periodic. If this array is shorter than numDims, the unspecified axes are assumed to be zero (false).

This constructor uses the Teuchos::DefaultComm

Domi::MDComm::MDComm ( const Teuchos::RCP< const Teuchos::Comm< int > >  teuchosComm,
int  numDims,
const Teuchos::ArrayView< const int > &  commDims,
const Teuchos::ArrayView< const int > &  periodic = Teuchos::ArrayView< const int >() 
)

Constructor with Teuchos Comm, number of dimensions and axis sizes.

Parameters
teuchosComm[in] The Teuchos Communicator
numDims[in] The number of dimensions in the MDComm.
commDims[in] An array containing the sizes of the MDComm along each axis. If the size of commDims is less than numDims, then the missing values are treated as unspecified. Negative values will also be treated as unspecified. Unspecified values will be converted to positive such that the product of the resulting axis sizes will equal the number of processors in the Teuchos communicator.
periodic[in] An array of ints which are simple flags denoting whether each axis is periodic. If this array is shorter than numDims, the unspecified axes are assumed to be zero (false).
Domi::MDComm::MDComm ( const MDComm parent,
int  axis,
int  axisRank 
)

Axis rank sub-communicator constructor.

Parameters
parent[in] The parent MDComm object.
axis[in] The axis to which the axisRank argument applies
axisRank[in] The value of the rank along the given axis

This constructor will return an MDComm that is one dimension less than the parent MDComm (unless the parent MDComm is already one-dimensional), equivalent to a slice of the parent at the given axis rank value.

Domi::MDComm::MDComm ( const MDComm parent,
int  axis,
const Slice slice 
)

Slice sub-communicator constructor.

Parameters
parent[in] The parent MDComm object.
axis[in] The axis to which the slice argument applies
slice[in] A Slice object that defines what portion of the parent will be translated to the sub-communicator along the given axis axis.
Domi::MDComm::MDComm ( const MDComm parent,
const Teuchos::ArrayView< Slice > &  slices 
)

Array of Slices sub-communicator constructor.

Parameters
parent[in] The parent MDComm object.
slices[in] An array of Slice objects that defines what portions of the parent will be translated to the sub-communicator along each axis.
Domi::MDComm::MDComm ( const MDComm source)

Copy constructor.

Parameters
source[in] Source MDComm to be copied
Domi::MDComm::~MDComm ( )

Destructor

Member Function Documentation

Teuchos::RCP< const MDComm > Domi::MDComm::getAxisComm ( int  axis) const

Return an axis communicator for the given axis.

Parameters
axis[in] The axis of the requested axis communicator

An axis communicator is a 1D MDComm sub-communicator that represents the comms on a given axis. Further, this sub-communicator will always be valid for the processor on which it was constructed.

Teuchos::ArrayView< Teuchos::RCP< const MDComm > > Domi::MDComm::getAxisComms ( ) const

Return array of all axis communicators.

An axis communicator is a 1D MDComm sub-communicator that represents the comms on a given axis. Further, this sub-communicator will always be valid for the processor on which it was constructed.

int Domi::MDComm::getCommDim ( int  axis) const

Get the communicator size along the given axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)

This method will throw a Domi::SubcommunicatorError if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

Teuchos::Array< int > Domi::MDComm::getCommDims ( ) const

Get the communicator sizes along each axis.

This method will throw a Domi::SubcommunicatorError if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

int Domi::MDComm::getCommIndex ( int  axis) const

Get the comm index along the given axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)

This method will throw a Domi::SubcommunicatorError if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

int Domi::MDComm::getLowerNeighbor ( int  axis) const

Get the rank of the lower neighbor.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)

This method will throw a Domi::SubcommunicatorError if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

If the periodic flag for the given axis is off, and the axis rank of the calling processor is zero, then this method returns -1.

If the periodic flag for the given axis is on, and the axis rank of the calling processor is zero, then the returned lower neighbor will be the highest axis rank processor along this axis.

Teuchos::RCP< const Teuchos::Comm< int > > Domi::MDComm::getTeuchosComm ( ) const

Get the Teuchos communicator.

Note that if the communicator is not a full communicator, i.e. a sub-communicator, that the underlying Comm pointer may be NULL, depending on this processor's rank.

int Domi::MDComm::getUpperNeighbor ( int  axis) const

Get the rank of the upper neighbor.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)

This method will throw a Domi::SubcommunicatorError if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

If the periodic flag for the given axis is off, and the axis rank of the calling processor is the highest axis rank along the axis, then this method returns -1.

If the periodic flag for the given axis is on, and the axis rank of the calling processor is the highest axis rank along the axis, then this method will return axis rank zero.

bool Domi::MDComm::isPeriodic ( int  axis) const

Return the periodic flag for the given axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)

This method will throw a Domi::SubcommunicatorError if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

int Domi::MDComm::numDims ( ) const

Get the number of dimensions.

This method will return 0 if the communicator is a sub-communicator and this processor does not belong to the sub-communicator.

bool Domi::MDComm::onSubcommunicator ( ) const

Query whether this processor is on the sub-communicator.

Sub-communicators are formed when a parent MDComm is sliced by using the (parent,slices) constructor. For a full communicator, this method will always return true.

MDComm& Domi::MDComm::operator= ( const MDComm source)

Assignment operator.

Parameters
source[in] MDComm to be copied

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

Generated on Fri Sep 1 2023 07:56:17 for Domi by doxygen 1.8.5