42 #ifndef THYRA_DETACHED_SPMD_VECTOR_VIEW_HPP
43 #define THYRA_DETACHED_SPMD_VECTOR_VIEW_HPP
46 #include "Thyra_SpmdVectorBase.hpp"
47 #include "Teuchos_Assert.hpp"
61 template<
class Scalar>
67 using Teuchos::rcp_dynamic_cast;
72 sv_ = spmd_v->getLocalSubVector();
84 {
if (!
is_null(v_))
return v_->spmdSpace();
return Teuchos::null; }
88 Teuchos_Ordinal
globalOffset()
const {
return sv_.globalOffset(); }
90 Teuchos_Ordinal
subDim()
const {
return sv_.subDim(); }
94 ptrdiff_t
stride()
const {
return sv_.stride(); }
96 const Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
98 const Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
118 template<
class Scalar>
124 using Teuchos::rcp_dynamic_cast;
129 sv_ = spmd_v->getNonconstLocalSubVector();
141 {
if (!
is_null(v_))
return v_->spmdSpace();
return Teuchos::null; }
147 Teuchos_Ordinal
subDim()
const {
return sv_.subDim(); }
151 ptrdiff_t
stride()
const {
return sv_.stride(); }
153 Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
155 Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
170 #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