Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultMultiVectorProductVectorSpace_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_MULTI_VECTOR_PRODUCT_VECTOR_SPACE_DECL_HPP
11 #define THYRA_DEFAULT_MULTI_VECTOR_PRODUCT_VECTOR_SPACE_DECL_HPP
12 
13 #include "Thyra_ProductVectorSpaceBase.hpp" // Interface
14 #include "Thyra_DefaultProductVectorSpace.hpp" // Implementation
15 #include "Thyra_VectorSpaceDefaultBase.hpp"
16 
17 
18 namespace Thyra {
19 
20 
32 template<class Scalar>
33 class DefaultMultiVectorProductVectorSpace
34  : virtual public ProductVectorSpaceBase<Scalar>
35  , virtual protected VectorSpaceDefaultBase<Scalar>
36 {
37 public:
38 
41 
44 
64  void initialize(
65  const RCP<const VectorSpaceBase<Scalar> > &space,
66  const int numColumns
67  );
68 
70  RCP<const DefaultProductVectorSpace<Scalar> >
72 
93  void uninitialize(
94  RCP<const VectorSpaceBase<Scalar> > *space = 0,
95  int *numColumns = 0
96  );
97 
99 
102 
104  int numBlocks() const;
106  RCP<const VectorSpaceBase<Scalar> > getBlock(const int k) const;
107 
109 
112 
114  Ordinal dim() const;
116  bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const;
118  RCP< VectorBase<Scalar> > createMember() const;
120  Scalar scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y ) const;
124  void scalarProdsImpl(
125  const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
126  const ArrayView<Scalar> &scalarProds ) const;
130  bool hasInCoreView( const Range1D& rng, const EViewType viewType,
131  const EStrideType strideType ) const;
133  RCP< const VectorSpaceFactoryBase<Scalar> > smallVecSpcFcty() const;
142  RCP< MultiVectorBase<Scalar> > createMembers(int numMembers) const;
144  RCP< const VectorSpaceBase<Scalar> > clone() const;
145 
147 
150 
154  std::string description() const;
155 
163  void describe(
165  const Teuchos::EVerbosityLevel verbLevel
166  ) const;
167 
169 
170 private:
171 
172  // ///////////////////////////////////
173  // Private data members
174 
175  RCP<const VectorSpaceBase<Scalar> > space_;
176  int numColumns_;
177  RCP<const DefaultProductVectorSpace<Scalar> > defaultProdVecSpc_;
178 
179  // ///////////////////////////////////
180  // Private member functions
181 
182  void assertInitialized() const;
183 
184 };
185 
186 
191 template<class Scalar>
192 inline
193 RCP<DefaultMultiVectorProductVectorSpace<Scalar> >
195 {
197 }
198 
199 
204 template<class Scalar>
205 inline
208  const RCP<const VectorSpaceBase<Scalar> > &space,
209  const int numColumns
210  )
211 {
212  RCP<DefaultMultiVectorProductVectorSpace<Scalar> > multiVecProdVecSpace =
213  multiVectorProductVectorSpace<Scalar>();
214  multiVecProdVecSpace->initialize(space,numColumns);
215  return multiVecProdVecSpace;
216 }
217 
218 
219 // /////////////////////////////////
220 // Inline members
221 
222 
223 template<class Scalar>
224 inline
227 {
228  return defaultProdVecSpc_;
229 }
230 
231 
232 template<class Scalar>
233 inline
235 {
236 #ifdef TEUCHOS_DEBUG
237  TEUCHOS_TEST_FOR_EXCEPT( is_null(space_) );
238 #endif
239 }
240 
241 
242 } // namespace Thyra
243 
244 
245 #endif // THYRA_DEFAULT_MULTI_VECTOR_PRODUCT_VECTOR_SPACE_DECL_HPP
void uninitialize(RCP< const VectorSpaceBase< Scalar > > *space=0, int *numColumns=0)
Uninitialize.
RCP< const VectorSpaceBase< Scalar > > clone() const
Clones the object as promised.
bool is_null(const boost::shared_ptr< T > &p)
RCP< DefaultMultiVectorProductVectorSpace< Scalar > > multiVectorProductVectorSpace(const RCP< const VectorSpaceBase< Scalar > > &space, const int numColumns)
Nonmember constructor function.
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Returns the sum of the scalar products of the constituent vectors.
void initialize(const RCP< const VectorSpaceBase< Scalar > > &space, const int numColumns)
Initialize with a list of constituent vector spaces.
RCP< DefaultMultiVectorProductVectorSpace< Scalar > > multiVectorProductVectorSpace()
Nonmember constructor function.
Abstract interface for objects that represent a space for vectors.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
bool isCompatible(const VectorSpaceBase< Scalar > &vecSpc) const
RCP< const VectorSpaceFactoryBase< Scalar > > smallVecSpcFcty() const
Returns getBlock(0)-&gt;smallVecSpcFcty().
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent vector space.
void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds) const
Returns the sum of the scalar products of each of the columns of the constituent multi-vectors.
RCP< const DefaultProductVectorSpace< Scalar > > getDefaultProductVectorSpace() const
bool hasInCoreView(const Range1D &rng, const EViewType viewType, const EStrideType strideType) const
Returns true if all of the constituent vector spaces return true.
Standard concrete implementation of a product vector space that creates product vectors fromed implic...
RCP< VectorBase< Scalar > > createMember() const
Returns a DefaultMultiVectorProductVector object.
RCP< const VectorSpaceBase< Scalar > > getBlock(const int k) const
EStrideType
Determine if data is unit stride or non-unit stride.
void scalarProds(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const
Return the scalar product of each column in two multi-vectors in the vector space.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
Returns a DefaultColumnwiseMultiVector object.
std::string description() const
Prints just the name DefaultMultiVectorProductVectorSpace along with the overall dimension and the nu...
Teuchos::Range1D Range1D