Thyra Version of the Day
Loading...
Searching...
No Matches
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
18namespace Thyra {
19
20
35template<class Scalar>
37 : public SpmdVectorSpaceDefaultBase<Scalar>
38{
39public:
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
140protected:
141
144
147 createMember() const;
150 createMembers(int numMembers) const;
163
165
166public:
167
170
174 Ordinal localSubDim() const;
175
177
178private:
179
180 // //////////////////////////////////////
181 // Private data members
182
184 Ordinal localSubDim_;
185 int numProc_;
186 int procRank_;
188
189 // /////////////////////////////////////
190 // Private member functions
191
193
194public:
195
196}; // end class DefaultSpmdVectorSpace
197
198
203template<class Scalar>
209
210
215template<class Scalar>
218{
221 vs->initialize(dim);
222 return vs;
223}
224
225
231template<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
251template<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
Concrete implementation of an SPMD vector space subclass which creates DefaultSpmdVector and DefaultS...
RCP< const Teuchos::Comm< Ordinal > > getComm() const
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()
Nonmember consturctor that creats an uninitialized vector space.
RCP< DefaultSpmdVectorSpace< Scalar > > defaultSpmdVectorSpace(const Ordinal dim)
Nonmember consturctor that creats a serial vector space.
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 > > createMembers(int numMembers) 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.
static RCP< DefaultSpmdVectorSpace< Scalar > > create()
Create with weak ownership to self.
RCP< const VectorSpaceBase< Scalar > > clone() const
RCP< MultiVectorBase< Scalar > > createMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const
void initialize(const Ordinal dim)
Initialize a serial space.
RCP< VectorBase< Scalar > > createMemberView(const RTOpPack::SubVectorView< Scalar > &raw_v) const
RCP< VectorBase< Scalar > > createMember() const
void uninitialize()
Set to an uninitialized state.
Base VectorSpaceBase class for all SPMD vector spaces with contiguous local-to-global indexing.
bool isLocallyReplicated() const
Returns true if vector space is locally replicated 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.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.