56 const char func_name[]
58 ,
const size_t num_vecs,
const Vector* vecs[]
60 ,RTOpPack::ReductTarget *reduct_obj
65 &space = (num_vecs ? vecs[0]->
space() : targ_vecs[0]->
space() );
69 global_offset_in < 0, std::logic_error
70 ,func_name <<
" : Error! global_offset_in = "
71 <<global_offset_in<<
" is not valid" );
73 first_ele_in > dim, std::logic_error
74 ,func_name <<
" : Error! first_ele_in = "
75 <<first_ele_in<<
" is not compatible with space.dim() = " << dim );
77 sub_dim_in < 0 || (sub_dim_in > 0 && sub_dim_in > dim-(first_ele_in-1)), std::logic_error
78 ,func_name <<
" : Error! first_ele_in = "
79 <<first_ele_in<<
" and sub_dim_in = "<<sub_dim_in
80 <<
" is not compatible with space.dim() = " << dim );
81 {
for(
size_t k = 0; k < num_vecs; ++k) {
82 const bool is_compatible = space.
is_compatible(vecs[k]->space());
85 ,func_name <<
" : Error! vecs["<<k<<
"]->space() of type \'"
86 <<
typeName(vecs[k]->space()) <<
"\' "
87 <<
" with dimension vecs["<<k<<
"].dim() = " << vecs[k]->dim()
88 <<
" is not compatible with space of type \'"
89 <<
typeName(space) <<
" with dimmension space.dim() = " << dim );
91 {
for(
size_t k = 0; k < num_targ_vecs; ++k) {
92 const bool is_compatible = space.
is_compatible(targ_vecs[k]->space());
95 ,func_name <<
" : Error! targ_vecs["<<k<<
"]->space() of type \'"
96 <<
typeName(targ_vecs[k]->space()) <<
"\' "
97 <<
" with dimension targ_vecs["<<k<<
"].dim() = " << targ_vecs[k]->dim()
98 <<
" is not compatible with space of type \'"
99 <<
typeName(space) <<
" with dimmension space.dim() = " << dim );
105 ,
const size_t num_vecs,
const Vector* vecs[]
107 ,RTOpPack::ReductTarget *reduct_obj
116 &space = ( num_vecs ? vecs[0]->
space() : targ_vecs[0]->
space() );
118 full_dim = space.
dim(),
119 global_sub_dim = sub_dim_in ? sub_dim_in : full_dim - (first_ele_in-1);
121 global_sub_rng =
Range1D(first_ele_in,(first_ele_in-1)+global_sub_dim);
127 Workspace<RTOpPack::ConstSubVectorView<value_type> > local_vecs(wss,num_vecs);
128 Workspace<RTOpPack::SubVectorView<value_type> > local_targ_vecs(wss,num_targ_vecs);
130 for(k = 0; k < num_vecs; ++k) {
133 (local_vecs[k] = _v).setGlobalOffset( _v.
globalOffset() + global_offset_in );
135 for(k = 0; k < num_targ_vecs; ++k) {
138 (local_targ_vecs[k] = _v).setGlobalOffset( _v.
globalOffset() + global_offset_in );
145 op.apply_op( local_vecs(), local_targ_vecs(), Teuchos::ptr(reduct_obj) );
153 for(k = 0; k < num_vecs; ++k) {
154 RTOpPack::ConstSubVectorView<value_type> &v = local_vecs[k];
155 v.setGlobalOffset( v.globalOffset() - global_offset_in );
159 for(k = 0; k < num_targ_vecs; ++k) {
160 RTOpPack::SubVectorView<value_type> &v = local_targ_vecs[k];
161 v.setGlobalOffset( v.globalOffset() - global_offset_in );
virtual const VectorSpace & space() const =0
Return the vector space that this vector belongs to.
std::string typeName(const T &t)
virtual void get_sub_vector(const Range1D &rng, RTOpPack::SubVector *sub_vec) const
Get a non-mutable explicit view of a sub-vector.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
RTOp_index_type index_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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)
Implements reduction/transformation operators for any serial vectors using just the public vector int...
virtual void commit_sub_vector(RTOpPack::MutableSubVector *sub_vec)
Free a mutable explicit view of a sub-vector.
. One-based subregion index range class.
RTOpT< RTOp_value_type > RTOp
Abstract interface for objects that represent a space for mutable coordinate vectors.
virtual void free_sub_vector(RTOpPack::SubVector *sub_vec) const
Free an explicit view of a sub-vector.
virtual bool is_compatible(const VectorSpace &vec_spc) const =0
Compare the compatibility of two vector spaces.
Teuchos_Ordinal globalOffset() const
virtual index_type dim() const =0
Return the dimmension of the vector space.
virtual void get_sub_vector(const Range1D &rng, RTOpPack::MutableSubVector *sub_vec)
Get a mutable explicit view of a sub-vector.
Thrown if vector spaces are incompatible.
Abstract interface for mutable coordinate vectors {abstract}.
Class for a mutable sub-vector.
void apply_op_validate_input(const char func_name[], 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)
Validate the inputs to apply_op().
RangePack::Range1D Range1D
Class for a non-mutable sub-vector.
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()