Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_ScalarProdVectorSpaceBase_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_SCALAR_PROD_VECTOR_SPACE_BASE_DECL_HPP
11 #define THYRA_SCALAR_PROD_VECTOR_SPACE_BASE_DECL_HPP
12 
13 #include "Thyra_OperatorVectorAdapterSupportTypes.hpp"
14 #include "Thyra_VectorSpaceDefaultBase.hpp"
15 
16 
17 namespace Thyra {
18 
19 
52 template<class Scalar>
53 class ScalarProdVectorSpaceBase : virtual public VectorSpaceDefaultBase<Scalar> {
54 public:
55 
58 
69 
86  const RCP<const ScalarProdBase<Scalar> > &scalarProd );
87 
108  virtual void setScalarProd(
109  const RCP<const ScalarProdBase<Scalar> > &scalarProd );
110 
113  RCP<const ScalarProdBase<Scalar> > getScalarProd() const;
114 
116 
119 
121  bool isEuclidean() const;
123  Scalar scalarProd(
124  const VectorBase<Scalar>& x, const VectorBase<Scalar>& y ) const;
126  void scalarProdsImpl(
127  const MultiVectorBase<Scalar>& X, const MultiVectorBase<Scalar>& Y,
128  const ArrayView<Scalar> &scalarProds_out ) const;
129 
131 
132 private:
133 
134  RCP<const ScalarProdBase<Scalar> > scalarProd_;
135 
136 };
137 
138 
143 template<class Scalar>
144 RCP<const ScalarProdVectorSpaceBase<Scalar> >
146  const RCP<const VectorSpaceBase<Scalar> > &vs,
147  const Ordinal dim
148  )
149 {
150  return Teuchos::rcp_dynamic_cast<const ScalarProdVectorSpaceBase<Scalar> >(
151  vs->smallVecSpcFcty()->createVecSpc(dim), true);
152 }
153 
154 
155 } // end namespace Thyra
156 
157 
158 #endif // THYRA_SCALAR_PROD_VECTOR_SPACE_BASE_DECL_HPP
RCP< const ScalarProdVectorSpaceBase< Scalar > > createSmallScalarProdVectorSpaceBase(const RCP< const VectorSpaceBase< Scalar > > &vs, const Ordinal dim)
Create a small vector space casted to ScalarProdVectorSpaceBase.
ScalarProdVectorSpaceBase()
Construct to use dot product as the default.
void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const
Calls getScalarProd()-&gt;scalarProds(X,Y,scalar_prods)
Abstract interface for objects that represent a space for vectors.
bool isEuclidean() const
Returns getScalarProd()-&gt;isEuclidean()
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
RCP< const ScalarProdBase< Scalar > > getScalarProd() const
Return the current scalar product.
virtual void setScalarProd(const RCP< const ScalarProdBase< Scalar > > &scalarProd)
Set a different scalar product.
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Returns getScalarProd()-&gt;scalarProd(x,y)