48 void Foam::globalMeshData::initProcAddr()
51 processorPatchIndices_ = -1;
54 processorPatchNeighbours_ = -1;
60 label nNeighbours = 0;
66 processorPatches_[nNeighbours] =
patchi;
67 processorPatchIndices_[
patchi] = nNeighbours++;
70 processorPatches_.
setSize(nNeighbours);
78 forAll(processorPatches_, i)
84 refCast<const processorPolyPatch>
91 toNeighbour << processorPatchIndices_[
patchi];
94 pBufs.finishedSends();
96 forAll(processorPatches_, i)
100 UIPstream fromNeighbour
102 refCast<const processorPolyPatch>
109 fromNeighbour >> processorPatchNeighbours_[
patchi];
115 void Foam::globalMeshData::calcSharedPoints()
const
120 || sharedPointLabelsPtr_.valid()
121 || sharedPointAddrPtr_.valid()
130 globalPoints parallelPoints(mesh_,
false,
true);
134 forAll(parallelPoints.pointPoints(), i)
136 const labelList& pPoints = parallelPoints.pointPoints()[i];
138 parallelPoints.transformedPointPoints()[i];
140 if (pPoints.size()+transPPoints.size() > 0)
147 globalIndex masterNumbering(nMaster);
149 nGlobalPoints_ = masterNumbering.size();
156 labelList master(parallelPoints.map().constructSize(), -1);
157 forAll(parallelPoints.pointPoints(), i)
159 const labelList& pPoints = parallelPoints.pointPoints()[i];
161 parallelPoints.transformedPointPoints()[i];
163 if (pPoints.size()+transPPoints.size() > 0)
165 master[i] = masterNumbering.toGlobal(nMaster);
168 master[pPoints[j]] = master[i];
172 master[transPPoints[j]] = master[i];
190 parallelPoints.map().reverseDistribute
192 parallelPoints.map().constructSize(),
199 forAll(parallelPoints.pointPoints(), i)
207 sharedPointLabelsPtr_.reset(
new labelList(nMaster));
208 labelList& sharedPointLabels = sharedPointLabelsPtr_();
209 sharedPointAddrPtr_.reset(
new labelList(nMaster));
210 labelList& sharedPointAddr = sharedPointAddrPtr_();
213 forAll(parallelPoints.pointPoints(), i)
218 sharedPointLabels[nMaster] = i;
219 sharedPointAddr[nMaster] = master[i];
226 Pout<<
"globalMeshData : nGlobalPoints_:" << nGlobalPoints_ <<
nl
227 <<
"globalMeshData : sharedPointLabels_:"
228 << sharedPointLabelsPtr_().size() <<
nl
229 <<
"globalMeshData : sharedPointAddr_:"
230 << sharedPointAddrPtr_().size() <<
endl;
235 void Foam::globalMeshData::countSharedEdges
237 const EdgeMap<labelList>& procSharedEdges,
238 EdgeMap<label>& globalShared,
245 const edge&
e = iter.key();
249 if (globalFnd == globalShared.end())
252 if (iter().size() == 1)
255 globalShared.insert(
e, -1);
261 globalShared.insert(
e, sharedEdgeI++);
266 if (globalFnd() == -1)
270 globalFnd() = sharedEdgeI++;
277 void Foam::globalMeshData::calcSharedEdges()
const
287 || sharedEdgeLabelsPtr_.valid()
288 || sharedEdgeAddrPtr_.valid()
296 const labelList& sharedPtAddr = sharedPointAddr();
297 const labelList& sharedPtLabels = sharedPointLabels();
301 Map<label> meshToShared(2*sharedPtLabels.size());
304 meshToShared.insert(sharedPtLabels[i], i);
310 EdgeMap<labelList> localShared(2*sharedPtAddr.size());
312 const edgeList& edges = mesh_.edges();
316 const edge&
e = edges[edgeI];
320 if (e0Fnd != meshToShared.end())
324 if (e1Fnd != meshToShared.end())
332 sharedPtAddr[e0Fnd()],
333 sharedPtAddr[e1Fnd()]
337 localShared.find(sharedEdge);
339 if (iter == localShared.end())
342 localShared.insert(sharedEdge,
labelList(1, edgeI));
349 label sz = edgeLabels.size();
350 edgeLabels.setSize(sz+1);
351 edgeLabels[sz] = edgeI;
367 EdgeMap<label> globalShared(nGlobalPoints());
371 label sharedEdgeI = 0;
376 Pout<<
"globalMeshData::calcSharedEdges : Merging in from proc0 : "
377 << localShared.size() <<
endl;
379 countSharedEdges(localShared, globalShared, sharedEdgeI);
393 EdgeMap<labelList> procSharedEdges(fromSlave);
397 Pout<<
"globalMeshData::calcSharedEdges : "
398 <<
"Merging in from proc"
399 <<
Foam::name(slave) <<
" : " << procSharedEdges.size()
402 countSharedEdges(procSharedEdges, globalShared, sharedEdgeI);
410 EdgeMap<label> oldSharedEdges(globalShared);
412 globalShared.clear();
418 globalShared.insert(iter.key(), iter());
423 Pout<<
"globalMeshData::calcSharedEdges : Filtered "
424 << oldSharedEdges.size()
425 <<
" down to " << globalShared.size() <<
endl;
442 toSlave << globalShared;
455 toMaster << localShared;
464 fromMaster >> globalShared;
471 nGlobalEdges_ = globalShared.size();
473 DynamicList<label> dynSharedEdgeLabels(globalShared.size());
474 DynamicList<label> dynSharedEdgeAddr(globalShared.size());
478 const edge&
e = iter.key();
482 if (edgeFnd != globalShared.end())
491 dynSharedEdgeLabels.append(edgeLabels[i]);
494 dynSharedEdgeAddr.append(edgeFnd());
499 sharedEdgeLabelsPtr_.reset(
new labelList());
500 labelList& sharedEdgeLabels = sharedEdgeLabelsPtr_();
501 sharedEdgeLabels.transfer(dynSharedEdgeLabels);
503 sharedEdgeAddrPtr_.reset(
new labelList());
504 labelList& sharedEdgeAddr = sharedEdgeAddrPtr_();
505 sharedEdgeAddr.transfer(dynSharedEdgeAddr);
509 Pout<<
"globalMeshData : nGlobalEdges_:" << nGlobalEdges_ <<
nl
510 <<
"globalMeshData : sharedEdgeLabels:" << sharedEdgeLabels.size()
512 <<
"globalMeshData : sharedEdgeAddr:" << sharedEdgeAddr.size()
518 void Foam::globalMeshData::calcGlobalPointSlaves()
const
522 Pout<<
"globalMeshData::calcGlobalPointSlaves() :"
523 <<
" calculating coupled master to slave point addressing."
528 globalPoints globalData(mesh_, coupledPatch(),
true,
true);
530 globalPointSlavesPtr_.reset
534 move(globalData.pointPoints())
537 globalPointTransformedSlavesPtr_.reset
541 move(globalData.transformedPointPoints())
545 globalPointSlavesMapPtr_.reset
549 move(globalData.map())
555 void Foam::globalMeshData::calcPointConnectivity
557 List<labelPairList>& allPointConnectivity
560 const globalIndexAndTransform&
transforms = globalTransforms();
562 const labelListList& transformedSlaves = globalPointTransformedSlaves();
566 labelPairList myData(globalPointSlavesMap().constructSize());
577 globalPointSlavesMap().distribute(myData);
581 allPointConnectivity.setSize(globalPointSlavesMap().constructSize());
589 const labelList& pSlaves = slaves[pointi];
590 const labelList& pTransformSlaves = transformedSlaves[pointi];
592 if (pSlaves.size()+pTransformSlaves.size())
596 pConnectivity.setSize(1+pSlaves.size()+pTransformSlaves.size());
600 pConnectivity[connI++] = myData[pointi];
604 pConnectivity[connI++] = myData[pSlaves[i]];
607 forAll(pTransformSlaves, i)
610 label transformI = globalPointSlavesMap().whichTransform
615 const labelPair&
n = myData[pTransformSlaves[i]];
629 allPointConnectivity[pSlaves[i]] = pConnectivity;
631 forAll(pTransformSlaves, i)
633 allPointConnectivity[pTransformSlaves[i]] = pConnectivity;
644 if (pConnectivity.size() == 0)
646 pConnectivity.setSize(1, myData[pointi]);
651 globalPointSlavesMap().reverseDistribute
659 void Foam::globalMeshData::calcGlobalPointEdges
662 List<labelPairList>& globalPointPoints
665 const edgeList& edges = coupledPatch().edges();
666 const labelListList& pointEdges = coupledPatch().pointEdges();
667 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
669 const labelListList& transformedSlaves = globalPointTransformedSlaves();
670 const globalIndexAndTransform&
transforms = globalTransforms();
674 globalPointEdges.setSize(globalPointSlavesMap().constructSize());
675 globalPointPoints.setSize(globalPointSlavesMap().constructSize());
676 forAll(pointEdges, pointi)
678 const labelList& pEdges = pointEdges[pointi];
679 labelList& globalPEdges = globalPointEdges[pointi];
680 globalPEdges.
setSize(pEdges.size());
683 globalPEdges[i] = globalEdgeNumbers.toGlobal(pEdges[i]);
687 globalPPoints.setSize(pEdges.size());
690 label otherPointi = edges[pEdges[i]].otherVertex(pointi);
701 globalPointSlavesMap().distribute(globalPointEdges);
702 globalPointSlavesMap().distribute(globalPointPoints);
706 const labelList& pSlaves = slaves[pointi];
707 const labelList& pTransformSlaves = transformedSlaves[pointi];
712 n += globalPointEdges[pSlaves[i]].size();
714 forAll(pTransformSlaves, i)
716 n += globalPointEdges[pTransformSlaves[i]].size();
721 labelList& globalPEdges = globalPointEdges[pointi];
722 label sz = globalPEdges.size();
723 globalPEdges.setSize(sz+
n);
726 const labelList& otherData = globalPointEdges[pSlaves[i]];
729 globalPEdges[sz++] = otherData[j];
732 forAll(pTransformSlaves, i)
735 globalPointEdges[pTransformSlaves[i]];
738 globalPEdges[sz++] = otherData[j];
745 globalPointEdges[pSlaves[i]] = globalPEdges;
747 forAll(pTransformSlaves, i)
749 globalPointEdges[pTransformSlaves[i]] = globalPEdges;
757 label sz = globalPPoints.size();
758 globalPPoints.setSize(sz +
n);
763 const labelPairList& otherData = globalPointPoints[pSlaves[i]];
766 globalPPoints[sz++] = otherData[j];
770 forAll(pTransformSlaves, i)
773 label transformI = globalPointSlavesMap().whichTransform
779 globalPointPoints[pTransformSlaves[i]];
798 globalPointPoints[pSlaves[i]] = globalPPoints;
800 forAll(pTransformSlaves, i)
802 globalPointPoints[pTransformSlaves[i]] = globalPPoints;
807 globalPointSlavesMap().reverseDistribute
813 globalPointSlavesMap().reverseDistribute
825 const label localPoint
828 const globalIndexAndTransform&
transforms = globalTransforms();
833 label remoteTransformI = -1;
834 label localTransformI = -1;
843 localTransformI = transformI;
848 if (proci == remoteProci && pointi == remoteIndex)
850 remoteTransformI = transformI;
858 if (remoteTransformI == -1 || localTransformI == -1)
861 <<
"Problem. Cannot find " << remotePoint
862 <<
" or " << localPoint <<
" "
863 << coupledPatch().localPoints()[localPoint]
866 <<
"remoteTransformI:" << remoteTransformI <<
endl
867 <<
"localTransformI:" << localTransformI
879 void Foam::globalMeshData::calcGlobalEdgeSlaves()
const
883 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :"
884 <<
" calculating coupled master to slave edge addressing." <<
endl;
887 const edgeList& edges = coupledPatch().edges();
888 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
889 const globalIndexAndTransform&
transforms = globalTransforms();
902 List<labelPairList> allPointConnectivity;
903 calcPointConnectivity(allPointConnectivity);
909 List<labelPairList> globalPointPoints;
910 calcGlobalPointEdges(globalPointEdges, globalPointPoints);
923 List<labelPairList> allEdgeConnectivity(edges.size());
927 const edge&
e = edges[edgeI];
928 const labelList& pEdges0 = globalPointEdges[
e[0]];
930 const labelList& pEdges1 = globalPointEdges[
e[1]];
934 DynamicList<labelPair> eEdges(2);
952 pEdges0[i] == pEdges1[j]
953 && pEdges0[i] != globalEdgeNumbers.toGlobal(edgeI)
965 label transform0 = findTransform
967 allPointConnectivity[
e[0]],
971 label transform1 = findTransform
973 allPointConnectivity[
e[1]],
978 if (transform0 == transform1)
980 label proci = globalEdgeNumbers.whichProcID(pEdges0[i]);
986 globalEdgeNumbers.toLocal(proci, pEdges0[i]),
995 allEdgeConnectivity[edgeI].transfer(eEdges);
998 allEdgeConnectivity[edgeI],
1007 globalEdgeSlavesPtr_.reset(
new labelListList(edges.size()));
1009 List<labelPairList> transformedEdges(edges.size());
1010 forAll(allEdgeConnectivity, edgeI)
1013 if (edgeInfo.size() >= 2)
1015 const labelPair& masterInfo = edgeInfo[0];
1028 labelList& eEdges = globalEdgeSlaves[edgeI];
1029 eEdges.
setSize(edgeInfo.size()-1);
1032 trafoEEdges.setSize(edgeInfo.size()-1);
1034 label nonTransformI = 0;
1035 label transformI = 0;
1037 for (
label i = 1; i < edgeInfo.size(); i++)
1049 eEdges[nonTransformI++] = globalEdgeNumbers.toGlobal
1057 trafoEEdges[transformI++] = info;
1061 eEdges.setSize(nonTransformI);
1062 trafoEEdges.setSize(transformI);
1072 globalEdgeSlavesMapPtr_.reset
1081 globalEdgeTransformedSlavesPtr_(),
1090 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :"
1091 <<
" coupled edges:" << edges.size()
1092 <<
" additional coupled edges:"
1093 << globalEdgeSlavesMapPtr_().constructSize() - edges.size()
1099 void Foam::globalMeshData::calcGlobalEdgeOrientation()
const
1103 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :"
1104 <<
" calculating edge orientation w.r.t. master edge." <<
endl;
1108 const distributionMap& pointsMap = globalPointSlavesMap();
1109 const globalIndex& globalPoints = globalPointNumbering();
1112 for (
label pointi = 0; pointi < coupledPatch().nPoints(); pointi++)
1114 masterPoint[pointi] = globalPoints.toGlobal(pointi);
1120 globalPointSlaves(),
1121 globalPointTransformedSlaves(),
1129 globalEdgeOrientationPtr_.reset
1131 new PackedBoolList(coupledPatch().nEdges())
1133 PackedBoolList& globalEdgeOrientation = globalEdgeOrientationPtr_();
1135 forAll(coupledPatch().edges(), edgeI)
1137 const edge&
e = coupledPatch().edges()[edgeI];
1138 globalEdgeOrientation[edgeI] = masterPoint[
e[0]] < masterPoint[
e[1]];
1143 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :"
1144 <<
" finished calculating edge orientation." <<
endl;
1149 void Foam::globalMeshData::calcPointBoundaryFaces
1154 const polyBoundaryMesh&
bMesh = mesh_.boundaryMesh();
1155 const Map<label>& meshPointMap = coupledPatch().meshPointMap();
1169 const face&
f = pp[i];
1177 if (iter != meshPointMap.end())
1179 nPointFaces[iter()]++;
1189 pointBoundaryFaces.setSize(coupledPatch().
nPoints());
1190 forAll(nPointFaces, pointi)
1192 pointBoundaryFaces[pointi].setSize(nPointFaces[pointi]);
1207 const face&
f = pp[i];
1214 if (iter != meshPointMap.end())
1217 pp.start() + i - mesh_.nInternalFaces();
1218 pointBoundaryFaces[iter()][nPointFaces[iter()]++] =
1228 void Foam::globalMeshData::calcGlobalPointBoundaryFaces()
const
1232 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :"
1233 <<
" calculating coupled point to boundary face addressing."
1239 calcPointBoundaryFaces(pointBoundaryFaces);
1243 globalBoundaryFaceNumberingPtr_.reset
1245 new globalIndex(mesh_.nFaces()-mesh_.nInternalFaces())
1247 globalIndex& globalIndices = globalBoundaryFaceNumberingPtr_();
1251 globalPointBoundaryFacesPtr_.reset
1255 labelListList& globalPointBoundaryFaces = globalPointBoundaryFacesPtr_();
1257 forAll(pointBoundaryFaces, pointi)
1259 const labelList& bFaces = pointBoundaryFaces[pointi];
1260 labelList& globalFaces = globalPointBoundaryFaces[pointi];
1261 globalFaces.
setSize(bFaces.size());
1264 globalFaces[i] = globalIndices.toGlobal(bFaces[i]);
1270 globalPointSlavesMap().distribute
1272 globalPointBoundaryFaces,
1281 globalPointTransformedSlaves();
1282 const globalIndexAndTransform&
transforms = globalTransforms();
1286 List<labelPairList> transformedFaces(pointSlaves.size());
1289 forAll(pointSlaves, pointi)
1291 const labelList& slaves = pointSlaves[pointi];
1292 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1294 if (slaves.size() > 0)
1296 labelList& myBFaces = globalPointBoundaryFaces[pointi];
1297 label sz = myBFaces.size();
1303 n += globalPointBoundaryFaces[slaves[i]].size();
1306 myBFaces.setSize(sz+
n);
1311 globalPointBoundaryFaces[slaves[i]];
1318 label slave = slaveBFaces[j];
1319 if (
findIndex(SubList<label>(myBFaces, sz), slave) == -1)
1321 myBFaces[
n++] = slave;
1325 myBFaces.setSize(
n);
1329 if (transformedSlaves.size() > 0)
1331 const labelList& untrafoFaces = globalPointBoundaryFaces[pointi];
1334 label sz = myBFaces.size();
1338 forAll(transformedSlaves, i)
1340 n += globalPointBoundaryFaces[transformedSlaves[i]].size();
1343 myBFaces.setSize(sz+
n);
1345 forAll(transformedSlaves, i)
1347 label transformI = globalPointSlavesMap().whichTransform
1349 transformedSlaves[i]
1353 globalPointBoundaryFaces[transformedSlaves[i]];
1357 label slave = slaveBFaces[j];
1359 if (
findIndex(untrafoFaces, slave)== -1)
1361 label proci = globalIndices.whichProcID(slave);
1362 label facei = globalIndices.toLocal(proci, slave);
1373 myBFaces.setSize(
n);
1377 if (slaves.size() + transformedSlaves.size() == 0)
1379 globalPointBoundaryFaces[pointi].clear();
1386 globalPointTransformedBoundaryFacesPtr_.reset
1391 globalPointBoundaryFacesMapPtr_.reset
1396 globalPointBoundaryFaces,
1400 globalPointTransformedBoundaryFacesPtr_(),
1405 globalPointBoundaryFaces.setSize(coupledPatch().
nPoints());
1406 globalPointTransformedBoundaryFacesPtr_().setSize(coupledPatch().
nPoints());
1410 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :"
1411 <<
" coupled points:" << coupledPatch().nPoints()
1412 <<
" local boundary faces:" << globalIndices.localSize()
1413 <<
" additional coupled faces:"
1414 << globalPointBoundaryFacesMapPtr_().constructSize()
1415 - globalIndices.localSize()
1421 void Foam::globalMeshData::calcGlobalPointBoundaryCells()
const
1425 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :"
1426 <<
" calculating coupled point to boundary cell addressing."
1434 Map<label> meshCellMap(4*coupledPatch().
nPoints());
1435 DynamicList<label> cellMap(meshCellMap.size());
1440 forAll(coupledPatch().meshPoints(), pointi)
1442 label meshPointi = coupledPatch().meshPoints()[pointi];
1443 const labelList& pCells = mesh_.pointCells(meshPointi);
1445 labelList& bCells = pointBoundaryCells[pointi];
1446 bCells.
setSize(pCells.size());
1450 label celli = pCells[i];
1453 if (fnd != meshCellMap.end())
1459 meshCellMap.insert(celli, bCelli);
1460 cellMap.append(celli);
1468 boundaryCellsPtr_.reset(
new labelList());
1469 labelList& boundaryCells = boundaryCellsPtr_();
1470 boundaryCells.transfer(cellMap.shrink());
1476 globalBoundaryCellNumberingPtr_.reset
1478 new globalIndex(boundaryCells.size())
1480 globalIndex& globalIndices = globalBoundaryCellNumberingPtr_();
1483 globalPointBoundaryCellsPtr_.reset
1487 labelListList& globalPointBoundaryCells = globalPointBoundaryCellsPtr_();
1489 forAll(pointBoundaryCells, pointi)
1491 const labelList& pCells = pointBoundaryCells[pointi];
1492 labelList& globalCells = globalPointBoundaryCells[pointi];
1493 globalCells.
setSize(pCells.size());
1496 globalCells[i] = globalIndices.toGlobal(pCells[i]);
1502 globalPointSlavesMap().distribute
1504 globalPointBoundaryCells,
1512 globalPointTransformedSlaves();
1513 const globalIndexAndTransform&
transforms = globalTransforms();
1515 List<labelPairList> transformedCells(pointSlaves.size());
1518 forAll(pointSlaves, pointi)
1520 const labelList& slaves = pointSlaves[pointi];
1521 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1523 if (slaves.size() > 0)
1525 labelList& myBCells = globalPointBoundaryCells[pointi];
1526 label sz = myBCells.size();
1532 n += globalPointBoundaryCells[slaves[i]].size();
1535 myBCells.setSize(sz+
n);
1540 globalPointBoundaryCells[slaves[i]];
1547 label slave = slaveBCells[j];
1548 if (
findIndex(SubList<label>(myBCells, sz), slave) == -1)
1550 myBCells[
n++] = slave;
1554 myBCells.setSize(
n);
1558 if (transformedSlaves.size() > 0)
1560 const labelList& untrafoCells = globalPointBoundaryCells[pointi];
1563 label sz = myBCells.size();
1567 forAll(transformedSlaves, i)
1569 n += globalPointBoundaryCells[transformedSlaves[i]].size();
1572 myBCells.setSize(sz+
n);
1574 forAll(transformedSlaves, i)
1576 label transformI = globalPointSlavesMap().whichTransform
1578 transformedSlaves[i]
1582 globalPointBoundaryCells[transformedSlaves[i]];
1586 label slave = slaveBCells[j];
1589 if (
findIndex(untrafoCells, slave)== -1)
1591 label proci = globalIndices.whichProcID(slave);
1592 label celli = globalIndices.toLocal(proci, slave);
1602 myBCells.setSize(
n);
1605 if (slaves.size() + transformedSlaves.size() == 0)
1607 globalPointBoundaryCells[pointi].clear();
1614 globalPointTransformedBoundaryCellsPtr_.reset
1619 globalPointBoundaryCellsMapPtr_.reset
1624 globalPointBoundaryCells,
1628 globalPointTransformedBoundaryCellsPtr_(),
1633 globalPointBoundaryCells.setSize(coupledPatch().
nPoints());
1634 globalPointTransformedBoundaryCellsPtr_().setSize(coupledPatch().
nPoints());
1638 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :"
1639 <<
" coupled points:" << coupledPatch().nPoints()
1640 <<
" local boundary cells:" << globalIndices.localSize()
1641 <<
" additional coupled cells:"
1642 << globalPointBoundaryCellsMapPtr_().constructSize()
1643 - globalIndices.localSize()
1649 void Foam::globalMeshData::calcGlobalCoPointSlaves()
const
1653 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :"
1654 <<
" calculating coupled master to collocated"
1655 <<
" slave point addressing." <<
endl;
1659 globalPoints globalData(mesh_, coupledPatch(),
true,
false);
1661 globalCoPointSlavesPtr_.reset
1665 move(globalData.pointPoints())
1668 globalCoPointSlavesMapPtr_.reset
1672 move(globalData.map())
1678 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :"
1679 <<
" finished calculating coupled master to collocated"
1680 <<
" slave point addressing." <<
endl;
1693 processorTopology_(mesh.boundaryMesh(),
UPstream::worldComm),
1694 processorPatches_(0),
1695 processorPatchIndices_(0),
1696 processorPatchNeighbours_(0),
1698 sharedPointLabelsPtr_(nullptr),
1699 sharedPointAddrPtr_(nullptr),
1700 sharedPointGlobalLabelsPtr_(nullptr),
1702 sharedEdgeLabelsPtr_(nullptr),
1703 sharedEdgeAddrPtr_(nullptr)
1720 nGlobalPoints_ = -1;
1721 sharedPointLabelsPtr_.clear();
1722 sharedPointAddrPtr_.clear();
1723 sharedPointGlobalLabelsPtr_.clear();
1727 sharedEdgeLabelsPtr_.clear();
1728 sharedEdgeAddrPtr_.clear();
1731 coupledPatchPtr_.clear();
1732 coupledPatchMeshEdgesPtr_.clear();
1733 coupledPatchMeshEdgeMapPtr_.clear();
1734 globalTransformsPtr_.clear();
1737 globalPointNumberingPtr_.clear();
1738 globalPointSlavesPtr_.clear();
1739 globalPointTransformedSlavesPtr_.clear();
1740 globalPointSlavesMapPtr_.clear();
1742 globalEdgeNumberingPtr_.clear();
1743 globalEdgeSlavesPtr_.clear();
1744 globalEdgeTransformedSlavesPtr_.clear();
1745 globalEdgeOrientationPtr_.clear();
1746 globalEdgeSlavesMapPtr_.clear();
1749 globalBoundaryFaceNumberingPtr_.clear();
1750 globalPointBoundaryFacesPtr_.clear();
1751 globalPointTransformedBoundaryFacesPtr_.clear();
1752 globalPointBoundaryFacesMapPtr_.clear();
1755 boundaryCellsPtr_.clear();
1756 globalBoundaryCellNumberingPtr_.clear();
1757 globalPointBoundaryCellsPtr_.clear();
1758 globalPointTransformedBoundaryCellsPtr_.clear();
1759 globalPointBoundaryCellsMapPtr_.clear();
1762 globalCoPointSlavesPtr_.clear();
1763 globalCoPointSlavesMapPtr_.clear();
1771 if (!sharedPointGlobalLabelsPtr_.valid())
1773 sharedPointGlobalLabelsPtr_.reset
1775 new labelList(sharedPointLabels().size())
1777 labelList& sharedPointGlobalLabels = sharedPointGlobalLabelsPtr_();
1781 "pointProcAddressing",
1782 mesh_.facesInstance()/mesh_.meshSubDir,
1791 Pout<<
"globalMeshData::sharedPointGlobalLabels : "
1792 <<
"Reading pointProcAddressing" <<
endl;
1804 sharedPointGlobalLabels[i] = pointProcAddressing[pointi];
1809 Pout<<
"globalMeshData::sharedPointGlobalLabels :"
1810 <<
" Setting pointProcAddressing to -1" <<
endl;
1812 sharedPointGlobalLabels = -1;
1815 return sharedPointGlobalLabelsPtr_();
1825 const labelList& pointAddr = sharedPointAddr();
1834 label sharedPointi = pointAddr[i];
1836 sharedPoints[sharedPointi] = mesh_.points()[
pointLabels[i]];
1851 fromSlave >> nbrSharedPointAddr >> nbrSharedPoints;
1853 forAll(nbrSharedPointAddr, i)
1855 label sharedPointi = nbrSharedPointAddr[i];
1857 sharedPoints[sharedPointi] = nbrSharedPoints[i];
1875 toSlave << sharedPoints;
1900 fromMaster >> sharedPoints;
1904 return sharedPoints;
1910 if (nGlobalPoints_ == -1)
1914 return nGlobalPoints_;
1920 if (!sharedPointLabelsPtr_.valid())
1924 return sharedPointLabelsPtr_();
1930 if (!sharedPointAddrPtr_.valid())
1934 return sharedPointAddrPtr_();
1940 if (nGlobalEdges_ == -1)
1944 return nGlobalEdges_;
1950 if (!sharedEdgeLabelsPtr_.valid())
1954 return sharedEdgeLabelsPtr_();
1960 if (!sharedEdgeAddrPtr_.valid())
1964 return sharedEdgeAddrPtr_();
1970 if (!coupledPatchPtr_.valid())
1982 nCoupled += pp.
size();
1998 coupledFaces[nCoupled++] = facei++;
2003 coupledPatchPtr_.reset
2018 Pout<<
"globalMeshData::coupledPatch() :"
2019 <<
" constructed coupled faces patch:"
2020 <<
" faces:" << coupledPatchPtr_().size()
2021 <<
" points:" << coupledPatchPtr_().nPoints()
2025 return coupledPatchPtr_();
2031 if (!coupledPatchMeshEdgesPtr_.valid())
2033 coupledPatchMeshEdgesPtr_.reset
2037 coupledPatch().meshEdges
2045 return coupledPatchMeshEdgesPtr_();
2052 if (!coupledPatchMeshEdgeMapPtr_.valid())
2056 coupledPatchMeshEdgeMapPtr_.reset(
new Map<label>(2*
me.size()));
2057 Map<label>& em = coupledPatchMeshEdgeMapPtr_();
2064 return coupledPatchMeshEdgeMapPtr_();
2070 if (!globalPointNumberingPtr_.valid())
2072 globalPointNumberingPtr_.reset
2077 return globalPointNumberingPtr_();
2084 if (!globalTransformsPtr_.valid())
2088 return globalTransformsPtr_();
2094 if (!globalPointSlavesPtr_.valid())
2096 calcGlobalPointSlaves();
2098 return globalPointSlavesPtr_();
2105 if (!globalPointTransformedSlavesPtr_.valid())
2107 calcGlobalPointSlaves();
2109 return globalPointTransformedSlavesPtr_();
2115 if (!globalPointSlavesMapPtr_.valid())
2117 calcGlobalPointSlaves();
2119 return globalPointSlavesMapPtr_();
2125 if (!globalEdgeNumberingPtr_.valid())
2127 globalEdgeNumberingPtr_.reset
2132 return globalEdgeNumberingPtr_();
2138 if (!globalEdgeSlavesPtr_.valid())
2140 calcGlobalEdgeSlaves();
2142 return globalEdgeSlavesPtr_();
2149 if (!globalEdgeTransformedSlavesPtr_.valid())
2151 calcGlobalEdgeSlaves();
2153 return globalEdgeTransformedSlavesPtr_();
2159 if (!globalEdgeOrientationPtr_.valid())
2161 calcGlobalEdgeOrientation();
2163 return globalEdgeOrientationPtr_();
2169 if (!globalEdgeSlavesMapPtr_.valid())
2171 calcGlobalEdgeSlaves();
2173 return globalEdgeSlavesMapPtr_();
2180 if (!globalBoundaryFaceNumberingPtr_.valid())
2182 calcGlobalPointBoundaryFaces();
2184 return globalBoundaryFaceNumberingPtr_();
2191 if (!globalPointBoundaryFacesPtr_.valid())
2193 calcGlobalPointBoundaryFaces();
2195 return globalPointBoundaryFacesPtr_();
2202 if (!globalPointTransformedBoundaryFacesPtr_.valid())
2204 calcGlobalPointBoundaryFaces();
2206 return globalPointTransformedBoundaryFacesPtr_();
2213 if (!globalPointBoundaryFacesMapPtr_.valid())
2215 calcGlobalPointBoundaryFaces();
2217 return globalPointBoundaryFacesMapPtr_();
2223 if (!boundaryCellsPtr_.valid())
2225 calcGlobalPointBoundaryCells();
2227 return boundaryCellsPtr_();
2234 if (!globalBoundaryCellNumberingPtr_.valid())
2236 calcGlobalPointBoundaryCells();
2238 return globalBoundaryCellNumberingPtr_();
2245 if (!globalPointBoundaryCellsPtr_.valid())
2247 calcGlobalPointBoundaryCells();
2249 return globalPointBoundaryCellsPtr_();
2256 if (!globalPointTransformedBoundaryCellsPtr_.valid())
2258 calcGlobalPointBoundaryCells();
2260 return globalPointTransformedBoundaryCellsPtr_();
2267 if (!globalPointBoundaryCellsMapPtr_.valid())
2269 calcGlobalPointBoundaryCells();
2271 return globalPointBoundaryCellsMapPtr_();
2277 if (!globalCoPointSlavesPtr_.valid())
2279 calcGlobalCoPointSlaves();
2281 return globalCoPointSlavesPtr_();
2288 if (!globalCoPointSlavesMapPtr_.valid())
2290 calcGlobalCoPointSlaves();
2292 return globalCoPointSlavesMapPtr_();
2303 const globalIndex& globalCoupledPoints = globalPointNumbering();
2315 forAll(masterGlobalPoint, pointi)
2317 const labelList& slavePoints = pointSlaves[pointi];
2318 if (slavePoints.
size() > 0)
2320 masterGlobalPoint[pointi] = globalCoupledPoints.
toGlobal(pointi);
2338 forAll(pointSlaves, pointi)
2340 if (masterGlobalPoint[pointi] == -1)
2347 masterGlobalPoint[pointi]
2348 == globalCoupledPoints.
toGlobal(pointi)
2361 label myUniquePoints = mesh_.nPoints() - cpp.
nPoints() + nMaster;
2375 pointToGlobal.
setSize(mesh_.nPoints());
2377 uniquePoints.
setSize(myUniquePoints);
2380 forAll(isMaster, meshPointi)
2382 if (isMaster[meshPointi])
2384 pointToGlobal[meshPointi] = globalPointsPtr().toGlobal(nMaster);
2385 uniquePoints[nMaster] = meshPointi;
2395 forAll(pointSlaves, pointi)
2397 const labelList& slaves = pointSlaves[pointi];
2399 if (slaves.
size() > 0)
2403 masterToGlobal[pointi] = pointToGlobal[meshPointi];
2406 masterToGlobal[slaves[i]] = masterToGlobal[pointi];
2415 forAll(pointSlaves, pointi)
2419 if (!isMaster[meshPointi])
2421 pointToGlobal[meshPointi] = masterToGlobal[pointi];
2426 return globalPointsPtr;
2464 forAll(meshPoints, patchPointi)
2466 label meshPointi = meshPoints[patchPointi];
2472 patchToCoupled[patchPointi] = iter();
2473 coupledToGlobalPatch[iter()] = globalPPoints.
toGlobal(patchPointi);
2486 pointSlavesMap.
distribute(coupledToGlobalPatch);
2487 forAll(pointSlaves, coupledPointi)
2489 const labelList& slaves = pointSlaves[coupledPointi];
2491 if (slaves.
size() > 0)
2495 if (coupledToGlobalPatch[coupledPointi] != -1)
2498 masterI = coupledToGlobalPatch[coupledPointi];
2505 label slavePp = coupledToGlobalPatch[slaves[i]];
2506 if (slavePp != -1 && slavePp < masterI)
2516 coupledToGlobalPatch[coupledPointi] = masterI;
2519 coupledToGlobalPatch[slaves[i]] = masterI;
2534 forAll(meshPoints, patchPointi)
2536 if (patchToCoupled[patchPointi] == -1)
2542 label coupledPointi = patchToCoupled[patchPointi];
2545 globalPPoints.
toGlobal(patchPointi)
2546 == coupledToGlobalPatch[coupledPointi]
2563 uniqueMeshPoints.
setSize(nMasters);
2570 forAll(meshPoints, patchPointi)
2572 if (patchToCoupled[patchPointi] == -1)
2574 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2578 label coupledPointi = patchToCoupled[patchPointi];
2581 globalPPoints.
toGlobal(patchPointi)
2582 == coupledToGlobalPatch[coupledPointi]
2585 globalMaster[coupledPointi] =
2586 globalPointsPtr().toGlobal(nMasters);
2587 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2607 forAll(meshPoints, patchPointi)
2609 if (patchToCoupled[patchPointi] == -1)
2611 pointToGlobal[patchPointi] = globalPointsPtr().toGlobal(nMasters++);
2615 label coupledPointi = patchToCoupled[patchPointi];
2616 pointToGlobal[patchPointi] = globalMaster[coupledPointi];
2620 globalPPoints.
toGlobal(patchPointi)
2621 == coupledToGlobalPatch[coupledPointi]
2629 return globalPointsPtr;
2650 scalar tolDim = matchTol_ * mesh_.bounds().mag();
2654 Pout<<
"globalMeshData : merge dist:" << tolDim <<
endl;
2677 Pout<<
"globalMeshData : nTotalFaces_:" << nTotalFaces_ <<
endl;
2690 Pout<<
"globalMeshData : nTotalCells_:" << nTotalCells_ <<
endl;
2705 Pout<<
"globalMeshData : nTotalPoints_:" << nTotalPoints_ <<
endl;
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
friend class iterator
Declare friendship with the iterator.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
friend class const_iterator
Declare friendship with the const_iterator.
Input inter-processor communications stream.
A List with indirect addressing.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
Output inter-processor communications stream.
label nPoints() const
Return number of points supporting patch faces.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
A List with indirect addressing.
label size() const
Return the number of elements in the UList.
Inter-processor communications stream.
static int masterNo()
Process index of the master.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
static bool master(const label communicator=0)
Am I the master process.
static int lastSlave(const label communicator=0)
Process index of last slave.
static label worldComm
Default communicator (all processors)
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
static int firstSlave()
Process index of first slave.
static bool & parRun()
Is this a parallel run?
static int & msgType()
Message tag of standard messages.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
label size() const
Return the number of elements in the UPtrList.
label constructSize() const
Constructed data size.
Class containing processor-to-processor mapping information.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label toGlobal(const label i) const
From local to global.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
void movePoints(const pointField &newPoints)
Update for moving points.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
void topoChange()
Change global mesh data given a topological change. Does a.
const labelListList & globalPointTransformedBoundaryCells() const
globalMeshData(const polyMesh &mesh)
Construct from mesh, derive rest (does parallel communication!)
const labelListList & globalEdgeTransformedSlaves() const
const Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
const labelList & sharedEdgeAddr() const
Return addressing into the complete globally shared edge.
static const Foam::scalar matchTol_
Geometric tolerance (fraction of bounding box)
label nGlobalPoints() const
Return number of globally shared points.
const distributionMap & globalPointBoundaryFacesMap() const
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const labelListList & globalPointTransformedBoundaryFaces() const
const labelList & boundaryCells() const
From boundary cell to mesh cell.
const labelListList & globalPointBoundaryFaces() const
const globalIndex & globalBoundaryFaceNumbering() const
Numbering of boundary faces is face-mesh.nInternalFaces()
const distributionMap & globalEdgeSlavesMap() const
const distributionMap & globalPointBoundaryCellsMap() const
const distributionMap & globalPointSlavesMap() const
label nGlobalEdges() const
Return number of globally shared edges. Demand-driven.
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
~globalMeshData()
Destructor.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
const labelList & sharedPointGlobalLabels() const
Return shared point global labels. Tries to read.
const labelListList & globalCoPointSlaves() const
const distributionMap & globalCoPointSlavesMap() const
pointField sharedPoints() const
Collect coordinates of shared points on all processors.
const globalIndex & globalBoundaryCellNumbering() const
Numbering of boundary cells is according to boundaryCells()
const labelListList & globalPointSlaves() const
const globalIndex & globalEdgeNumbering() const
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
const labelList & sharedEdgeLabels() const
Return indices of local edges that are globally shared.
const labelListList & globalPointTransformedSlaves() const
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
const labelListList & globalPointBoundaryCells() const
void clearOut()
Remove all demand driven data.
const labelListList & globalEdgeSlaves() const
const globalIndex & globalPointNumbering() const
Numbering of coupled points is according to coupledPatch.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
A patch is a list of labels that address the faces in the global face list.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label start() const
Return start label of this patch in the polyMesh face list.
Templated form of IOobject providing type information for file reading and header type checking.
bool headerOk()
Read header (uses typeGlobalFile to find file) and check.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const polyBoundaryMesh & bMesh
const dimensionedScalar me
Electron mass.
List< labelPair > labelPairList
List of labelPairs.
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
errorManip< error > abort(error &err)
List< labelList > labelListList
A List of labelList.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
dimensionSet transform(const dimensionSet &)
defineTypeNameAndDebug(combustionModel, 0)
static bool less(const vector &x, const vector &y)
To compare normals.
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static const label labelMax
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
labelList pointLabels(nPoints, -1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable