Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultProductMultiVector_decl.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP
11 #define THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP
12 
13 #include "Thyra_ProductMultiVectorBase.hpp"
14 #include "Thyra_MultiVectorDefaultBase.hpp"
15 #include "Teuchos_ConstNonconstObjectContainer.hpp"
16 
17 
18 namespace Thyra {
19 
20 
22 template <class Scalar> class DefaultProductVectorSpace;
23 
24 
38 template<class Scalar>
40  : virtual public ProductMultiVectorBase<Scalar>,
41  virtual protected MultiVectorDefaultBase<Scalar>
42 {
43 public:
44 
47 
50 
52  void initialize(
54  const int numMembers
55  );
56 
58  void initialize(
60  const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs
61  );
62 
64  void initialize(
66  const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs
67  );
68 
73  void uninitialize();
74 
76 
79 
81  std::string description() const;
82 
84  void describe(
86  const Teuchos::EVerbosityLevel verbLevel
87  ) const;
88 
90 
93 
96  productSpace() const;
98  bool blockIsConst(const int k) const;
101  getNonconstMultiVectorBlock(const int k);
104  getMultiVectorBlock(const int k) const;
105 
107 
112 
114 
117 
120  range() const;
123  domain() const;
124 
126 
127 protected:
128 
131 
133  virtual void assignImpl(Scalar alpha);
135  virtual void assignMultiVecImpl(const MultiVectorBase<Scalar>& mv);
137  virtual void scaleImpl(Scalar alpha);
139  virtual void updateImpl(
140  Scalar alpha,
141  const MultiVectorBase<Scalar>& mv
142  );
144  virtual void linearCombinationImpl(
145  const ArrayView<const Scalar>& alpha,
146  const ArrayView<const Ptr<const MultiVectorBase<Scalar> > >& mv,
147  const Scalar& beta
148  );
150  virtual void dotsImpl(
151  const MultiVectorBase<Scalar>& mv,
152  const ArrayView<Scalar>& prods
153  ) const;
155  virtual void norms1Impl(
157  ) const;
159  virtual void norms2Impl(
161  ) const;
163  virtual void normsInfImpl(
165  ) const;
172  contigSubViewImpl( const Range1D& colRng ) const;
175  nonconstContigSubViewImpl( const Range1D& colRng );
178  nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
184  const RTOpPack::RTOpT<Scalar> &primary_op,
185  const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs,
186  const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs,
187  const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs,
188  const Ordinal primary_global_offset
189  ) const;
192  const Range1D &rowRng,
193  const Range1D &colRng,
195  ) const;
199  ) const;
202  const Range1D &rowRng,
203  const Range1D &colRng,
205  );
209  );
210 
212 
215 
217  bool opSupportedImpl(EOpTransp M_trans) const;
218 
220  void applyImpl(
221  const EOpTransp M_trans,
222  const MultiVectorBase<Scalar> &X,
223  const Ptr<MultiVectorBase<Scalar> > &Y,
224  const Scalar alpha,
225  const Scalar beta
226  ) const;
227 
229 
230 public:
231 
232 private:
233 
234  // //////////////////////////////
235  // Private types
236 
238 
239  // //////////////////////////////
240  // Private data members
241 
243  Teuchos::Array<CNMVC> multiVecs_;
244  // cache
245  int numBlocks_;
246 
247  // //////////////////////////////
248  // Private member functions
249 
250  template<class MultiVectorType>
251  void initializeImpl(
252  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
253  const ArrayView<const RCP<MultiVectorType> > &multiVecs
254  );
255 
256  void assertInitialized() const;
257 
258  void validateColIndex(const int j) const;
259 
260 };
261 
262 
267 template<class Scalar>
269 defaultProductMultiVector();
270 
271 
276 template<class Scalar>
278 defaultProductMultiVector(
279  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
280  const int numMembers
281  );
282 
283 
288 template<class Scalar>
290 defaultProductMultiVector(
291  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
292  const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs
293  );
294 
295 
300 template<class Scalar>
302 defaultProductMultiVector(
303  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
304  const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs
305  );
306 
307 
314 template<class Scalar>
316 castOrCreateSingleBlockProductMultiVector(
317  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
318  const RCP<const MultiVectorBase<Scalar> > &mv
319  );
320 
321 
328 template<class Scalar>
330 nonconstCastOrCreateSingleBlockProductMultiVector(
331  const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
332  const RCP<MultiVectorBase<Scalar> > &mv
333  );
334 
335 
336 // /////////////////////////
337 // Inline members
338 
339 
340 #ifndef TEUCHOS_DEBUG
341 
342 
343 template<class Scalar>
344 inline
346 {}
347 
348 
349 template<class Scalar>
350 inline
351 void DefaultProductMultiVector<Scalar>::validateColIndex(const int /* j */) const
352 {}
353 
354 
355 #endif // TEUCHOS_DEBUG
356 
357 
358 } // namespace Thyra
359 
360 
361 #endif // THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP
Base interface for product multi-vectors.
virtual void updateImpl(Scalar alpha, const MultiVectorBase< Scalar > &mv)
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
void acquireDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
virtual void norms1Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual void dotsImpl(const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
RCP< const VectorSpaceBase< Scalar > > range() const
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void norms2Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
Node subclass that uses a default MultiVectorBase implementation to provide default implementations f...
RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
void releaseDetachedMultiVectorViewImpl(RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
RCP< MultiVectorBase< Scalar > > getNonconstMultiVectorBlock(const int k)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
void acquireNonconstDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Interface for a collection of column vectors called a multi-vector.
RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &colRng)
Concrete implementation of a product multi-vector.
virtual void linearCombinationImpl(const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &mv, const Scalar &beta)
virtual void assignMultiVecImpl(const MultiVectorBase< Scalar > &mv)
RCP< MultiVectorBase< Scalar > > clone_mv() const
void norms(const MultiVectorBase< Scalar > &V, const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms)
Column-wise multi-vector natural norm.
virtual void normsInfImpl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
void mvMultiReductApplyOpImpl(const RTOpPack::RTOpT< Scalar > &primary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const ArrayView< const Ptr< RTOpPack::ReductTarget > > &reduct_objs, const Ordinal primary_global_offset) const
RCP< const VectorSpaceBase< Scalar > > domain() const
void commitNonconstDetachedMultiVectorViewImpl(RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
void initialize(const RCP< const DefaultProductVectorSpace< Scalar > > &productSpace, const int numMembers)
RCP< const MultiVectorBase< Scalar > > getMultiVectorBlock(const int k) const
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
RCP< const ProductVectorSpaceBase< Scalar > > productSpace() const
RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &colRng) const
RCP< const VectorBase< Scalar > > colImpl(Ordinal j) const