48 #include "RTOpPack_RTOpSubRangeDecorator.hpp"
54 namespace AbstractLinAlgPack {
62 const Teuchos::RCP<Thyra::VectorBase<value_type> >& thyra_vec
69 const Teuchos::RCP<Thyra::VectorBase<value_type> >& thyra_vec
72 namespace mmp = MemMngPack;
74 thyra_vec.get()==NULL, std::invalid_argument
75 ,
"VectorMutableThyra::initialize(thyra_vec): Error!"
102 ,
const size_t num_vecs
104 ,
const size_t num_targ_vecs
106 ,RTOpPack::ReductTarget *reduct_obj
115 using Teuchos::rcpFromRef;
124 op,num_vecs,vecs,num_targ_vecs,targ_vecs,reduct_obj
125 ,first_ele,sub_dim,global_offset
131 Workspace< Teuchos::RCP<const Thyra::VectorBase<value_type> > > thyra_vecs_sptr(wss,num_vecs);
132 Workspace<Ptr<const Thyra::VectorBase<value_type> > > thyra_vecs(wss,num_vecs);
133 for(
int k = 0; k < as<int>(num_vecs); ++k ) {
135 thyra_vecs[k] = thyra_vecs_sptr[k].ptr();
139 Workspace< Teuchos::RCP<Thyra::VectorBase<value_type> > > targ_thyra_vecs_sptr(wss,num_targ_vecs);
140 Workspace<Ptr<Thyra::VectorBase<value_type> > > targ_thyra_vecs(wss,num_targ_vecs);
141 for(
int k = 0; k < as<int>(num_targ_vecs); ++k ) {
143 targ_thyra_vecs[k] = targ_thyra_vecs_sptr[k].ptr();
147 RTOpPack::RTOpSubRangeDecorator<value_type>
148 subRangeOp(rcpFromRef(op), first_ele-1, sub_dim==0 ? -1 : sub_dim);
149 Thyra::applyOp<value_type>(subRangeOp, thyra_vecs(), targ_thyra_vecs(),
150 Teuchos::ptr(reduct_obj), global_offset);
153 for(
int k = 0; k < as<int>(num_vecs); ++k ) {
156 for(
int k = 0; k < as<int>(num_targ_vecs); ++k ) {
172 RTOpPack::ConstSubVectorView<RTOp_value_type> _sub_vec = *sub_vec;
173 thyra_vec_->acquireDetachedView(convert(rng),&_sub_vec);
181 RTOpPack::ConstSubVectorView<RTOp_value_type> _sub_vec = *sub_vec;
182 thyra_vec_->releaseDetachedView(&_sub_vec);
190 RTOpPack::SubVectorView<RTOp_value_type> _sub_vec = *sub_vec;
191 thyra_vec_->acquireDetachedView(convert(rng),&_sub_vec);
197 RTOpPack::SubVectorView<RTOp_value_type> _sub_vec = *sub_vec;
198 thyra_vec_->commitDetachedView(&_sub_vec);
205 thyra_vec_->setSubVector(sub_vec);
void set_sub_vector(const RTOpPack::SparseSubVector &sub_vec)
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
RTOp_index_type index_type
RTOp_value_type value_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Thyra::VectorSpaceBase< value_type > > set_uninitialized()
Set to uninitialized and return smart pointer to the internal Thyra::VectorSpaceBase<value_type> obj...
void get_thyra_vector(const VectorSpaceThyra &thyra_vec_spc, const Vector &vec, Teuchos::RCP< const Thyra::VectorBase< value_type > > *thyra_vec)
const VectorSpace & space() const
void commit_thyra_vector(const VectorSpaceThyra &thyra_vec_spc, VectorMutable *vec, Teuchos::RCP< Thyra::VectorBase< value_type > > *thyra_vec)
. One-based subregion index range class.
virtual void has_changed() const
Must be called by any vector subclass that modifies this vector object!
RTOpT< RTOp_value_type > RTOp
Abstract interface for objects that represent a space for mutable coordinate vectors.
T_To & dyn_cast(T_From &from)
Extract a constant DenseLinAlgPack::DVectorSlice view of a Vector object.
void get_sub_vector(const Range1D &rng, RTOpPack::SubVector *sub_vec) const
void commit_sub_vector(RTOpPack::MutableSubVector *sub_vec)
void Vp_StMtV(VectorMutable *v_lhs, value_type alpha, const MatrixOp &M_rhs1, BLAS_Cpp::Transp trans_rhs1, const Vector &v_rhs2, value_type beta=1.0)
v_lhs = alpha * op(M_rhs1) * v_rhs2 + beta * v_lhs (BLAS xGEMV)
TypeTo as(const TypeFrom &t)
void apply_op(const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const
void Vp_StMtV(value_type alpha, const GenPermMatrixSlice &P, BLAS_Cpp::Transp P_trans, const Vector &x, value_type beta)
VectorMutableThyra()
Construct to uninitialized.
void initialize(const Teuchos::RCP< const Thyra::VectorSpaceBase< value_type > > &thyra_vec_spc, const inner_prod_ptr_t &inner_prod=Teuchos::null)
Initalize given a smart pointer to a Thyra::VetorSpace object.
void free_sub_vector(RTOpPack::SubVector *sub_vec) const
Teuchos::RCP< Thyra::VectorBase< value_type > > set_uninitialized()
Set to uninitialized and return smart pointer to the internal Thyra::VectorBase object.
Abstract interface for mutable coordinate vectors {abstract}.
SparseSubVectorT< RTOp_value_type > SparseSubVector
void free_thyra_vector(const VectorSpaceThyra &thyra_vec_spc, const Vector &vec, Teuchos::RCP< const Thyra::VectorBase< value_type > > *thyra_vec)
Extract a non-const DenseLinAlgPack::DVectorSlice view of a VectorMutable object. ...
void apply_op_serial(const RTOpPack::RTOp &op, const size_t num_vecs, const Vector *vecs[], const size_t num_targ_vecs, VectorMutable *targ_vecs[], RTOpPack::ReductTarget *reduct_obj, const index_type first_ele, const index_type sub_dim, const index_type global_offset) const
Class for a mutable sub-vector.
Teuchos::RCP< const Thyra::VectorBase< value_type > > thyra_vec() const
Return a (converted) smart pointer to the internal smart pointer to the Thyra::VectorBase object...
void initialize(const Teuchos::RCP< Thyra::VectorBase< value_type > > &thyra_vec)
Initalize given a smart pointer to a Thyra::Vetor object.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Class for a non-mutable sub-vector.
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Concrete matrix type to represent general permutation (mapping) matrices.