49 void Foam::globalMeshData::initProcAddr()
51 processorPatchIndices_.setSize(mesh_.boundaryMesh().size());
52 processorPatchIndices_ = -1;
54 processorPatchNeighbours_.setSize(mesh_.boundaryMesh().size());
55 processorPatchNeighbours_ = -1;
59 processorPatches_.setSize(mesh_.boundaryMesh().size());
61 label nNeighbours = 0;
65 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
67 processorPatches_[nNeighbours] =
patchi;
68 processorPatchIndices_[
patchi] = nNeighbours++;
71 processorPatches_.setSize(nNeighbours);
79 forAll(processorPatches_, i)
81 label patchi = processorPatches_[i];
85 refCast<const processorPolyPatch>
87 mesh_.boundaryMesh()[
patchi]
92 toNeighbour << processorPatchIndices_[
patchi];
95 pBufs.finishedSends();
97 forAll(processorPatches_, i)
99 label patchi = processorPatches_[i];
101 UIPstream fromNeighbour
103 refCast<const processorPolyPatch>
105 mesh_.boundaryMesh()[
patchi]
110 fromNeighbour >> processorPatchNeighbours_[
patchi];
116 void Foam::globalMeshData::calcSharedPoints()
const 121 || sharedPointLabelsPtr_.valid()
122 || sharedPointAddrPtr_.valid()
131 globalPoints parallelPoints(mesh_,
false,
true);
135 forAll(parallelPoints.pointPoints(), i)
137 const labelList& pPoints = parallelPoints.pointPoints()[i];
139 parallelPoints.transformedPointPoints()[i];
141 if (pPoints.size()+transPPoints.size() > 0)
148 globalIndex masterNumbering(nMaster);
150 nGlobalPoints_ = masterNumbering.size();
157 labelList master(parallelPoints.map().constructSize(), -1);
158 forAll(parallelPoints.pointPoints(), i)
160 const labelList& pPoints = parallelPoints.pointPoints()[i];
162 parallelPoints.transformedPointPoints()[i];
164 if (pPoints.size()+transPPoints.size() > 0)
166 master[i] = masterNumbering.toGlobal(nMaster);
169 master[pPoints[j]] = master[i];
173 master[transPPoints[j]] = master[i];
191 parallelPoints.map().reverseDistribute
193 parallelPoints.map().constructSize(),
200 forAll(parallelPoints.pointPoints(), i)
208 sharedPointLabelsPtr_.reset(
new labelList(nMaster));
209 labelList& sharedPointLabels = sharedPointLabelsPtr_();
210 sharedPointAddrPtr_.reset(
new labelList(nMaster));
211 labelList& sharedPointAddr = sharedPointAddrPtr_();
214 forAll(parallelPoints.pointPoints(), i)
219 sharedPointLabels[nMaster] = i;
220 sharedPointAddr[nMaster] = master[i];
227 Pout<<
"globalMeshData : nGlobalPoints_:" << nGlobalPoints_ <<
nl 228 <<
"globalMeshData : sharedPointLabels_:" 229 << sharedPointLabelsPtr_().size() <<
nl 230 <<
"globalMeshData : sharedPointAddr_:" 231 << sharedPointAddrPtr_().size() <<
endl;
236 void Foam::globalMeshData::countSharedEdges
238 const EdgeMap<labelList>& procSharedEdges,
239 EdgeMap<label>& globalShared,
246 const edge& e = iter.key();
250 if (globalFnd == globalShared.end())
253 if (iter().size() == 1)
256 globalShared.insert(e, -1);
262 globalShared.insert(e, sharedEdgeI++);
267 if (globalFnd() == -1)
271 globalFnd() = sharedEdgeI++;
278 void Foam::globalMeshData::calcSharedEdges()
const 288 || sharedEdgeLabelsPtr_.valid()
289 || sharedEdgeAddrPtr_.valid()
297 const labelList& sharedPtAddr = sharedPointAddr();
298 const labelList& sharedPtLabels = sharedPointLabels();
302 Map<label> meshToShared(2*sharedPtLabels.size());
305 meshToShared.insert(sharedPtLabels[i], i);
311 EdgeMap<labelList> localShared(2*sharedPtAddr.size());
313 const edgeList& edges = mesh_.edges();
317 const edge& e = edges[edgeI];
321 if (e0Fnd != meshToShared.end())
325 if (e1Fnd != meshToShared.end())
333 sharedPtAddr[e0Fnd()],
334 sharedPtAddr[e1Fnd()]
338 localShared.find(sharedEdge);
340 if (iter == localShared.end())
343 localShared.insert(sharedEdge,
labelList(1, edgeI));
350 label sz = edgeLabels.size();
351 edgeLabels.setSize(sz+1);
352 edgeLabels[sz] = edgeI;
368 EdgeMap<label> globalShared(nGlobalPoints());
372 label sharedEdgeI = 0;
377 Pout<<
"globalMeshData::calcSharedEdges : Merging in from proc0 : " 378 << localShared.size() <<
endl;
380 countSharedEdges(localShared, globalShared, sharedEdgeI);
394 EdgeMap<labelList> procSharedEdges(fromSlave);
398 Pout<<
"globalMeshData::calcSharedEdges : " 399 <<
"Merging in from proc" 400 <<
Foam::name(slave) <<
" : " << procSharedEdges.size()
403 countSharedEdges(procSharedEdges, globalShared, sharedEdgeI);
411 EdgeMap<label> oldSharedEdges(globalShared);
413 globalShared.clear();
419 globalShared.insert(iter.key(), iter());
424 Pout<<
"globalMeshData::calcSharedEdges : Filtered " 425 << oldSharedEdges.size()
426 <<
" down to " << globalShared.size() <<
endl;
443 toSlave << globalShared;
456 toMaster << localShared;
465 fromMaster >> globalShared;
472 nGlobalEdges_ = globalShared.size();
474 DynamicList<label> dynSharedEdgeLabels(globalShared.size());
475 DynamicList<label> dynSharedEdgeAddr(globalShared.size());
479 const edge& e = iter.key();
483 if (edgeFnd != globalShared.end())
492 dynSharedEdgeLabels.append(edgeLabels[i]);
495 dynSharedEdgeAddr.append(edgeFnd());
500 sharedEdgeLabelsPtr_.reset(
new labelList());
501 labelList& sharedEdgeLabels = sharedEdgeLabelsPtr_();
502 sharedEdgeLabels.transfer(dynSharedEdgeLabels);
504 sharedEdgeAddrPtr_.reset(
new labelList());
505 labelList& sharedEdgeAddr = sharedEdgeAddrPtr_();
506 sharedEdgeAddr.transfer(dynSharedEdgeAddr);
510 Pout<<
"globalMeshData : nGlobalEdges_:" << nGlobalEdges_ <<
nl 511 <<
"globalMeshData : sharedEdgeLabels:" << sharedEdgeLabels.size()
513 <<
"globalMeshData : sharedEdgeAddr:" << sharedEdgeAddr.size()
519 void Foam::globalMeshData::calcGlobalPointSlaves()
const 523 Pout<<
"globalMeshData::calcGlobalPointSlaves() :" 524 <<
" calculating coupled master to slave point addressing." 529 globalPoints globalData(mesh_, coupledPatch(),
true,
true);
531 globalPointSlavesPtr_.reset
535 move(globalData.pointPoints())
538 globalPointTransformedSlavesPtr_.reset
542 move(globalData.transformedPointPoints())
546 globalPointSlavesMapPtr_.reset
550 move(globalData.map())
556 void Foam::globalMeshData::calcPointConnectivity
558 List<labelPairList>& allPointConnectivity
561 const globalIndexAndTransform& transforms = globalTransforms();
563 const labelListList& transformedSlaves = globalPointTransformedSlaves();
567 labelPairList myData(globalPointSlavesMap().constructSize());
570 myData[pointi] = transforms.encode
574 transforms.nullTransformIndex()
578 globalPointSlavesMap().distribute(myData);
582 allPointConnectivity.setSize(globalPointSlavesMap().constructSize());
590 const labelList& pSlaves = slaves[pointi];
591 const labelList& pTransformSlaves = transformedSlaves[pointi];
593 if (pSlaves.size()+pTransformSlaves.size())
597 pConnectivity.setSize(1+pSlaves.size()+pTransformSlaves.size());
601 pConnectivity[connI++] = myData[pointi];
605 pConnectivity[connI++] = myData[pSlaves[i]];
608 forAll(pTransformSlaves, i)
611 label transformI = globalPointSlavesMap().whichTransform
616 const labelPair& n = myData[pTransformSlaves[i]];
617 label proci = transforms.processor(n);
618 label index = transforms.index(n);
619 pConnectivity[connI++] = transforms.encode
630 allPointConnectivity[pSlaves[i]] = pConnectivity;
632 forAll(pTransformSlaves, i)
634 allPointConnectivity[pTransformSlaves[i]] = pConnectivity;
645 if (pConnectivity.size() == 0)
647 pConnectivity.setSize(1, myData[pointi]);
652 globalPointSlavesMap().reverseDistribute
660 void Foam::globalMeshData::calcGlobalPointEdges
663 List<labelPairList>& globalPointPoints
666 const edgeList& edges = coupledPatch().edges();
667 const labelListList& pointEdges = coupledPatch().pointEdges();
668 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
670 const labelListList& transformedSlaves = globalPointTransformedSlaves();
671 const globalIndexAndTransform& transforms = globalTransforms();
675 globalPointEdges.setSize(globalPointSlavesMap().constructSize());
676 globalPointPoints.setSize(globalPointSlavesMap().constructSize());
677 forAll(pointEdges, pointi)
679 const labelList& pEdges = pointEdges[pointi];
680 labelList& globalPEdges = globalPointEdges[pointi];
681 globalPEdges.
setSize(pEdges.size());
684 globalPEdges[i] = globalEdgeNumbers.toGlobal(pEdges[i]);
688 globalPPoints.setSize(pEdges.size());
691 label otherPointi = edges[pEdges[i]].otherVertex(pointi);
692 globalPPoints[i] = transforms.encode
696 transforms.nullTransformIndex()
702 globalPointSlavesMap().distribute(globalPointEdges);
703 globalPointSlavesMap().distribute(globalPointPoints);
707 const labelList& pSlaves = slaves[pointi];
708 const labelList& pTransformSlaves = transformedSlaves[pointi];
713 n += globalPointEdges[pSlaves[i]].size();
715 forAll(pTransformSlaves, i)
717 n += globalPointEdges[pTransformSlaves[i]].size();
722 labelList& globalPEdges = globalPointEdges[pointi];
723 label sz = globalPEdges.size();
724 globalPEdges.setSize(sz+n);
727 const labelList& otherData = globalPointEdges[pSlaves[i]];
730 globalPEdges[sz++] = otherData[j];
733 forAll(pTransformSlaves, i)
736 globalPointEdges[pTransformSlaves[i]];
739 globalPEdges[sz++] = otherData[j];
746 globalPointEdges[pSlaves[i]] = globalPEdges;
748 forAll(pTransformSlaves, i)
750 globalPointEdges[pTransformSlaves[i]] = globalPEdges;
758 label sz = globalPPoints.size();
759 globalPPoints.setSize(sz + n);
764 const labelPairList& otherData = globalPointPoints[pSlaves[i]];
767 globalPPoints[sz++] = otherData[j];
771 forAll(pTransformSlaves, i)
774 label transformI = globalPointSlavesMap().whichTransform
780 globalPointPoints[pTransformSlaves[i]];
785 label proci = transforms.processor(n);
786 label index = transforms.index(n);
787 globalPPoints[sz++] = transforms.encode
799 globalPointPoints[pSlaves[i]] = globalPPoints;
801 forAll(pTransformSlaves, i)
803 globalPointPoints[pTransformSlaves[i]] = globalPPoints;
808 globalPointSlavesMap().reverseDistribute
814 globalPointSlavesMap().reverseDistribute
826 const label localPoint
829 const globalIndexAndTransform& transforms = globalTransforms();
831 const label remoteProci = transforms.processor(remotePoint);
832 const label remoteIndex = transforms.index(remotePoint);
834 label remoteTransformI = -1;
835 label localTransformI = -1;
838 label proci = transforms.processor(info[i]);
839 label pointi = transforms.index(info[i]);
840 label transformI = transforms.transformIndex(info[i]);
844 localTransformI = transformI;
849 if (proci == remoteProci && pointi == remoteIndex)
851 remoteTransformI = transformI;
859 if (remoteTransformI == -1 || localTransformI == -1)
862 <<
"Problem. Cannot find " << remotePoint
863 <<
" or " << localPoint <<
" " 864 << coupledPatch().localPoints()[localPoint]
867 <<
"remoteTransformI:" << remoteTransformI <<
endl 868 <<
"localTransformI:" << localTransformI
872 return transforms.subtractTransformIndex
880 void Foam::globalMeshData::calcGlobalEdgeSlaves()
const 884 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 885 <<
" calculating coupled master to slave edge addressing." <<
endl;
888 const edgeList& edges = coupledPatch().edges();
889 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
890 const globalIndexAndTransform& transforms = globalTransforms();
903 List<labelPairList> allPointConnectivity;
904 calcPointConnectivity(allPointConnectivity);
910 List<labelPairList> globalPointPoints;
911 calcGlobalPointEdges(globalPointEdges, globalPointPoints);
924 List<labelPairList> allEdgeConnectivity(edges.size());
928 const edge& e = edges[edgeI];
929 const labelList& pEdges0 = globalPointEdges[e[0]];
931 const labelList& pEdges1 = globalPointEdges[e[1]];
935 DynamicList<labelPair> eEdges(2);
943 transforms.nullTransformIndex()
953 pEdges0[i] == pEdges1[j]
954 && pEdges0[i] != globalEdgeNumbers.toGlobal(edgeI)
966 label transform0 = findTransform
968 allPointConnectivity[e[0]],
972 label transform1 = findTransform
974 allPointConnectivity[e[1]],
979 if (transform0 == transform1)
981 label proci = globalEdgeNumbers.whichProcID(pEdges0[i]);
987 globalEdgeNumbers.toLocal(proci, pEdges0[i]),
996 allEdgeConnectivity[edgeI].transfer(eEdges);
999 allEdgeConnectivity[edgeI],
1008 globalEdgeSlavesPtr_.reset(
new labelListList(edges.size()));
1010 List<labelPairList> transformedEdges(edges.size());
1011 forAll(allEdgeConnectivity, edgeI)
1014 if (edgeInfo.size() >= 2)
1016 const labelPair& masterInfo = edgeInfo[0];
1022 transforms.processor(masterInfo)
1025 && (transforms.index(masterInfo) == edgeI)
1029 labelList& eEdges = globalEdgeSlaves[edgeI];
1030 eEdges.
setSize(edgeInfo.size()-1);
1033 trafoEEdges.setSize(edgeInfo.size()-1);
1035 label nonTransformI = 0;
1036 label transformI = 0;
1038 for (
label i = 1; i < edgeInfo.size(); i++)
1041 label proci = transforms.processor(info);
1042 label index = transforms.index(info);
1043 label transform = transforms.transformIndex
1048 if (transform == transforms.nullTransformIndex())
1050 eEdges[nonTransformI++] = globalEdgeNumbers.toGlobal
1058 trafoEEdges[transformI++] = info;
1062 eEdges.setSize(nonTransformI);
1063 trafoEEdges.setSize(transformI);
1073 globalEdgeSlavesMapPtr_.reset
1082 globalEdgeTransformedSlavesPtr_(),
1091 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 1092 <<
" coupled edges:" << edges.size()
1093 <<
" additional coupled edges:" 1094 << globalEdgeSlavesMapPtr_().constructSize() - edges.size()
1100 void Foam::globalMeshData::calcGlobalEdgeOrientation()
const 1104 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1105 <<
" calculating edge orientation w.r.t. master edge." <<
endl;
1109 const distributionMap& pointsMap = globalPointSlavesMap();
1110 const globalIndex& globalPoints = globalPointNumbering();
1113 for (
label pointi = 0; pointi < coupledPatch().nPoints(); pointi++)
1115 masterPoint[pointi] = globalPoints.toGlobal(pointi);
1121 globalPointSlaves(),
1122 globalPointTransformedSlaves(),
1130 globalEdgeOrientationPtr_.reset
1132 new PackedBoolList(coupledPatch().nEdges())
1134 PackedBoolList& globalEdgeOrientation = globalEdgeOrientationPtr_();
1136 forAll(coupledPatch().edges(), edgeI)
1138 const edge& e = coupledPatch().edges()[edgeI];
1139 globalEdgeOrientation[edgeI] = masterPoint[e[0]] < masterPoint[e[1]];
1144 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1145 <<
" finished calculating edge orientation." <<
endl;
1150 void Foam::globalMeshData::calcPointBoundaryFaces
1155 const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
1156 const Map<label>& meshPointMap = coupledPatch().meshPointMap();
1164 const polyPatch& pp = bMesh[
patchi];
1170 const face& f = pp[i];
1178 if (iter != meshPointMap.end())
1180 nPointFaces[iter()]++;
1190 pointBoundaryFaces.setSize(coupledPatch().
nPoints());
1191 forAll(nPointFaces, pointi)
1193 pointBoundaryFaces[pointi].setSize(nPointFaces[pointi]);
1202 const polyPatch& pp = bMesh[
patchi];
1208 const face& f = pp[i];
1215 if (iter != meshPointMap.end())
1218 pp.start() + i - mesh_.nInternalFaces();
1219 pointBoundaryFaces[iter()][nPointFaces[iter()]++] =
1229 void Foam::globalMeshData::calcGlobalPointBoundaryFaces()
const 1233 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1234 <<
" calculating coupled point to boundary face addressing." 1240 calcPointBoundaryFaces(pointBoundaryFaces);
1244 globalBoundaryFaceNumberingPtr_.reset
1246 new globalIndex(mesh_.nFaces()-mesh_.nInternalFaces())
1248 globalIndex& globalIndices = globalBoundaryFaceNumberingPtr_();
1252 globalPointBoundaryFacesPtr_.reset
1256 labelListList& globalPointBoundaryFaces = globalPointBoundaryFacesPtr_();
1258 forAll(pointBoundaryFaces, pointi)
1260 const labelList& bFaces = pointBoundaryFaces[pointi];
1261 labelList& globalFaces = globalPointBoundaryFaces[pointi];
1262 globalFaces.
setSize(bFaces.size());
1265 globalFaces[i] = globalIndices.toGlobal(bFaces[i]);
1271 globalPointSlavesMap().distribute
1273 globalPointBoundaryFaces,
1282 globalPointTransformedSlaves();
1283 const globalIndexAndTransform& transforms = globalTransforms();
1287 List<labelPairList> transformedFaces(pointSlaves.size());
1290 forAll(pointSlaves, pointi)
1292 const labelList& slaves = pointSlaves[pointi];
1293 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1295 if (slaves.size() > 0)
1297 labelList& myBFaces = globalPointBoundaryFaces[pointi];
1298 label sz = myBFaces.size();
1304 n += globalPointBoundaryFaces[slaves[i]].size();
1307 myBFaces.setSize(sz+n);
1312 globalPointBoundaryFaces[slaves[i]];
1319 label slave = slaveBFaces[j];
1320 if (
findIndex(SubList<label>(myBFaces, sz), slave) == -1)
1322 myBFaces[n++] = slave;
1326 myBFaces.setSize(n);
1330 if (transformedSlaves.size() > 0)
1332 const labelList& untrafoFaces = globalPointBoundaryFaces[pointi];
1335 label sz = myBFaces.size();
1339 forAll(transformedSlaves, i)
1341 n += globalPointBoundaryFaces[transformedSlaves[i]].size();
1344 myBFaces.setSize(sz+n);
1346 forAll(transformedSlaves, i)
1348 label transformI = globalPointSlavesMap().whichTransform
1350 transformedSlaves[i]
1354 globalPointBoundaryFaces[transformedSlaves[i]];
1358 label slave = slaveBFaces[j];
1360 if (
findIndex(untrafoFaces, slave)== -1)
1362 label proci = globalIndices.whichProcID(slave);
1363 label facei = globalIndices.toLocal(proci, slave);
1365 myBFaces[n++] = transforms.encode
1374 myBFaces.setSize(n);
1378 if (slaves.size() + transformedSlaves.size() == 0)
1380 globalPointBoundaryFaces[pointi].clear();
1387 globalPointTransformedBoundaryFacesPtr_.reset
1392 globalPointBoundaryFacesMapPtr_.reset
1397 globalPointBoundaryFaces,
1401 globalPointTransformedBoundaryFacesPtr_(),
1406 globalPointBoundaryFaces.setSize(coupledPatch().
nPoints());
1407 globalPointTransformedBoundaryFacesPtr_().setSize(coupledPatch().
nPoints());
1411 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1412 <<
" coupled points:" << coupledPatch().nPoints()
1413 <<
" local boundary faces:" << globalIndices.localSize()
1414 <<
" additional coupled faces:" 1415 << globalPointBoundaryFacesMapPtr_().constructSize()
1416 - globalIndices.localSize()
1422 void Foam::globalMeshData::calcGlobalPointBoundaryCells()
const 1426 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1427 <<
" calculating coupled point to boundary cell addressing." 1435 Map<label> meshCellMap(4*coupledPatch().
nPoints());
1436 DynamicList<label> cellMap(meshCellMap.size());
1441 forAll(coupledPatch().meshPoints(), pointi)
1443 label meshPointi = coupledPatch().meshPoints()[pointi];
1444 const labelList& pCells = mesh_.pointCells(meshPointi);
1446 labelList& bCells = pointBoundaryCells[pointi];
1447 bCells.
setSize(pCells.size());
1451 label celli = pCells[i];
1454 if (fnd != meshCellMap.end())
1460 meshCellMap.insert(celli, bCelli);
1461 cellMap.append(celli);
1469 boundaryCellsPtr_.reset(
new labelList());
1470 labelList& boundaryCells = boundaryCellsPtr_();
1471 boundaryCells.transfer(cellMap.shrink());
1477 globalBoundaryCellNumberingPtr_.reset
1479 new globalIndex(boundaryCells.size())
1481 globalIndex& globalIndices = globalBoundaryCellNumberingPtr_();
1484 globalPointBoundaryCellsPtr_.reset
1488 labelListList& globalPointBoundaryCells = globalPointBoundaryCellsPtr_();
1490 forAll(pointBoundaryCells, pointi)
1492 const labelList& pCells = pointBoundaryCells[pointi];
1493 labelList& globalCells = globalPointBoundaryCells[pointi];
1494 globalCells.
setSize(pCells.size());
1497 globalCells[i] = globalIndices.toGlobal(pCells[i]);
1503 globalPointSlavesMap().distribute
1505 globalPointBoundaryCells,
1513 globalPointTransformedSlaves();
1514 const globalIndexAndTransform& transforms = globalTransforms();
1516 List<labelPairList> transformedCells(pointSlaves.size());
1519 forAll(pointSlaves, pointi)
1521 const labelList& slaves = pointSlaves[pointi];
1522 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1524 if (slaves.size() > 0)
1526 labelList& myBCells = globalPointBoundaryCells[pointi];
1527 label sz = myBCells.size();
1533 n += globalPointBoundaryCells[slaves[i]].size();
1536 myBCells.setSize(sz+n);
1541 globalPointBoundaryCells[slaves[i]];
1548 label slave = slaveBCells[j];
1549 if (
findIndex(SubList<label>(myBCells, sz), slave) == -1)
1551 myBCells[n++] = slave;
1555 myBCells.setSize(n);
1559 if (transformedSlaves.size() > 0)
1561 const labelList& untrafoCells = globalPointBoundaryCells[pointi];
1564 label sz = myBCells.size();
1568 forAll(transformedSlaves, i)
1570 n += globalPointBoundaryCells[transformedSlaves[i]].size();
1573 myBCells.setSize(sz+n);
1575 forAll(transformedSlaves, i)
1577 label transformI = globalPointSlavesMap().whichTransform
1579 transformedSlaves[i]
1583 globalPointBoundaryCells[transformedSlaves[i]];
1587 label slave = slaveBCells[j];
1590 if (
findIndex(untrafoCells, slave)== -1)
1592 label proci = globalIndices.whichProcID(slave);
1593 label celli = globalIndices.toLocal(proci, slave);
1594 myBCells[n++] = transforms.encode
1603 myBCells.setSize(n);
1606 if (slaves.size() + transformedSlaves.size() == 0)
1608 globalPointBoundaryCells[pointi].clear();
1615 globalPointTransformedBoundaryCellsPtr_.reset
1620 globalPointBoundaryCellsMapPtr_.reset
1625 globalPointBoundaryCells,
1629 globalPointTransformedBoundaryCellsPtr_(),
1634 globalPointBoundaryCells.setSize(coupledPatch().
nPoints());
1635 globalPointTransformedBoundaryCellsPtr_().setSize(coupledPatch().
nPoints());
1639 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1640 <<
" coupled points:" << coupledPatch().nPoints()
1641 <<
" local boundary cells:" << globalIndices.localSize()
1642 <<
" additional coupled cells:" 1643 << globalPointBoundaryCellsMapPtr_().constructSize()
1644 - globalIndices.localSize()
1650 void Foam::globalMeshData::calcGlobalCoPointSlaves()
const 1654 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1655 <<
" calculating coupled master to collocated" 1656 <<
" slave point addressing." <<
endl;
1660 globalPoints globalData(mesh_, coupledPatch(),
true,
false);
1662 globalCoPointSlavesPtr_.reset
1666 move(globalData.pointPoints())
1669 globalCoPointSlavesMapPtr_.reset
1673 move(globalData.map())
1679 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1680 <<
" finished calculating coupled master to collocated" 1681 <<
" slave point addressing." <<
endl;
1694 processorTopology_(mesh.boundaryMesh(),
UPstream::worldComm),
1695 processorPatches_(0),
1696 processorPatchIndices_(0),
1697 processorPatchNeighbours_(0),
1699 sharedPointLabelsPtr_(nullptr),
1700 sharedPointAddrPtr_(nullptr),
1701 sharedPointGlobalLabelsPtr_(nullptr),
1703 sharedEdgeLabelsPtr_(nullptr),
1704 sharedEdgeAddrPtr_(nullptr)
1721 nGlobalPoints_ = -1;
1722 sharedPointLabelsPtr_.clear();
1723 sharedPointAddrPtr_.clear();
1724 sharedPointGlobalLabelsPtr_.clear();
1728 sharedEdgeLabelsPtr_.clear();
1729 sharedEdgeAddrPtr_.clear();
1732 coupledPatchPtr_.clear();
1733 coupledPatchMeshEdgesPtr_.clear();
1734 coupledPatchMeshEdgeMapPtr_.clear();
1735 globalTransformsPtr_.clear();
1738 globalPointNumberingPtr_.clear();
1739 globalPointSlavesPtr_.clear();
1740 globalPointTransformedSlavesPtr_.clear();
1741 globalPointSlavesMapPtr_.clear();
1743 globalEdgeNumberingPtr_.clear();
1744 globalEdgeSlavesPtr_.clear();
1745 globalEdgeTransformedSlavesPtr_.clear();
1746 globalEdgeOrientationPtr_.clear();
1747 globalEdgeSlavesMapPtr_.clear();
1750 globalBoundaryFaceNumberingPtr_.clear();
1751 globalPointBoundaryFacesPtr_.clear();
1752 globalPointTransformedBoundaryFacesPtr_.clear();
1753 globalPointBoundaryFacesMapPtr_.clear();
1756 boundaryCellsPtr_.clear();
1757 globalBoundaryCellNumberingPtr_.clear();
1758 globalPointBoundaryCellsPtr_.clear();
1759 globalPointTransformedBoundaryCellsPtr_.clear();
1760 globalPointBoundaryCellsMapPtr_.clear();
1763 globalCoPointSlavesPtr_.clear();
1764 globalCoPointSlavesMapPtr_.clear();
1772 if (!sharedPointGlobalLabelsPtr_.valid())
1774 sharedPointGlobalLabelsPtr_.reset
1782 "pointProcAddressing",
1788 if (addrHeader.headerOk())
1792 Pout<<
"globalMeshData::sharedPointGlobalLabels : " 1793 <<
"Reading pointProcAddressing" <<
endl;
1802 label pointi = pointLabels[i];
1805 sharedPointGlobalLabels[i] = pointProcAddressing[pointi];
1810 Pout<<
"globalMeshData::sharedPointGlobalLabels :" 1811 <<
" Setting pointProcAddressing to -1" <<
endl;
1813 sharedPointGlobalLabels = -1;
1816 return sharedPointGlobalLabelsPtr_();
1835 label sharedPointi = pointAddr[i];
1837 sharedPoints[sharedPointi] = mesh_.
points()[pointLabels[i]];
1852 fromSlave >> nbrSharedPointAddr >> nbrSharedPoints;
1854 forAll(nbrSharedPointAddr, i)
1856 label sharedPointi = nbrSharedPointAddr[i];
1858 sharedPoints[sharedPointi] = nbrSharedPoints[i];
1933 return mergedPoints;
1939 if (nGlobalPoints_ == -1)
1943 return nGlobalPoints_;
1949 if (!sharedPointLabelsPtr_.valid())
1953 return sharedPointLabelsPtr_();
1959 if (!sharedPointAddrPtr_.valid())
1963 return sharedPointAddrPtr_();
1969 if (nGlobalEdges_ == -1)
1973 return nGlobalEdges_;
1979 if (!sharedEdgeLabelsPtr_.valid())
1983 return sharedEdgeLabelsPtr_();
1989 if (!sharedEdgeAddrPtr_.valid())
1993 return sharedEdgeAddrPtr_();
1999 if (!coupledPatchPtr_.valid())
2011 nCoupled += pp.size();
2027 coupledFaces[nCoupled++] = facei++;
2032 coupledPatchPtr_.reset
2047 Pout<<
"globalMeshData::coupledPatch() :" 2048 <<
" constructed coupled faces patch:" 2049 <<
" faces:" << coupledPatchPtr_().size()
2050 <<
" points:" << coupledPatchPtr_().nPoints()
2054 return coupledPatchPtr_();
2060 if (!coupledPatchMeshEdgesPtr_.valid())
2062 coupledPatchMeshEdgesPtr_.reset
2074 return coupledPatchMeshEdgesPtr_();
2081 if (!coupledPatchMeshEdgeMapPtr_.valid())
2086 Map<label>& em = coupledPatchMeshEdgeMapPtr_();
2093 return coupledPatchMeshEdgeMapPtr_();
2099 if (!globalPointNumberingPtr_.valid())
2101 globalPointNumberingPtr_.reset
2106 return globalPointNumberingPtr_();
2113 if (!globalTransformsPtr_.valid())
2117 return globalTransformsPtr_();
2123 if (!globalPointSlavesPtr_.valid())
2125 calcGlobalPointSlaves();
2127 return globalPointSlavesPtr_();
2134 if (!globalPointTransformedSlavesPtr_.valid())
2136 calcGlobalPointSlaves();
2138 return globalPointTransformedSlavesPtr_();
2144 if (!globalPointSlavesMapPtr_.valid())
2146 calcGlobalPointSlaves();
2148 return globalPointSlavesMapPtr_();
2154 if (!globalEdgeNumberingPtr_.valid())
2156 globalEdgeNumberingPtr_.reset
2161 return globalEdgeNumberingPtr_();
2167 if (!globalEdgeSlavesPtr_.valid())
2169 calcGlobalEdgeSlaves();
2171 return globalEdgeSlavesPtr_();
2178 if (!globalEdgeTransformedSlavesPtr_.valid())
2180 calcGlobalEdgeSlaves();
2182 return globalEdgeTransformedSlavesPtr_();
2188 if (!globalEdgeOrientationPtr_.valid())
2190 calcGlobalEdgeOrientation();
2192 return globalEdgeOrientationPtr_();
2198 if (!globalEdgeSlavesMapPtr_.valid())
2200 calcGlobalEdgeSlaves();
2202 return globalEdgeSlavesMapPtr_();
2209 if (!globalBoundaryFaceNumberingPtr_.valid())
2211 calcGlobalPointBoundaryFaces();
2213 return globalBoundaryFaceNumberingPtr_();
2220 if (!globalPointBoundaryFacesPtr_.valid())
2222 calcGlobalPointBoundaryFaces();
2224 return globalPointBoundaryFacesPtr_();
2231 if (!globalPointTransformedBoundaryFacesPtr_.valid())
2233 calcGlobalPointBoundaryFaces();
2235 return globalPointTransformedBoundaryFacesPtr_();
2242 if (!globalPointBoundaryFacesMapPtr_.valid())
2244 calcGlobalPointBoundaryFaces();
2246 return globalPointBoundaryFacesMapPtr_();
2252 if (!boundaryCellsPtr_.valid())
2254 calcGlobalPointBoundaryCells();
2256 return boundaryCellsPtr_();
2263 if (!globalBoundaryCellNumberingPtr_.valid())
2265 calcGlobalPointBoundaryCells();
2267 return globalBoundaryCellNumberingPtr_();
2274 if (!globalPointBoundaryCellsPtr_.valid())
2276 calcGlobalPointBoundaryCells();
2278 return globalPointBoundaryCellsPtr_();
2285 if (!globalPointTransformedBoundaryCellsPtr_.valid())
2287 calcGlobalPointBoundaryCells();
2289 return globalPointTransformedBoundaryCellsPtr_();
2296 if (!globalPointBoundaryCellsMapPtr_.valid())
2298 calcGlobalPointBoundaryCells();
2300 return globalPointBoundaryCellsMapPtr_();
2306 if (!globalCoPointSlavesPtr_.valid())
2308 calcGlobalCoPointSlaves();
2310 return globalCoPointSlavesPtr_();
2317 if (!globalCoPointSlavesMapPtr_.valid())
2319 calcGlobalCoPointSlaves();
2321 return globalCoPointSlavesMapPtr_();
2344 forAll(masterGlobalPoint, pointi)
2346 const labelList& slavePoints = pointSlaves[pointi];
2347 if (slavePoints.
size() > 0)
2349 masterGlobalPoint[pointi] = globalCoupledPoints.
toGlobal(pointi);
2367 forAll(pointSlaves, pointi)
2369 if (masterGlobalPoint[pointi] == -1)
2376 masterGlobalPoint[pointi]
2377 == globalCoupledPoints.
toGlobal(pointi)
2406 uniquePoints.
setSize(myUniquePoints);
2409 forAll(isMaster, meshPointi)
2411 if (isMaster[meshPointi])
2413 pointToGlobal[meshPointi] = globalPointsPtr().toGlobal(nMaster);
2414 uniquePoints[nMaster] = meshPointi;
2424 forAll(pointSlaves, pointi)
2426 const labelList& slaves = pointSlaves[pointi];
2428 if (slaves.
size() > 0)
2432 masterToGlobal[pointi] = pointToGlobal[meshPointi];
2435 masterToGlobal[slaves[i]] = masterToGlobal[pointi];
2444 forAll(pointSlaves, pointi)
2448 if (!isMaster[meshPointi])
2450 pointToGlobal[meshPointi] = masterToGlobal[pointi];
2455 return globalPointsPtr;
2494 forAll(meshPoints, patchPointi)
2496 label meshPointi = meshPoints[patchPointi];
2502 patchToCoupled[patchPointi] = iter();
2503 coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi);
2521 pointSlavesMap.
distribute(coupledToGlobalPatch);
2522 forAll(pointSlaves, coupledPointi)
2524 const labelList& slaves = pointSlaves[coupledPointi];
2526 if (slaves.
size() > 0)
2530 if (coupledToGlobalPatch[coupledPointi] != -1)
2533 masterI = coupledToGlobalPatch[coupledPointi];
2540 label slavePp = coupledToGlobalPatch[slaves[i]];
2541 if (slavePp != -1 && slavePp < masterI)
2551 coupledToGlobalPatch[coupledPointi] = masterI;
2554 coupledToGlobalPatch[slaves[i]] = masterI;
2569 forAll(meshPoints, patchPointi)
2571 if (patchToCoupled[patchPointi] == -1)
2577 label coupledPointi = patchToCoupled[patchPointi];
2580 globalPPoints.toGlobal(patchPointi)
2581 == coupledToGlobalPatch[coupledPointi]
2604 uniqueMeshPoints.
setSize(nMasters);
2611 forAll(meshPoints, patchPointi)
2613 if (patchToCoupled[patchPointi] == -1)
2615 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2619 label coupledPointi = patchToCoupled[patchPointi];
2622 globalPPoints.toGlobal(patchPointi)
2623 == coupledToGlobalPatch[coupledPointi]
2626 globalMaster[coupledPointi] =
2627 globalPointsPtr().toGlobal(nMasters);
2628 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2648 forAll(meshPoints, patchPointi)
2650 if (patchToCoupled[patchPointi] == -1)
2652 pointToGlobal[patchPointi] = globalPointsPtr().toGlobal(nMasters++);
2656 label coupledPointi = patchToCoupled[patchPointi];
2657 pointToGlobal[patchPointi] = globalMaster[coupledPointi];
2661 globalPPoints.toGlobal(patchPointi)
2662 == coupledToGlobalPatch[coupledPointi]
2670 return globalPointsPtr;
2695 Pout<<
"globalMeshData : merge dist:" << tolDim <<
endl;
2718 Pout<<
"globalMeshData : nTotalFaces_:" << nTotalFaces_ <<
endl;
2731 Pout<<
"globalMeshData : nTotalCells_:" << nTotalCells_ <<
endl;
2746 Pout<<
"globalMeshData : nTotalPoints_:" << nTotalPoints_ <<
endl;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
List< labelList > labelListList
A List of labelList.
label nPoints() const
Return number of points supporting patch faces.
const labelListList & globalPointSlaves() const
#define forAll(list, i)
Loop across all elements in list.
void combineReduce(const List< UPstream::commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
static int masterNo()
Process index of the master.
const labelListList & globalPointTransformedSlaves() const
pointField geometricSharedPoints() const
Like sharedPoints but keeps cyclic points separate.
const fileName & facesInstance() const
Return the current instance directory for faces.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const globalIndex & globalBoundaryCellNumbering() const
Numbering of boundary cells is according to boundaryCells()
labelList pointLabels(nPoints, -1)
const labelList & sharedPointGlobalLabels() const
Return shared point global labels. Tries to read.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
const labelListList & globalPointTransformedBoundaryFaces() const
static int firstSlave()
Process index of first slave.
const labelListList & pointEdges() const
HashTable< label, label, Hash< label > >::iterator iterator
static const Foam::scalar matchTol_
Geometric tolerance (fraction of bounding box)
Templated form of IOobject providing type information for file reading and header type checking...
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void size(const label)
Override size to be inconsistent with allocated storage.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
void clearOut()
Remove all demand driven data.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const distributionMap & globalEdgeSlavesMap() const
static bool master(const label communicator=0)
Am I the master process.
Holds information (coordinate and normal) regarding nearest wall point.
const labelListList & globalPointBoundaryCells() const
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
static int & msgType()
Message tag of standard messages.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
const labelListList & globalEdgeSlaves() const
static label worldComm
Default communicator (all processors)
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
const labelListList & globalPointBoundaryFaces() const
static bool less(const vector &x, const vector &y)
To compare normals.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
virtual const pointField & points() const
Return raw points.
Input inter-processor communications stream.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
const labelList & boundaryCells() const
From boundary cell to mesh cell.
label nGlobalEdges() const
Return number of globally shared edges. Demand-driven.
const distributionMap & globalPointBoundaryCellsMap() const
A list of faces which address into the list of points.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
const globalIndex & globalEdgeNumbering() const
label nGlobalPoints() const
Return number of globally shared points.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const labelList & sharedEdgeAddr() const
Return addressing into the complete globally shared edge.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
friend class const_iterator
Declare friendship with the const_iterator.
scalar mag() const
The magnitude of the bounding box span.
const globalIndex & globalPointNumbering() const
Numbering of coupled points is according to coupledPatch.
Pair< label > labelPair
Label pair.
static const label labelMax
List< label > labelList
A List of labels.
virtual const faceList & faces() const
Return raw faces.
List< labelPair > labelPairList
List of labelPairs.
errorManip< error > abort(error &err)
label constructSize() const
Constructed data size.
static void syncData(List< Type > &pointData, const labelListList &slaves, const labelListList &transformedSlaves, const distributionMap &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
~globalMeshData()
Destructor.
defineTypeNameAndDebug(combustionModel, 0)
Output inter-processor communications stream.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
word name(const complex &)
Return a string representation of a complex.
void movePoints(const pointField &newPoints)
Update for moving points.
void topoChange()
Change global mesh data given a topological change. Does a.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
void setSize(const label)
Reset size of List.
const boundBox & bounds() const
Return mesh bounding box.
label toGlobal(const label i) const
From local to global.
Class containing processor-to-processor mapping information.
const labelListList & globalPointTransformedBoundaryCells() const
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const distributionMap & globalPointSlavesMap() const
const dimensionedScalar me
Electron mass.
globalMeshData(const polyMesh &mesh)
Construct from mesh, derive rest (does parallel communication!)
prefixOSstream Pout(cout, "Pout")
A List with indirect addressing.
label start() const
Return start label of this patch in the polyMesh face list.
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
const distributionMap & globalPointBoundaryFacesMap() const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
A patch is a list of labels that address the faces in the global face list.
friend class iterator
Declare friendship with the iterator.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
pointField sharedPoints() const
Collect coordinates of shared points on all processors.
Inter-processor communications stream.
const distributionMap & globalCoPointSlavesMap() const
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
const labelList & sharedEdgeLabels() const
Return indices of local edges that are globally shared.
const labelListList & globalCoPointSlaves() const
static int lastSlave(const label communicator=0)
Process index of last slave.
A HashTable to objects of type <T> with a label key.
const labelListList & globalEdgeTransformedSlaves() const
const globalIndex & globalBoundaryFaceNumbering() const
Numbering of boundary faces is face-mesh.nInternalFaces()