43 #ifndef THYRA_TPETRA_VECTOR_SPACE_HPP
44 #define THYRA_TPETRA_VECTOR_SPACE_HPP
47 #include "Thyra_TpetraVectorSpace_decl.hpp"
48 #include "Thyra_TpetraThyraWrappers.hpp"
49 #include "Thyra_TpetraVector.hpp"
50 #include "Thyra_TpetraMultiVector.hpp"
51 #include "Thyra_TpetraEuclideanScalarProd.hpp"
57 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
58 RCP<TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
67 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
69 const RCP<
const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
73 tpetraMap_ = tpetraMap;
74 this->updateState(tpetraMap->getGlobalNumElements(),
75 !tpetraMap->isDistributed());
76 this->setScalarProd(tpetraEuclideanScalarProd<Scalar,LocalOrdinal,GlobalOrdinal,Node>());
83 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
87 return tpetraVector<Scalar>(
88 weakSelfPtr_.create_strong().getConst(),
90 new Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node>(tpetraMap_,
false)
96 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 return tpetraMultiVector<Scalar>(
101 weakSelfPtr_.create_strong().getConst(),
102 tpetraVectorSpace<Scalar>(
103 Tpetra::createLocalMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(
104 numMembers, tpetraMap_->getComm()
108 new Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>(
109 tpetraMap_, numMembers,
false)
117 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
122 const Range1D rng = full_range(rng_in,0,this->dim()-1);
123 const Ordinal l_localOffset = this->localOffset();
125 const Ordinal myLocalSubDim = tpetraMap_.is_null () ?
126 static_cast<Ordinal> (0) : tpetraMap_->getNodeNumElements ();
128 return ( l_localOffset<=rng.
lbound() && rng.
ubound()<l_localOffset+myLocalSubDim );
132 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
136 return tpetraVectorSpace<Scalar>(tpetraMap_);
139 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
149 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
157 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
160 return tpetraMap_.is_null () ?
static_cast<Ordinal> (0) :
161 static_cast<Ordinal> (tpetraMap_->getNodeNumElements ());
167 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
178 #endif // THYRA_TPETRA_VECTOR_SPACE_HPP
Ordinal localSubDim() const
Concrete implementation of an SPMD vector space for Tpetra.
RCP< const VectorSpaceBase< Scalar > > clone() const
RCP< T > create_weak() const
static RCP< TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > create()
Create with weak ownership to self.
void initialize(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &tpetraMap)
Initialize a serial space.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetraMap() const
Get the embedded Tpetra::Map.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
bool hasInCoreView(const Range1D &rng, const EViewType viewType, const EStrideType strideType) const
Returns true if all the elements in rng are in this process.
RCP< const Teuchos::Comm< Ordinal > > convertTpetraToThyraComm(const RCP< const Teuchos::Comm< int > > &tpetraComm)
Given an Tpetra Teuchos::Comm<int> object, return an equivalent Teuchos::Comm<Ordinal> object...
RCP< VectorBase< Scalar > > createMember() const
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
EStrideType
Determine if data is unit stride or non-unit stride.
RCP< const Teuchos::Comm< Ordinal > > getComm() const