Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_MapExtractor_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef XPETRA_MAPEXTRACTOR_DECL_HPP_
11#define XPETRA_MAPEXTRACTOR_DECL_HPP_
12
13#include <map>
14
15#include <iostream>
16
17#include <Teuchos_RCP.hpp>
18#include <Teuchos_Describable.hpp>
19
20#include <Xpetra_Import.hpp>
22#include <Xpetra_Map_decl.hpp>
24#include <Xpetra_MapUtils.hpp>
26#include <Xpetra_Vector.hpp>
29
30namespace Xpetra {
31
32#ifndef DOXYGEN_SHOULD_SKIP_THIS
33// forward declaration of BlockedMultiVector, needed to prevent circular inclusions
34template <class S, class LO, class GO, class N>
35class BlockedMultiVector;
36
37// forward declaration of BlockedMap, needed because some functions take them as parameters
38// (This should go away when BlockedMap is converted to ETI)
39template <class LO, class GO, class N>
40class BlockedMap;
41#endif
42
43template <class Scalar,
44 class LocalOrdinal,
45 class GlobalOrdinal,
46 class Node>
48 public:
49 typedef Scalar scalar_type;
50 typedef LocalOrdinal local_ordinal_type;
51 typedef GlobalOrdinal global_ordinal_type;
52 typedef Node node_type;
53
54 private:
55#undef XPETRA_MAPEXTRACTOR_SHORT
57
58 public:
59 //! MapExtractor basic constructor
60 //!
61 //! @param[in] fullmap Full map containing all GIDs throughout the full vector. This parameter is only important if bThyraMode == false (see below)
62 //! @param[in] maps Vector containing submaps. The set of all GIDs stored in the submaps should be the same than stored in fullmap, if bThyraMode == false. In Thyra mode, the submaps should contain consecutive GIDs starting with 0 in each submap.
63 //! @param[in] bThyraMode Flag which allows to switch between generating a MapExtractor in Thyra mode or Xpetra mode
64 //!
65 //! In Thyra mode, fullmap is not important as a fullmap with unique blocked GIDs is automatically generated which map the GIDs of the submaps
66 //! to uniquely defined GIDs in the fullmap. The user has to provide a fullmap in Thyra mode to specify the underlying linear algebra library
67 //! (Epetra or Tpetra) and some other map information (e.g. indexBase). This could be fixed.
68 //!
69 //! In Xpetra mode, the fullmap has to be the same as the union of the GIDs stored in the submaps in maps. The intersection of the GIDs of the sub-
70 //! maps in maps must be empty.
71 MapExtractor(const RCP<const Map>& fullmap, const std::vector<RCP<const Map>>& maps, bool bThyraMode = false);
72
74 MapExtractor(const std::vector<RCP<const Map>>& maps, const std::vector<RCP<const Map>>& thyramaps);
75
82 MapExtractor(const Teuchos::RCP<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>>& blockedMap);
83
85 MapExtractor(const MapExtractor& input);
86
88 virtual ~MapExtractor();
89
92 void ExtractVector(const Vector& full, size_t block, Vector& partial) const;
93 void ExtractVector(const MultiVector& full, size_t block, MultiVector& partial) const;
94 void ExtractVector(RCP<const Vector>& full, size_t block, RCP<Vector>& partial) const;
95 void ExtractVector(RCP<Vector>& full, size_t block, RCP<Vector>& partial) const;
96 void ExtractVector(RCP<const MultiVector>& full, size_t block, RCP<MultiVector>& partial) const;
97 void ExtractVector(RCP<MultiVector>& full, size_t block, RCP<MultiVector>& partial) const;
98
99 RCP<Vector> ExtractVector(RCP<const Vector>& full, size_t block, bool bThyraMode = false) const;
100 RCP<Vector> ExtractVector(RCP<Vector>& full, size_t block, bool bThyraMode = false) const;
101 RCP<MultiVector> ExtractVector(RCP<const MultiVector>& full, size_t block, bool bThyraMode = false) const;
102 RCP<MultiVector> ExtractVector(RCP<MultiVector>& full, size_t block, bool bThyraMode = false) const;
103
104 RCP<MultiVector> ExtractVector(RCP<const Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& full, size_t block, bool bThyraMode = false) const;
105 RCP<MultiVector> ExtractVector(RCP<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& full, size_t block, bool bThyraMode = false) const;
106
108
111 void InsertVector(const Vector& partial, size_t block, Vector& full, bool bThyraMode = false) const;
112 void InsertVector(const MultiVector& partial, size_t block, MultiVector& full, bool bThyraMode = false) const;
113 void InsertVector(RCP<const Vector> partial, size_t block, RCP<Vector> full, bool bThyraMode = false) const;
114 void InsertVector(RCP<Vector> partial, size_t block, RCP<Vector> full, bool bThyraMode = false) const;
115 void InsertVector(RCP<const MultiVector> partial, size_t block, RCP<MultiVector> full, bool bThyraMode = false) const;
116 void InsertVector(RCP<MultiVector> partial, size_t block, RCP<MultiVector> full, bool bThyraMode = false) const;
117 void InsertVector(RCP<const MultiVector> partial, size_t block, RCP<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> full, bool bThyraMode = false) const;
118 void InsertVector(RCP<MultiVector> partial, size_t block, RCP<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> full, bool bThyraMode = false) const;
119
121
122 RCP<Vector> getVector(size_t i, bool bThyraMode = false, bool bZero = true) const;
123 RCP<MultiVector> getVector(size_t i, size_t numvec, bool bThyraMode = false, bool bZero = true) const;
124
126 bool getThyraMode() const;
127
130
132 size_t NumMaps() const;
133
138 const RCP<const Map> getMap(size_t i, bool bThyraMode = false) const;
141 const RCP<const Map> getMap() const;
146
147 const RCP<const Map> getFullMap() const;
150 size_t getMapIndexForGID(GlobalOrdinal gid) const;
151
152
153
158
159} // namespace Xpetra
160
161#define XPETRA_MAPEXTRACTOR_SHORT
162#endif /* XPETRA_MAPEXTRACTOR_HPP_ */
MapExtractor(const RCP< const Map > &fullmap, const std::vector< RCP< const Map > > &maps, bool bThyraMode=false)
Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > map_
blocked map containing the sub block maps (either thyra or xpetra mode)