54 namespace AbstractLinAlgPack {
62 initialize(vec_spaces,num_vec_spaces,small_vec_spc_fcty);
71 vector_spaces_.resize(num_vec_spaces);
72 std::copy(vec_spaces,vec_spaces+num_vec_spaces,vector_spaces_.begin());
73 vec_spaces_offsets_.resize(num_vec_spaces+1);
74 vec_spaces_offsets_[0] = 0;
75 for(
int k = 1; k <= num_vec_spaces; ++k )
76 vec_spaces_offsets_[k] = vec_spaces_offsets_[k-1] + vec_spaces[k-1]->
dim();
86 i < 1 || this->
dim() < i, std::out_of_range
87 ,
"VectorSpaceBlocked::get_vector_space_position(...): Error, i = "
88 << i <<
" is not in range [1,"<<this->
dim()<<
"]"
91 *kth_vector_space = 0;
92 *kth_global_offset = 0;
93 while( *kth_vector_space < vector_spaces_.size() ) {
94 const RTOp_index_type off_kp1 = vec_spaces_offsets_[*kth_vector_space+1];
95 if( off_kp1 + 1 > i ) {
96 *kth_global_offset = vec_spaces_offsets_[*kth_vector_space];
99 ++(*kth_vector_space);
112 if( !vec_space_comp || vec_space_comp->vector_spaces_.size() != this->vector_spaces_.size() )
115 for(
int k = 0; k < vector_spaces_.size(); ++k ) {
116 if( !vec_space_comp->vector_spaces_[k]->
is_compatible(*this->vector_spaces_[k]) )
124 return vec_spaces_offsets_[vector_spaces_.size()];
130 return small_vec_spc_fcty_;
136 namespace rcp = MemMngPack;
143 Workspace<VectorMutable::vec_mut_ptr_t>
144 vecs(wss,num_vec_spaces);
145 for(
int k = 0; k < num_vec_spaces; ++k )
171 namespace rcp = MemMngPack;
177 dim < rng.
ubound(), std::out_of_range
178 ,
"VectorSpaceBlocked::sub_space(...): Error, rng = "
179 <<
"["<<rng.
lbound()<<
","<<rng.
ubound()<<
"] is not in range [1,"<<dim<<
"]" );
184 int kth_vector_space = -1;
192 if( rng.
lbound() == kth_global_offset + 1
193 && rng.
size() == vec_spaces_offsets[kth_vector_space+1] - vec_spaces_offsets[kth_vector_space] )
195 return vector_spaces[kth_vector_space];
196 if( rng.
ubound() <= vec_spaces_offsets[kth_vector_space+1] )
198 return vector_spaces[kth_vector_space]->
sub_space(rng-vec_spaces_offsets[kth_vector_space]);
201 int end_kth_vector_space = -1;
206 TEUCHOS_TEST_FOR_EXCEPT( !( end_kth_vector_space > kth_vector_space ) );
212 &vector_spaces[kth_vector_space]
213 ,end_kth_vector_space - kth_vector_space + 1 )
215 if( rng.
lbound() == kth_global_offset + 1
216 && rng.
size() == vec_spaces_offsets[end_kth_vector_space+1] - vec_spaces_offsets[kth_vector_space] )
218 return vec_space_comp;
224 rng.
lbound()-vec_spaces_offsets[kth_vector_space]
225 ,rng.
ubound()-vec_spaces_offsets[kth_vector_space] )
std::vector< index_type > vec_spaces_offsets_t
RTOp_index_type index_type
Concrete subclass for a default sub-space of a vector.
void initialize(const VectorSpace::space_ptr_t vec_spaces[], int num_vector_spaces, const VectorSpace::space_fcty_ptr_t &small_vec_spc_fcty=Teuchos::null)
Initialize with a set of vector space objects.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Index size() const
Return the size of the range (ubound() - lbound() + 1)
vec_mut_ptr_t create_member() const
Index ubound() const
Return upper bound of the range.
multi_vec_mut_ptr_t create_members(size_type num_vecs) const
Concrete subclass for a blocked vector.
space_fcty_ptr_t small_vec_spc_fcty() const
space_ptr_t clone() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
. One-based subregion index range class.
Teuchos::RCP< const VectorSpace > space_ptr_t
RTOp_index_type size_type
Abstract interface for objects that represent a space for mutable coordinate vectors.
void copy(const f_int &N, const f_dbl_prec *X, const f_int &INCX, f_dbl_prec *Y, const f_int &INCY)
space_ptr_t sub_space(const Range1D &rng) const
VectorSpace subclass for the composite of one or more VectorSpace objects.
bool full_range() const
Returns true if the range represents the entire region (constructed from Range1D()) ...
const VectorSpace::space_ptr_t * vector_spaces() const
std::vector< VectorSpace::space_ptr_t > vector_spaces_t
Index lbound() const
Return lower bound of the range.
int num_vector_spaces() const
Return the value of num_vec_spaces passed to this->initialize().
Teuchos::RCP< VectorMutable > vec_mut_ptr_t
bool is_compatible(const VectorSpace &vec_space) const
Returns true if same type and has compatible vector spaces.
RangePack::Range1D Range1D
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
void get_vector_space_position(index_type i, int *kth_vector_space, index_type *kth_global_offset) const
Get the position of the vector space object and its offset into the composite vector of the vector sp...
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
Teuchos_Ordinal RTOp_index_type