MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_IndexManager_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef MUELU_INDEXMANAGER_DECL_HPP
11#define MUELU_INDEXMANAGER_DECL_HPP
12
13// use for Teuchos:Comm<T>
14#include "Teuchos_CommHelpers.hpp"
15#include "Teuchos_OrdinalTraits.hpp"
16
17#include <Xpetra_Map_fwd.hpp>
18
19#include "MueLu_ConfigDefs.hpp"
20#include "MueLu_BaseClass.hpp"
22
23/*****************************************************************************
24
25****************************************************************************/
26
27namespace MueLu {
28
42template <class LocalOrdinal, class GlobalOrdinal, class Node>
43class IndexManager : public BaseClass {
44#undef MUELU_INDEXMANAGER_SHORT
46
47 private:
48 protected:
49 const RCP<const Teuchos::Comm<int> > comm_;
50 const bool coupled_;
51 const bool singleCoarsePoint_;
52 const int numDimensions;
54
55 Array<int> coarseRate;
56 Array<int> endRate;
57
60 const Array<GO> gFineNodesPerDir;
61
64 const Array<LO> lFineNodesPerDir;
65
69
73
78
80 Array<LO> offsets;
82 Array<GO> startIndices;
84
85 bool meshEdge[6] = {false};
86 bool ghostInterface[6] = {false};
87 bool ghostedDir[6] = {false};
88
89 public:
90 IndexManager() = default;
91
92 IndexManager(const RCP<const Teuchos::Comm<int> > comm, const bool coupled,
93 const bool singleCoarsePoint, const int NumDimensions,
94 const int interpolationOrder, const Array<GO> GFineNodesPerDir,
95 const Array<LO> LFineNodesPerDir);
96
97 virtual ~IndexManager() {}
98
102
104
105 virtual void getGhostedNodesData(const RCP<const Map> fineMap,
106 Array<LO>& ghostedNodeCoarseLIDs,
107 Array<int>& ghostedNodeCoarsePIDs,
108 Array<GO>& ghostedNodeCoarseGIDs) const = 0;
109
110 virtual void getCoarseNodesData(const RCP<const Map> fineCoordinatesMap,
111 Array<GO>& coarseNodeCoarseGIDs,
112 Array<GO>& coarseNodeFineGIDs) const = 0;
113
114 bool isAggregationCoupled() const { return coupled_; }
115
117
118 int getNumDimensions() const { return numDimensions; }
119
121
123
125
126 LO getNumLocalFineNodes() const { return lNumFineNodes; }
127
129
131
132 Array<int> getCoarseningRates() const { return coarseRate; }
133
134 int getCoarseningRate(const int dim) const { return coarseRate[dim]; }
135
136 Array<int> getCoarseningEndRates() const { return endRate; }
137
138 int getCoarseningEndRate(const int dim) const { return endRate[dim]; }
139
140 bool getMeshEdge(const int dir) const { return meshEdge[dir]; }
141
142 bool getGhostInterface(const int dir) const { return ghostInterface[dir]; }
143
144 Array<LO> getOffsets() const { return offsets; }
145
146 LO getOffset(int const dim) const { return offsets[dim]; }
147
148 Array<LO> getCoarseNodeOffsets() const { return coarseNodeOffsets; }
149
150 LO getCoarseNodeOffset(int const dim) const { return coarseNodeOffsets[dim]; }
151
152 Array<GO> getStartIndices() const { return startIndices; }
153
154 GO getStartIndex(int const dim) const { return startIndices[dim]; }
155
157
158 GO getStartGhostedCoarseNode(int const dim) const { return startGhostedCoarseNode[dim]; }
159
160 Array<LO> getLocalFineNodesPerDir() const { return lFineNodesPerDir; }
161
162 LO getLocalFineNodesInDir(const int dim) const { return lFineNodesPerDir[dim]; }
163
164 Array<GO> getGlobalFineNodesPerDir() const { return gFineNodesPerDir; }
165
166 GO getGlobalFineNodesInDir(const int dim) const { return gFineNodesPerDir[dim]; }
167
168 Array<LO> getLocalCoarseNodesPerDir() const { return lCoarseNodesPerDir; }
169
170 LO getLocalCoarseNodesInDir(const int dim) const { return lCoarseNodesPerDir[dim]; }
171
172 Array<GO> getGlobalCoarseNodesPerDir() const { return gCoarseNodesPerDir; }
173
174 GO getGlobalCoarseNodesInDir(const int dim) const { return gCoarseNodesPerDir[dim]; }
175
176 Array<LO> getGhostedNodesPerDir() const { return ghostedNodesPerDir; }
177
178 LO getGhostedNodesInDir(const int dim) const { return ghostedNodesPerDir[dim]; }
179
180 virtual std::vector<std::vector<GO> > getCoarseMeshData() const = 0;
181
182 virtual void getFineNodeGlobalTuple(const GO myGID, GO& i, GO& j, GO& k) const = 0;
183
184 virtual void getFineNodeLocalTuple(const LO myLID, LO& i, LO& j, LO& k) const = 0;
185
186 virtual void getFineNodeGhostedTuple(const LO myLID, LO& i, LO& j, LO& k) const = 0;
187
188 virtual void getFineNodeGID(const GO i, const GO j, const GO k, GO& myGID) const = 0;
189
190 virtual void getFineNodeLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
191
192 virtual void getCoarseNodeGlobalTuple(const GO myGID, GO& i, GO& j, GO& k) const = 0;
193
194 virtual void getCoarseNodeLocalTuple(const LO myLID, LO& i, LO& j, LO& k) const = 0;
195
196 virtual void getCoarseNodeGID(const GO i, const GO j, const GO k, GO& myGID) const = 0;
197
198 virtual void getCoarseNodeLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
199
200 virtual void getCoarseNodeGhostedLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
201
202 virtual void getCoarseNodeFineLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
203
204 virtual void getGhostedNodeFineLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
205
206 virtual void getGhostedNodeCoarseLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
207};
208
209} // namespace MueLu
210
211#define MUELU_INDEXMANAGER_SHORT
212#endif // MUELU_INDEXMANAGER_DECL_HPP
Base class for MueLu classes.
Container class for mesh layout and indices calculation.
Array< LO > offsets
distance between lowest (resp. highest) index to the lowest (resp. highest) ghostedNodeIndex in that ...
virtual void getFineNodeGlobalTuple(const GO myGID, GO &i, GO &j, GO &k) const =0
GO gNumCoarseNodes
global number of nodes remaining after coarsening.
virtual void getCoarseNodeLID(const LO i, const LO j, const LO k, LO &myLID) const =0
Array< int > getCoarseningEndRates() const
virtual void getCoarseNodesData(const RCP< const Map > fineCoordinatesMap, Array< GO > &coarseNodeCoarseGIDs, Array< GO > &coarseNodeFineGIDs) const =0
Array< LO > coarseNodeOffsets
distance between lowest (resp. highest) index to the lowest (resp. highest) coarseNodeIndex in that d...
virtual void getGhostedNodesData(const RCP< const Map > fineMap, Array< LO > &ghostedNodeCoarseLIDs, Array< int > &ghostedNodeCoarsePIDs, Array< GO > &ghostedNodeCoarseGIDs) const =0
virtual void getCoarseNodeGlobalTuple(const GO myGID, GO &i, GO &j, GO &k) const =0
GO getStartGhostedCoarseNode(int const dim) const
virtual void getFineNodeLocalTuple(const LO myLID, LO &i, LO &j, LO &k) const =0
Array< GO > getGlobalFineNodesPerDir() const
const int interpolationOrder_
Interpolation order used by grid transfer operators using these aggregates.
Array< GO > getGlobalCoarseNodesPerDir() const
const bool coupled_
Flag for coupled vs uncoupled aggregation mode, if true aggregation is coupled.
GO gNumFineNodes
global number of nodes.
GO minGlobalIndex
lowest GID of any node in the local process
virtual void computeGlobalCoarseParameters()=0
virtual void getGhostedNodeCoarseLID(const LO i, const LO j, const LO k, LO &myLID) const =0
GO getGlobalCoarseNodesInDir(const int dim) const
Array< LO > ghostedNodesPerDir
local number of ghosted nodes (i.e. ghost + coarse nodes) per direction
Array< GO > startGhostedCoarseNode
lowest coarse global tuple (i,j,k) of a node remaing on the local process after coarsening.
const Array< LO > lFineNodesPerDir
local number of nodes per direction.
virtual void getFineNodeGhostedTuple(const LO myLID, LO &i, LO &j, LO &k) const =0
virtual void getCoarseNodeFineLID(const LO i, const LO j, const LO k, LO &myLID) const =0
virtual void getCoarseNodeGhostedLID(const LO i, const LO j, const LO k, LO &myLID) const =0
Array< LO > getCoarseNodeOffsets() const
virtual std::vector< std::vector< GO > > getCoarseMeshData() const =0
LO numGhostedNodes10
local number of ghosted nodes (i.e. ghost + coarse nodes) per 0-1 slice.
Array< GO > gCoarseNodesPerDir
global number of nodes per direction remaining after coarsening.
int getCoarseningRate(const int dim) const
Array< LO > getGhostedNodesPerDir() const
Array< GO > startIndices
lowest global tuple (i,j,k) of a node on the local process
LO lNumCoarseNodes
local number of nodes remaining after coarsening.
GO gNumFineNodes10
global number of nodes per 0-1 slice.
Array< int > coarseRate
coarsening rate in each direction
virtual void getCoarseNodeGID(const GO i, const GO j, const GO k, GO &myGID) const =0
Array< GO > getStartGhostedCoarseNodes() const
LO getLocalCoarseNodesInDir(const int dim) const
bool getGhostInterface(const int dir) const
Array< LO > getLocalFineNodesPerDir() const
GO getStartIndex(int const dim) const
bool ghostedDir[6]
flags indicating if ghost points are needed at ilo, ihi, jlo, jhi, klo and khi boundaries.
IndexManager()=default
LO numGhostNodes
local number of ghost nodes
bool meshEdge[6]
flags indicating if we run into the edge of the mesh in ilo, ihi, jlo, jhi, klo or khi.
virtual void getFineNodeGID(const GO i, const GO j, const GO k, GO &myGID) const =0
virtual void getCoarseNodeLocalTuple(const LO myLID, LO &i, LO &j, LO &k) const =0
bool getMeshEdge(const int dir) const
bool ghostInterface[6]
flags indicating if ghost points are needed at ilo, ihi, jlo, jhi, klo and khi boundaries.
Array< GO > getStartIndices() const
int getCoarseningEndRate(const int dim) const
const bool singleCoarsePoint_
Flag telling us if can reduce dimensions to a single layer.
const int numDimensions
Number of spacial dimensions in the problem.
LO lNumCoarseNodes10
local number of nodes per 0-1 slice remaining after coarsening.
virtual void getGhostedNodeFineLID(const LO i, const LO j, const LO k, LO &myLID) const =0
LO lNumFineNodes10
local number of nodes per 0-1 slice.
GO getGlobalFineNodesInDir(const int dim) const
LO getCoarseNodeOffset(int const dim) const
LO getOffset(int const dim) const
LO lNumFineNodes
local number of nodes.
virtual void getFineNodeLID(const LO i, const LO j, const LO k, LO &myLID) const =0
const RCP< const Teuchos::Comm< int > > comm_
Communicator used by uncoupled aggregation.
Array< LO > getLocalCoarseNodesPerDir() const
GO gNumCoarseNodes10
global number of nodes per 0-1 slice remaining after coarsening.
Array< int > endRate
adapted coarsening rate at the edge of the mesh in each direction.
LO numGhostedNodes
local number of ghosted nodes (i.e. ghost + coarse nodes).
const Array< GO > gFineNodesPerDir
global number of nodes per direction.
Array< int > getCoarseningRates() const
Array< LO > lCoarseNodesPerDir
local number of nodes per direction remaing after coarsening.
LO getLocalFineNodesInDir(const int dim) const
LO getGhostedNodesInDir(const int dim) const
Namespace for MueLu classes and methods.