10 #ifndef THYRA_DETACHED_SPMD_VECTOR_VIEW_HPP
11 #define THYRA_DETACHED_SPMD_VECTOR_VIEW_HPP
14 #include "Thyra_SpmdVectorBase.hpp"
15 #include "Teuchos_Assert.hpp"
29 template<
class Scalar>
35 using Teuchos::rcp_dynamic_cast;
40 sv_ = spmd_v->getLocalSubVector();
52 {
if (!
is_null(v_))
return v_->spmdSpace();
return Teuchos::null; }
56 Teuchos_Ordinal
globalOffset()
const {
return sv_.globalOffset(); }
58 Teuchos_Ordinal
subDim()
const {
return sv_.subDim(); }
62 ptrdiff_t
stride()
const {
return sv_.stride(); }
64 const Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
66 const Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
86 template<
class Scalar>
92 using Teuchos::rcp_dynamic_cast;
97 sv_ = spmd_v->getNonconstLocalSubVector();
109 {
if (!
is_null(v_))
return v_->spmdSpace();
return Teuchos::null; }
115 Teuchos_Ordinal
subDim()
const {
return sv_.subDim(); }
119 ptrdiff_t
stride()
const {
return sv_.stride(); }
121 Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
123 Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
138 #endif // THYRA_DETACHED_SPMD_VECTOR_VIEW_HPP
Teuchos_Ordinal globalOffset() const
Create an explicit detached mutable (non-const) view of all of the local elements on this process of ...
bool is_null(const boost::shared_ptr< T > &p)
const Scalar & operator[](Teuchos_Ordinal i) const
ConstDetachedSpmdVectorView(const Teuchos::RCP< const VectorBase< Scalar > > &v)
Base class for SPMD vectors that can provide views of contiguous elements in a process.
const RTOpPack::SubVectorView< Scalar > & sv() const
const RTOpPack::ConstSubVectorView< Scalar > & sv() const
~ConstDetachedSpmdVectorView()
Abstract interface for finite-dimensional dense vectors.
DetachedSpmdVectorView(const Teuchos::RCP< VectorBase< Scalar > > &v)
Teuchos_Ordinal subDim() const
Teuchos_Ordinal globalOffset() const
const Scalar & operator()(Teuchos_Ordinal i) const
const RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpace() const
const RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpace() const
const ArrayRCP< const Scalar > values() const
~DetachedSpmdVectorView()
Scalar & operator()(Teuchos_Ordinal i) const
Scalar & operator[](Teuchos_Ordinal i) const
Create an explicit detached non-mutable (const) view of all of the local elements on this process of ...
const ArrayRCP< const Scalar > values() const
Teuchos_Ordinal subDim() const