Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_TpetraVectorSpace_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_TPETRA_VECTOR_SPACE_DECL_HPP
11 #define THYRA_TPETRA_VECTOR_SPACE_DECL_HPP
12 
13 
14 #include "Thyra_SpmdVectorSpaceDefaultBase.hpp"
15 #include "Tpetra_Map.hpp"
16 #include "Tpetra_MultiVector.hpp"
17 
18 
19 namespace Thyra {
20 
21 
26 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
28 {
29 public:
30 
33 
36 
39 
41  void initialize(
42  const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
43  );
44 
46 
48 
49 
55  createLocallyReplicatedVectorSpace(int size) const;
56 
58 
64  bool hasInCoreView(
65  const Range1D& rng, const EViewType viewType, const EStrideType strideType
66  ) const;
69 
72  getTpetraMap() const;
73 
75 
76 protected:
77 
80 
83  createMember() const;
86  createMembers(int numMembers) const;
87 
88 public:
89 
92 
95 
97 
98 public:
99 
102 
106  Ordinal localSubDim() const;
107 
109 
110 private:
111 
112  // //////////////////////////////////////
113  // Private data members
114 
118  // The only reason Thyra needs this comm_ object is because Thyra
119  // uses Ordinal as the Comm template parameter, while Tpetra uses
120  // int. Ordinal is some 64-bit type, which doesn't make any sense,
121  // given that MPI implementations currently only allow 32-bit
122  // process ranks. This is why Thyra does not just use the Map's
123  // stored communicator.
125  RCP<this_t> weakSelfPtr_;
126 
127  // /////////////////////////////////////
128  // Private member functions
129 
131 
132 }; // end class TpetraVectorSpace
133 
134 
139 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
142  const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
143  )
144 {
147  vs->initialize(tpetraMap);
148  return vs;
149 }
150 
151 
152 } // end namespace Thyra
153 
154 
155 #endif // THYRA_TPETRA_VECTOR_SPACE_DECL_HPP
Concrete implementation of an SPMD vector space for Tpetra.
Base VectorSpaceBase class for all SPMD vector spaces with contiguous local-to-global indexing...
RCP< const VectorSpaceBase< Scalar > > clone() const
RCP< TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > tpetraVectorSpace(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &tpetraMap)
Nonmember constructor that creats a serial vector space.
RCP< TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > createLocallyReplicatedVectorSpace(int size) const
Create Tpetra locally replicated vector space.
static RCP< TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > create()
Create with weak ownership to self.
void initialize(const RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > &tpetraMap)
Initialize a serial space.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getTpetraMap() const
Get the embedded Tpetra::Map.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > this_t
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< VectorBase< Scalar > > createMember() const
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
EStrideType
Determine if data is unit stride or non-unit stride.
RCP< const Teuchos::Comm< Ordinal > > getComm() const
RCP< MultiVectorBase< Scalar > > createCachedMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, bool initialize=true) const
Create a (possibly) cached multi-vector member that is a non-const view of raw multi-vector data...