| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// MueLu: A package for multigrid based preconditioning |
| 4 |
// |
| 5 |
// Copyright 2012 NTESS and the MueLu contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
#ifndef MUELU_SETUPREGIONUTILITIES_HPP |
| 11 |
#define MUELU_SETUPREGIONUTILITIES_HPP |
| 12 |
|
| 13 |
#include "Teuchos_Array.hpp" |
| 14 |
|
| 15 |
template <class LocalOrdinal> |
| 16 |
void findInterface(const int numDimensions, Teuchos::Array<LocalOrdinal> nodesPerDim, |
| 17 |
const Teuchos::Array<int> boundaryConditions, |
| 18 |
Teuchos::Array<LocalOrdinal>& interfacesDimensions, |
| 19 |
Teuchos::Array<LocalOrdinal>& interfacesLIDs) { |
| 20 |
using LO = LocalOrdinal; |
| 21 |
|
| 22 |
std::cout << "nodesPerDim: " << nodesPerDim << std::endl; |
| 23 |
|
| 24 |
// The goal of this function is to build a list of LIDs on the skin |
| 25 |
// of the mesh, broken down by logical faces i.e. in 2D four edges, |
| 26 |
// in 3D six faces, while ordering the list lexicographically. |
| 27 |
|
| 28 |
// Step 1: determine what edges/faces are needed based on BC. |
| 29 |
LO numInterfaces = 0, numTotalLIDs = 0, numInterfaceLIDs; |
| 30 |
interfacesDimensions.resize(18, 1); |
| 31 |
for (LO dim = 0; dim < 3; ++dim) { |
| 32 |
// Check for nodes and no boundary conditions in this direction, otherwise skip it. |
| 33 |
if ((nodesPerDim[dim] == 1) || (boundaryConditions[2 * dim] + boundaryConditions[2 * dim + 1] == 2)) { |
| 34 |
continue; |
| 35 |
} |
| 36 |
|
| 37 |
// Since we are not skipping this direction |
| 38 |
// we at least need to store data for one surface |
| 39 |
numInterfaceLIDs = 1; |
| 40 |
for (LO dimIdx = 0; dimIdx < 3; ++dimIdx) { |
| 41 |
interfacesDimensions[numInterfaces * 3 + dimIdx] = (dimIdx == dim ? 1 : nodesPerDim[dimIdx]); |
| 42 |
numInterfaceLIDs *= (dimIdx == dim ? 1 : nodesPerDim[dimIdx]); |
| 43 |
} |
| 44 |
numTotalLIDs += numInterfaceLIDs; |
| 45 |
++numInterfaces; |
| 46 |
|
| 47 |
// If there are no BC we need to store the surface twice. |
| 48 |
if (boundaryConditions[2 * dim] + boundaryConditions[2 * dim + 1] == 0) { |
| 49 |
for (LO dimIdx = 0; dimIdx < 3; ++dimIdx) { |
| 50 |
interfacesDimensions[numInterfaces * 3 + dimIdx] = interfacesDimensions[(numInterfaces - 1) * 3 + dimIdx]; |
| 51 |
} |
| 52 |
numTotalLIDs += numInterfaceLIDs; |
| 53 |
++numInterfaces; |
| 54 |
} |
| 55 |
} |
| 56 |
interfacesDimensions.resize(3 * numInterfaces); |
| 57 |
interfacesLIDs.resize(numTotalLIDs, -1); |
| 58 |
|
| 59 |
// Step 2 lazy implementation of all geometrical cases. |
| 60 |
|
| 61 |
LO nodeOffset = 0; |
| 62 |
if (numDimensions == 2) { |
| 63 |
// left interface |
| 64 |
if (boundaryConditions[0] == 0) { |
| 65 |
for (LO nodeIdx = 0; nodeIdx < nodesPerDim[1]; ++nodeIdx) { |
| 66 |
interfacesLIDs[nodeOffset + nodeIdx] = nodeIdx * nodesPerDim[0]; |
| 67 |
} |
| 68 |
nodeOffset += nodesPerDim[1]; |
| 69 |
} |
| 70 |
|
| 71 |
// right interface |
| 72 |
if (boundaryConditions[1] == 0) { |
| 73 |
for (LO nodeIdx = 0; nodeIdx < nodesPerDim[1]; ++nodeIdx) { |
| 74 |
interfacesLIDs[nodeOffset + nodeIdx] = (nodeIdx + 1) * nodesPerDim[0] - 1; |
| 75 |
} |
| 76 |
nodeOffset += nodesPerDim[1]; |
| 77 |
} |
| 78 |
|
| 79 |
// front interface |
| 80 |
if (boundaryConditions[2] == 0) { |
| 81 |
for (LO nodeIdx = 0; nodeIdx < nodesPerDim[0]; ++nodeIdx) { |
| 82 |
interfacesLIDs[nodeOffset + nodeIdx] = nodeIdx; |
| 83 |
} |
| 84 |
nodeOffset += nodesPerDim[0]; |
| 85 |
} |
| 86 |
|
| 87 |
// back interface |
| 88 |
if (boundaryConditions[3] == 0) { |
| 89 |
for (LO nodeIdx = 0; nodeIdx < nodesPerDim[0]; ++nodeIdx) { |
| 90 |
interfacesLIDs[nodeOffset + nodeIdx] = (nodesPerDim[1] - 1) * nodesPerDim[0] + nodeIdx; |
| 91 |
} |
| 92 |
nodeOffset += nodesPerDim[0]; |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
if (numDimensions == 3) { |
| 97 |
// left interface |
| 98 |
if (boundaryConditions[0] == 0) { |
| 99 |
for (LO k = 0; k < nodesPerDim[2]; ++k) { |
| 100 |
for (LO j = 0; j < nodesPerDim[1]; ++j) { |
| 101 |
interfacesLIDs[nodeOffset + k * nodesPerDim[1] + j] = k * nodesPerDim[1] * nodesPerDim[0] + j * nodesPerDim[0]; |
| 102 |
} |
| 103 |
} |
| 104 |
nodeOffset += nodesPerDim[2] * nodesPerDim[1]; |
| 105 |
} |
| 106 |
|
| 107 |
// right interface |
| 108 |
if (boundaryConditions[1] == 0) { |
| 109 |
for (LO k = 0; k < nodesPerDim[2]; ++k) { |
| 110 |
for (LO j = 0; j < nodesPerDim[1]; ++j) { |
| 111 |
interfacesLIDs[nodeOffset + k * nodesPerDim[1] + j] = k * nodesPerDim[1] * nodesPerDim[0] + (j + 1) * nodesPerDim[0] - 1; |
| 112 |
} |
| 113 |
} |
| 114 |
nodeOffset += nodesPerDim[2] * nodesPerDim[1]; |
| 115 |
} |
| 116 |
|
| 117 |
// front interface |
| 118 |
if (boundaryConditions[2] == 0) { |
| 119 |
for (LO k = 0; k < nodesPerDim[2]; ++k) { |
| 120 |
for (LO i = 0; i < nodesPerDim[0]; ++i) { |
| 121 |
interfacesLIDs[nodeOffset + k * nodesPerDim[0] + i] = k * nodesPerDim[1] * nodesPerDim[0] + i; |
| 122 |
} |
| 123 |
} |
| 124 |
nodeOffset += nodesPerDim[2] * nodesPerDim[0]; |
| 125 |
} |
| 126 |
|
| 127 |
// back interface |
| 128 |
if (boundaryConditions[3] == 0) { |
| 129 |
for (LO k = 0; k < nodesPerDim[2]; ++k) { |
| 130 |
for (LO i = 0; i < nodesPerDim[0]; ++i) { |
| 131 |
interfacesLIDs[nodeOffset + k * nodesPerDim[0] + i] = k * nodesPerDim[1] * nodesPerDim[0] + (nodesPerDim[1] - 1) * nodesPerDim[0] + i; |
| 132 |
} |
| 133 |
} |
| 134 |
nodeOffset += nodesPerDim[2] * nodesPerDim[0]; |
| 135 |
} |
| 136 |
|
| 137 |
// bottom interface |
| 138 |
if (boundaryConditions[4] == 0) { |
| 139 |
for (LO j = 0; j < nodesPerDim[1]; ++j) { |
| 140 |
for (LO i = 0; i < nodesPerDim[0]; ++i) { |
| 141 |
interfacesLIDs[nodeOffset + j * nodesPerDim[0] + i] = j * nodesPerDim[0] + i; |
| 142 |
} |
| 143 |
} |
| 144 |
nodeOffset += nodesPerDim[1] * nodesPerDim[0]; |
| 145 |
} |
| 146 |
|
| 147 |
// top interface |
| 148 |
if (boundaryConditions[5] == 0) { |
| 149 |
for (LO j = 0; j < nodesPerDim[1]; ++j) { |
| 150 |
for (LO i = 0; i < nodesPerDim[0]; ++i) { |
| 151 |
interfacesLIDs[nodeOffset + j * nodesPerDim[0] + i] = (nodesPerDim[2] - 1) * nodesPerDim[1] * nodesPerDim[0] + j * nodesPerDim[0] + i; |
| 152 |
} |
| 153 |
} |
| 154 |
nodeOffset += nodesPerDim[1] * nodesPerDim[0]; |
| 155 |
} |
| 156 |
} |
| 157 |
} // findInterface |
| 158 |
|
| 159 |
template <class LocalOrdinal, class GlobalOrdinal, class Node> |
| 160 |
void createRegionData(const int numDimensions, |
| 161 |
const bool useUnstructured, const int numDofsPerNode, |
| 162 |
const Teuchos::ArrayView<GlobalOrdinal> gNodesPerDim, |
| 163 |
const Teuchos::ArrayView<LocalOrdinal> lNodesPerDim, |
| 164 |
const Teuchos::ArrayView<GlobalOrdinal> procsPerDim, |
| 165 |
const Teuchos::RCP<Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > nodeMap, |
| 166 |
const Teuchos::RCP<Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > dofMap, |
| 167 |
int& maxRegPerGID, LocalOrdinal& numLocalRegionNodes, |
| 168 |
Teuchos::Array<int>& boundaryConditions, |
| 169 |
Teuchos::Array<GlobalOrdinal>& sendGIDs, ///< GIDs of nodes |
| 170 |
Teuchos::Array<int>& sendPIDs, |
| 171 |
int& numInterfaces, |
| 172 |
Teuchos::Array<LocalOrdinal>& rNodesPerDim, |
| 173 |
Teuchos::Array<GlobalOrdinal>& quasiRegionGIDs, |
| 174 |
Teuchos::Array<GlobalOrdinal>& quasiRegionCoordGIDs, |
| 175 |
Teuchos::Array<LocalOrdinal>& compositeToRegionLIDs, |
| 176 |
Teuchos::Array<GlobalOrdinal>& interfaceGIDs, |
| 177 |
Teuchos::Array<LocalOrdinal>& interfaceLIDsData) { |
| 178 |
using GO = GlobalOrdinal; |
| 179 |
using LO = LocalOrdinal; |
| 180 |
|
| 181 |
const int myRank = nodeMap->getComm()->getRank(); |
| 182 |
Teuchos::Array<GO> startIndices(3); |
| 183 |
Teuchos::Array<GO> endIndices(3); |
| 184 |
const GO startGID = dofMap->getMinGlobalIndex() / numDofsPerNode; |
| 185 |
{ |
| 186 |
startIndices[2] = startGID / (gNodesPerDim[1] * gNodesPerDim[0]); |
| 187 |
const GO rem = startGID % (gNodesPerDim[1] * gNodesPerDim[0]); |
| 188 |
startIndices[1] = rem / gNodesPerDim[0]; |
| 189 |
startIndices[0] = rem % gNodesPerDim[0]; |
| 190 |
endIndices[0] = startIndices[0] + lNodesPerDim[0] - 1; |
| 191 |
endIndices[1] = startIndices[1] + lNodesPerDim[1] - 1; |
| 192 |
endIndices[2] = startIndices[2] + lNodesPerDim[2] - 1; |
| 193 |
} |
| 194 |
|
| 195 |
int leftBC = 0, rightBC = 0, frontBC = 0, backBC = 0, bottomBC = 0, topBC = 0; |
| 196 |
if (startIndices[0] == 0) { |
| 197 |
leftBC = 1; |
| 198 |
} |
| 199 |
if (startIndices[1] == 0) { |
| 200 |
frontBC = 1; |
| 201 |
} |
| 202 |
if (startIndices[2] == 0) { |
| 203 |
bottomBC = 1; |
| 204 |
} |
| 205 |
|
| 206 |
if (endIndices[0] == gNodesPerDim[0] - 1) { |
| 207 |
rightBC = 1; |
| 208 |
} |
| 209 |
if (endIndices[1] == gNodesPerDim[1] - 1) { |
| 210 |
backBC = 1; |
| 211 |
} |
| 212 |
if (endIndices[2] == gNodesPerDim[2] - 1) { |
| 213 |
topBC = 1; |
| 214 |
} |
| 215 |
|
| 216 |
boundaryConditions.resize(6); |
| 217 |
boundaryConditions[0] = leftBC; |
| 218 |
boundaryConditions[1] = rightBC; |
| 219 |
boundaryConditions[2] = frontBC; |
| 220 |
boundaryConditions[3] = backBC; |
| 221 |
boundaryConditions[4] = bottomBC; |
| 222 |
boundaryConditions[5] = topBC; |
| 223 |
|
| 224 |
LO numReceive = 0, numSend = 0; |
| 225 |
Teuchos::Array<GO> receiveGIDs; |
| 226 |
Teuchos::Array<int> receivePIDs; |
| 227 |
Teuchos::Array<LO> receiveLIDs, sendLIDs, interfaceLIDs; |
| 228 |
|
| 229 |
if (numDimensions == 1) { |
| 230 |
maxRegPerGID = 2; |
| 231 |
if (leftBC == 0) { |
| 232 |
numReceive = 1; |
| 233 |
receiveGIDs.resize(numReceive); |
| 234 |
receivePIDs.resize(numReceive); |
| 235 |
receiveLIDs.resize(numReceive); |
| 236 |
|
| 237 |
receiveGIDs[0] = startIndices[0] - 1; |
| 238 |
receivePIDs[0] = myRank - 1; |
| 239 |
} |
| 240 |
if (rightBC == 0) { |
| 241 |
numSend = 1; |
| 242 |
sendGIDs.resize(numSend); |
| 243 |
sendPIDs.resize(numSend); |
| 244 |
sendLIDs.resize(numSend); |
| 245 |
|
| 246 |
sendGIDs[0] = endIndices[0]; |
| 247 |
sendGIDs[0] = myRank + 1; |
| 248 |
sendLIDs[0] = lNodesPerDim[0] - 1; |
| 249 |
} |
| 250 |
} else if (numDimensions == 2) { |
| 251 |
maxRegPerGID = 4; |
| 252 |
// Received nodes |
| 253 |
if (frontBC == 0 && leftBC == 0) { |
| 254 |
numReceive = lNodesPerDim[0] + lNodesPerDim[1] + 1; |
| 255 |
receiveGIDs.resize(numReceive); |
| 256 |
receivePIDs.resize(numReceive); |
| 257 |
receiveLIDs.resize(numReceive); |
| 258 |
|
| 259 |
LO countIDs = 0; |
| 260 |
// Receive front-left corner node |
| 261 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] - 1; |
| 262 |
receivePIDs[countIDs] = myRank - procsPerDim[0] - 1; |
| 263 |
++countIDs; |
| 264 |
// Receive front edge nodes |
| 265 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 266 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] + i; |
| 267 |
receivePIDs[countIDs] = myRank - procsPerDim[0]; |
| 268 |
++countIDs; |
| 269 |
} |
| 270 |
// Receive left edge nodes |
| 271 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 272 |
receiveGIDs[countIDs] = startGID - 1 + j * gNodesPerDim[0]; |
| 273 |
receivePIDs[countIDs] = myRank - 1; |
| 274 |
++countIDs; |
| 275 |
} |
| 276 |
|
| 277 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 278 |
numInterfaces = 2; |
| 279 |
|
| 280 |
interfaceLIDs.resize((lNodesPerDim[0] + 1) + (lNodesPerDim[1] + 1)); |
| 281 |
for (LO nodeIdx = 0; nodeIdx < lNodesPerDim[0] + 1; ++nodeIdx) { |
| 282 |
interfaceLIDs[nodeIdx] = nodeIdx; |
| 283 |
} |
| 284 |
for (LO nodeIdx = 0; nodeIdx < lNodesPerDim[1] + 1; ++nodeIdx) { |
| 285 |
interfaceLIDs[lNodesPerDim[0] + 1 + nodeIdx] = nodeIdx * (lNodesPerDim[1] + 1); |
| 286 |
} |
| 287 |
} |
| 288 |
|
| 289 |
} else if (frontBC == 0) { |
| 290 |
numReceive = lNodesPerDim[0]; |
| 291 |
receiveGIDs.resize(numReceive); |
| 292 |
receivePIDs.resize(numReceive); |
| 293 |
receiveLIDs.resize(numReceive); |
| 294 |
|
| 295 |
LO countIDs = 0; |
| 296 |
// Receive front edge nodes |
| 297 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 298 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] + i; |
| 299 |
receivePIDs[countIDs] = myRank - procsPerDim[0]; |
| 300 |
++countIDs; |
| 301 |
} |
| 302 |
|
| 303 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 304 |
numInterfaces = 1; |
| 305 |
|
| 306 |
interfaceLIDs.resize(lNodesPerDim[0] + 1); |
| 307 |
for (LO nodeIdx = 0; nodeIdx < lNodesPerDim[0] + 1; ++nodeIdx) { |
| 308 |
interfaceLIDs[nodeIdx] = nodeIdx; |
| 309 |
} |
| 310 |
} |
| 311 |
|
| 312 |
} else if (leftBC == 0) { |
| 313 |
numReceive = lNodesPerDim[1]; |
| 314 |
receiveGIDs.resize(numReceive); |
| 315 |
receivePIDs.resize(numReceive); |
| 316 |
receiveLIDs.resize(numReceive); |
| 317 |
|
| 318 |
LO countIDs = 0; |
| 319 |
// Receive left edge nodes |
| 320 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 321 |
receiveGIDs[countIDs] = startGID - 1 + j * gNodesPerDim[0]; |
| 322 |
receivePIDs[countIDs] = myRank - 1; |
| 323 |
++countIDs; |
| 324 |
} |
| 325 |
|
| 326 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 327 |
numInterfaces = 1; |
| 328 |
|
| 329 |
interfaceLIDs.resize(lNodesPerDim[1] + 1); |
| 330 |
for (LO nodeIdx = 0; nodeIdx < lNodesPerDim[1] + 1; ++nodeIdx) { |
| 331 |
interfaceLIDs[nodeIdx] = nodeIdx * (lNodesPerDim[1] + 1); |
| 332 |
} |
| 333 |
} |
| 334 |
} |
| 335 |
|
| 336 |
// Sent nodes |
| 337 |
if (rightBC == 0 && backBC == 0) { |
| 338 |
numSend = lNodesPerDim[0] + lNodesPerDim[1] + 1; |
| 339 |
sendGIDs.resize(numSend); |
| 340 |
sendPIDs.resize(numSend); |
| 341 |
sendLIDs.resize(numSend); |
| 342 |
|
| 343 |
LO countIDs = 0; |
| 344 |
// Send nodes of right edge |
| 345 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 346 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + startGID + lNodesPerDim[0] - 1; |
| 347 |
sendPIDs[countIDs] = myRank + 1; |
| 348 |
sendLIDs[countIDs] = (j + 1) * lNodesPerDim[0] - 1; |
| 349 |
++countIDs; |
| 350 |
} |
| 351 |
// Send nodes of back edge |
| 352 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 353 |
sendGIDs[countIDs] = i + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 354 |
sendPIDs[countIDs] = myRank + procsPerDim[0]; |
| 355 |
sendLIDs[countIDs] = (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 356 |
++countIDs; |
| 357 |
} |
| 358 |
// Send node of back-right corner |
| 359 |
sendGIDs[countIDs] = startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 360 |
sendPIDs[countIDs] = myRank + procsPerDim[0] + 1; |
| 361 |
sendLIDs[countIDs] = lNodesPerDim[1] * lNodesPerDim[0] - 1; |
| 362 |
++countIDs; |
| 363 |
} else if (backBC == 0) { |
| 364 |
numSend = lNodesPerDim[0]; |
| 365 |
|
| 366 |
sendGIDs.resize(numSend); |
| 367 |
sendPIDs.resize(numSend); |
| 368 |
sendLIDs.resize(numSend); |
| 369 |
|
| 370 |
LO countIDs = 0; |
| 371 |
// Send nodes of back edge |
| 372 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 373 |
sendGIDs[countIDs] = i + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 374 |
sendPIDs[countIDs] = myRank + procsPerDim[0]; |
| 375 |
sendLIDs[countIDs] = (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 376 |
++countIDs; |
| 377 |
} |
| 378 |
} else if (rightBC == 0) { |
| 379 |
numSend = lNodesPerDim[1]; |
| 380 |
sendGIDs.resize(numSend); |
| 381 |
sendPIDs.resize(numSend); |
| 382 |
sendLIDs.resize(numSend); |
| 383 |
|
| 384 |
LO countIDs = 0; |
| 385 |
// Send nodes of right edge |
| 386 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 387 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + startGID + lNodesPerDim[0] - 1; |
| 388 |
sendPIDs[countIDs] = myRank + 1; |
| 389 |
sendLIDs[countIDs] = (j + 1) * lNodesPerDim[0] - 1; |
| 390 |
++countIDs; |
| 391 |
} |
| 392 |
} |
| 393 |
} else if (numDimensions == 3) { |
| 394 |
maxRegPerGID = 8; |
| 395 |
// Received nodes |
| 396 |
if ((bottomBC == 0) && (frontBC == 0) && (leftBC == 0)) { |
| 397 |
numReceive = lNodesPerDim[0] * lNodesPerDim[1] // bottom face |
| 398 |
+ lNodesPerDim[0] * (lNodesPerDim[2] + 1) // front face |
| 399 |
+ (lNodesPerDim[1] + 1) * (lNodesPerDim[2] + 1); // left face |
| 400 |
receiveGIDs.resize(numReceive); |
| 401 |
receivePIDs.resize(numReceive); |
| 402 |
receiveLIDs.resize(numReceive); |
| 403 |
|
| 404 |
LO countIDs = 0; |
| 405 |
// Receive front-left-bottom corner node |
| 406 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] - 1 - gNodesPerDim[1] * gNodesPerDim[0]; |
| 407 |
receivePIDs[countIDs] = myRank - procsPerDim[0] - 1 - procsPerDim[1] * procsPerDim[0]; |
| 408 |
++countIDs; |
| 409 |
|
| 410 |
// Receive front-bottom edge nodes |
| 411 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 412 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] * gNodesPerDim[1] - gNodesPerDim[0] + i; |
| 413 |
receivePIDs[countIDs] = myRank - procsPerDim[0] * procsPerDim[1] - procsPerDim[0]; |
| 414 |
++countIDs; |
| 415 |
} |
| 416 |
|
| 417 |
// Recieve left-bottom edge nodes |
| 418 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 419 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] * gNodesPerDim[1] - 1 + j * gNodesPerDim[0]; |
| 420 |
receivePIDs[countIDs] = myRank - procsPerDim[0] * procsPerDim[1] - 1; |
| 421 |
++countIDs; |
| 422 |
// Recieve bottom face nodes |
| 423 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 424 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] * gNodesPerDim[1] + i + j * gNodesPerDim[0]; |
| 425 |
receivePIDs[countIDs] = myRank - procsPerDim[0] * procsPerDim[1]; |
| 426 |
++countIDs; |
| 427 |
} |
| 428 |
} |
| 429 |
|
| 430 |
// Receive front-left edge nodes |
| 431 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 432 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] - 1 + k * gNodesPerDim[0] * gNodesPerDim[1]; |
| 433 |
receivePIDs[countIDs] = myRank - procsPerDim[0] - 1; |
| 434 |
++countIDs; |
| 435 |
// Receive front face nodes |
| 436 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 437 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] + i + k * (gNodesPerDim[1] * gNodesPerDim[0]); |
| 438 |
receivePIDs[countIDs] = myRank - procsPerDim[0]; |
| 439 |
++countIDs; |
| 440 |
} |
| 441 |
// Receive left face nodes |
| 442 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 443 |
receiveGIDs[countIDs] = startGID - 1 + j * gNodesPerDim[0] + k * (gNodesPerDim[1] * gNodesPerDim[0]); |
| 444 |
receivePIDs[countIDs] = myRank - 1; |
| 445 |
++countIDs; |
| 446 |
} |
| 447 |
} |
| 448 |
|
| 449 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 450 |
numInterfaces = 3; |
| 451 |
|
| 452 |
interfaceLIDs.resize((lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1) + (lNodesPerDim[0] + 1) * (lNodesPerDim[2] + 1) + (lNodesPerDim[1] + 1) * (lNodesPerDim[2] + 1)); |
| 453 |
|
| 454 |
LO nodeOffset = 0, nodeIdx, nodeLID; |
| 455 |
// Bottom face |
| 456 |
for (nodeIdx = 0; nodeIdx < (lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1); ++nodeIdx) { |
| 457 |
interfaceLIDs[nodeIdx] = nodeIdx; |
| 458 |
} |
| 459 |
// Front face |
| 460 |
nodeOffset += (lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1); |
| 461 |
for (LO k = 0; k < lNodesPerDim[2] + 1; ++k) { |
| 462 |
for (LO i = 0; i < lNodesPerDim[0] + 1; ++i) { |
| 463 |
nodeIdx = k * (lNodesPerDim[0] + 1) + i + nodeOffset; |
| 464 |
nodeLID = k * (lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1) + i; |
| 465 |
interfaceLIDs[nodeIdx] = nodeLID; |
| 466 |
} |
| 467 |
} |
| 468 |
// Left face |
| 469 |
nodeOffset += (lNodesPerDim[0] + 1) * (lNodesPerDim[2] + 1); |
| 470 |
for (LO k = 0; k < lNodesPerDim[2] + 1; ++k) { |
| 471 |
for (LO j = 0; j < lNodesPerDim[1] + 1; ++j) { |
| 472 |
nodeIdx = k * (lNodesPerDim[1] + 1) + j + nodeOffset; |
| 473 |
nodeLID = k * (lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1) + j * (lNodesPerDim[0] + 1); |
| 474 |
interfaceLIDs[nodeIdx] = nodeLID; |
| 475 |
} |
| 476 |
} |
| 477 |
} |
| 478 |
|
| 479 |
// Two faces received |
| 480 |
} else if ((bottomBC == 0) && (frontBC == 0)) { |
| 481 |
numReceive = lNodesPerDim[0] * (lNodesPerDim[1] + lNodesPerDim[2] + 1); |
| 482 |
receiveGIDs.resize(numReceive); |
| 483 |
receivePIDs.resize(numReceive); |
| 484 |
receiveLIDs.resize(numReceive); |
| 485 |
|
| 486 |
LO countIDs = 0; |
| 487 |
// Receive front-bottom edge nodes |
| 488 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 489 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] * gNodesPerDim[1] - gNodesPerDim[0] + i; |
| 490 |
receivePIDs[countIDs] = myRank - procsPerDim[0] * procsPerDim[1] - procsPerDim[0]; |
| 491 |
++countIDs; |
| 492 |
} |
| 493 |
// Receive bottom face nodes |
| 494 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 495 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 496 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] * gNodesPerDim[1] + i + j * gNodesPerDim[0]; |
| 497 |
receivePIDs[countIDs] = myRank - procsPerDim[0] * procsPerDim[1]; |
| 498 |
++countIDs; |
| 499 |
} |
| 500 |
} |
| 501 |
// Receive front face nodes |
| 502 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 503 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 504 |
receiveGIDs[countIDs] = startGID - gNodesPerDim[0] + i + k * (gNodesPerDim[1] * gNodesPerDim[0]); |
| 505 |
receivePIDs[countIDs] = myRank - procsPerDim[0]; |
| 506 |
++countIDs; |
| 507 |
} |
| 508 |
} |
| 509 |
|
| 510 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 511 |
numInterfaces = 2; |
| 512 |
|
| 513 |
interfaceLIDs.resize(lNodesPerDim[0] * (lNodesPerDim[1] + 1) + lNodesPerDim[0] * (lNodesPerDim[2] + 1)); |
| 514 |
|
| 515 |
LO nodeOffset = 0, nodeIdx, nodeLID; |
| 516 |
// Bottom face |
| 517 |
for (nodeIdx = 0; nodeIdx < lNodesPerDim[0] * (lNodesPerDim[1] + 1); ++nodeIdx) { |
| 518 |
interfaceLIDs[nodeIdx] = nodeIdx; |
| 519 |
} |
| 520 |
// Front face |
| 521 |
nodeOffset += lNodesPerDim[0] * (lNodesPerDim[1] + 1); |
| 522 |
for (LO k = 0; k < lNodesPerDim[2] + 1; ++k) { |
| 523 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 524 |
nodeIdx = k * lNodesPerDim[0] + i + nodeOffset; |
| 525 |
nodeLID = k * lNodesPerDim[0] * (lNodesPerDim[1] + 1) + i; |
| 526 |
interfaceLIDs[nodeIdx] = nodeLID; |
| 527 |
} |
| 528 |
} |
| 529 |
} |
| 530 |
|
| 531 |
} else if ((bottomBC == 0) && (leftBC == 0)) { |
| 532 |
numReceive = lNodesPerDim[1] * (lNodesPerDim[0] + lNodesPerDim[2] + 1); |
| 533 |
receiveGIDs.resize(numReceive); |
| 534 |
receivePIDs.resize(numReceive); |
| 535 |
receiveLIDs.resize(numReceive); |
| 536 |
|
| 537 |
LO countIDs = 0; |
| 538 |
// Receive left-bottom edge nodes |
| 539 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 540 |
receiveGIDs[countIDs] = j * gNodesPerDim[0] + startGID - gNodesPerDim[1] * gNodesPerDim[0] - 1; |
| 541 |
receivePIDs[countIDs] = myRank - procsPerDim[1] * procsPerDim[0] - 1; |
| 542 |
++countIDs; |
| 543 |
// Receive bottom face nodes |
| 544 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 545 |
receiveGIDs[countIDs] = j * gNodesPerDim[0] + i + startGID - gNodesPerDim[1] * gNodesPerDim[0]; |
| 546 |
receivePIDs[countIDs] = myRank - procsPerDim[1] * procsPerDim[0]; |
| 547 |
++countIDs; |
| 548 |
} |
| 549 |
} |
| 550 |
// Receive left face nodes |
| 551 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 552 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 553 |
receiveGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + j * gNodesPerDim[0] + startGID - 1; |
| 554 |
receivePIDs[countIDs] = myRank - 1; |
| 555 |
++countIDs; |
| 556 |
} |
| 557 |
} |
| 558 |
|
| 559 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 560 |
numInterfaces = 2; |
| 561 |
|
| 562 |
interfaceLIDs.resize((lNodesPerDim[0] + 1) * lNodesPerDim[1] + lNodesPerDim[1] * (lNodesPerDim[2] + 1)); |
| 563 |
|
| 564 |
LO nodeOffset = 0, nodeIdx, nodeLID; |
| 565 |
// Bottom face |
| 566 |
for (nodeIdx = 0; nodeIdx < (lNodesPerDim[0] + 1) * lNodesPerDim[1]; ++nodeIdx) { |
| 567 |
interfaceLIDs[nodeIdx] = nodeIdx; |
| 568 |
} |
| 569 |
// Left face |
| 570 |
nodeOffset += (lNodesPerDim[0] + 1) * lNodesPerDim[1]; |
| 571 |
for (LO k = 0; k < lNodesPerDim[2] + 1; ++k) { |
| 572 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 573 |
nodeIdx = k * lNodesPerDim[1] + j + nodeOffset; |
| 574 |
nodeLID = k * (lNodesPerDim[0] + 1) * lNodesPerDim[1] + j * (lNodesPerDim[0] + 1); |
| 575 |
interfaceLIDs[nodeIdx] = nodeLID; |
| 576 |
} |
| 577 |
} |
| 578 |
} |
| 579 |
|
| 580 |
} else if ((frontBC == 0) && (leftBC == 0)) { |
| 581 |
numReceive = lNodesPerDim[2] * (lNodesPerDim[0] + lNodesPerDim[1] + 1); |
| 582 |
receiveGIDs.resize(numReceive); |
| 583 |
receivePIDs.resize(numReceive); |
| 584 |
receiveLIDs.resize(numReceive); |
| 585 |
|
| 586 |
LO countIDs = 0; |
| 587 |
// Receive front-left edge nodes |
| 588 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 589 |
receiveGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + startGID - gNodesPerDim[0] - 1; |
| 590 |
receivePIDs[countIDs] = myRank - procsPerDim[0] - 1; |
| 591 |
++countIDs; |
| 592 |
// Receive front face nodes |
| 593 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 594 |
receiveGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + i + startGID - gNodesPerDim[0]; |
| 595 |
receivePIDs[countIDs] = myRank - procsPerDim[0]; |
| 596 |
++countIDs; |
| 597 |
} |
| 598 |
// Receive left face nodes |
| 599 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 600 |
receiveGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + j * gNodesPerDim[0] + startGID - 1; |
| 601 |
receivePIDs[countIDs] = myRank - 1; |
| 602 |
++countIDs; |
| 603 |
} |
| 604 |
} |
| 605 |
|
| 606 |
if (useUnstructured) { // Set parameters for interface aggregation |
| 607 |
numInterfaces = 2; |
| 608 |
|
| 609 |
interfaceLIDs.resize((lNodesPerDim[0] + 1) * lNodesPerDim[2] + (lNodesPerDim[1] + 1) * lNodesPerDim[2]); |
| 610 |
|
| 611 |
LO nodeOffset = 0, nodeIdx, nodeLID; |
| 612 |
// Front face |
| 613 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 614 |
for (LO i = 0; i < lNodesPerDim[0] + 1; ++i) { |
| 615 |
nodeIdx = k * (lNodesPerDim[0] + 1) + i; |
| 616 |
nodeLID = k * (lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1) + i; |
| 617 |
interfaceLIDs[nodeIdx] = nodeLID; |
| 618 |
} |
| 619 |
} |
| 620 |
// Left face |
| 621 |
nodeOffset += (lNodesPerDim[0] + 1) * lNodesPerDim[2]; |
| 622 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 623 |
for (LO j = 0; j < lNodesPerDim[1] + 1; ++j) { |
| 624 |
nodeIdx = k * (lNodesPerDim[1] + 1) + j + nodeOffset; |
| 625 |
nodeLID = k * (lNodesPerDim[0] + 1) * (lNodesPerDim[1] + 1) + j * (lNodesPerDim[0] + 1); |
| 626 |
interfaceLIDs[nodeIdx] = nodeLID; |
| 627 |
} |
| 628 |
} |
| 629 |
} |
| 630 |
|
| 631 |
// Single face received |
| 632 |
} else if (bottomBC == 0) { |
| 633 |
numReceive = lNodesPerDim[0] * lNodesPerDim[1]; |
| 634 |
receiveGIDs.resize(numReceive); |
| 635 |
receivePIDs.resize(numReceive); |
| 636 |
receiveLIDs.resize(numReceive); |
| 637 |
|
| 638 |
LO countIDs = 0; |
| 639 |
// Receive bottom face nodes |
| 640 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 641 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 642 |
receiveGIDs[countIDs] = j * gNodesPerDim[0] + i + startGID - gNodesPerDim[1] * gNodesPerDim[0]; |
| 643 |
receivePIDs[countIDs] = myRank - procsPerDim[1] * procsPerDim[0]; |
| 644 |
++countIDs; |
| 645 |
} |
| 646 |
} |
| 647 |
|
| 648 |
} else if (frontBC == 0) { |
| 649 |
numReceive = lNodesPerDim[0] * lNodesPerDim[2]; |
| 650 |
receiveGIDs.resize(numReceive); |
| 651 |
receivePIDs.resize(numReceive); |
| 652 |
receiveLIDs.resize(numReceive); |
| 653 |
|
| 654 |
LO countIDs = 0; |
| 655 |
// Receive front face nodes |
| 656 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 657 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 658 |
receiveGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + i + startGID - gNodesPerDim[0]; |
| 659 |
receivePIDs[countIDs] = myRank - procsPerDim[0]; |
| 660 |
++countIDs; |
| 661 |
} |
| 662 |
} |
| 663 |
|
| 664 |
} else if (leftBC == 0) { |
| 665 |
numReceive = lNodesPerDim[1] * lNodesPerDim[2]; |
| 666 |
receiveGIDs.resize(numReceive); |
| 667 |
receivePIDs.resize(numReceive); |
| 668 |
receiveLIDs.resize(numReceive); |
| 669 |
|
| 670 |
LO countIDs = 0; |
| 671 |
// Recive left face nodes |
| 672 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 673 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 674 |
receiveGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + j * gNodesPerDim[0] + startGID - 1; |
| 675 |
receivePIDs[countIDs] = myRank - 1; |
| 676 |
++countIDs; |
| 677 |
} |
| 678 |
} |
| 679 |
} |
| 680 |
|
| 681 |
// Sent nodes |
| 682 |
if ((topBC == 0) && (backBC == 0) && (rightBC == 0)) { |
| 683 |
numSend = (lNodesPerDim[0]) * (lNodesPerDim[1]) + (lNodesPerDim[0]) * (lNodesPerDim[2]) + (lNodesPerDim[1]) * (lNodesPerDim[2]) + lNodesPerDim[0] + lNodesPerDim[1] + lNodesPerDim[2] + 1; |
| 684 |
sendGIDs.resize(numSend); |
| 685 |
sendPIDs.resize(numSend); |
| 686 |
sendLIDs.resize(numSend); |
| 687 |
|
| 688 |
LO countIDs = 0; |
| 689 |
// Send nodes of right face |
| 690 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 691 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 692 |
sendGIDs[countIDs] = k * (gNodesPerDim[1] * gNodesPerDim[0]) + j * gNodesPerDim[0] + startGID + lNodesPerDim[0] - 1; |
| 693 |
sendLIDs[countIDs] = k * (lNodesPerDim[1] * lNodesPerDim[0]) + j * lNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 694 |
sendPIDs[countIDs] = myRank + 1; |
| 695 |
++countIDs; |
| 696 |
} |
| 697 |
} |
| 698 |
// Send nodes of back face |
| 699 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 700 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 701 |
sendGIDs[countIDs] = k * (gNodesPerDim[1] * gNodesPerDim[0]) + i + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 702 |
sendLIDs[countIDs] = k * (lNodesPerDim[1] * lNodesPerDim[0]) + (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 703 |
sendPIDs[countIDs] = myRank + procsPerDim[0]; |
| 704 |
++countIDs; |
| 705 |
} |
| 706 |
} |
| 707 |
// Send nodes of right-back edge |
| 708 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 709 |
sendGIDs[countIDs] = k * (gNodesPerDim[1] * gNodesPerDim[0]) + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 710 |
sendLIDs[countIDs] = k * (lNodesPerDim[1] * lNodesPerDim[0]) + lNodesPerDim[1] * lNodesPerDim[0] - 1; |
| 711 |
sendPIDs[countIDs] = myRank + procsPerDim[0] + 1; |
| 712 |
++countIDs; |
| 713 |
} |
| 714 |
// Send nodes of top face |
| 715 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 716 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 717 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + i + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0]; |
| 718 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + i; |
| 719 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0]; |
| 720 |
++countIDs; |
| 721 |
} |
| 722 |
} |
| 723 |
// Send nodes of top-right edge |
| 724 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 725 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 726 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * (lNodesPerDim[1] * lNodesPerDim[0]) + j * lNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 727 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0] + 1; |
| 728 |
++countIDs; |
| 729 |
} |
| 730 |
// Send nodes of top-back edge |
| 731 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 732 |
sendGIDs[countIDs] = i + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0] + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 733 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * (lNodesPerDim[1] * lNodesPerDim[0]) + (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 734 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0] + procsPerDim[0]; |
| 735 |
++countIDs; |
| 736 |
} |
| 737 |
// Send node of top-back-right corner |
| 738 |
sendGIDs[countIDs] = startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0] + (lNodesPerDim[1] - 1) * gNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 739 |
sendLIDs[countIDs] = lNodesPerDim[2] * lNodesPerDim[1] * lNodesPerDim[0] - 1; |
| 740 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0] + procsPerDim[0] + 1; |
| 741 |
++countIDs; |
| 742 |
|
| 743 |
} else if ((topBC == 0) && (backBC == 0)) { |
| 744 |
numSend = (lNodesPerDim[0] * lNodesPerDim[2]) // back face |
| 745 |
+ (lNodesPerDim[0] * lNodesPerDim[1]) // Top face |
| 746 |
+ (lNodesPerDim[0]); // top-back edge |
| 747 |
sendGIDs.resize(numSend); |
| 748 |
sendPIDs.resize(numSend); |
| 749 |
sendLIDs.resize(numSend); |
| 750 |
|
| 751 |
LO countIDs = 0; |
| 752 |
// Send nodes of back face |
| 753 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 754 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 755 |
sendGIDs[countIDs] = k * (gNodesPerDim[1] * gNodesPerDim[0]) + i + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 756 |
sendLIDs[countIDs] = k * lNodesPerDim[1] * lNodesPerDim[0] + (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 757 |
sendPIDs[countIDs] = myRank + procsPerDim[0]; |
| 758 |
++countIDs; |
| 759 |
} |
| 760 |
} |
| 761 |
// Send nodes of top face |
| 762 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 763 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 764 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + i + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0]; |
| 765 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + i; |
| 766 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0]; |
| 767 |
++countIDs; |
| 768 |
} |
| 769 |
} |
| 770 |
// Send nodes of top-back edge |
| 771 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 772 |
sendGIDs[countIDs] = i + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0] + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 773 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * lNodesPerDim[1] * lNodesPerDim[0] + (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 774 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0] + procsPerDim[0]; |
| 775 |
++countIDs; |
| 776 |
} |
| 777 |
|
| 778 |
} else if ((topBC == 0) && (rightBC == 0)) { |
| 779 |
numSend = (lNodesPerDim[1] * lNodesPerDim[2]) // right face |
| 780 |
+ (lNodesPerDim[0] * lNodesPerDim[1]) // Top face |
| 781 |
+ (lNodesPerDim[1]); // top-right edge |
| 782 |
sendGIDs.resize(numSend); |
| 783 |
sendPIDs.resize(numSend); |
| 784 |
sendLIDs.resize(numSend); |
| 785 |
|
| 786 |
LO countIDs = 0; |
| 787 |
// Send nodes of right face |
| 788 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 789 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 790 |
sendGIDs[countIDs] = k * (gNodesPerDim[1] * gNodesPerDim[0]) + j * gNodesPerDim[0] + startGID + lNodesPerDim[0] - 1; |
| 791 |
sendLIDs[countIDs] = k * (lNodesPerDim[1] * lNodesPerDim[0]) + j * lNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 792 |
sendPIDs[countIDs] = myRank + 1; |
| 793 |
++countIDs; |
| 794 |
} |
| 795 |
} |
| 796 |
// Send nodes of top face |
| 797 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 798 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 799 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + i + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0]; |
| 800 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + i; |
| 801 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0]; |
| 802 |
++countIDs; |
| 803 |
} |
| 804 |
} |
| 805 |
// Send nodes of top-right edge |
| 806 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 807 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[1] * gNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 808 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 809 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0] + 1; |
| 810 |
++countIDs; |
| 811 |
} |
| 812 |
|
| 813 |
} else if ((backBC == 0) && (rightBC == 0)) { |
| 814 |
numSend = lNodesPerDim[2] * (lNodesPerDim[0] + lNodesPerDim[1] + 1); |
| 815 |
sendGIDs.resize(numSend); |
| 816 |
sendPIDs.resize(numSend); |
| 817 |
sendLIDs.resize(numSend); |
| 818 |
|
| 819 |
LO countIDs = 0; |
| 820 |
// Send nodes of right face |
| 821 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 822 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 823 |
sendGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + j * gNodesPerDim[0] + startGID + lNodesPerDim[0] - 1; |
| 824 |
sendLIDs[countIDs] = k * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 825 |
sendPIDs[countIDs] = myRank + 1; |
| 826 |
++countIDs; |
| 827 |
} |
| 828 |
} |
| 829 |
// Send nodes of back face |
| 830 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 831 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 832 |
sendGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + i + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 833 |
sendLIDs[countIDs] = k * lNodesPerDim[1] * lNodesPerDim[0] + (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 834 |
sendPIDs[countIDs] = myRank + procsPerDim[0]; |
| 835 |
++countIDs; |
| 836 |
} |
| 837 |
} |
| 838 |
// Send nodes of back-right edge |
| 839 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 840 |
sendGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 841 |
sendLIDs[countIDs] = k * (lNodesPerDim[1] * lNodesPerDim[0]) + lNodesPerDim[1] * lNodesPerDim[0] - 1; |
| 842 |
sendPIDs[countIDs] = myRank + procsPerDim[0] + 1; |
| 843 |
++countIDs; |
| 844 |
} |
| 845 |
|
| 846 |
} else if (topBC == 0) { |
| 847 |
numSend = lNodesPerDim[0] * lNodesPerDim[1]; |
| 848 |
sendGIDs.resize(numSend); |
| 849 |
sendPIDs.resize(numSend); |
| 850 |
sendLIDs.resize(numSend); |
| 851 |
|
| 852 |
LO countIDs = 0; |
| 853 |
// Send nodes of top face |
| 854 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 855 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 856 |
sendGIDs[countIDs] = j * gNodesPerDim[0] + i + startGID + (lNodesPerDim[2] - 1) * gNodesPerDim[0] * gNodesPerDim[1]; |
| 857 |
sendLIDs[countIDs] = (lNodesPerDim[2] - 1) * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + i; |
| 858 |
sendPIDs[countIDs] = myRank + procsPerDim[1] * procsPerDim[0]; |
| 859 |
++countIDs; |
| 860 |
} |
| 861 |
} |
| 862 |
|
| 863 |
} else if (backBC == 0) { |
| 864 |
numSend = lNodesPerDim[0] * lNodesPerDim[2]; |
| 865 |
sendGIDs.resize(numSend); |
| 866 |
sendPIDs.resize(numSend); |
| 867 |
sendLIDs.resize(numSend); |
| 868 |
|
| 869 |
LO countIDs = 0; |
| 870 |
// Send nodes of back face |
| 871 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 872 |
for (LO i = 0; i < lNodesPerDim[0]; ++i) { |
| 873 |
sendGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + i + startGID + (lNodesPerDim[1] - 1) * gNodesPerDim[0]; |
| 874 |
sendLIDs[countIDs] = k * lNodesPerDim[1] * lNodesPerDim[0] + (lNodesPerDim[1] - 1) * lNodesPerDim[0] + i; |
| 875 |
sendPIDs[countIDs] = myRank + procsPerDim[0]; |
| 876 |
++countIDs; |
| 877 |
} |
| 878 |
} |
| 879 |
|
| 880 |
} else if (rightBC == 0) { |
| 881 |
numSend = lNodesPerDim[1] * lNodesPerDim[2]; |
| 882 |
sendGIDs.resize(numSend); |
| 883 |
sendPIDs.resize(numSend); |
| 884 |
sendLIDs.resize(numSend); |
| 885 |
|
| 886 |
LO countIDs = 0; |
| 887 |
// Send nodes of right face |
| 888 |
for (LO k = 0; k < lNodesPerDim[2]; ++k) { |
| 889 |
for (LO j = 0; j < lNodesPerDim[1]; ++j) { |
| 890 |
sendGIDs[countIDs] = k * gNodesPerDim[1] * gNodesPerDim[0] + j * gNodesPerDim[0] + startGID + lNodesPerDim[0] - 1; |
| 891 |
sendLIDs[countIDs] = k * lNodesPerDim[1] * lNodesPerDim[0] + j * lNodesPerDim[0] + lNodesPerDim[0] - 1; |
| 892 |
sendPIDs[countIDs] = myRank + 1; |
| 893 |
++countIDs; |
| 894 |
} |
| 895 |
} |
| 896 |
} |
| 897 |
} |
| 898 |
|
| 899 |
// The code below could probably be separated and performed in its own function. |
| 900 |
// It pretty much tries to go from the more geometric based information generated |
| 901 |
// above to the quasiRegion map which means finding the GID of nodes-off rank on the interface. |
| 902 |
const LO numLocalCompositeNodes = lNodesPerDim[0] * lNodesPerDim[1] * lNodesPerDim[2]; |
| 903 |
numLocalRegionNodes = numLocalCompositeNodes + numReceive; |
| 904 |
quasiRegionGIDs.resize(numLocalRegionNodes * numDofsPerNode); |
| 905 |
quasiRegionCoordGIDs.resize(numLocalRegionNodes); |
| 906 |
|
| 907 |
rNodesPerDim[0] = lNodesPerDim[0]; |
| 908 |
rNodesPerDim[1] = lNodesPerDim[1]; |
| 909 |
rNodesPerDim[2] = lNodesPerDim[2]; |
| 910 |
if (leftBC == 0) { |
| 911 |
rNodesPerDim[0] += 1; |
| 912 |
} |
| 913 |
if (frontBC == 0) { |
| 914 |
rNodesPerDim[1] += 1; |
| 915 |
} |
| 916 |
if (bottomBC == 0) { |
| 917 |
rNodesPerDim[2] += 1; |
| 918 |
} |
| 919 |
|
| 920 |
// Using receiveGIDs, rNodesPerDim and numLocalRegionNodes, build quasi-region row map |
| 921 |
// This will potentially be done by the application or in a MueLu interface but for now |
| 922 |
// let us keep it in this utility function. |
| 923 |
LO interfaceCount = 0, compositeIdx = 0; |
| 924 |
Teuchos::Array<LO> regionIJK(3); |
| 925 |
for (LO nodeRegionIdx = 0; nodeRegionIdx < numLocalRegionNodes; ++nodeRegionIdx) { |
| 926 |
regionIJK[2] = nodeRegionIdx / (rNodesPerDim[1] * rNodesPerDim[0]); |
| 927 |
LO tmp = nodeRegionIdx % (rNodesPerDim[1] * rNodesPerDim[0]); |
| 928 |
regionIJK[1] = tmp / rNodesPerDim[0]; |
| 929 |
regionIJK[0] = tmp % rNodesPerDim[0]; |
| 930 |
|
| 931 |
if ((regionIJK[0] == 0 && leftBC == 0) || |
| 932 |
(regionIJK[1] == 0 && frontBC == 0) || |
| 933 |
(regionIJK[2] == 0 && bottomBC == 0)) { |
| 934 |
quasiRegionCoordGIDs[nodeRegionIdx] = receiveGIDs[interfaceCount]; |
| 935 |
for (int dof = 0; dof < numDofsPerNode; ++dof) { |
| 936 |
quasiRegionGIDs[nodeRegionIdx * numDofsPerNode + dof] = |
| 937 |
receiveGIDs[interfaceCount] * numDofsPerNode + dof; |
| 938 |
} |
| 939 |
receiveLIDs[interfaceCount] = nodeRegionIdx; |
| 940 |
++interfaceCount; |
| 941 |
} else { |
| 942 |
compositeIdx = (regionIJK[2] + bottomBC - 1) * lNodesPerDim[1] * lNodesPerDim[0] + (regionIJK[1] + frontBC - 1) * lNodesPerDim[0] + (regionIJK[0] + leftBC - 1); |
| 943 |
quasiRegionCoordGIDs[nodeRegionIdx] = nodeMap->getGlobalElement(compositeIdx); |
| 944 |
for (int dof = 0; dof < numDofsPerNode; ++dof) { |
| 945 |
quasiRegionGIDs[nodeRegionIdx * numDofsPerNode + dof] = dofMap->getGlobalElement(compositeIdx * numDofsPerNode + dof); |
| 946 |
compositeToRegionLIDs[compositeIdx * numDofsPerNode + dof] = nodeRegionIdx * numDofsPerNode + dof; |
| 947 |
} |
| 948 |
} |
| 949 |
} |
| 950 |
|
| 951 |
// Here we gather the interface GIDs (in composite layout) |
| 952 |
// and the interface LIDs (in region layout) for the local rank |
| 953 |
interfaceLIDsData.resize((sendGIDs.size() + receiveGIDs.size()) * numDofsPerNode); |
| 954 |
interfaceGIDs.resize((sendGIDs.size() + receiveGIDs.size()) * numDofsPerNode); |
| 955 |
using size_type = typename Teuchos::Array<GO>::size_type; |
| 956 |
for (size_type nodeIdx = 0; nodeIdx < sendGIDs.size(); ++nodeIdx) { |
| 957 |
for (int dof = 0; dof < numDofsPerNode; ++dof) { |
| 958 |
LO dofIdx = nodeIdx * numDofsPerNode + dof; |
| 959 |
interfaceGIDs[dofIdx] = sendGIDs[nodeIdx] * numDofsPerNode + dof; |
| 960 |
interfaceLIDsData[dofIdx] = compositeToRegionLIDs[sendLIDs[nodeIdx] * numDofsPerNode + dof]; |
| 961 |
} |
| 962 |
} |
| 963 |
for (size_type nodeIdx = 0; nodeIdx < receiveGIDs.size(); ++nodeIdx) { |
| 964 |
for (int dof = 0; dof < numDofsPerNode; ++dof) { |
| 965 |
LO dofIdx = nodeIdx * numDofsPerNode + dof; |
| 966 |
interfaceGIDs[dofIdx + sendGIDs.size() * numDofsPerNode] = receiveGIDs[nodeIdx] * numDofsPerNode + dof; |
| 967 |
interfaceLIDsData[dofIdx + sendLIDs.size() * numDofsPerNode] = receiveLIDs[nodeIdx] * numDofsPerNode + dof; |
| 968 |
} |
| 969 |
} |
| 970 |
|
| 971 |
// Have all the GIDs and LIDs we stort them in place with std::sort() |
| 972 |
// Subsequently we bring unique values to the beginning of the array with |
| 973 |
// std::unique() and delete the duplicates with erase. |
| 974 |
std::sort(interfaceLIDsData.begin(), interfaceLIDsData.end()); |
| 975 |
interfaceLIDsData.erase(std::unique(interfaceLIDsData.begin(), interfaceLIDsData.end()), |
| 976 |
interfaceLIDsData.end()); |
| 977 |
std::sort(interfaceGIDs.begin(), interfaceGIDs.end()); |
| 978 |
interfaceGIDs.erase(std::unique(interfaceGIDs.begin(), interfaceGIDs.end()), |
| 979 |
interfaceGIDs.end()); |
| 980 |
|
| 981 |
} // createRegionData |
| 982 |
|
| 983 |
template <class LocalOrdinal, class GlobalOrdinal, class Node> |
| 984 |
void MakeRegionPerGIDWithGhosts(const Teuchos::RCP<Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> >& nodeMap, |
| 985 |
const Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > regionRowMap, |
| 986 |
const Teuchos::RCP<Xpetra::Import<LocalOrdinal, GlobalOrdinal, Node> >& rowImport, |
| 987 |
const int maxRegPerGID, |
| 988 |
const LocalOrdinal numDofsPerNode, |
| 989 |
const Teuchos::Array<LocalOrdinal>& lNodesPerDir, |
| 990 |
const Teuchos::Array<GlobalOrdinal>& sendGIDs, |
| 991 |
const Teuchos::Array<int>& sendPIDs, |
| 992 |
const Teuchos::Array<LocalOrdinal>& interfaceRegionLIDs, |
| 993 |
Teuchos::RCP<Xpetra::MultiVector<LocalOrdinal, LocalOrdinal, GlobalOrdinal, Node> >& regionsPerGIDWithGhosts, |
| 994 |
Teuchos::RCP<Xpetra::MultiVector<GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node> >& interfaceGIDsMV) { |
| 995 |
using LO = LocalOrdinal; |
| 996 |
using GO = GlobalOrdinal; |
| 997 |
using NO = Node; |
| 998 |
using Teuchos::Array; |
| 999 |
using Teuchos::ArrayRCP; |
| 1000 |
using Teuchos::RCP; |
| 1001 |
|
| 1002 |
const RCP<const Xpetra::Map<LO, GO, NO> > dofMap = rowImport->getSourceMap(); |
| 1003 |
const RCP<const Xpetra::Map<LO, GO, NO> > quasiRegionRowMap = rowImport->getTargetMap(); |
| 1004 |
const int myRank = dofMap->getComm()->getRank(); |
| 1005 |
|
| 1006 |
RCP<Xpetra::MultiVector<LO, LO, GO, NO> > regionsPerGID = |
| 1007 |
Xpetra::MultiVectorFactory<LO, LO, GO, NO>::Build(dofMap, maxRegPerGID, false); |
| 1008 |
regionsPerGIDWithGhosts = |
| 1009 |
Xpetra::MultiVectorFactory<LO, LO, GO, NO>::Build(quasiRegionRowMap, maxRegPerGID, false); |
| 1010 |
|
| 1011 |
{ // Scope for regionsPerGIDView |
| 1012 |
Array<ArrayRCP<LO> > regionsPerGIDView(maxRegPerGID); |
| 1013 |
for (int regionIdx = 0; regionIdx < maxRegPerGID; ++regionIdx) { |
| 1014 |
regionsPerGIDView[regionIdx] = regionsPerGID->getDataNonConst(regionIdx); |
| 1015 |
} |
| 1016 |
|
| 1017 |
// Initialize all entries to myRank in first column and to -1 in other columns |
| 1018 |
for (LO dofIdx = 0; dofIdx < lNodesPerDir[0] * lNodesPerDir[1] * lNodesPerDir[2] * numDofsPerNode; ++dofIdx) { |
| 1019 |
regionsPerGIDView[0][dofIdx] = myRank; |
| 1020 |
for (int regionIdx = 1; regionIdx < maxRegPerGID; ++regionIdx) { |
| 1021 |
regionsPerGIDView[regionIdx][dofIdx] = -1; |
| 1022 |
} |
| 1023 |
} |
| 1024 |
|
| 1025 |
// Now loop over the sendGIDs array to fill entries with values in sendPIDs |
| 1026 |
LO nodeIdx = 0; |
| 1027 |
for (LO sendIdx = 0; sendIdx < static_cast<LO>(sendPIDs.size()); ++sendIdx) { |
| 1028 |
nodeIdx = nodeMap->getLocalElement(sendGIDs[sendIdx]); |
| 1029 |
for (int dof = 0; dof < numDofsPerNode; ++dof) { |
| 1030 |
LO dofIdx = nodeIdx * numDofsPerNode + dof; |
| 1031 |
for (int regionIdx = 1; regionIdx < maxRegPerGID; ++regionIdx) { |
| 1032 |
if (regionsPerGIDView[regionIdx][dofIdx] == -1) { |
| 1033 |
regionsPerGIDView[regionIdx][dofIdx] = sendPIDs[sendIdx]; |
| 1034 |
break; |
| 1035 |
} |
| 1036 |
} |
| 1037 |
} |
| 1038 |
} |
| 1039 |
} |
| 1040 |
|
| 1041 |
regionsPerGIDWithGhosts->doImport(*regionsPerGID, *rowImport, Xpetra::INSERT); |
| 1042 |
|
| 1043 |
interfaceGIDsMV = Xpetra::MultiVectorFactory<GO, LO, GO, NO>::Build(quasiRegionRowMap, maxRegPerGID, false); |
| 1044 |
interfaceGIDsMV->putScalar(Teuchos::OrdinalTraits<GO>::zero()); |
| 1045 |
const LO numRegionInterfaceLIDs = static_cast<LO>(interfaceRegionLIDs.size()); |
| 1046 |
{ // Scope for interfaceGIDsPerRegion |
| 1047 |
Array<ArrayRCP<LO> > regionsPerGIDWithGhostsData(maxRegPerGID); |
| 1048 |
Array<ArrayRCP<GO> > interfaceGIDsMVData(maxRegPerGID); |
| 1049 |
for (int regionIdx = 0; regionIdx < maxRegPerGID; ++regionIdx) { |
| 1050 |
regionsPerGIDWithGhostsData[regionIdx] = regionsPerGIDWithGhosts->getDataNonConst(regionIdx); |
| 1051 |
interfaceGIDsMVData[regionIdx] = interfaceGIDsMV->getDataNonConst(regionIdx); |
| 1052 |
for (LO idx = 0; idx < numRegionInterfaceLIDs; ++idx) { |
| 1053 |
LO LID = interfaceRegionLIDs[idx]; |
| 1054 |
if (regionsPerGIDWithGhostsData[regionIdx][LID] == myRank) { |
| 1055 |
interfaceGIDsMVData[regionIdx][LID] = regionRowMap->getGlobalElement(LID); |
| 1056 |
} |
| 1057 |
} |
| 1058 |
} |
| 1059 |
} |
| 1060 |
|
| 1061 |
} // MakeRegionPerGIDWithGhosts |
| 1062 |
|
| 1063 |
/*! |
| 1064 |
\brief Extract list of region GIDs of all interface DOFs from the region row map |
| 1065 |
|
| 1066 |
Starting from the known list of \c interfaceRegionLIDs, we know, which entries in the \c regionRowMap |
| 1067 |
refert to interface DOFs, so we can grab them and stick them into the list of \c interfaceRegionGIDs. |
| 1068 |
*/ |
| 1069 |
template <class LocalOrdinal, class GlobalOrdinal, class Node> |
| 1070 |
void ExtractListOfInterfaceRegionGIDs( |
| 1071 |
Teuchos::RCP<const Xpetra::Map<LocalOrdinal, GlobalOrdinal, Node> > regionRowMap, |
| 1072 |
const Teuchos::Array<LocalOrdinal>& interfaceRegionLIDs, Teuchos::Array<GlobalOrdinal>& interfaceRegionGIDs) { |
| 1073 |
interfaceRegionGIDs.resize(interfaceRegionLIDs.size()); |
| 1074 |
for (LocalOrdinal interfaceIdx = 0; interfaceIdx < static_cast<LocalOrdinal>(interfaceRegionLIDs.size()); ++interfaceIdx) { |
| 1075 |
interfaceRegionGIDs[interfaceIdx] = |
| 1076 |
regionRowMap->getGlobalElement(interfaceRegionLIDs[interfaceIdx]); |
| 1077 |
} |
| 1078 |
} // ExtractListOfInterfaceRegionGIDs |
| 1079 |
|
| 1080 |
#endif // MUELU_SETUPREGIONUTILITIES_HPP |