Thyra
Version of the Day
|
Base abstract VectorSpaceBase
class for all SPMD-based vector spaces.
More...
#include <Thyra_SpmdVectorSpaceBase_decl.hpp>
Pure virtual methods to be overridden by subclasses | |
virtual Teuchos::RCP< const Teuchos::Comm< Ordinal > > | getComm () const =0 |
Returns the SPMD communicator. More... | |
virtual Ordinal | localSubDim () const =0 |
Returns the number of local elements stored on this process. More... | |
virtual Ordinal | localOffset () const =0 |
Returns the offset for the local sub-vector stored on this process. More... | |
virtual Ordinal | mapCode () const =0 |
Returns the code for the mapping of elements to processes. More... | |
virtual bool | isLocallyReplicated () const =0 |
Returns true if vector space is locally replicated space. More... | |
Additional Inherited Members | |
Public Member Functions inherited from Thyra::VectorSpaceBase< Scalar > | |
virtual Ordinal | dim () const =0 |
Return the dimension of the vector space. More... | |
virtual bool | isCompatible (const VectorSpaceBase< Scalar > &vecSpc) const =0 |
Compare the compatibility of two vector spaces. More... | |
virtual RCP< const VectorSpaceFactoryBase< Scalar > > | smallVecSpcFcty () const =0 |
Return a VectorSpaceFactoryBase object for the creation of (usually serial) vector spaces with a small dimension. More... | |
virtual Scalar | scalarProd (const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const =0 |
Return the scalar product of two vectors in the vector space. More... | |
void | scalarProds (const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const |
Return the scalar product of each column in two multi-vectors in the vector space. More... | |
virtual bool | isEuclidean () const |
Return if this vector space has a Euclidean (identity) basis in which case the scalar product is the same as the dot product. More... | |
virtual bool | hasInCoreView (const Range1D &rng=Range1D(), const EViewType viewType=VIEW_TYPE_DETACHED, const EStrideType strideType=STRIDE_TYPE_NONUNIT) const |
Returns true if this->acquireDetachedView(rng,...) returns a direct view of the range of data requested. More... | |
virtual RCP< const VectorSpaceBase< Scalar > > | clone () const |
Clone this object (if supported). More... | |
Protected Member Functions inherited from Thyra::VectorSpaceBase< Scalar > | |
virtual RCP< VectorBase< Scalar > > | createMember () const =0 |
Create a vector member from the vector space. More... | |
virtual RCP< MultiVectorBase < Scalar > > | createMembers (int numMembers) const =0 |
Create a set of vector members (a MultiVectorBase ) from the vector space. More... | |
virtual RCP< VectorBase< Scalar > > | createMemberView (const RTOpPack::SubVectorView< Scalar > &raw_v) const =0 |
Create a vector member that is a non-const view of raw vector data. More... | |
virtual RCP< const VectorBase < Scalar > > | createMemberView (const RTOpPack::ConstSubVectorView< Scalar > &raw_v) const =0 |
Create a vector member that is a const view of raw vector data. More... | |
virtual RCP< MultiVectorBase < Scalar > > | createMembersView (const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const =0 |
Create a multi-vector member that is a non-const view of raw multi-vector data. More... | |
virtual RCP< const MultiVectorBase< Scalar > > | createMembersView (const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv) const =0 |
Create a multi-vector member that is a const view of raw multi-vector data. More... | |
virtual void | scalarProdsImpl (const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds) const =0 |
Related Functions inherited from Thyra::VectorSpaceBase< Scalar > | |
template<class Scalar > | |
RCP< const VectorSpaceBase < Scalar > > | makeHaveOwnership (const RCP< const VectorSpaceBase< Scalar > > &vs) |
Helper function that clones a VectorSpaceBase object if the RCP does not have ownership. More... | |
template<class Scalar > | |
RCP< VectorBase< Scalar > > | createMember (const RCP< const VectorSpaceBase< Scalar > > &vs, const std::string &label="") |
Create a vector member from the vector space. More... | |
template<class Scalar > | |
RCP< VectorBase< Scalar > > | createMember (const VectorSpaceBase< Scalar > &vs, const std::string &label="") |
Calls createMember(Teuchos::rcp(&vs,false)) . More... | |
template<class Scalar > | |
RCP< MultiVectorBase< Scalar > > | createMembers (const RCP< const VectorSpaceBase< Scalar > > &vs, int numMembers, const std::string &label="") |
Create a set of vector members (a MultiVectorBase ) from the vector space. More... | |
template<class Scalar > | |
RCP< MultiVectorBase< Scalar > > | createMembers (const RCP< const VectorSpaceBase< Scalar > > &vs, const RCP< const VectorSpaceBase< Scalar > > &domain, const std::string &label="") |
Create a set of vector members (a MultiVectorBase ) from the vector space. More... | |
template<class Scalar > | |
RCP< MultiVectorBase< Scalar > > | createMembers (const VectorSpaceBase< Scalar > &vs, int numMembers, const std::string &label="") |
Calls createMembers(Teuchos::rcp(&vs,false),numMembers) . More... | |
template<class Scalar > | |
RCP< VectorBase< Scalar > > | createMemberView (const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::SubVectorView< Scalar > &raw_v, const std::string &label="") |
Create a vector member that is a non-const view of raw data. More... | |
template<class Scalar > | |
RCP< VectorBase< Scalar > > | createMemberView (const VectorSpaceBase< Scalar > &vs, const RTOpPack::SubVectorView< Scalar > &raw_v, const std::string &label="") |
Calls createMemberView(Teuchos::rcp(&vs,false),raw_v) . More... | |
template<class Scalar > | |
RCP< const VectorBase< Scalar > > | createMemberView (const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::ConstSubVectorView< Scalar > &raw_v, const std::string &label="") |
Create a vector member that is a const view of raw data. More... | |
template<class Scalar > | |
RCP< const VectorBase< Scalar > > | createMemberView (const VectorSpaceBase< Scalar > &vs, const RTOpPack::ConstSubVectorView< Scalar > &raw_v, const std::string &label="") |
Calls createMemberView(Teuchos::rcp(&vs,false),raw_v) . More... | |
template<class Scalar > | |
RCP< MultiVectorBase< Scalar > > | createMembersView (const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, const std::string &label="") |
Create a multi-vector member that is a non-const view of raw data. More... | |
template<class Scalar > | |
RCP< MultiVectorBase< Scalar > > | createMembersView (const VectorSpaceBase< Scalar > &vs, const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, const std::string &label="") |
Calls createMembersView(Teuchos::rcp(&vs,false),raw_mv) . More... | |
template<class Scalar > | |
RCP< const MultiVectorBase < Scalar > > | createMembersView (const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv, const std::string &label="") |
Create a multi-vector member that is a const view of raw data. More... | |
template<class Scalar > | |
RCP< const MultiVectorBase < Scalar > > | createMembersView (const VectorSpaceBase< Scalar > &vs, const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv, const std::string &label="") |
Calls createMembersView(Teuchos::rcp(&vs,false),raw_mv) . More... | |
Base abstract VectorSpaceBase
class for all SPMD-based vector spaces.
This interface defines a basic mechanism for the interoperability of SPMD VectorBase
and MultiVectorBase
objects. See the base classes SPMDVetorBase
and SpmdMultiVectorBase
to demonstrate how this interface is used to achieve universal interoperability of vector and multi-vector objects.
Specifically, these classes are designed to handle three different use case:
localSubDim()==dim()
. In this case, the SPMD_Comm
returned from getComm()
can be SPMD_COMM_NULL
. localSubDim() < dim()
. This implementation assumes that all of the elements are stored contiguously in each process and that there are no ghost elements as described below. localSubDim()==dim()
even if there is more than one process. This case is checked for so that the reduction operations are performed correctly. This interface provides all the information necessary to implement the SpmdVectorBase::applyOp()
and SpmdMultiVectorBase::applyOp()
functions in all of the above described use cases. This interface returns an SPMD communicator (of which all compatible vector spaces must have the same communicator obviously) through the method getComm()
.
For the case of a distributed parallel vector, this interface base class assumes that vector data is partitioned to processes in contiguous chunks of dense subvectors. To spell this out, let v
be the local vector that is sorted on this process and let g
be the global vector. Then these two vectors are related (using zero-based indexing) as:
v(k) == g(this->localOffset() + k), for k = 0...this->localSubDim()-1
Any type of mapping of vector data to processes that can not be interpreted in this way can not rely on this base class for interoperability. Note that as long as the elements in a process are partitioned to unique processes and no ghost elements are present, the actual indexes used by the application with these vectors is immaterial. The indexes associated with this set of interfaces, however, are only meaningful to abstract numerical algorithms and provide an arbitrary label for certain types of coordinate-dependent operations (like required in an active-set method for optimization). Therefore, as long as the underlying vector represents a unique partitioning of elements, these classes can be used. There is a default implementation of localOffset()
that automatically assumes this contiguous mapping of elements to processes and in general this should not be changed.
Notes to subclass developers:
The pure virtual methods getComm()
and localSubDim()
declared in this interface along with the pure virtual methods dim()
and createMember()
are the only methods that must be overridden.
If this
this is in an uninitialized state then localSubDim()
should return 0
.
If optimized implementations of multi-vectors can be supported, then the createMembers()
method should also be overridden.
Definition at line 52 of file Thyra_SpmdMultiVectorBase.hpp.
|
pure virtual |
Returns the SPMD communicator.
Implemented in Thyra::DefaultSpmdVectorSpace< Scalar >, and Thyra::TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node >.
|
pure virtual |
Returns the number of local elements stored on this process.
If this
this is uninitialized then localSubDim()
returns 0
.
Implemented in Thyra::DefaultSpmdVectorSpace< Scalar >, and Thyra::TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node >.
|
pure virtual |
Returns the offset for the local sub-vector stored on this process.
Implemented in Thyra::SpmdVectorSpaceDefaultBase< Scalar >.
|
pure virtual |
Returns the code for the mapping of elements to processes.
Postconditions:
this->localSubDim() > 0
] this->mapCode() > 0
. this->localSubDim() <= 0
] this->mapCode() <= 0
. Implemented in Thyra::SpmdVectorSpaceDefaultBase< Scalar >.
|
pure virtual |
Returns true if vector space is locally replicated space.
Implemented in Thyra::SpmdVectorSpaceDefaultBase< Scalar >.