Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_DefaultSpmdVectorSpace_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_SPACE_DECL_HPP
11 #define THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
12 
13 
14 #include "Thyra_SpmdVectorSpaceDefaultBase_decl.hpp"
15 #include "Thyra_ProductVectorSpaceBase.hpp"
16 
17 
18 namespace Thyra {
19 
20 
35 template<class Scalar>
37  : public SpmdVectorSpaceDefaultBase<Scalar>
38 {
39 public:
40 
43 
46 
54  void initialize(const Ordinal dim);
55 
110  void initialize(
111  const RCP<const Teuchos::Comm<Ordinal> > &comm,
112  const Ordinal localSubDim, const Ordinal globalDim,
113  const bool isLocallyReplicated = false
114  );
115 
124  void uninitialize();
125 
127 
133  bool hasInCoreView(
134  const Range1D& rng, const EViewType viewType, const EStrideType strideType
135  ) const;
139 
140 protected:
141 
144 
147  createMember() const;
150  createMembers(int numMembers) const;
163 
165 
166 public:
167 
170 
174  Ordinal localSubDim() const;
175 
177 
178 private:
179 
180  // //////////////////////////////////////
181  // Private data members
182 
184  Ordinal localSubDim_;
185  int numProc_;
186  int procRank_;
187  RCP<DefaultSpmdVectorSpace<Scalar> > weakSelfPtr_;
188 
189  // /////////////////////////////////////
190  // Private member functions
191 
193 
194 public:
195 
196 }; // end class DefaultSpmdVectorSpace
197 
198 
203 template<class Scalar>
206 {
208 }
209 
210 
215 template<class Scalar>
218 {
221  vs->initialize(dim);
222  return vs;
223 }
224 
225 
231 template<class Scalar>
234  const RCP<const Teuchos::Comm<Ordinal> > &comm,
235  const Ordinal localSubDim, const Ordinal globalDim,
236  const bool isLocallyReplicated = false
237  )
238 {
241  vs->initialize(comm, localSubDim, globalDim, isLocallyReplicated);
242  return vs;
243 }
244 
245 
251 template<class Scalar>
254  const RCP<const Teuchos::Comm<Ordinal> > &comm,
255  const Ordinal globalDim
256  )
257 {
260  vs->initialize(comm, globalDim, globalDim, true);
261  return vs;
262 }
263 
264 
265 } // end namespace Thyra
266 
267 
268 #endif // THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
Base VectorSpaceBase class for all SPMD vector spaces with contiguous local-to-global indexing...
bool hasInCoreView(const Range1D &rng, const EViewType viewType, const EStrideType strideType) const
Returns true if all the elements in rng are in this process.
RCP< DefaultSpmdVectorSpace< Scalar > > defaultSpmdVectorSpace(const RCP< const Teuchos::Comm< Ordinal > > &comm, const Ordinal localSubDim, const Ordinal globalDim, const bool isLocallyReplicated=false)
Nonmember consturctor function that creates a distributed or locally-replicated parallel vector space...
RCP< MultiVectorBase< Scalar > > createMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const
RCP< const Teuchos::Comm< Ordinal > > getComm() const
EViewType
Determines if a view is a direct view of data or a detached copy of data.
RCP< const VectorSpaceBase< Scalar > > clone() const
RCP< DefaultSpmdVectorSpace< Scalar > > defaultSpmdVectorSpace(const Ordinal dim)
Nonmember consturctor that creats a serial vector space.
bool isLocallyReplicated() const
Returns true if vector space is locally replicated space.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
void uninitialize()
Set to an uninitialized state.
RCP< DefaultSpmdVectorSpace< Scalar > > defaultSpmdVectorSpace()
Nonmember consturctor that creats an uninitialized vector space.
RCP< VectorBase< Scalar > > createMember() const
Concrete implementation of an SPMD vector space subclass which creates DefaultSpmdVector and DefaultS...
void initialize(const Ordinal dim)
Initialize a serial space.
RCP< VectorBase< Scalar > > createMemberView(const RTOpPack::SubVectorView< Scalar > &raw_v) const
RCP< DefaultSpmdVectorSpace< Scalar > > locallyReplicatedDefaultSpmdVectorSpace(const RCP< const Teuchos::Comm< Ordinal > > &comm, const Ordinal globalDim)
Nonmember consturctor function that creates a locally-replicated parallel vector space.
Ordinal dim() const
Returns the sum of the local number of elements on every process.
EStrideType
Determine if data is unit stride or non-unit stride.
static RCP< DefaultSpmdVectorSpace< Scalar > > create()
Create with weak ownership to self.