10 #ifndef MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_
11 #define MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_
13 #include <Xpetra_MapFactory.hpp>
19 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
22 const int NumDimensions,
const int interpolationOrder,
23 const int MyRank,
const int NumRanks,
25 const Array<LO> CoarseRate,
const bool singleCoarsePoint)
26 :
IndexManager(comm, coupled, singleCoarsePoint, NumDimensions, interpolationOrder,
27 Array<
GO>(3, -1), LFineNodesPerDir)
29 , numRanks(NumRanks) {
31 for (
int dim = 0; dim < 3; ++dim) {
33 if (CoarseRate.
size() == 1) {
48 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
51 GO input[1] = {as<GO>(this->lNumCoarseNodes)}, output[1] = {0};
53 this->gNumCoarseNodes = output[0];
56 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 ghostedNodeCoarseLIDs.
resize(this->getNumLocalGhostedNodes());
64 ghostedNodeCoarsePIDs.
resize(this->getNumLocalGhostedNodes());
66 for (
LO idx = 0; idx < this->getNumLocalGhostedNodes(); ++idx) {
67 ghostedNodeCoarseLIDs[idx] = idx;
68 ghostedNodeCoarsePIDs[idx] = myRank;
72 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
78 coarseNodeCoarseGIDs.
resize(this->getNumLocalCoarseNodes());
79 coarseNodeFineGIDs.
resize(this->getNumLocalCoarseNodes());
86 for (
LO coarseLID = 0; coarseLID < this->getNumLocalCoarseNodes(); ++coarseLID) {
87 Array<LO> coarseIndices(3), fineIndices(3);
88 this->getCoarseNodeLocalTuple(coarseLID,
92 for (
int dim = 0; dim < 3; ++dim) {
93 if (coarseIndices[dim] == this->lCoarseNodesPerDir[dim] - 1) {
94 if (this->lCoarseNodesPerDir[dim] == 1) {
97 fineIndices[dim] = this->lFineNodesPerDir[dim] - 1;
100 fineIndices[dim] = coarseIndices[dim] * this->coarseRate[dim];
104 fineLID = fineIndices[2] * this->lNumFineNodes10 + fineIndices[1] * this->lFineNodesPerDir[0] + fineIndices[0];
105 coarseNodeFineGIDs[coarseLID] = fineNodeGIDs[fineLID];
109 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 std::vector<std::vector<GO> > coarseMeshData;
113 return coarseMeshData;
116 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
121 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
125 k = myLID / this->lNumFineNodes10;
126 tmp = myLID % this->lNumFineNodes10;
127 j = tmp / this->lFineNodesPerDir[0];
128 i = tmp % this->lFineNodesPerDir[0];
131 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
135 k = myLID / this->lNumFineNodes10;
136 tmp = myLID % this->lNumFineNodes10;
137 j = tmp / this->lFineNodesPerDir[0];
138 i = tmp % this->lFineNodesPerDir[0];
140 k += this->offsets[2];
141 j += this->offsets[1];
142 i += this->offsets[0];
145 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
150 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
155 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
160 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
164 k = myLID / this->lNumCoarseNodes10;
165 tmp = myLID % this->lNumCoarseNodes10;
166 j = tmp / this->lCoarseNodesPerDir[0];
167 i = tmp % this->lCoarseNodesPerDir[0];
170 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
175 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
180 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
183 myLID = k * this->numGhostedNodes10 + j * this->ghostedNodesPerDir[0] + i;
186 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
191 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
196 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
void getGhostedNodeCoarseLID(const LO i, const LO j, const LO k, LO &myLID) const
void getFineNodeLID(const LO i, const LO j, const LO k, LO &myLID) const
void getCoarseNodeGID(const GO i, const GO j, const GO k, GO &myGID) const
Array< int > coarseRate
coarsening rate in each direction
void getFineNodeLocalTuple(const LO myLID, LO &i, LO &j, LO &k) const
void getFineNodeGhostedTuple(const LO myLID, LO &i, LO &j, LO &k) const
const int numDimensions
Number of spacial dimensions in the problem.
UncoupledIndexManager()=default
void resize(size_type new_size, const value_type &x=value_type())
void getFineNodeGID(const GO i, const GO j, const GO k, GO &myGID) const
void getCoarseNodeLocalTuple(const LO myLID, LO &i, LO &j, LO &k) const
void getCoarseNodeFineLID(const LO i, const LO j, const LO k, LO &myLID) const
void getCoarseNodeGhostedLID(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 getCoarseNodeGlobalTuple(const GO myGID, GO &i, GO &j, GO &k) const
void computeMeshParameters()
void getFineNodeGlobalTuple(const GO myGID, GO &i, GO &j, GO &k) const
std::vector< std::vector< GO > > getCoarseMeshData() const
void getGhostedNodeFineLID(const LO i, const LO j, const LO k, LO &myLID) const
GO gNumCoarseNodes
global number of nodes remaining after coarsening.
void getCoarseNodesData(const RCP< const Map > fineCoordinatesMap, Array< GO > &coarseNodeCoarseGIDs, Array< GO > &coarseNodeFineGIDs) const
Container class for mesh layout and indices calculation.
void getGhostedNodesData(const RCP< const Map > fineMap, Array< LO > &ghostedNodeCoarseLIDs, Array< int > &ghostedNodeCoarsePIDs, Array< GO > &ghostedNodeCoarseGIDs) const
void getCoarseNodeLID(const LO i, const LO j, const LO k, LO &myLID) const
void computeGlobalCoarseParameters()