65 Array<LO>& ghostedNodeCoarseLIDs, Array<int>& ghostedNodeCoarsePIDs, Array<GO>& ghostedNodeCoarseGIDs)
const {
66 ghostedNodeCoarseLIDs.resize(this->getNumLocalGhostedNodes());
67 ghostedNodeCoarsePIDs.resize(this->getNumLocalGhostedNodes());
68 ghostedNodeCoarseGIDs.resize(this->numGhostedNodes);
72 Array<GO> lCoarseNodeCoarseGIDs(this->lNumCoarseNodes),
73 lCoarseNodeFineGIDs(this->lNumCoarseNodes);
74 Array<GO> ghostedCoarseNodeFineGIDs(this->numGhostedNodes);
75 Array<LO> ghostedCoarseNodeCoarseIndices(3), ghostedCoarseNodeFineIndices(3), ijk(3);
76 LO currentIndex = -1, currentCoarseIndex = -1;
77 for (ijk[2] = 0; ijk[2] < this->ghostedNodesPerDir[2]; ++ijk[2]) {
78 for (ijk[1] = 0; ijk[1] < this->ghostedNodesPerDir[1]; ++ijk[1]) {
79 for (ijk[0] = 0; ijk[0] < this->ghostedNodesPerDir[0]; ++ijk[0]) {
80 currentIndex = ijk[2] * this->numGhostedNodes10 + ijk[1] * this->ghostedNodesPerDir[0] + ijk[0];
81 ghostedCoarseNodeCoarseIndices[0] = this->startGhostedCoarseNode[0] + ijk[0];
82 ghostedCoarseNodeCoarseIndices[1] = this->startGhostedCoarseNode[1] + ijk[1];
83 ghostedCoarseNodeCoarseIndices[2] = this->startGhostedCoarseNode[2] + ijk[2];
84 GO myCoarseGID = ghostedCoarseNodeCoarseIndices[0] + ghostedCoarseNodeCoarseIndices[1] * this->gCoarseNodesPerDir[0] + ghostedCoarseNodeCoarseIndices[2] * this->gNumCoarseNodes10;
85 ghostedNodeCoarseGIDs[currentIndex] = myCoarseGID;
86 GO myGID = 0, factor[3] = {};
87 factor[2] = this->gNumFineNodes10;
88 factor[1] = this->gFineNodesPerDir[0];
90 for (
int dim = 0; dim < 3; ++dim) {
91 if (dim < this->numDimensions) {
92 if (this->startIndices[dim] - this->offsets[dim] + ijk[dim] * this->coarseRate[dim] < this->gFineNodesPerDir[dim] - 1) {
93 myGID += (this->startIndices[dim] - this->offsets[dim] + ijk[dim] * this->coarseRate[dim]) * factor[dim];
95 myGID += (this->startIndices[dim] - this->offsets[dim] + (ijk[dim] - 1) * this->coarseRate[dim] + this->endRate[dim]) * factor[dim];
103 if ((!this->ghostInterface[0] || ijk[0] != 0) &&
104 (!this->ghostInterface[2] || ijk[1] != 0) &&
105 (!this->ghostInterface[4] || ijk[2] != 0) &&
106 (!this->ghostInterface[1] || ijk[0] != this->ghostedNodesPerDir[0] - 1) &&
107 (!this->ghostInterface[3] || ijk[1] != this->ghostedNodesPerDir[1] - 1) &&
108 (!this->ghostInterface[5] || ijk[2] != this->ghostedNodesPerDir[2] - 1)) {
110 if (this->interpolationOrder_ == 0) {
111 currentCoarseIndex = 0;
112 if (this->ghostInterface[4]) {
113 currentCoarseIndex += (ijk[2] - 1) * this->lNumCoarseNodes10;
115 currentCoarseIndex += ijk[2] * this->lNumCoarseNodes10;
117 if (this->ghostInterface[2]) {
118 currentCoarseIndex += (ijk[1] - 1) * this->getLocalCoarseNodesInDir(0);
120 currentCoarseIndex += ijk[1] * this->getLocalCoarseNodesInDir(0);
122 if (this->ghostInterface[0]) {
123 currentCoarseIndex += ijk[0] - 1;
125 currentCoarseIndex += ijk[0];
128 this->getGhostedNodeCoarseLID(ijk[0], ijk[1], ijk[2], currentCoarseIndex);
131 lCoarseNodeCoarseGIDs[currentCoarseIndex] = myCoarseGID;
132 lCoarseNodeFineGIDs[currentCoarseIndex] = myGID;
134 ghostedCoarseNodeFineGIDs[currentIndex] = myGID;
139 RCP<const Map> coarseMap = Xpetra::MapFactory<LO, GO, NO>::Build(fineMap->lib(),
140 this->gNumCoarseNodes,
141 lCoarseNodeCoarseGIDs(),
142 fineMap->getIndexBase(),
145 coarseMap->getRemoteIndexList(ghostedNodeCoarseGIDs(),
146 ghostedNodeCoarsePIDs(),
147 ghostedNodeCoarseLIDs());
154 Array<GO>& coarseNodeCoarseGIDs,
155 Array<GO>& coarseNodeFineGIDs)
const {
157 coarseNodeCoarseGIDs.resize(this->getNumLocalCoarseNodes());
158 coarseNodeFineGIDs.resize(this->getNumLocalCoarseNodes());
161 ArrayView<const GO> fineNodeGIDs = fineCoordinatesMap->getLocalElementList();
163 Array<GO> coarseStartIndices(3);
165 for (
int dim = 0; dim < 3; ++dim) {
166 coarseStartIndices[dim] = this->startIndices[dim] / this->coarseRate[dim];
167 tmp = this->startIndices[dim] % this->coarseRate[dim];
169 ++coarseStartIndices[dim];
175 Array<LO> lCoarseIndices(3);
176 Array<GO> gCoarseIndices(3);
177 for (LO coarseLID = 0; coarseLID < this->getNumLocalCoarseNodes(); ++coarseLID) {
178 this->getCoarseNodeLocalTuple(coarseLID,
182 getCoarseNodeFineLID(lCoarseIndices[0], lCoarseIndices[1], lCoarseIndices[2], fineLID);
183 coarseNodeFineGIDs[coarseLID] = fineNodeGIDs[fineLID];
186 for (
int dim = 0; dim < 3; dim++) {
187 gCoarseIndices[dim] = coarseStartIndices[dim] + lCoarseIndices[dim];
189 getCoarseNodeGID(gCoarseIndices[0],
192 coarseNodeCoarseGIDs[coarseLID]);
310 LO itmp = i - (this->offsets[0] > 0 ? 1 : 0);
311 LO jtmp = j - (this->offsets[1] > 0 ? 1 : 0);
312 LO ktmp = k - (this->offsets[2] > 0 ? 1 : 0);
314 if (ktmp * this->coarseRate[2] < this->lFineNodesPerDir[2]) {
315 myLID += ktmp * this->coarseRate[2] * this->lNumCoarseNodes10;
317 myLID += (this->lFineNodesPerDir[2] - 1) * this->lNumCoarseNodes10;
320 if (jtmp * this->coarseRate[1] < this->lFineNodesPerDir[1]) {
321 myLID += jtmp * this->coarseRate[1] * this->lFineNodesPerDir[0];
323 myLID += (this->lFineNodesPerDir[1] - 1) * this->lFineNodesPerDir[1];
326 if (itmp * this->coarseRate[0] < this->lFineNodesPerDir[0]) {
327 myLID += itmp * this->coarseRate[0];
329 myLID += this->lFineNodesPerDir[0] - 1;