Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultSpmdVectorSpace_decl.hpp
1// @HEADER
2// ***********************************************************************
3//
4// Thyra: Interfaces and Support for Abstract Numerical Algorithms
5// Copyright (2004) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// Redistribution and use in source and binary forms, with or without
11// modification, are permitted provided that the following conditions are
12// met:
13//
14// 1. Redistributions of source code must retain the above copyright
15// notice, this list of conditions and the following disclaimer.
16//
17// 2. Redistributions in binary form must reproduce the above copyright
18// notice, this list of conditions and the following disclaimer in the
19// documentation and/or other materials provided with the distribution.
20//
21// 3. Neither the name of the Corporation nor the names of the
22// contributors may be used to endorse or promote products derived from
23// this software without specific prior written permission.
24//
25// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36//
37// Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38//
39// ***********************************************************************
40// @HEADER
41
42
43#ifndef THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
44#define THYRA_DEFAULT_SPMD_VECTOR_SPACE_DECL_HPP
45
46
47#include "Thyra_SpmdVectorSpaceDefaultBase_decl.hpp"
48#include "Thyra_ProductVectorSpaceBase.hpp"
49
50
51namespace Thyra {
52
53
68template<class Scalar>
70 : public SpmdVectorSpaceDefaultBase<Scalar>
71{
72public:
73
76
79
87 void initialize(const Ordinal dim);
88
143 void initialize(
144 const RCP<const Teuchos::Comm<Ordinal> > &comm,
145 const Ordinal localSubDim, const Ordinal globalDim,
146 const bool isLocallyReplicated = false
147 );
148
157 void uninitialize();
158
160
166 bool hasInCoreView(
167 const Range1D& rng, const EViewType viewType, const EStrideType strideType
168 ) const;
172
173protected:
174
177
180 createMember() const;
183 createMembers(int numMembers) const;
196
198
199public:
200
203
207 Ordinal localSubDim() const;
208
210
211private:
212
213 // //////////////////////////////////////
214 // Private data members
215
217 Ordinal localSubDim_;
218 int numProc_;
219 int procRank_;
221
222 // /////////////////////////////////////
223 // Private member functions
224
226
227public:
228
229}; // end class DefaultSpmdVectorSpace
230
231
236template<class Scalar>
239{
241}
242
243
248template<class Scalar>
251{
254 vs->initialize(dim);
255 return vs;
256}
257
258
264template<class Scalar>
267 const RCP<const Teuchos::Comm<Ordinal> > &comm,
268 const Ordinal localSubDim, const Ordinal globalDim,
269 const bool isLocallyReplicated = false
270 )
271{
274 vs->initialize(comm, localSubDim, globalDim, isLocallyReplicated);
275 return vs;
276}
277
278
284template<class Scalar>
287 const RCP<const Teuchos::Comm<Ordinal> > &comm,
288 const Ordinal globalDim
289 )
290{
293 vs->initialize(comm, globalDim, globalDim, true);
294 return vs;
295}
296
297
298} // end namespace Thyra
299
300
301#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. `*.