46 #ifndef MUELU_GLOBALLEXICOGRAPHICINDEXMANAGER_DEF_HPP_ 47 #define MUELU_GLOBALLEXICOGRAPHICINDEXMANAGER_DEF_HPP_ 50 #include <Xpetra_MapFactory.hpp> 54 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
57 const int NumDimensions,
const int interpolationOrder,
58 const Array<GO> GFineNodesPerDir,
59 const Array<LO> LFineNodesPerDir,
const Array<LO> CoarseRate,
60 const GO MinGlobalIndex) :
61 IndexManager(comm, coupled, NumDimensions, interpolationOrder, GFineNodesPerDir, LFineNodesPerDir) {
64 for(
int dim = 0; dim < 3; ++dim) {
66 if(CoarseRate.size() == 1) {
83 for(
int dim = 0; dim < 3; ++dim) {
93 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
103 Array<LO>& ghostedNodeCoarseLIDs, Array<int>& ghostedNodeCoarsePIDs, Array<GO>&ghostedNodeCoarseGIDs)
const {
114 Array<LO> ghostedCoarseNodeCoarseIndices(3), ghostedCoarseNodeFineIndices(3), ijk(3);
115 LO currentIndex = -1, currentCoarseIndex = -1;
117 for(ijk[1] = 0; ijk[1] < this->ghostedNodesPerDir[1]; ++ijk[1]) {
118 for(ijk[0] = 0; ijk[0] < this->ghostedNodesPerDir[0]; ++ijk[0]) {
119 currentIndex = ijk[2]*this->
numGhostedNodes10 + ijk[1]*this->ghostedNodesPerDir[0] + ijk[0];
123 GO myCoarseGID = ghostedCoarseNodeCoarseIndices[0]
126 ghostedNodeCoarseGIDs[currentIndex] = myCoarseGID;
127 GO myGID = 0, factor[3] = {};
131 for(
int dim = 0; dim < 3; ++dim) {
136 + ijk[dim]*this->
coarseRate[dim])*factor[dim];
150 (!this->
ghostInterface[1] || ijk[0] != this->ghostedNodesPerDir[0] - 1) &&
151 (!this->
ghostInterface[3] || ijk[1] != this->ghostedNodesPerDir[1] - 1) &&
152 (!this->
ghostInterface[5] || ijk[2] != this->ghostedNodesPerDir[2] - 1)) {
156 currentCoarseIndex = 0;
168 currentCoarseIndex += ijk[0] - 1;
170 currentCoarseIndex += ijk[0];
176 lCoarseNodeCoarseGIDs[currentCoarseIndex] = myCoarseGID;
177 lCoarseNodeFineGIDs[currentCoarseIndex] = myGID;
179 ghostedCoarseNodeFineGIDs[currentIndex] = myGID;
184 RCP<const Map> coarseMap = Xpetra::MapFactory<LO,GO,NO>::Build (fineMap->lib(),
186 lCoarseNodeCoarseGIDs(),
187 fineMap->getIndexBase(),
190 coarseMap->getRemoteIndexList(ghostedNodeCoarseGIDs(),
191 ghostedNodeCoarsePIDs(),
192 ghostedNodeCoarseLIDs());
196 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
199 Array<GO>& coarseNodeCoarseGIDs,
200 Array<GO>& coarseNodeFineGIDs)
const {
207 ArrayView<const GO> fineNodeGIDs = fineCoordinatesMap->getNodeElementList();
209 Array<GO> coarseStartIndices(3);
211 for(
int dim = 0; dim < 3; ++dim) {
214 if(tmp > 0) {++coarseStartIndices[dim];}
219 Array<LO> lCoarseIndices(3);
220 Array<GO> gCoarseIndices(3);
227 coarseNodeFineGIDs[coarseLID] = fineNodeGIDs[fineLID];
230 for(
int dim=0; dim<3; dim++) {
231 gCoarseIndices[dim] = coarseStartIndices[dim] + lCoarseIndices[dim];
236 coarseNodeCoarseGIDs[coarseLID] );
242 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
245 std::vector<std::vector<GO> > coarseMeshData;
246 return coarseMeshData;
249 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
259 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
269 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
283 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
289 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
295 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
305 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
315 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
321 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
327 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
333 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
339 const LO indices[3] = {i, j, k};
342 for(
int dim = 0; dim < 3; ++dim) {
354 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
357 LO itmp = i - (this->
offsets[0] > 0 ? 1 : 0);
358 LO jtmp = j - (this->
offsets[1] > 0 ? 1 : 0);
359 LO ktmp = k - (this->
offsets[2] > 0 ? 1 : 0);
380 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
383 LO itmp = i - (this->
offsets[0] > 0 ? 1 : 0);
384 LO jtmp = j - (this->
offsets[1] > 0 ? 1 : 0);
385 LO ktmp = k - (this->
offsets[2] > 0 ? 1 : 0);
void getFineNodeGhostedTuple(const LO myLID, LO &i, LO &j, LO &k) const
LO numGhostedNodes
local number of ghosted nodes (i.e. ghost + coarse nodes).
Array< GO > gCoarseNodesPerDir
global number of nodes per direction remaining after coarsening.
void getCoarseNodeLID(const LO i, const LO j, const LO k, LO &myLID) const
Array< GO > startIndices
lowest global tuple (i,j,k) of a node on the local process
GO gNumFineNodes10
global number of nodes per 0-1 slice.
void getCoarseNodeGID(const GO i, const GO j, const GO k, GO &myGID) const
Array< GO > startGhostedCoarseNode
lowest coarse global tuple (i,j,k) of a node remaing on the local process after coarsening.
LO getNumLocalGhostedNodes() const
LO getNumLocalCoarseNodes() const
void computeGlobalCoarseParameters()
Namespace for MueLu classes and methods.
Array< LO > offsets
distance between lowest (resp. highest) index to the lowest (resp. highest) ghostedNodeIndex in that ...
const Array< GO > gFineNodesPerDir
global number of nodes per direction.
void getCoarseNodeFineLID(const LO i, const LO j, const LO k, LO &myLID) const
const Array< LO > lFineNodesPerDir
local number of nodes per direction.
Array< LO > ghostedNodesPerDir
local number of ghosted nodes (i.e. ghost + coarse nodes) per direction
LO lNumCoarseNodes
local number of nodes remaining after coarsening.
void getGhostedNodeCoarseLID(const LO i, const LO j, const LO k, LO &myLID) const
LO numGhostedNodes10
local number of ghosted nodes (i.e. ghost + coarse nodes) per 0-1 slice.
Array< int > coarseRate
coarsening rate in each direction
const int interpolationOrder_
Interpolation order used by grid transfer operators using these aggregates.
void getCoarseNodeGlobalTuple(const GO myGID, GO &i, GO &j, GO &k) const
void getFineNodeLocalTuple(const LO myLID, LO &i, LO &j, LO &k) const
LO getCoarseNodeOffset(int const dim) const
const int numDimensions
Number of spacial dimensions in the problem.
Array< LO > lCoarseNodesPerDir
local number of nodes per direction remaing after coarsening.
Array< int > endRate
adapted coarsening rate at the edge of the mesh in each direction.
bool ghostInterface[6]
flags indicating if ghost points are needed at ilo, ihi, jlo, jhi, klo and khi boundaries.
void getCoarseNodesData(const RCP< const Map > fineCoordinatesMap, Array< GO > &coarseNodeCoarseGIDs, Array< GO > &coarseNodeFineGIDs) const
LO getLocalFineNodesInDir(const int dim) const
void getFineNodeGlobalTuple(const GO myGID, GO &i, GO &j, GO &k) const
void getCoarseNodeGhostedLID(const LO i, const LO j, const LO k, LO &myLID) const
bool meshEdge[6]
flags indicating if we run into the edge of the mesh in ilo, ihi, jlo, jhi, klo or khi...
LO lNumCoarseNodes10
local number of nodes per 0-1 slice remaining after coarsening.
LO getLocalCoarseNodesInDir(const int dim) const
void getCoarseNodeLocalTuple(const LO myLID, LO &i, LO &j, LO &k) const
std::vector< std::vector< GO > > getCoarseMeshData() const
void getFineNodeLID(const LO i, const LO j, const LO k, LO &myLID) const
GO gNumCoarseNodes10
global number of nodes per 0-1 slice remaining after coarsening.
void getGhostedNodesData(const RCP< const Map > fineMap, Array< LO > &ghostedNodeCoarseLIDs, Array< int > &ghostedNodeCoarsePIDs, Array< GO > &ghostedNodeCoarseGIDs) const
LO lNumFineNodes10
local number of nodes per 0-1 slice.
void getGhostedNodeFineLID(const LO i, const LO j, const LO k, LO &myLID) const
void computeMeshParameters()
GlobalLexicographicIndexManager()
void getFineNodeGID(const GO i, const GO j, const GO k, GO &myGID) const
GO gNumCoarseNodes
global number of nodes remaining after coarsening.
Container class for mesh layout and indices calculation.
int getCoarseningRate(const int dim) const