Thyra  Version of the Day
Thyra_DefaultProductVector_def.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_DEFAULT_PRODUCT_VECTOR_DEF_HPP
43 #define THYRA_DEFAULT_PRODUCT_VECTOR_DEF_HPP
44 
45 
46 #include "Thyra_DefaultProductVector_decl.hpp"
47 #include "Thyra_DefaultProductVectorSpace.hpp"
48 #include "Teuchos_Workspace.hpp"
49 
50 
51 namespace Thyra {
52 
53 
54 // Constructors/initializers/accessors
55 
56 
57 template <class Scalar>
59  : numBlocks_(0)
60 {
61  uninitialize();
62 }
63 
64 
65 template <class Scalar>
67  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in
68  )
69  : numBlocks_(0)
70 {
71  initialize(productSpace_in);
72 }
73 
74 
75 template <class Scalar>
77  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in
78  )
79 {
80  // ToDo: Validate input!
81  numBlocks_ = productSpace_in->numBlocks();
82  productSpace_ = productSpace_in;
83  vecs_.resize(numBlocks_);
84  for( int k = 0; k < numBlocks_; ++k )
85  vecs_[k].initialize(createMember(productSpace_in->getBlock(k)));
86 }
87 
88 
89 template <class Scalar>
91  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in,
92  const ArrayView<const RCP<VectorBase<Scalar> > > &vecs
93  )
94 {
95  using Teuchos::as;
96 #ifdef TEUCHOS_DEBUG
97  TEUCHOS_ASSERT_EQUALITY( as<Ordinal>(productSpace_in->numBlocks()),
98  as<Ordinal>(vecs.size()) );
99 #endif
100  numBlocks_ = productSpace_in->numBlocks();
101  productSpace_ = productSpace_in;
102  vecs_.resize(numBlocks_);
103  for( int k = 0; k < numBlocks_; ++k )
104  vecs_[k].initialize(vecs[k]);
105 }
106 
107 
108 template <class Scalar>
110  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in,
111  const ArrayView<const RCP<const VectorBase<Scalar> > > &vecs
112  )
113 {
114  using Teuchos::as;
115 #ifdef TEUCHOS_DEBUG
116  TEUCHOS_ASSERT_EQUALITY( as<Ordinal>(productSpace_in->numBlocks()),
117  as<Ordinal>(vecs.size()) );
118 #endif
119  numBlocks_ = productSpace_in->numBlocks();
120  productSpace_ = productSpace_in;
121  vecs_.resize(numBlocks_);
122  for( int k = 0; k < numBlocks_; ++k )
123  vecs_[k].initialize(vecs[k]);
124 }
125 
126 
127 template <class Scalar>
129 {
130  productSpace_ = Teuchos::null;
131  vecs_.resize(0);
132  numBlocks_ = 0;
133 }
134 
135 
136 // Overridden from Teuchos::Describable
137 
138 
139 template<class Scalar>
141 {
142  const RCP<const VectorSpaceBase<Scalar> > vs = this->space();
143  std::ostringstream oss;
144  oss
145  << Teuchos::Describable::description()
146  << "{"
147  << "dim="<<(nonnull(vs) ? vs->dim() : 0)
148  << ", numBlocks = "<<numBlocks_
149  << "}";
150  return oss.str();
151 }
152 
153 
154 template<class Scalar>
156  Teuchos::FancyOStream &out_arg,
157  const Teuchos::EVerbosityLevel verbLevel
158  ) const
159 {
160  using Teuchos::FancyOStream;
161  using Teuchos::OSTab;
162  using Teuchos::describe;
163  RCP<FancyOStream> out = rcp(&out_arg,false);
164  OSTab tab(out);
165  switch(verbLevel) {
166  case Teuchos::VERB_NONE:
167  break;
168  case Teuchos::VERB_DEFAULT:
169  case Teuchos::VERB_LOW:
170  *out << this->description() << std::endl;
171  break;
172  case Teuchos::VERB_MEDIUM:
173  case Teuchos::VERB_HIGH:
174  case Teuchos::VERB_EXTREME:
175  {
176  *out
177  << Teuchos::Describable::description() << "{"
178  << "dim=" << this->space()->dim()
179  << "}\n";
180  OSTab tab2(out);
181  *out
182  << "numBlocks="<< numBlocks_ << std::endl
183  << "Constituent vector objects v[0], v[1], ... v[numBlocks-1]:\n";
184  OSTab tab3(out);
185  for( int k = 0; k < numBlocks_; ++k ) {
186  *out << "v["<<k<<"] = " << describe(*vecs_[k].getConstObj(),verbLevel);
187  }
188  break;
189  }
190  default:
191  TEUCHOS_TEST_FOR_EXCEPT(true); // Should never get here!
192  }
193 }
194 
195 
196 // Extensions to ProductVectorBase suitable for physically-blocked vectors
197 
198 
199 template <class Scalar>
201  int i, const RCP<const VectorBase<Scalar> >& b
202  )
203 {
204 #ifdef TEUCHOS_DEBUG
205  TEUCHOS_TEST_FOR_EXCEPT(i < 0 || i >= numBlocks_);
206  TEUCHOS_TEST_FOR_EXCEPT(!productSpace_->getBlock(i)->isCompatible(*(b->space())));
207 #endif
208  vecs_[i] = b;
209 }
210 
211 
212 template <class Scalar>
214  int i, const RCP<VectorBase<Scalar> >& b
215  )
216 {
217 #ifdef TEUCHOS_DEBUG
218  TEUCHOS_TEST_FOR_EXCEPT(i < 0 || i >= numBlocks_);
219  TEUCHOS_TEST_FOR_EXCEPT(!productSpace_->getBlock(i)->isCompatible(*(b->space())));
220 #endif
221  vecs_[i] = b;
222 }
223 
224 
225 // Overridden from ProductVectorBase
226 
227 
228 template <class Scalar>
229 RCP<VectorBase<Scalar> >
231 {
232 #ifdef TEUCHOS_DEBUG
233  TEUCHOS_TEST_FOR_EXCEPT( k < 0 || numBlocks_-1 < k);
234 #endif
235  return vecs_[k].getNonconstObj();
236 }
237 
238 
239 template <class Scalar>
240 RCP<const VectorBase<Scalar> >
242 {
243 #ifdef TEUCHOS_DEBUG
244  TEUCHOS_TEST_FOR_EXCEPT( k < 0 || numBlocks_-1 < k);
245 #endif
246  return vecs_[k].getConstObj();
247 }
248 
249 
250 // Overridden from ProductMultiVectorBase
251 
252 
253 template <class Scalar>
254 RCP<const ProductVectorSpaceBase<Scalar> >
256 {
257  return productSpace_;
258 }
259 
260 
261 template <class Scalar>
263 {
264 #ifdef TEUCHOS_DEBUG
265  TEUCHOS_TEST_FOR_EXCEPT( k < 0 || numBlocks_-1 < k);
266 #endif
267  return vecs_[k].isConst();
268 }
269 
270 
271 template <class Scalar>
272 RCP<MultiVectorBase<Scalar> >
274 {
275  return getNonconstVectorBlock(k);
276 }
277 
278 
279 template <class Scalar>
280 RCP<const MultiVectorBase<Scalar> >
282 {
283  return getVectorBlock(k);
284 }
285 
286 
287 // Overridden from VectorBase
288 
289 
290 template <class Scalar>
291 RCP< const VectorSpaceBase<Scalar> >
293 {
294  return productSpace_;
295 }
296 
297 
298 template <class Scalar>
300  const RTOpPack::RTOpT<Scalar> &op,
301  const ArrayView<const Ptr<const VectorBase<Scalar> > > &vecs,
302  const ArrayView<const Ptr<VectorBase<Scalar> > > &targ_vecs,
303  const Ptr<RTOpPack::ReductTarget> &reduct_obj,
304  const Ordinal global_offset_in
305  ) const
306 {
307 
308  // 2008/02/20: rabartl: ToDo: Upgrade Teuchos::Workspace<T> to implicitly
309  // convert to Teuchos::ArrayView<T>. This will allow the calls to
310  // applyOp(...) with sub_vecs and sub_targ_vecs to work without trouble!
311  // For now, I just want to get this done. It is likely that this function
312  // is going to change in major ways soon anyway!
313 
314  //using Teuchos::Workspace;
315  using Teuchos::ptr_dynamic_cast;
316  using Teuchos::describe;
317  using Teuchos::null;
318 
319  //Teuchos::WorkspaceStore* wss = Teuchos::get_default_workspace_store().get();
320 
321  const Ordinal n = productSpace_->dim();
322  const int num_vecs = vecs.size();
323  const int num_targ_vecs = targ_vecs.size();
324 
325  // Validate the compatibility of the vectors!
326 #ifdef TEUCHOS_DEBUG
327  bool test_failed;
328  for(int k = 0; k < num_vecs; ++k) {
329  test_failed = !this->space()->isCompatible(*vecs[k]->space());
330  TEUCHOS_TEST_FOR_EXCEPTION(
332  ,"DefaultProductVector::applyOp(...): Error vecs["<<k<<"]->space() = "
333  <<vecs[k]->space()->description()<<"\' is not compatible with this "
334  <<"vector space = "<<this->space()->description()<<"!"
335  );
336  }
337  for(int k = 0; k < num_targ_vecs; ++k) {
338  test_failed = !this->space()->isCompatible(*targ_vecs[k]->space());
339  TEUCHOS_TEST_FOR_EXCEPTION(
341  ,"DefaultProductVector::applyOp(...): Error targ_vecs["<<k<<"]->space() = "
342  <<targ_vecs[k]->space()->description()<<"\' is not compatible with this "
343  <<"vector space = "<<this->space()->description()<<"!"
344  );
345  }
346 #endif
347 
348  //
349  // Dynamic cast each of the vector arguments to the ProductVectorBase interface
350  //
351  // NOTE: If the constituent vector is not a product vector, then a product
352  // vector of one component is created.
353  //
354 
355  Array<RCP<const ProductVectorBase<Scalar> > > vecs_args_store(num_vecs);
356  Array<Ptr<const ProductVectorBase<Scalar> > > vecs_args(num_vecs);
357  for(int k = 0; k < num_vecs; ++k) {
358  vecs_args_store[k] =
359  castOrCreateProductVectorBase<Scalar>(rcpFromPtr(vecs[k]));
360  vecs_args[k] = vecs_args_store[k].ptr();
361  }
362 
363  Array<RCP<ProductVectorBase<Scalar> > > targ_vecs_args_store(num_targ_vecs);
364  Array<Ptr<ProductVectorBase<Scalar> > > targ_vecs_args(num_targ_vecs);
365  for(int k = 0; k < num_targ_vecs; ++k) {
366  targ_vecs_args_store[k] =
367  castOrCreateNonconstProductVectorBase<Scalar>(rcpFromPtr(targ_vecs[k]));
368  targ_vecs_args[k] = targ_vecs_args_store[k].ptr();
369  }
370 
371  //
372  // If we get here, then we will implement the applyOpImpl(...) one vector
373  // block at a time.
374  //
375  const Ordinal dim = n;
376  Ordinal num_elements_remaining = dim;
377  const int numBlocks = productSpace_->numBlocks();
378  Array<RCP<const VectorBase<Scalar> > >
379  sub_vecs_rcps(num_vecs);
380  Array<Ptr<const VectorBase<Scalar> > >
381  sub_vecs(num_vecs);
382  Array<RCP<VectorBase<Scalar> > >
383  sub_targ_vecs_rcps(num_targ_vecs);
384  Array<Ptr<VectorBase<Scalar> > >
385  sub_targ_vecs(num_targ_vecs);
386  Ordinal g_off = 0;
387  for(int k = 0; k < numBlocks; ++k) {
388  const Ordinal dim_k = productSpace_->getBlock(k)->dim();
389  // Fill constituent vectors for block k
390  for( int i = 0; i < num_vecs; ++i ) {
391  sub_vecs_rcps[i] = vecs_args[i]->getVectorBlock(k);
392  sub_vecs[i] = sub_vecs_rcps[i].ptr();
393  }
394  // Fill constituent target vectors for block k
395  for( int j = 0; j < num_targ_vecs; ++j ) {
396  sub_targ_vecs_rcps[j] = targ_vecs_args[j]->getNonconstVectorBlock(k);
397  sub_targ_vecs[j] = sub_targ_vecs_rcps[j].ptr();
398  }
399  Thyra::applyOp<Scalar>(
400  op, sub_vecs(), sub_targ_vecs(),
401  reduct_obj,
402  global_offset_in + g_off
403  );
404  g_off += dim_k;
405  num_elements_remaining -= dim_k;
406  }
407  TEUCHOS_TEST_FOR_EXCEPT(!(num_elements_remaining==0));
408 
409 }
410 
411 
412 // protected
413 
414 
415 // Overridden protected functions from VectorBase
416 
417 
418 template <class Scalar>
420  const Range1D& rng_in, RTOpPack::ConstSubVectorView<Scalar>* sub_vec
421  ) const
422 {
423  const Range1D
424  rng = rng_in.full_range() ? Range1D(0,productSpace_->dim()-1) : rng_in;
425  int kth_vector_space = -1;
426  Ordinal kth_global_offset = 0;
427  productSpace_->getVecSpcPoss(rng.lbound(),&kth_vector_space,&kth_global_offset);
428 #ifdef TEUCHOS_DEBUG
429  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= numBlocks_ ) );
430 #endif
431  if(
432  rng.lbound() + rng.size()
433  <= kth_global_offset + vecs_[kth_vector_space].getConstObj()->space()->dim()
434  )
435  {
436  // This involves only one sub-vector so just return it.
437  const_cast<const VectorBase<Scalar>*>(
438  &*vecs_[kth_vector_space].getConstObj()
439  )->acquireDetachedView( rng - kth_global_offset, sub_vec );
440  sub_vec->setGlobalOffset( sub_vec->globalOffset() + kth_global_offset );
441  }
442  else {
443  // Just let the default implementation handle this. ToDo: In the future
444  // we could manually construct an explicit sub-vector that spanned
445  // two or more constituent vectors but this would be a lot of work.
446  // However, this would require the use of temporary memory but
447  // so what.
449  }
450 }
451 
452 
453 template <class Scalar>
456  ) const
457 {
458  if( sub_vec->values().get() == NULL ) return;
459  int kth_vector_space = -1;
460  Ordinal kth_global_offset = 0;
461  productSpace_->getVecSpcPoss(sub_vec->globalOffset(),&kth_vector_space,&kth_global_offset);
462 #ifdef TEUCHOS_DEBUG
463  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= numBlocks_ ) );
464 #endif
465  if(
466  sub_vec->globalOffset() + sub_vec->subDim()
467  <= kth_global_offset + vecs_[kth_vector_space].getConstObj()->space()->dim()
468  )
469  {
470  // This sub_vec was extracted from a single constituent vector
471  sub_vec->setGlobalOffset( sub_vec->globalOffset() - kth_global_offset );
472  vecs_[kth_vector_space].getConstObj()->releaseDetachedView(sub_vec);
473  }
474  else {
475  // This sub_vec was created by the default implementation!
477  }
478 }
479 
480 
481 template <class Scalar>
483  const Range1D& rng_in, RTOpPack::SubVectorView<Scalar>* sub_vec
484  )
485 {
486  const Range1D
487  rng = rng_in.full_range() ? Range1D(0,productSpace_->dim()-1) : rng_in;
488  int kth_vector_space = -1;
489  Ordinal kth_global_offset = 0;
490  productSpace_->getVecSpcPoss(rng.lbound(),&kth_vector_space,&kth_global_offset);
491 #ifdef TEUCHOS_DEBUG
492  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= numBlocks_ ) );
493 #endif
494  if(
495  rng.lbound() + rng.size()
496  <= kth_global_offset + vecs_[kth_vector_space].getConstObj()->space()->dim()
497  )
498  {
499  // This involves only one sub-vector so just return it.
500  vecs_[kth_vector_space].getConstObj()->acquireDetachedView(
501  rng - kth_global_offset, sub_vec
502  );
503  sub_vec->setGlobalOffset( sub_vec->globalOffset() + kth_global_offset );
504  }
505  else {
506  // Just let the default implementation handle this. ToDo: In the future
507  // we could manually construct an explicit sub-vector that spanned
508  // two or more constituent vectors but this would be a lot of work.
509  // However, this would require the use of temporary memory but
510  // so what.
512  }
513 }
514 
515 
516 template <class Scalar>
519  )
520 {
521  if( sub_vec->values().get() == NULL ) return;
522  int kth_vector_space = -1;
523  Ordinal kth_global_offset = 0;
524  productSpace_->getVecSpcPoss(sub_vec->globalOffset(),&kth_vector_space,&kth_global_offset);
525 #ifdef TEUCHOS_DEBUG
526  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= numBlocks_ ) );
527 #endif
528  if(
529  sub_vec->globalOffset() + sub_vec->subDim()
530  <= kth_global_offset + vecs_[kth_vector_space].getConstObj()->space()->dim()
531  )
532  {
533  // This sub_vec was extracted from a single constituent vector
534  sub_vec->setGlobalOffset( sub_vec->globalOffset() - kth_global_offset );
535  vecs_[kth_vector_space].getNonconstObj()->commitDetachedView(sub_vec);
536  }
537  else {
538  // This sub_vec was created by the default implementation!
540  }
541 }
542 
543 
544 template <class Scalar>
547  )
548 {
549  int kth_vector_space = -1;
550  Ordinal kth_global_offset = 0;
551  productSpace_->getVecSpcPoss(sub_vec.globalOffset(),&kth_vector_space,&kth_global_offset);
552 #ifdef TEUCHOS_DEBUG
553  TEUCHOS_TEST_FOR_EXCEPT( !( 0 <= kth_vector_space && kth_vector_space <= numBlocks_ ) );
554 #endif
555  if(
556  sub_vec.globalOffset() + sub_vec.subDim()
557  <= kth_global_offset + vecs_[kth_vector_space].getConstObj()->space()->dim()
558  )
559  {
560  // This sub-vector fits into a single constituent vector
561  RTOpPack::SparseSubVectorT<Scalar> sub_vec_g = sub_vec;
562  sub_vec_g.setGlobalOffset( sub_vec_g.globalOffset() - kth_global_offset );
563  vecs_[kth_vector_space].getNonconstObj()->setSubVector(sub_vec_g);
564  }
565  else {
566  // Let the default implementation take care of this. ToDo: In the future
567  // it would be possible to manually set the relevant constituent
568  // vectors with no temp memory allocations.
570  }
571 }
572 
573 
574 // Overridden protected functions from MultiVectorBase
575 
576 
577 template <class Scalar>
579 {
580  const int num_vecs = vecs_.size();
581  for(int k = 0; k < num_vecs; ++k) {
582  vecs_[k].getNonconstObj()->assign(alpha);
583  }
584 }
585 
586 
587 } // namespace Thyra
588 
589 
590 template<class Scalar>
591 Teuchos::RCP<Thyra::ProductVectorBase<Scalar> >
592 Thyra::castOrCreateNonconstProductVectorBase(const RCP<VectorBase<Scalar> > v)
593 {
594  using Teuchos::rcp_dynamic_cast;
595  using Teuchos::tuple;
596  const RCP<ProductVectorBase<Scalar> > prod_v =
597  rcp_dynamic_cast<ProductVectorBase<Scalar> >(v);
598  if (nonnull(prod_v)) {
599  return prod_v;
600  }
601  return defaultProductVector<Scalar>(
602  productVectorSpace<Scalar>(tuple(v->space())()),
603  tuple(v)()
604  );
605 }
606 
607 
608 template<class Scalar>
609 Teuchos::RCP<const Thyra::ProductVectorBase<Scalar> >
610 Thyra::castOrCreateProductVectorBase(const RCP<const VectorBase<Scalar> > v)
611 {
612  using Teuchos::rcp_dynamic_cast;
613  using Teuchos::tuple;
614  const RCP<const ProductVectorBase<Scalar> > prod_v =
615  rcp_dynamic_cast<const ProductVectorBase<Scalar> >(v);
616  if (nonnull(prod_v)) {
617  return prod_v;
618  }
619  return defaultProductVector<Scalar>(
620  productVectorSpace<Scalar>(tuple(v->space())()),
621  tuple(v)()
622  );
623 }
624 
625 
626 //
627 // Explicit instant macro
628 //
629 
630 #define THYRA_DEFAULT_PRODUCT_VECTOR_INSTANT(SCALAR) \
631  \
632  template class DefaultProductVector<SCALAR >; \
633  \
634  template RCP<ProductVectorBase<SCALAR > > \
635  castOrCreateNonconstProductVectorBase(const RCP<VectorBase<SCALAR > > v); \
636  \
637  template RCP<const ProductVectorBase<SCALAR > > \
638  castOrCreateProductVectorBase(const RCP<const VectorBase<SCALAR > > v); \
639 
640 
641 
642 #endif // THYRA_DEFAULT_PRODUCT_VECTOR_DEF_HPP
void setSubVector(const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
Calls setSubVectorImpl().
void setSubVectorImpl(const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)
Thrown if vector spaces are incompatible.
void applyOpImpl(const RTOpPack::RTOpT< Scalar > &op, const ArrayView< const Ptr< const VectorBase< Scalar > > > &vecs, const ArrayView< const Ptr< VectorBase< Scalar > > > &targ_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal global_offset) const
RCP< const MultiVectorBase< Scalar > > getMultiVectorBlock(const int k) const
Ordinal globalOffset() const
Teuchos_Ordinal subDim() const
const ArrayRCP< const Scalar > values() const
virtual void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
void setNonconstBlock(int i, const RCP< VectorBase< Scalar > > &b)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
RCP< const ProductVectorSpaceBase< Scalar > > productSpace() const
DefaultProductVector()
Construct to uninitialized.
void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
Abstract interface for finite-dimensional dense vectors.
Teuchos_Ordinal globalOffset() const
virtual void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
RCP< const VectorBase< Scalar > > getVectorBlock(const int k) const
void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
RCP< VectorBase< Scalar > > getNonconstVectorBlock(const int k)
void setGlobalOffset(Ordinal globalOffset_in)
void setGlobalOffset(Teuchos_Ordinal globalOffset_in)
RCP< const VectorSpaceBase< Scalar > > space() const
RCP< MultiVectorBase< Scalar > > getNonconstMultiVectorBlock(const int k)
const ArrayRCP< Scalar > values() const
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
void setBlock(int i, const RCP< const VectorBase< Scalar > > &b)
void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
void initialize(const RCP< const DefaultProductVectorSpace< Scalar > > &productSpace)
Initialize.
Teuchos::Range1D Range1D
virtual void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)