MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_IndexManager_decl.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// MueLu: A package for multigrid based preconditioning
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Ray Tuminaro (rstumin@sandia.gov)
41// Luc Berger-Vergiat (lberge@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef MUELU_INDEXMANAGER_DECL_HPP
47#define MUELU_INDEXMANAGER_DECL_HPP
48
49// use for Teuchos:Comm<T>
50#include "Teuchos_CommHelpers.hpp"
51#include "Teuchos_OrdinalTraits.hpp"
52
53#include <Xpetra_Map_fwd.hpp>
54
55#include "MueLu_ConfigDefs.hpp"
56#include "MueLu_BaseClass.hpp"
58
59/*****************************************************************************
60
61****************************************************************************/
62
63namespace MueLu {
64
77
78 template <class LocalOrdinal, class GlobalOrdinal, class Node>
79 class IndexManager : public BaseClass {
80#undef MUELU_INDEXMANAGER_SHORT
82
83 private:
84
85 protected:
86
87 const RCP<const Teuchos::Comm<int> > comm_;
88 const bool coupled_;
89 const bool singleCoarsePoint_;
90 const int numDimensions;
92
93 Array<int> coarseRate;
94 Array<int> endRate;
95
98 const Array<GO> gFineNodesPerDir;
99
102 const Array<LO> lFineNodesPerDir;
103
107
111
116
118 Array<LO> offsets;
120 Array<GO> startIndices;
122
123 bool meshEdge[6] = {false};
124 bool ghostInterface[6] = {false};
125 bool ghostedDir[6] = {false};
126
127 public:
128
129 IndexManager() = default;
130
131 IndexManager(const RCP<const Teuchos::Comm<int> > comm, const bool coupled,
132 const bool singleCoarsePoint, const int NumDimensions,
133 const int interpolationOrder, const Array<GO> GFineNodesPerDir,
134 const Array<LO> LFineNodesPerDir);
135
136 virtual ~IndexManager() {}
137
141
143
144 virtual void getGhostedNodesData(const RCP<const Map> fineMap,
145 Array<LO>& ghostedNodeCoarseLIDs,
146 Array<int>& ghostedNodeCoarsePIDs,
147 Array<GO>& ghostedNodeCoarseGIDs) const = 0;
148
149 virtual void getCoarseNodesData(const RCP<const Map> fineCoordinatesMap,
150 Array<GO>& coarseNodeCoarseGIDs,
151 Array<GO>& coarseNodeFineGIDs) const = 0;
152
153 bool isAggregationCoupled() const {return coupled_;}
154
156
157 int getNumDimensions() const {return numDimensions;}
158
160
162
164
166
168
170
171 Array<int> getCoarseningRates() const {return coarseRate;}
172
173 int getCoarseningRate(const int dim) const {return coarseRate[dim];}
174
175 Array<int> getCoarseningEndRates() const {return endRate;}
176
177 int getCoarseningEndRate(const int dim) const {return endRate[dim];}
178
179 bool getMeshEdge(const int dir) const {return meshEdge[dir];}
180
181 bool getGhostInterface(const int dir) const {return ghostInterface[dir];}
182
183 Array<LO> getOffsets() const {return offsets;}
184
185 LO getOffset(int const dim) const {return offsets[dim];}
186
187 Array<LO> getCoarseNodeOffsets() const {return coarseNodeOffsets;}
188
189 LO getCoarseNodeOffset(int const dim) const {return coarseNodeOffsets[dim];}
190
191 Array<GO> getStartIndices() const {return startIndices;}
192
193 GO getStartIndex(int const dim) const {return startIndices[dim];}
194
196
197 GO getStartGhostedCoarseNode(int const dim) const {return startGhostedCoarseNode[dim];}
198
199 Array<LO> getLocalFineNodesPerDir() const {return lFineNodesPerDir;}
200
201 LO getLocalFineNodesInDir(const int dim) const {return lFineNodesPerDir[dim];}
202
203 Array<GO> getGlobalFineNodesPerDir() const {return gFineNodesPerDir;}
204
205 GO getGlobalFineNodesInDir(const int dim) const {return gFineNodesPerDir[dim];}
206
208
209 LO getLocalCoarseNodesInDir(const int dim) const {return lCoarseNodesPerDir[dim];}
210
212
213 GO getGlobalCoarseNodesInDir(const int dim) const {return gCoarseNodesPerDir[dim];}
214
215 Array<LO> getGhostedNodesPerDir() const {return ghostedNodesPerDir;}
216
217 LO getGhostedNodesInDir(const int dim) const {return ghostedNodesPerDir[dim];}
218
219 virtual std::vector<std::vector<GO> > getCoarseMeshData() const = 0;
220
221 virtual void getFineNodeGlobalTuple(const GO myGID, GO& i, GO& j, GO& k) const = 0;
222
223 virtual void getFineNodeLocalTuple(const LO myLID, LO& i, LO& j, LO& k) const = 0;
224
225 virtual void getFineNodeGhostedTuple(const LO myLID, LO& i, LO& j, LO& k) const = 0;
226
227 virtual void getFineNodeGID(const GO i, const GO j, const GO k, GO& myGID) const = 0;
228
229 virtual void getFineNodeLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
230
231 virtual void getCoarseNodeGlobalTuple(const GO myGID, GO& i, GO& j, GO& k) const = 0;
232
233 virtual void getCoarseNodeLocalTuple(const LO myLID, LO& i, LO& j, LO& k) const = 0;
234
235 virtual void getCoarseNodeGID(const GO i, const GO j, const GO k, GO& myGID) const = 0;
236
237 virtual void getCoarseNodeLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
238
239 virtual void getCoarseNodeGhostedLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
240
241 virtual void getCoarseNodeFineLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
242
243 virtual void getGhostedNodeFineLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
244
245 virtual void getGhostedNodeCoarseLID(const LO i, const LO j, const LO k, LO& myLID) const = 0;
246
247 };
248
249} //namespace MueLu
250
251#define MUELU_INDEXMANAGER_SHORT
252#endif // MUELU_INDEXMANAGER_DECL_HPP
Base class for MueLu classes.
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.