46 #ifndef MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_
47 #define MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_
49 #include <Xpetra_MapFactory.hpp>
55 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
58 const int NumDimensions,
const int interpolationOrder,
59 const int MyRank,
const int NumRanks,
62 IndexManager(comm, coupled, NumDimensions, interpolationOrder,
Array<GO>(3, -1), LFineNodesPerDir),
63 myRank(MyRank), numRanks(NumRanks)
67 for(
int dim = 0; dim < 3; ++dim) {
69 if(CoarseRate.
size() == 1) {
84 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
87 GO input[1] = {as<GO>(this->lNumCoarseNodes)}, output[1] = {0};
89 this->gNumCoarseNodes = output[0];
92 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 ghostedNodeCoarseLIDs.
resize(this->getNumLocalGhostedNodes());
101 ghostedNodeCoarsePIDs.
resize(this->getNumLocalGhostedNodes());
103 for(LO idx = 0; idx < this->getNumLocalGhostedNodes(); ++idx) {
104 ghostedNodeCoarseLIDs[idx] = idx;
105 ghostedNodeCoarsePIDs[idx] = myRank;
109 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
116 coarseNodeCoarseGIDs.
resize(this->getNumLocalCoarseNodes());
117 coarseNodeFineGIDs.
resize(this->getNumLocalCoarseNodes());
124 for(LO coarseLID = 0; coarseLID < this->getNumLocalCoarseNodes(); ++coarseLID) {
125 Array<LO> coarseIndices(3), fineIndices(3);
126 this->getCoarseNodeLocalTuple(coarseLID,
130 for(
int dim = 0; dim < 3; ++dim) {
131 if(coarseIndices[dim] == this->lCoarseNodesPerDir[dim] - 1) {
132 fineIndices[dim] = this->lFineNodesPerDir[dim] - 1;
134 fineIndices[dim] = coarseIndices[dim]*this->coarseRate[dim];
138 fineLID = fineIndices[2]*this->lNumFineNodes10
139 + fineIndices[1]*this->lFineNodesPerDir[0]
141 coarseNodeFineGIDs[coarseLID] = fineNodeGIDs[fineLID];
146 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
149 std::vector<std::vector<GO> > coarseMeshData;
150 return coarseMeshData;
153 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
158 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
162 k = myLID / this->lNumFineNodes10;
163 tmp = myLID % this->lNumFineNodes10;
164 j = tmp / this->lFineNodesPerDir[0];
165 i = tmp % this->lFineNodesPerDir[0];
168 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
172 k = myLID / this->lNumFineNodes10;
173 tmp = myLID % this->lNumFineNodes10;
174 j = tmp / this->lFineNodesPerDir[0];
175 i = tmp % this->lFineNodesPerDir[0];
177 k += this->offsets[2];
178 j += this->offsets[1];
179 i += this->offsets[0];
182 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
187 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
192 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
197 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
201 k = myLID / this->lNumCoarseNodes10;
202 tmp = myLID % this->lNumCoarseNodes10;
203 j = tmp / this->lCoarseNodesPerDir[0];
204 i = tmp % this->lCoarseNodesPerDir[0];
207 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
212 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
217 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
220 myLID = k*this->numGhostedNodes10 + j*this->ghostedNodesPerDir[0] + i;
223 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
228 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
233 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()