Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_ProductVectorSpaceBase.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_PRODUCT_VECTOR_SPACE_BASE_HPP
11 #define THYRA_PRODUCT_VECTOR_SPACE_BASE_HPP
12 
13 
14 #include "Thyra_VectorSpaceBase.hpp"
15 #include "Teuchos_ExpandScalarTypeMacros.hpp"
16 
17 
18 namespace Thyra {
19 
20 
62 template<class Scalar>
63 class ProductVectorSpaceBase : virtual public VectorSpaceBase<Scalar> {
64 public:
65 
72  virtual int numBlocks() const = 0;
73 
80  virtual Teuchos::RCP<const VectorSpaceBase<Scalar> > getBlock(const int k) const = 0;
81 
82 #ifdef DOXYGEN_COMPILE
83 private:
84  const VectorSpaceBase<Scalar> *spaces;
85 #endif
86 
87 private:
88 
89  // Not defined and not to be called
90  ProductVectorSpaceBase<Scalar>&
91  operator=(const ProductVectorSpaceBase<Scalar>&);
92 
93 };
94 
95 
101 template<class Scalar>
102 inline
103 RCP<ProductVectorSpaceBase<Scalar> >
105  const RCP<VectorSpaceBase<Scalar> > &v,
106  const bool forceSuccess = true
107  )
108 {
109  return Teuchos::rcp_dynamic_cast<ProductVectorSpaceBase<Scalar> >(
110  v, forceSuccess);
111 }
112 
113 
119 template<class Scalar>
120 inline
123  const RCP<const VectorSpaceBase<Scalar> > &v,
124  const bool forceSuccess = true
125  )
126 {
127  return Teuchos::rcp_dynamic_cast<const ProductVectorSpaceBase<Scalar> >(
128  v, forceSuccess);
129 }
130 
131 
137 inline
140  const RCP<VectorSpaceBase<double> > &vs,
141  const bool forceSuccess = true
142  )
143 {
144  return nonconstProductVectorSpaceBase<double>(vs, forceSuccess);
145 }
146 
147 
152 inline
155  const RCP<const VectorSpaceBase<double> > &vs,
156  const bool forceSuccess = true
157  )
158 {
159  return productVectorSpaceBase<double>(vs, forceSuccess);
160 }
161 
162 
163 } // namespace Thyra
164 
165 #endif // THYRA_PRODUCT_VECTOR_SPACE_BASE_HPP
virtual Teuchos::RCP< const VectorSpaceBase< Scalar > > getBlock(const int k) const =0
Returns a vector space for the kth (zero-based) block.
RCP< ProductVectorSpaceBase< double > > nonconstProductVectorSpaceBase(const RCP< VectorSpaceBase< double > > &vs, const bool forceSuccess=true)
Inline overload of nonconstProductVectorSpaceBase&lt;Scalar&gt;(..) for double.
virtual int numBlocks() const =0
Returns the number of blocks that make up this product space.
Abstract interface for objects that represent a space for vectors.
RCP< const ProductVectorSpaceBase< double > > productVectorSpaceBase(const RCP< const VectorSpaceBase< double > > &vs, const bool forceSuccess=true)
Inline overload of productVectorSpaceBase&lt;Scalar&gt;(..) for double.
RCP< const ProductVectorSpaceBase< Scalar > > productVectorSpaceBase(const RCP< const VectorSpaceBase< Scalar > > &v, const bool forceSuccess=true)
Dynamic cast from a const VectorSpaceBase to a const ProductVectorSpaceBase object and thow exception...
RCP< ProductVectorSpaceBase< Scalar > > nonconstProductVectorSpaceBase(const RCP< VectorSpaceBase< Scalar > > &v, const bool forceSuccess=true)
Dynamic cast from a VectorSpaceBase to a ProductVectorSpaceBase object and thow exception if this fai...