10 #ifndef THYRA_DEFAULT_SPMD_VECTOR_SPACE_DEF_HPP
11 #define THYRA_DEFAULT_SPMD_VECTOR_SPACE_DEF_HPP
13 #include "Thyra_DefaultSpmdVectorSpace_decl.hpp"
14 #include "Thyra_SpmdVectorSpaceDefaultBase.hpp"
15 #include "Thyra_VectorSpaceFactoryBase.hpp"
16 #include "Thyra_DefaultSpmdMultiVector.hpp"
17 #include "Thyra_DefaultSpmdVector.hpp"
18 #include "Teuchos_CommHelpers.hpp"
24 template<
class Scalar>
25 RCP<DefaultSpmdVectorSpace<Scalar> >
34 template<
class Scalar>
39 this->
initialize(Teuchos::null, dim_in, dim_in);
43 template<
class Scalar>
47 const bool isLocallyReplicated_in
54 localSubDim_ = localSubDim_in;
55 if (! comm.is_null ()) {
56 numProc_ = comm->getSize ();
57 procRank_ = comm->getRank ();
63 this->updateState(globalDim, isLocallyReplicated_in);
67 template<
class Scalar>
70 comm_ = Teuchos::null;
78 template<
class Scalar>
84 values = Teuchos::arcp<Scalar>(localSubDim_);
87 weakSelfPtr_.create_strong(),
95 template<
class Scalar>
101 weakSelfPtr_.create_strong(),
103 this->smallVecSpcFcty()->createVecSpc(numMembers),true
110 template<
class Scalar>
121 weakSelfPtr_.create_strong(),
129 template<
class Scalar>
140 weakSelfPtr_.create_strong(),
141 Teuchos::arcp(const_cast<Scalar*>(raw_v.
values().
get()),0,raw_v.
subDim(),
false),
148 template<
class Scalar>
159 weakSelfPtr_.create_strong(),
161 this->smallVecSpcFcty()->createVecSpc(raw_mv.
numSubCols()),
true),
169 template<
class Scalar>
180 weakSelfPtr_.create_strong(),
182 this->smallVecSpcFcty()->createVecSpc(raw_mv.
numSubCols()),
true),
184 const_cast<Scalar*>(raw_mv.
values().
get()),
192 template<
class Scalar>
197 const Range1D rng = full_range(rng_in,0,this->dim()-1);
198 const Ordinal l_localOffset = this->localOffset();
199 return ( l_localOffset<=rng.
lbound() && rng.
ubound()<l_localOffset+localSubDim_ );
203 template<
class Scalar>
207 return defaultSpmdVectorSpace<Scalar>(comm_, localSubDim_, this->dim(),
208 this->isLocallyReplicated());
215 template<
class Scalar>
223 template<
class Scalar>
233 template<
class Scalar>
235 :localSubDim_(-1), numProc_(-1), procRank_(-1)
245 #endif // THYRA_DEFAULT_SPMD_VECTOR_SPACE_DEF_HPP
void initialize(int *argc, char ***argv)
Ordinal numSubCols() const
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< T > create_weak() const
RCP< MultiVectorBase< Scalar > > createMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const
const ArrayRCP< Scalar > values() const
RCP< const Teuchos::Comm< Ordinal > > getComm() const
EViewType
Determines if a view is a direct view of data or a detached copy of data.
RCP< const VectorSpaceBase< Scalar > > clone() const
Ordinal localSubDim() const
const ArrayRCP< Scalar > values() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Ordinal leadingDim() const
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
void uninitialize()
Set to an uninitialized state.
RCP< VectorBase< Scalar > > createMember() const
Concrete implementation of an SPMD vector space subclass which creates DefaultSpmdVector and DefaultS...
void initialize(const Ordinal dim)
Initialize a serial space.
Efficient concrete implementation subclass for SPMD vectors.
const ArrayRCP< const Scalar > values() const
RCP< VectorBase< Scalar > > createMemberView(const RTOpPack::SubVectorView< Scalar > &raw_v) const
Efficient concrete implementation subclass for SPMD multi-vectors.
EStrideType
Determine if data is unit stride or non-unit stride.
static RCP< DefaultSpmdVectorSpace< Scalar > > create()
Create with weak ownership to self.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
const ArrayRCP< const Scalar > values() const