Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultSpmdVector_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_SPMD_VECTOR_DECL_HPP
11 #define THYRA_DEFAULT_SPMD_VECTOR_DECL_HPP
12 
13 
14 #include "Thyra_SpmdVectorDefaultBase_decl.hpp"
15 
16 
17 namespace Thyra {
18 
19 
36 template<class Scalar>
37 class DefaultSpmdVector : virtual public SpmdVectorDefaultBase<Scalar> {
38 public:
39 
42 
43 
46 
50  ,const ArrayRCP<Scalar> &localValues
51  ,const Ordinal stride
52  );
53 
79  void initialize(
81  ,const ArrayRCP<Scalar> &localValues
82  ,const Ordinal stride
83  );
84 
90  void uninitialize(
92  ,ArrayRCP<Scalar> *localValues = NULL
93  ,Ordinal *stride = NULL
94  );
95 
97 
100 
106  Scalar* getPtr();
108  const Scalar* getPtr() const;
110  Ordinal getStride() const;
111 
113 
116 
119 
121 
125  void getNonconstLocalVectorDataImpl(const Ptr<ArrayRCP<Scalar> > &localValues);
127  void getLocalVectorDataImpl(const Ptr<ArrayRCP<const Scalar> > &localValues) const;
128 
130 
131 private:
132 
133  // ///////////////////////////////////////
134  // Private data members
135 
137  ArrayRCP<Scalar> localValues_;
138  Ordinal stride_;
139 
140 };
141 
142 
143 // /////////////////////////////////////////////////////
144 // Inline members
145 
146 
147 template<class Scalar>
148 inline
151 {
152  return localValues_;
153 }
154 
155 
156 template<class Scalar>
157 inline
160 {
161  return localValues_;
162 }
163 
164 
165 template<class Scalar>
166 inline
168 {
169  return localValues_.get();
170 }
171 
172 
173 template<class Scalar>
174 inline
176 {
177  return localValues_.get();
178 }
179 
180 
181 template<class Scalar>
182 inline
184 {
185  return stride_;
186 }
187 
188 
189 } // end namespace Thyra
190 
191 
192 #endif // THYRA_DEFAULT_SPMD_VECTOR_DECL_HPP
RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpaceImpl() const
void uninitialize(RCP< const SpmdVectorSpaceBase< Scalar > > *spmdSpace=NULL, ArrayRCP< Scalar > *localValues=NULL, Ordinal *stride=NULL)
Set to an uninitialized state.
Base class for SPMD vectors that can provide views of contiguous elements in a process.
void initialize(const RCP< const SpmdVectorSpaceBase< Scalar > > &spmdSpace, const ArrayRCP< Scalar > &localValues, const Ordinal stride)
Initialize.
void getNonconstLocalVectorDataImpl(const Ptr< ArrayRCP< Scalar > > &localValues)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
void getLocalVectorDataImpl(const Ptr< ArrayRCP< const Scalar > > &localValues) const
Efficient concrete implementation subclass for SPMD vectors.
DefaultSpmdVector()
Construct to uninitialized.
RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpace() const
Returns the SPMD vector space object for the range of *this multi-vector.
Base abstract VectorSpaceBase class for all SPMD-based vector spaces.