42#include "Thyra_VectorBase.hpp"
44#ifndef THYRA_EXPLICIT_VECTOR_VIEW_HPP
45#define THYRA_EXPLICIT_VECTOR_VIEW_HPP
112 ,
const Range1D &rng =
Range1D(),
const bool forceUnitStride =
false
115 this->initialize(v,rng,forceUnitStride);
154 const Range1D &rng =
Range1D(),
const bool forceUnitStride =
false )
156 this->initialize(
Teuchos::rcp(&v,
false),rng,forceUnitStride);
165 delete []
const_cast<Scalar*
>(sv_.
values().
get());
166 v_->releaseDetachedView(&sv_s_);
193 const Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
198 const Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
208 const Range1D &rng,
const bool forceUnitStride
212 v_->acquireDetachedView(rng,&sv_s_);
213 if( forceUnitStride && sv_s_.
stride() != 1 ) {
228 ConstDetachedVectorView<Scalar>& operator==(
const ConstDetachedVectorView<Scalar>&);
253template<
class Scalar>
295 ,
const Range1D &rng =
Range1D(),
const bool forceUnitStride =
false
298 this->initialize(v,rng,forceUnitStride);
336 this->initialize(
Teuchos::rcp(&v,
false),rng,forceUnitStride);
357 v_->commitDetachedView(&sv_s_);
384 Scalar&
operator[](Teuchos_Ordinal i)
const {
return sv_[i]; }
388 Scalar&
operator()(Teuchos_Ordinal i)
const {
return sv_(i); }
398 ,
const Range1D &rng,
const bool forceUnitStride
402 v_->acquireDetachedView(rng,&sv_s_);
403 if( forceUnitStride && sv_s_.
stride() != 1 ) {
419 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)