Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultSpmdMultiVector_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_Spmd_MULTI_VECTOR_STD_DECL_HPP
11 #define THYRA_Spmd_MULTI_VECTOR_STD_DECL_HPP
12 
13 #include "Thyra_SpmdMultiVectorDefaultBase_decl.hpp"
14 
15 
16 namespace Thyra {
17 
18 
35 template<class Scalar>
36 class DefaultSpmdMultiVector : virtual public SpmdMultiVectorDefaultBase<Scalar> {
37 public:
38 
41 
44 
47  const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
48  const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace
49  );
50 
53  const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
54  const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
55  const ArrayRCP<Scalar> &localValues,
56  const Ordinal leadingDim = -1
57  );
58 
74  void initialize(
75  const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
76  const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace
77  );
78 
107  void initialize(
108  const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
109  const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
110  const ArrayRCP<Scalar> &localValues,
111  const Ordinal leadingDim = -1
112  );
113 
119  void uninitialize(
120  RCP<const SpmdVectorSpaceBase<Scalar> > *spmdRangeSpace = NULL,
121  RCP<const ScalarProdVectorSpaceBase<Scalar> > *domainSpace = NULL,
122  ArrayRCP<Scalar> *localValues = NULL,
123  Ordinal *leadingDim = NULL
124  );
125 
128  domainScalarProdVecSpc() const;
129 
131 
132 protected:
133 
140  contigSubViewImpl(const Range1D& colRng) const;
143  nonconstContigSubViewImpl(const Range1D& colRng);
146  nonContigSubViewImpl(const ArrayView<const int> &cols) const;
151 
158  const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim
159  );
162  const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim
163  ) const;
165 
166 private:
167 
168  // ///////////////////////////////////////
169  // Private data members
170 
171  RCP<const SpmdVectorSpaceBase<Scalar> > spmdRangeSpace_;
173  ArrayRCP<Scalar> localValues_;
174  Ordinal leadingDim_;
175 
176  // ///////////////////////////////////////
177  // Private member functions
178 
179  ArrayRCP<Scalar> createContiguousCopy(const ArrayView<const int> &cols) const;
180 
181 public:
182 
183 #ifdef THYRA_DEBUG
184  // Unit testing sensing varaible
185  static int numSkipCopyBack;
186 #endif
187 
188 }; // end class DefaultSpmdMultiVector
189 
190 
191 template<class Scalar>
193 defaultSpmdMultiVector(
194  const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
195  const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
196  const ArrayRCP<Scalar> &localValues,
197  const Ordinal leadingDim = -1
198  )
199 {
200  return Teuchos::rcp(
202  spmdRangeSpace, domainSpace, localValues, leadingDim
203  )
204  );
205 }
206 
207 
208 } // end namespace Thyra
209 
210 
211 #endif // THYRA_Spmd_MULTI_VECTOR_STD_DECL_HPP
RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &colRng)
RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpaceImpl() const
Base node implementation class for SPMD multi-vectors.
RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
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 getLocalMultiVectorDataImpl(const Ptr< ArrayRCP< const Scalar > > &localValues, const Ptr< Ordinal > &leadingDim) const
void getNonconstLocalMultiVectorDataImpl(const Ptr< ArrayRCP< Scalar > > &localValues, const Ptr< Ordinal > &leadingDim)
RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
RCP< const ScalarProdVectorSpaceBase< Scalar > > domainScalarProdVecSpc() const
void uninitialize(RCP< const SpmdVectorSpaceBase< Scalar > > *spmdRangeSpace=NULL, RCP< const ScalarProdVectorSpaceBase< Scalar > > *domainSpace=NULL, ArrayRCP< Scalar > *localValues=NULL, Ordinal *leadingDim=NULL)
Set to an uninitialized state.
RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
Efficient concrete implementation subclass for SPMD multi-vectors.
DefaultSpmdMultiVector()
Construct to uninitialized.
void initialize(const RCP< const SpmdVectorSpaceBase< Scalar > > &spmdRangeSpace, const RCP< const ScalarProdVectorSpaceBase< Scalar > > &domainSpace)
Initialize only with vector spaces where storage is allocated internally..
Base abstract VectorSpaceBase class for all SPMD-based vector spaces.
RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &colRng) const