46 #ifndef MUELU_UNCOUPLEDINDEXMANAGER_DEF_HPP_
47 #define MUELU_UNCOUPLEDINDEXMANAGER_DEF_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, GFineNodesPerDir, LFineNodesPerDir),
63 myRank(MyRank), numRanks(NumRanks) {
66 for(
int dim = 0; dim < 3; ++dim) {
68 if(CoarseRate.
size() == 1) {
83 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
86 GO input[1] = {as<GO>(this->lNumCoarseNodes)}, output[1] = {0};
88 this->gNumCoarseNodes = output[0];
91 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
99 ghostedNodeCoarseLIDs.
resize(this->getNumLocalGhostedNodes());
100 ghostedNodeCoarsePIDs.
resize(this->getNumLocalGhostedNodes());
102 for(
LO idx = 0; idx < this->getNumLocalGhostedNodes(); ++idx) {
103 ghostedNodeCoarseLIDs[idx] = idx;
104 ghostedNodeCoarsePIDs[idx] = myRank;
108 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
115 coarseNodeCoarseGIDs.
resize(this->getNumLocalCoarseNodes());
116 coarseNodeFineGIDs.
resize(this->getNumLocalCoarseNodes());
123 for(
LO coarseLID = 0; coarseLID < this->getNumLocalCoarseNodes(); ++coarseLID) {
124 Array<LO> coarseIndices(3), fineIndices(3);
125 this->getCoarseNodeLocalTuple(coarseLID,
129 for(
int dim = 0; dim < 3; ++dim) {
130 if(coarseIndices[dim] == this->lCoarseNodesPerDir[dim] - 1) {
131 fineIndices[dim] = this->lFineNodesPerDir[dim] - 1;
133 fineIndices[dim] = coarseIndices[dim]*this->coarseRate[dim];
137 fineLID = fineIndices[2]*this->lNumFineNodes10
138 + fineIndices[1]*this->lFineNodesPerDir[0]
140 coarseNodeFineGIDs[coarseLID] = fineNodeGIDs[fineLID];
145 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
148 std::vector<std::vector<GO> > coarseMeshData;
149 return coarseMeshData;
152 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
157 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
161 k = myLID / this->lNumFineNodes10;
162 tmp = myLID % this->lNumFineNodes10;
163 j = tmp / this->lFineNodesPerDir[0];
164 i = tmp % this->lFineNodesPerDir[0];
167 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
171 k = myLID / this->lNumFineNodes10;
172 tmp = myLID % this->lNumFineNodes10;
173 j = tmp / this->lFineNodesPerDir[0];
174 i = tmp % this->lFineNodesPerDir[0];
176 k += this->offsets[2];
177 j += this->offsets[1];
178 i += this->offsets[0];
181 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
186 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
191 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
196 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
200 k = myLID / this->lNumCoarseNodes10;
201 tmp = myLID % this->lNumCoarseNodes10;
202 j = tmp / this->lCoarseNodesPerDir[0];
203 i = tmp % this->lCoarseNodesPerDir[0];
206 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
211 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
216 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
219 myLID = k*this->numGhostedNodes10 + j*this->ghostedNodesPerDir[0] + i;
222 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
227 template <
class LocalOrdinal,
class GlobalOrdinal,
class Node>
232 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
TEUCHOS_DEPRECATED void reduceAll(const Comm< Ordinal > &comm, const EReductionType reductType, const Packet &send, Packet *globalReduct)
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()