Domi
Multi-dimensional, distributed data structures
 All Classes Files Functions Variables Typedefs Friends
Classes | List of all members
Domi::MDVector< Scalar > Class Template Reference

Multi-dimensional distributed vector. More...

#include <Domi_MDVector.hpp>

+ Inheritance diagram for Domi::MDVector< Scalar >:

Public Member Functions

Constructors and destructor
 MDVector (const Teuchos::RCP< const MDMap > &mdMap, bool zeroOut=true)
 Main constructor. More...
 
 MDVector (const Teuchos::RCP< const MDMap > &mdMap, const dim_type leadingDim, const dim_type trailingDim=0, bool zeroOut=true)
 Augmented constructor. More...
 
 MDVector (const Teuchos::RCP< const MDMap > &mdMap, const MDArrayView< Scalar > &source)
 Constructor with initialization values (copy) More...
 
 MDVector (const Teuchos::RCP< const MDMap > &mdMap, const MDArrayRCP< Scalar > &source)
 Constructor with managed array object (view) More...
 
 MDVector (const MDVector< Scalar > &source, Teuchos::DataAccess access=Teuchos::View)
 Copy constructor with view or copy semantics. More...
 
 MDVector (const Teuchos::RCP< const Teuchos::Comm< int > > teuchosComm, Teuchos::ParameterList &plist)
 Constructor with Teuchos::Comm and ParameterList. More...
 
 MDVector (const Teuchos::RCP< const MDComm > mdComm, Teuchos::ParameterList &plist)
 Constructor with MDComm and ParameterList. More...
 
 MDVector (const MDVector< Scalar > &parent, int axis, dim_type index)
 Parent/single global ordinal sub-vector constructor. More...
 
 MDVector (const MDVector< Scalar > &parent, int axis, const Slice &slice, int bndryPad=0)
 Parent/single slice sub-vector constructor. More...
 
 MDVector (const MDVector< Scalar > &parent, const Teuchos::ArrayView< Slice > &slices, const Teuchos::ArrayView< int > &bndryPad=Teuchos::ArrayView< int >())
 Parent/array of slices sub-vector constructor. More...
 
MDVector< Scalar > & operator= (const MDVector< Scalar > &source)
 Assignment operator. More...
 
virtual ~MDVector ()
 Destructor.
 
MDMap methods
const Teuchos::RCP< const MDMapgetMDMap () const
 MDMap accessor method.
 
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...
 
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 axis rank of this processor. 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...
 
dim_type getGlobalDim (int axis, bool withBndryPad=false) const
 Get the global dimension along the specified axis. More...
 
Slice getGlobalBounds (int axis, bool withBndryPadding=false) const
 Get the bounds of the global problem. More...
 
Slice getGlobalRankBounds (int axis, bool withBndryPad=false) const
 Get the global loop bounds on this processor along the specified axis. More...
 
dim_type getLocalDim (int axis, bool withCommPad=false) const
 Get the local dimension along the specified axis. More...
 
Teuchos::ArrayView< const SlicegetLocalBounds () const
 Get the local loop bounds along every axis. More...
 
Slice getLocalBounds (int axis, bool withPad=false) const
 Get the local looping bounds along the specified axis. More...
 
Slice getLocalInteriorBounds (int axis) const
 Get the local interior looping bounds along the specified axis. More...
 
bool hasPadding () const
 Return true if there is any padding stored locally. More...
 
int getLowerPadSize (int axis) const
 Get the size of the lower padding along the given axis. More...
 
int getUpperPadSize (int axis) const
 Get the size of the upper padding along the given axis. More...
 
int getCommPadSize (int axis) const
 Get the communication padding size along the given axis. More...
 
int getLowerBndryPad (int axis) const
 Get the size of the lower boundary padding along the given axis. More...
 
int getUpperBndryPad (int axis) const
 Get the size of the upper boundary padding along the given axis. More...
 
int getBndryPadSize (int axis) const
 Get the boundary padding size along the given axis. More...
 
void setLowerPad (int axis, const Scalar value)
 Assign all elements of the lower pad a constant value. More...
 
void setUpperPad (int axis, const Scalar value)
 Assign all elements of the upper pad a constant value. More...
 
bool isReplicatedBoundary (int axis) const
 Return whether the given axis supports a replicated boundary.
 
Layout getLayout () const
 Get the storage order.
 
bool isContiguous () const
 True if there are no stride gaps on any processor. More...
 
Data extraction methods
MDArrayView< Scalar > getDataNonConst (bool includePadding=true)
 Get a non-const view of the data as an MDArrayView. More...
 
MDArrayView< const Scalar > getData (bool includePadding=true) const
 Get a const view of the data as an MDArrayView. More...
 
MDArrayView< Scalar > getLowerPadDataNonConst (int axis)
 Get a non-const view of the lower padding data along the given axis as an MDArrayView. More...
 
MDArrayView< const Scalar > getLowerPadData (int axis) const
 Get a const view of the lower padding data along the given axis as an MDArrayView. More...
 
MDArrayView< Scalar > getUpperPadDataNonConst (int axis)
 Get a non-const view of the upper padding data along the given axis as an MDArrayView. More...
 
MDArrayView< const Scalar > getUpperPadData (int axis) const
 Get a const view of the upper padding data along the given axis as an MDArrayView. More...
 
Mathematical methods
Scalar dot (const MDVector< Scalar > &a) const
 Compute the dot product of this MDVector and MDVector a. More...
 
Teuchos::ScalarTraits< Scalar >
::magnitudeType 
norm1 () const
 Compute the 1-norm of this MDVector.
 
Teuchos::ScalarTraits< Scalar >
::magnitudeType 
norm2 () const
 Compute the 2-norm of this MDVector.
 
Teuchos::ScalarTraits< Scalar >
::magnitudeType 
normInf () const
 Compute the infinity-norm of this MDVector.
 
Teuchos::ScalarTraits< Scalar >
::magnitudeType 
normWeighted (const MDVector< Scalar > &weights) const
 Compute the weighted norm of this. More...
 
Scalar meanValue () const
 Compute the mean (average) value of this MDVector.
 
Implementation of the Teuchos::Describable interface
virtual std::string description () const
 A simple one-line description of this MDVector.
 
virtual void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Print the object with some verbosity level to a FancyOStream. More...
 
Global assignment methods
void putScalar (const Scalar &value, bool includePadding=true)
 Set all values in the multivector with the given value. More...
 
void randomize ()
 Set all values in the multivector to pseudorandom numbers.
 
Global communication methods
void updateCommPad ()
 Sum values of a locally replicated multivector across all processes. More...
 
void updateCommPad (int axis)
 
void startUpdateCommPad (int axis)
 Start an asyncronous update of the communication padding. More...
 
void endUpdateCommPad (int axis)
 Complete an asyncronous update of the communication padding. More...
 
Sub-MDVector operators
MDVector< Scalar > operator[] (dim_type index) const
 Sub-vector access operator. More...
 
MDVector< Scalar > operator[] (Slice slice) const
 Sub-vector access operator. More...
 
Input/Output
void writeBinary (const std::string &filename, bool includeBndryPad=false) const
 Write the MDVector to a binary file. More...
 
void readBinary (const std::string &filename, bool includeBndryPad=false)
 Read the MDVector from a binary file. More...
 

Detailed Description

template<class Scalar>
class Domi::MDVector< Scalar >

Multi-dimensional distributed vector.

The MDVector class is intended to perform the functions of Epetra or Tpetra MultiVectors (or Vectors), with the additional capability that the data can be multi-dimensional. (Note that Epetra and Tpetra MultiVectors are 2 dimensional and distributed in an unstructured manner along only one of those dimensions. MDVectors can be any number of dimensions, and can be distributed in a structured fashion along all of them.)

Where Epetra and Tpetra MultiVectors are built on top of Epetra_Maps and Tpetra::Maps, respectively, the MDVector is built on top of an MDMap. As such, they support boundary padding, communication padding, and periodicity.

The basic MDVector constructor takes an MDMap and an optional boolean flag providing instruction whether to zero out the data or not. A slightly more advanced constructor takes an MDMap, a leading dimension, an optional trailing dimension, and an optional zero-out flag. This allows the user to augment the given MDMap with an undistributed dimension. This can be helpful when the user wants to store an array of quantities at each grid point. These quantities can be clustered or strided in memory depending on whether a leading or trailing dimension is specified, and what the data Layout is.

There are additional constructors as well, based on copying data, using Teuchos::ParameterLists to specify the MDVector layout, and parent/slice constructors, where slicing of the parent can be performed with an ordinal or a Slice.

The ability to slice a parent MDVector and obtain a sub-vector is an important feature of the MDVector class. When you take a slice of a parent MDVector, the resulting sub-vector may have a new, reduced communicator (both a new MDComm and Teuchos::Comm). When accessing a sub-vector, you should always use the onSubcommunicator() method to determine that the sub-vector exists on the current processor.

Like the Teuchos::MultiVector, the user cannot index directly into an MDVector. Rather, he or she must use the getData() and getDataNonConst() methods to obtain an MDArrayView of the data for manipulation. This is a little different than the Tpetra behavior, where an ArrayRCP is returned to the user. For MDVector, and MDArrayView is returned, as this supports the slicing semantics of the class. Note that each MDVector stores an internal MDArrayRCP of either its original data or its parent's data, and then it also stores an MDArrayView that is a view into the MDArrayRCP. So the MDArrayView passed to the user will be valid as long as the reference count of its MDArrayRCP is greater than zero. Looping bounds for this data can be obtained using the getLocalBounds() method, which returns a concrete Slice object, and takes a boolean that specifies whether padding should be included in the start and stop indexes.

There are a variety of methods for converting MDVectors to Epetra or Tpetra MultiVectors or Vectors, using either view or copy semantics. The view semantic is only available when the MDVector is contiguous in memory, meaning there are no stride gaps due to slicing. The copy semantic is always available. True Epetra or Tpetra MultiVectors, in which the number of vectors is greater than 1, are only available when there is a non-distributed leading dimension and the layout is C-order, or there is a non-distributed trailing dimension and the layout is Fortran-order.

If the MDVector was built with communication padding, then the user may use the updateCommPad() method to communicate via message passing data from the owning processors into the communication padding buffers. If communication along a single axis is desired, then the overloaded updateCommPad(int axis) method can be called instead. If asynchronous communication is desired, where computations can be performed between posting and receiving messages, then the startUpdateCommPad(int axis) and endUpdateCommPad(int axis) methods can be called. Note that the message data structures needed to coordinate these methods are stored internally.

Constructor & Destructor Documentation

template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const Teuchos::RCP< const MDMap > &  mdMap,
bool  zeroOut = true 
)

Main constructor.

Parameters
mdMap[in] MDMap that describes the domain decomposition of this MDVector
zeroOut[in] flag to initialize all data to zero
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const Teuchos::RCP< const MDMap > &  mdMap,
const dim_type  leadingDim,
const dim_type  trailingDim = 0,
bool  zeroOut = true 
)

Augmented constructor.

Parameters
mdMap[in] MDMap that describes the domain decomposition of this MDVector
leadingDim[in] leading augmentation dimension, typically used to provide additional degrees of freedom at each index defined by the MDMap
trailingDim[in] trailing augmentation dimension, typically used to provide additional degrees of freedom at each index defined by the MDMap
zeroOut[in] flag to initialize all data to zero

If leadingDim or trailingDim is less than 2, then the MDMap will not be augmented with a leading dimension or trailing dimension, respectively. Note that this constructor takes the given MDMap and computes a new, augmented MDComm and a new MDMap for this MDVector.

template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const Teuchos::RCP< const MDMap > &  mdMap,
const MDArrayView< Scalar > &  source 
)

Constructor with initialization values (copy)

Parameters
mdMap[in] MDMap that describes the domain decomposition of this MDVector
source[in] initialization values
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const Teuchos::RCP< const MDMap > &  mdMap,
const MDArrayRCP< Scalar > &  source 
)

Constructor with managed array object (view)

Parameters
mdMap[in] MDMap that describes the domain decomposition of this MDVector
source[in] memory-managed multi-dimensional array
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const MDVector< Scalar > &  source,
Teuchos::DataAccess  access = Teuchos::View 
)

Copy constructor with view or copy semantics.

Parameters
source[in] source MDVector
access[in] enumeration specifying view or copy construction

Create a new MDVector with the same structure of the source MDVector and either perform a deep copy or take a view of the source MDVector data for the new MDVector. Default behavior is to use view semantics.

template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const Teuchos::RCP< const Teuchos::Comm< int > >  teuchosComm,
Teuchos::ParameterList &  plist 
)

Constructor with Teuchos::Comm and ParameterList.

Parameters
teuchosComm[in] The Teuchos Communicator. Note that an MDComm and MDMap will be constructed from the information in plist.
plist[in] ParameterList with construction information
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const Teuchos::RCP< const MDComm mdComm,
Teuchos::ParameterList &  plist 
)

Constructor with MDComm and ParameterList.

Parameters
mdComm[in] an RCP of an MDComm (multi-dimensional communicator), on which this MDMap will be built.
plist[in] ParameterList with construction information
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const MDVector< Scalar > &  parent,
int  axis,
dim_type  index 
)

Parent/single global ordinal sub-vector constructor.

Parameters
parent[in] an MDVector, from which this MDVector will be derived
axis[in] the axis to which this index ordinal applies
index[in] the global ordinal that defines the sub-vector
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const MDVector< Scalar > &  parent,
int  axis,
const Slice slice,
int  bndryPad = 0 
)

Parent/single slice sub-vector constructor.

Parameters
parent[in] an MDVector, from which this MDVector will be derived
axis[in] the axis to which this slice applies
slice[in] a slice of global ordinals describing the sub-vector
bndryPad[in] the boundary padding along the altered axis of the new sub-vector. This may include indexes from the boundary padding of the parent MDVector, but it does not have to.
template<class Scalar >
Domi::MDVector< Scalar >::MDVector ( const MDVector< Scalar > &  parent,
const Teuchos::ArrayView< Slice > &  slices,
const Teuchos::ArrayView< int > &  bndryPad = Teuchos::ArrayView< int >() 
)

Parent/array of slices sub-vector constructor.

Parameters
parent[in] an MDVector, from which this sub-vector will be derived.
slices[in] an array of Slices of global axis indexes that defines the sub-vector. These slices must not include indexes from the boundary padding along each axis.
bndryPad[in] The boundary padding of the new sub-vector. These may include indexes from the boundary padding of the parent MDVector, but they do not have to.

Member Function Documentation

template<class Scalar >
void Domi::MDVector< Scalar >::describe ( Teuchos::FancyOStream &  out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const
virtual

Print the object with some verbosity level to a FancyOStream.

Parameters
out[in] output stream
verbLevel[in] verbosity level
template<class Scalar >
Scalar Domi::MDVector< Scalar >::dot ( const MDVector< Scalar > &  a) const

Compute the dot product of this MDVector and MDVector a.

Parameters
a[in] partner MDVector for performing dot product
template<class Scalar >
void Domi::MDVector< Scalar >::endUpdateCommPad ( int  axis)

Complete an asyncronous update of the communication padding.

Parameters
axis[in] the axis along which communication will be performed

Wait for all of the non-blocking updates for the communication padding along the given axis to complete

template<class Scalar >
int Domi::MDVector< Scalar >::getBndryPadSize ( int  axis) const
inline

Get the boundary padding size along the given axis.

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

This returns the value of the boundary padding along the given axis at the time of construction, regardless of whether a sub-map reduced these values.

template<class Scalar >
int Domi::MDVector< Scalar >::getCommDim ( int  axis) const
inline

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.

template<class Scalar >
int Domi::MDVector< Scalar >::getCommIndex ( int  axis) const
inline

Get the axis rank of this processor.

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.

template<class Scalar >
int Domi::MDVector< Scalar >::getCommPadSize ( int  axis) const
inline

Get the communication padding size along the given axis.

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

This returns the value of the communication padding along the given axis at the time of construction, regardless of the processor's position relative to the domain boundary.

template<class Scalar >
MDArrayView< const Scalar > Domi::MDVector< Scalar >::getData ( bool  includePadding = true) const

Get a const view of the data as an MDArrayView.

Parameters
includePadding[in] if true, include the boundary and communication padding in the returned MDArrayView
template<class Scalar >
MDArrayView< Scalar > Domi::MDVector< Scalar >::getDataNonConst ( bool  includePadding = true)

Get a non-const view of the data as an MDArrayView.

Parameters
includePadding[in] if true, include the boundary and communication padding in the returned MDArrayView
template<class Scalar >
Slice Domi::MDVector< Scalar >::getGlobalBounds ( int  axis,
bool  withBndryPadding = false 
) const
inline

Get the bounds of the global problem.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
withBndryPad[in] specify whether the bounds should include boundary padding or not
template<class Scalar >
dim_type Domi::MDVector< Scalar >::getGlobalDim ( int  axis,
bool  withBndryPad = false 
) const
inline

Get the global dimension along the specified axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
withBndryPad[in] specify whether the dimension should include boundary padding or not
template<class Scalar >
Slice Domi::MDVector< Scalar >::getGlobalRankBounds ( int  axis,
bool  withBndryPad = false 
) const
inline

Get the global loop bounds on this processor along the specified axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
withBndryPadding[in] specify whether the dimension should include boundary padding or not

The loop bounds are returned in the form of a Slice, in which the start() method returns the loop begin value, and the stop() method returns the non-inclusive end value.

template<class Scalar >
Teuchos::ArrayView< const Slice > Domi::MDVector< Scalar >::getLocalBounds ( ) const
inline

Get the local loop bounds along every axis.

The loop bounds are returned in the form of a Slice, in which the start() method returns the loop begin value, and the stop() method returns the non-inclusive end value. For this method, padding is included in the bounds.

template<class Scalar >
Slice Domi::MDVector< Scalar >::getLocalBounds ( int  axis,
bool  withPad = false 
) const
inline

Get the local looping bounds along the specified axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
withPad[in] specify whether the dimension should include padding or not

The loop bounds are returned in the form of a Slice, in which the start() method returns the loop begin value, and the stop() method returns the non-inclusive end value.

template<class Scalar >
dim_type Domi::MDVector< Scalar >::getLocalDim ( int  axis,
bool  withCommPad = false 
) const
inline

Get the local dimension along the specified axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
withCommPad[in] specify whether the dimension should include communication padding or not
template<class Scalar >
Slice Domi::MDVector< Scalar >::getLocalInteriorBounds ( int  axis) const
inline

Get the local interior looping bounds along the specified axis.

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

Local interior loop bounds are the same as local loop bounds without padding, except that for non-periodic axes the global end points of the given axis are excluded. For periodic axes, the local interior loop bounds are exactly the same as local loop bounds without padding.

The loop bounds are returned in the form of a Slice, in which the start() method returns the loop begin value, and the stop() method returns the non-inclusive end value.

template<class Scalar >
int Domi::MDVector< Scalar >::getLowerBndryPad ( int  axis) const
inline

Get the size of the lower boundary padding along the given axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
template<class Scalar >
int Domi::MDVector< Scalar >::getLowerNeighbor ( int  axis) const
inline

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 the highest axis rank processor along this axis, then the returned lower neighbor will be zero.

template<class Scalar >
MDArrayView< const Scalar > Domi::MDVector< Scalar >::getLowerPadData ( int  axis) const

Get a const view of the lower padding data along the given axis as an MDArrayView.

Parameters
axis[in] the axis from which to extract the lower padding
template<class Scalar >
MDArrayView< Scalar > Domi::MDVector< Scalar >::getLowerPadDataNonConst ( int  axis)

Get a non-const view of the lower padding data along the given axis as an MDArrayView.

Parameters
axis[in] the axis from which to extract the lower padding
template<class Scalar >
int Domi::MDVector< Scalar >::getLowerPadSize ( int  axis) const
inline

Get the size of the lower padding along the given axis.

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

Note that the returned padding can be either communication padding or boundary padding as appropriate.

template<class Scalar >
Teuchos::RCP< const Teuchos::Comm< int > > Domi::MDVector< Scalar >::getTeuchosComm ( ) const
inline

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.

template<class Scalar >
int Domi::MDVector< Scalar >::getUpperBndryPad ( int  axis) const
inline

Get the size of the upper boundary padding along the given axis.

Parameters
axis[in] the index of the axis (from zero to the number of dimensions - 1)
template<class Scalar >
int Domi::MDVector< Scalar >::getUpperNeighbor ( int  axis) const
inline

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 processor along this 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 zero, then the returned lower neighbor will be the highest axis rank processor along this axis.

template<class Scalar >
MDArrayView< const Scalar > Domi::MDVector< Scalar >::getUpperPadData ( int  axis) const

Get a const view of the upper padding data along the given axis as an MDArrayView.

Parameters
axis[in] the axis from which to extract the upper padding
template<class Scalar >
MDArrayView< Scalar > Domi::MDVector< Scalar >::getUpperPadDataNonConst ( int  axis)

Get a non-const view of the upper padding data along the given axis as an MDArrayView.

Parameters
axis[in] the axis from which to extract the upper padding
template<class Scalar >
int Domi::MDVector< Scalar >::getUpperPadSize ( int  axis) const
inline

Get the size of the upper padding along the given axis.

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

Note that the returned padding can be either communication padding or boundary padding as appropriate.

template<class Scalar >
bool Domi::MDVector< Scalar >::hasPadding ( ) const
inline

Return true if there is any padding stored locally.

Note that it is not as simple as whether there were communication padding specified in the constructor. Suppose non-zero communication padding was specified, but the problem is on one processor and no boundary padding was specified: this method will return false. Similarly, if no communication padding was specified but boundary padding was, then boundary processors will have padding and this method will return true.

template<class Scalar >
bool Domi::MDVector< Scalar >::isContiguous ( ) const
inline

True if there are no stride gaps on any processor.

An MDVector constructed from a communicator and dimensions will always be contiguous. An MDVector that is a slice of a parent MDMVector will generally be non-contiguous, with some exceptions. There are cases where some local data is contiguous and some is not, but this method returns True only if all processes' local data is contiguous.

template<class Scalar >
bool Domi::MDVector< Scalar >::isPeriodic ( int  axis) const
inline

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.

template<class Scalar >
Teuchos::ScalarTraits< Scalar >::magnitudeType Domi::MDVector< Scalar >::normWeighted ( const MDVector< Scalar > &  weights) const

Compute the weighted norm of this.

Parameters
weights[in] MDVector of weights for weighted norm
template<class Scalar >
int Domi::MDVector< Scalar >::numDims ( ) const
inline

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.

template<class Scalar >
bool Domi::MDVector< Scalar >::onSubcommunicator ( ) const
inline

Query whether this processor is on the sub-communicator.

Sub-communicators are formed when a parent MDVector is sliced by using the (parent,ordinal) or (parent,slice) constructors. For a full communicator, this method will always return true.

template<class Scalar >
MDVector< Scalar > & Domi::MDVector< Scalar >::operator= ( const MDVector< Scalar > &  source)

Assignment operator.

Parameters
source[in] source MDVector to be copied
template<class Scalar >
MDVector< Scalar > Domi::MDVector< Scalar >::operator[] ( dim_type  index) const

Sub-vector access operator.

Parameters
index[in] index of the desired sub-vector. Note that to obtain expected behavior, you should always chain together n square bracket operators when referencing an n-dimensional MDVector.

The returned MDVector will have one fewer dimensions than the calling MDVector.

template<class Scalar >
MDVector< Scalar > Domi::MDVector< Scalar >::operator[] ( Slice  slice) const

Sub-vector access operator.

Parameters
slice[in] a Slice of global indexes that specifies the desired sub-vector. Note that to obtain expected behavior, you should always chain together n square bracket operators when referencing an n-dimensional MDVector.

The returned MDVector will have the same number of dimensions as the calling MDVector.

Note that if you wish to obtain a sub-vector that has boundary padding along the axis being sliced, you will have to use the MDVector constructor that takes a parent MDVector, an axis, a Slice, and a boundary padding specification.

template<class Scalar >
void Domi::MDVector< Scalar >::putScalar ( const Scalar &  value,
bool  includePadding = true 
)

Set all values in the multivector with the given value.

Parameters
value[in] assignment value
includePadding[in] if true, assign values to the boundary and communication padding as well
template<class Scalar >
void Domi::MDVector< Scalar >::readBinary ( const std::string &  filename,
bool  includeBndryPad = false 
)

Read the MDVector from a binary file.

Parameters
filename[in] name of the input file
includeBndryPad[in] if true, include the boundary pad with the input data
template<class Scalar >
void Domi::MDVector< Scalar >::setLowerPad ( int  axis,
const Scalar  value 
)

Assign all elements of the lower pad a constant value.

Parameters
axis[in] the axis along which the lower padding is chosen
value[in] the value to be assigned to all elements of the lower padding
template<class Scalar >
void Domi::MDVector< Scalar >::setUpperPad ( int  axis,
const Scalar  value 
)

Assign all elements of the upper pad a constant value.

Parameters
axis[in] the axis along which the upper padding is chosen
value[in] the value to be assigned to all elements of the upper padding
template<class Scalar >
void Domi::MDVector< Scalar >::startUpdateCommPad ( int  axis)

Start an asyncronous update of the communication padding.

Parameters
axis[in] the axis along which communication will be performed

Post the non-blocking sends and receives for the communication padding along the given axis

template<class Scalar >
void Domi::MDVector< Scalar >::updateCommPad ( )

Sum values of a locally replicated multivector across all processes.

The simplest method for updating the communication padding.

This method will update the communication padding along all axes.

template<class Scalar >
void Domi::MDVector< Scalar >::writeBinary ( const std::string &  filename,
bool  includeBndryPad = false 
) const

Write the MDVector to a binary file.

Parameters
filename[in] name of the output file
includeBndryPad[in] if true, include the boundary pad with the output data

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

Generated on Wed Apr 24 2024 09:29:32 for Domi by doxygen 1.8.5