10#include "Thyra_VectorBase.hpp"
12#ifndef THYRA_EXPLICIT_VECTOR_VIEW_HPP
13#define THYRA_EXPLICIT_VECTOR_VIEW_HPP
80 ,
const Range1D &rng =
Range1D(),
const bool forceUnitStride =
false
83 this->initialize(v,rng,forceUnitStride);
122 const Range1D &rng =
Range1D(),
const bool forceUnitStride =
false )
124 this->initialize(
Teuchos::rcp(&v,
false),rng,forceUnitStride);
133 delete []
const_cast<Scalar*
>(sv_.
values().
get());
134 v_->releaseDetachedView(&sv_s_);
161 const Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
166 const Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
176 const Range1D &rng,
const bool forceUnitStride
180 v_->acquireDetachedView(rng,&sv_s_);
181 if( forceUnitStride && sv_s_.
stride() != 1 ) {
196 ConstDetachedVectorView<Scalar>& operator==(
const ConstDetachedVectorView<Scalar>&);
221template<
class Scalar>
263 ,
const Range1D &rng =
Range1D(),
const bool forceUnitStride =
false
266 this->initialize(v,rng,forceUnitStride);
304 this->initialize(
Teuchos::rcp(&v,
false),rng,forceUnitStride);
325 v_->commitDetachedView(&sv_s_);
352 Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
356 Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
366 ,
const Range1D &rng,
const bool forceUnitStride
370 v_->acquireDetachedView(rng,&sv_s_);
371 if( forceUnitStride && sv_s_.
stride() != 1 ) {
387 DetachedVectorView<Scalar>& operator==(
const DetachedVectorView<Scalar>&);
Ordinal globalOffset() const
const ArrayRCP< const Scalar > values() const
Create an explicit non-mutable (const) view of a VectorBase object.
const RTOpPack::ConstSubVectorView< Scalar > & sv() const
Returns the explicit view as an RTOpPack::ConstSubVectorView<Scalar> object.
ConstDetachedVectorView(const Teuchos::RCP< const VectorBase< Scalar > > &v, const Range1D &rng=Range1D(), const bool forceUnitStride=false)
Construct an explicit non-mutable (const) view of a subset of elements.
const Scalar & operator[](Teuchos_Ordinal i) const
Zero-based indexing: Preconditions: values()!=NULL && (0 <= i < subDim()-1).
ptrdiff_t stride() const
Return the stride between elements in the array returned from this->values().
const Scalar * values() const
Return a pointer to a Scalar array containing the explicit view.
~ConstDetachedVectorView()
Free the explicit view on the VectorBase object v passed to ConstDetachedVectorView().
Teuchos_Ordinal subDim() const
Returns the dimension of the explicit view.
Teuchos_Ordinal globalOffset() const
Returns the global offset for the explicit view.
const Scalar & operator()(Teuchos_Ordinal i) const
Zero-based indexing: Preconditions: values()!=NULL && (0 <= i < subDim()-1).
ConstDetachedVectorView(const VectorBase< Scalar > &v, const Range1D &rng=Range1D(), const bool forceUnitStride=false)
Construct an explicit non-mutable (const) view of a subset of elements.
Create an explicit mutable (non-const) view of a VectorBase object.
ptrdiff_t stride() const
Return the stride between elements in the array returned from this->values().
Scalar & operator()(Teuchos_Ordinal i) const
Zero-based indexing: Preconditions: values()!=NULL && (0 <= i < subDim()-1).
DetachedVectorView(VectorBase< Scalar > &v, const Range1D &rng=Range1D(), const bool forceUnitStride=false)
Construct an explicit mutable (non-const) view of a subset of elements.
const RTOpPack::SubVectorView< Scalar > & sv() const
Returns the explicit view as an RTOpPack::ConstSubVectorView<Scalar> object.
~DetachedVectorView()
Commits back the the explicit view on the VectorBase object v passed to DetachedVectorView().
Teuchos_Ordinal globalOffset() const
Returns the global offset for the explicit view.
Scalar * values() const
Return a pointer to a Scalar array containing the explicit view.
DetachedVectorView(const Teuchos::RCP< VectorBase< Scalar > > &v, const Range1D &rng=Range1D(), const bool forceUnitStride=false)
Construct an explicit mutable (non-const) view of a subset of elements.
Scalar & operator[](Teuchos_Ordinal i) const
Zero-based indexing: Preconditions: values()!=NULL && (0 <= i < subDim()-1).
Teuchos_Ordinal subDim() const
Returns the dimension of the explicit view.
Abstract interface for finite-dimensional dense vectors.
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
TEUCHOSCORE_LIB_DLL_EXPORT void TestForTermination_terminate(const std::string &msg)