10 #ifndef THYRA_SPMD_LOCAL_DATA_ACCESS_DEF_HPP
11 #define THYRA_SPMD_LOCAL_DATA_ACCESS_DEF_HPP
14 #include "Thyra_SpmdLocalDataAccess_decl.hpp"
15 #include "Thyra_ProductVectorBase.hpp"
16 #include "Thyra_ProductVectorSpaceBase.hpp"
17 #include "Thyra_SpmdVectorBase.hpp"
18 #include "Thyra_SpmdMultiVectorBase.hpp"
21 template<
class Scalar>
29 return spmd_v->getNonconstLocalSubVector();
34 !(p_v->productSpace()->numBlocks() == 1),
36 "Error, the function getNonconstLocalSubVectorView() can only return"
37 " a contiguous view of local SPMD data from a product vector with a single"
38 " block (which also must be able to give up a product view.");
39 return getNonconstLocalSubVectorView<Scalar>(p_v->getNonconstVectorBlock(0));
43 template<
class Scalar>
51 return spmd_v->getLocalSubVector();
56 !(p_v->productSpace()->numBlocks() == 1),
58 "Error, the function getLocalSubVectorView() can only return"
59 " a contiguous view of local SPMD data from a product vector with a single"
60 " block (which also must be able to give up a product view.");
61 return getLocalSubVectorView<Scalar>(p_v->getVectorBlock(0));
65 template<
class Scalar>
73 return spmd_mv->getNonconstLocalSubMultiVector();
78 !(p_mv->productSpace()->numBlocks() == 1),
80 "Error, the function getNonconstLocalSubVectorView() can only return"
81 " a contiguous view of local SPMD data from a product vector with a single"
82 " block (which also must be able to give up a product view.");
83 return getNonconstLocalSubMultiVectorView<Scalar>(p_mv->getNonconstMultiVectorBlock(0));
87 template<
class Scalar>
95 return spmd_mv->getLocalSubMultiVector();
100 !(p_mv->productSpace()->numBlocks() == 1),
102 "Error, the function getLocalSubVectorView() can only return"
103 " a contiguous view of local SPMD data from a product vector with a single"
104 " block (which also must be able to give up a product view.");
105 return getLocalSubMultiVectorView<Scalar>(p_mv->getMultiVectorBlock(0));
114 #define THYRA_SPMD_LOCAL_DATA_ACCESS_INSTANT(SCALAR) \
116 template RTOpPack::SubVectorView<SCALAR> \
117 getNonconstLocalSubVectorView(const RCP<VectorBase<SCALAR> > &vec); \
119 template RTOpPack::ConstSubVectorView<SCALAR> \
120 getLocalSubVectorView(const RCP<const VectorBase<SCALAR> > &vec); \
122 template RTOpPack::SubMultiVectorView<SCALAR> \
123 getNonconstLocalSubMultiVectorView(const RCP<MultiVectorBase<SCALAR> > &vec); \
125 template RTOpPack::ConstSubMultiVectorView<SCALAR> \
126 getLocalSubMultiVectorView(const RCP<const MultiVectorBase<SCALAR> > &vec); \
129 #endif // THYRA_SPMD_LOCAL_DATA_ACCESS_DEF_HPP
Base interface for product multi-vectors.
Base interface for product vectors.
Base interface class for SPMD multi-vectors.
Base class for SPMD vectors that can provide views of contiguous elements in a process.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Interface for a collection of column vectors called a multi-vector.
Abstract interface for finite-dimensional dense vectors.
bool nonnull(const boost::shared_ptr< T > &p)
RTOpPack::ConstSubVectorView< Scalar > getLocalSubVectorView(const RCP< const VectorBase< Scalar > > &vec)
Return a contiguous const semi-persisting view of the local process data of a VectorBase object...
RTOpPack::SubMultiVectorView< Scalar > getNonconstLocalSubMultiVectorView(const RCP< MultiVectorBase< Scalar > > &multivec)
Return a contiguous non-const semi-persisting view of the local process data of a MultiVectorBase obj...
RTOpPack::ConstSubMultiVectorView< Scalar > getLocalSubMultiVectorView(const RCP< const MultiVectorBase< Scalar > > &multivec)
Return a contiguous const semi-persisting view of the local process data of a MultiVectorBase object...
RTOpPack::SubVectorView< Scalar > getNonconstLocalSubVectorView(const RCP< VectorBase< Scalar > > &vec)
Return a contiguous non-const semi-persisting view of the local process data of a VectorBase object...