VectorSpaceBaseclass for all SPMD vector spaces with contiguous local-to-global indexing. More...
Inheritance diagram for Thyra::SpmdVectorSpaceDefaultBase< Scalar >:
Overridden from SpmdVectorSpaceBase
|Ordinal||localOffset () const|
|Ordinal||mapCode () const|
Overridden form Teuchos::Describable
|std::string||description () const|
Overridden from VectorSpaceBase
|Ordinal||dim () const|
|Returns the sum of the local number of elements on every process. |
|Teuchos::RCP< const VectorSpaceFactoryBase<|
Scalar > >
|smallVecSpcFcty () const|
|Returns a |
|bool||isCompatible (const VectorSpaceBase< Scalar > &vecSpc) const|
|Checks the general compatibility of parallel (or serial on one process) Spmd-based vector spaces. |
Public Member Functions
Protected Member Functions
|virtual void||updateState (const Ordinal globalDim)|
|This function must be called whenever the state of |
VectorSpaceBaseclass for all SPMD vector spaces with contiguous local-to-global indexing.
SpmdVectorSpaceBase for details on what this class represents in an abstract way.
Notes to subclass developers:
The pure virtual methods
createMember() are the only functions that must be overridden.
this this is in an uninitialized state then
localSubDim() should return
It should never be necessary to override the virtual functions
isCompatible() as these functions have very good and very general implementations.
If optimized implementations of multi-vectors can be supported, then the
createMembers() method should also be overridden.
This class defines a very general default implementation for
smallVecSpcFcty() that returns a
DefaultSpmdVectorSpaceFactory object which in turn can be used to create
DefaultSpmdVectorSpace objects. These are the vector space objects that are used by the domain space of multi-vectors created by
createMembers(). The class
DefaultSpmdMultiVector objects. This implementation of
smallVecSpcFcty() is very general should be very appropriate for many different concrete implementations.
Note: It is very important that subclasses call the
updateState() function whenever the state of
*this changes in a way that might affect the behavior of any of the public member functions. For example, if a different value of
localSubDim() will be returned the next time it is called by a client, then
updateState() needs to be called by the subclass. External clients should never need to worry about this function and that is why
updateState() is declared protected.
Definition at line 80 of file Thyra_SpmdVectorSpaceDefaultBase_decl.hpp.
|Ordinal Thyra::SpmdVectorSpaceDefaultBase< Scalar >::localOffset||(||)|| const
This method has a default implementation which just assigns this offset based on counting up
localSubDim() on each process and then setting
localOffset() by the rank of the process. For example, if there are 5 elements in process 0 and 4 elements in process rank, then
localOffset on each of these processes will be set as:
localOffset=0 on process 0,
localOffset=5 on process 1,
localOffset=9 on process 2 and so on.
Implements Thyra::SpmdVectorSpaceBase< Scalar >.
|Ordinal Thyra::SpmdVectorSpaceDefaultBase< Scalar >::mapCode||(||)|| const
This method takes the data
localSubDim() on each process and then uses it to compute a value for
mapCode (using a single global reduction if
numProc > 1) which is returned from this function.
The value returned from this default implementation of this method must not be changed or this approach breaks down. The only reason for overriding this method is for the subclass to be alerted of when this method is called but not what is returned from this method. If a subclass developer does not understand what this means then don't override this method!
The default implementation will always return
return > 0 (unless
this is uninitialized) so that if this method is overridden to return
return <= then this is a flag that the underlying vector map does not satisfy the assumptions of this vector space interface and vectors that are in
*this vector space can not collaborate with other Spmd-based vector implementations.
Implements Thyra::SpmdVectorSpaceBase< Scalar >.
|std::string Thyra::SpmdVectorSpaceDefaultBase< Scalar >::description||(||)|| const
|Teuchos::RCP< const VectorSpaceFactoryBase< Scalar > > Thyra::SpmdVectorSpaceDefaultBase< Scalar >::smallVecSpcFcty||(||)|| const
|bool Thyra::SpmdVectorSpaceDefaultBase< Scalar >::isCompatible||(||const VectorSpaceBase< Scalar > &||vecSpc||)|| const
Checks the general compatibility of parallel (or serial on one process) Spmd-based vector spaces.
vecSpaceare both serial in-core vectors or if
vecSpcis of type
vecSpchave the same Spmd communicators and the same mapping of elements to processes.
return = ( this->hasInCoreView() && vecSpc->hasInCoreView() ) || ( (mpiVecSpc = dynamic_cast<const SpmdVectorSpaceDefaultBase<Scalar>*>(&vecSpc)) && this->getComm() == mpiVecSpc->getComm() && this->mapCode() == mpiVecSpc->getComm()).
If the mapping of vector elements to processes is not as described above then this method should be overridden in a way that is specific to the vector implementation.
Implements Thyra::VectorSpaceBase< Scalar >.
|void Thyra::SpmdVectorSpaceDefaultBase< Scalar >::updateState||(||const Ordinal||globalDim||)||
This function must be called whenever the state of
this changes and some internal state must be updated.
|globalDim||[in] If |
Usually, this operation only needs to be called once for every *new* parallel vector space constructed and very few parallel vector spaces will be created per application usually.