51 x[0] =
min(x[0], y[0]);
52 x[1] =
min(x[1], y[1]);
60 void Foam::globalMeshData::initProcAddr()
62 processorPatchIndices_.setSize(mesh_.boundaryMesh().size());
63 processorPatchIndices_ = -1;
65 processorPatchNeighbours_.setSize(mesh_.boundaryMesh().size());
66 processorPatchNeighbours_ = -1;
70 processorPatches_.setSize(mesh_.boundaryMesh().size());
72 label nNeighbours = 0;
76 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
78 processorPatches_[nNeighbours] =
patchi;
79 processorPatchIndices_[
patchi] = nNeighbours++;
82 processorPatches_.setSize(nNeighbours);
90 forAll(processorPatches_, i)
96 refCast<const processorPolyPatch>
98 mesh_.boundaryMesh()[
patchi]
103 toNeighbour << processorPatchIndices_[
patchi];
108 forAll(processorPatches_, i)
114 refCast<const processorPolyPatch>
116 mesh_.boundaryMesh()[
patchi]
121 fromNeighbour >> processorPatchNeighbours_[
patchi];
127 void Foam::globalMeshData::calcSharedPoints()
const 132 || sharedPointLabelsPtr_.valid()
133 || sharedPointAddrPtr_.valid()
152 if (pPoints.
size()+transPPoints.
size() > 0)
161 nGlobalPoints_ = masterNumbering.
size();
175 if (pPoints.
size()+transPPoints.
size() > 0)
177 master[i] = masterNumbering.
toGlobal(nMaster);
180 master[pPoints[j]] = master[i];
184 master[transPPoints[j]] = master[i];
219 sharedPointLabelsPtr_.reset(
new labelList(nMaster));
220 labelList& sharedPointLabels = sharedPointLabelsPtr_();
221 sharedPointAddrPtr_.reset(
new labelList(nMaster));
222 labelList& sharedPointAddr = sharedPointAddrPtr_();
230 sharedPointLabels[nMaster] = i;
231 sharedPointAddr[nMaster] = master[i];
238 Pout<<
"globalMeshData : nGlobalPoints_:" << nGlobalPoints_ <<
nl 239 <<
"globalMeshData : sharedPointLabels_:" 240 << sharedPointLabelsPtr_().size() <<
nl 241 <<
"globalMeshData : sharedPointAddr_:" 242 << sharedPointAddrPtr_().size() <<
endl;
247 void Foam::globalMeshData::countSharedEdges
257 const edge&
e = iter.key();
261 if (globalFnd == globalShared.
end())
264 if (iter().size() == 1)
267 globalShared.
insert(e, -1);
273 globalShared.
insert(e, sharedEdgeI++);
278 if (globalFnd() == -1)
282 globalFnd() = sharedEdgeI++;
289 void Foam::globalMeshData::calcSharedEdges()
const 299 || sharedEdgeLabelsPtr_.valid()
300 || sharedEdgeAddrPtr_.valid()
308 const labelList& sharedPtAddr = sharedPointAddr();
309 const labelList& sharedPtLabels = sharedPointLabels();
316 meshToShared.insert(sharedPtLabels[i], i);
324 const edgeList& edges = mesh_.edges();
328 const edge&
e = edges[edgeI];
332 if (e0Fnd != meshToShared.
end())
336 if (e1Fnd != meshToShared.
end())
344 sharedPtAddr[e0Fnd()],
345 sharedPtAddr[e1Fnd()]
349 localShared.
find(sharedEdge);
351 if (iter == localShared.
end())
354 localShared.insert(sharedEdge,
labelList(1, edgeI));
363 edgeLabels[sz] = edgeI;
383 label sharedEdgeI = 0;
388 Pout<<
"globalMeshData::calcSharedEdges : Merging in from proc0 : " 389 << localShared.size() <<
endl;
391 countSharedEdges(localShared, globalShared, sharedEdgeI);
409 Pout<<
"globalMeshData::calcSharedEdges : " 410 <<
"Merging in from proc" 414 countSharedEdges(procSharedEdges, globalShared, sharedEdgeI);
424 globalShared.
clear();
430 globalShared.
insert(iter.key(), iter());
435 Pout<<
"globalMeshData::calcSharedEdges : Filtered " 436 << oldSharedEdges.
size()
437 <<
" down to " << globalShared.
size() <<
endl;
454 toSlave << globalShared;
467 toMaster << localShared;
476 fromMaster >> globalShared;
483 nGlobalEdges_ = globalShared.
size();
490 const edge&
e = iter.key();
494 if (edgeFnd != globalShared.
end())
503 dynSharedEdgeLabels.append(edgeLabels[i]);
506 dynSharedEdgeAddr.append(edgeFnd());
511 sharedEdgeLabelsPtr_.reset(
new labelList());
512 labelList& sharedEdgeLabels = sharedEdgeLabelsPtr_();
513 sharedEdgeLabels.
transfer(dynSharedEdgeLabels);
515 sharedEdgeAddrPtr_.reset(
new labelList());
516 labelList& sharedEdgeAddr = sharedEdgeAddrPtr_();
517 sharedEdgeAddr.
transfer(dynSharedEdgeAddr);
521 Pout<<
"globalMeshData : nGlobalEdges_:" << nGlobalEdges_ <<
nl 522 <<
"globalMeshData : sharedEdgeLabels:" << sharedEdgeLabels.
size()
524 <<
"globalMeshData : sharedEdgeAddr:" << sharedEdgeAddr.
size()
530 void Foam::globalMeshData::calcGlobalPointSlaves()
const 534 Pout<<
"globalMeshData::calcGlobalPointSlaves() :" 535 <<
" calculating coupled master to slave point addressing." 540 globalPoints globalData(mesh_, coupledPatch(),
true,
true);
542 globalPointSlavesPtr_.reset
549 globalPointTransformedSlavesPtr_.reset
557 globalPointSlavesMapPtr_.reset
561 move(globalData.
map())
567 void Foam::globalMeshData::calcPointConnectivity
574 const labelListList& transformedSlaves = globalPointTransformedSlaves();
578 labelPairList myData(globalPointSlavesMap().constructSize());
581 myData[pointi] = transforms.
encode 589 globalPointSlavesMap().distribute(myData);
593 allPointConnectivity.
setSize(globalPointSlavesMap().constructSize());
601 const labelList& pSlaves = slaves[pointi];
602 const labelList& pTransformSlaves = transformedSlaves[pointi];
604 if (pSlaves.
size()+pTransformSlaves.
size())
612 pConnectivity[connI++] = myData[pointi];
616 pConnectivity[connI++] = myData[pSlaves[i]];
619 forAll(pTransformSlaves, i)
622 label transformI = globalPointSlavesMap().whichTransform
627 const labelPair&
n = myData[pTransformSlaves[i]];
630 pConnectivity[connI++] = transforms.
encode 641 allPointConnectivity[pSlaves[i]] = pConnectivity;
643 forAll(pTransformSlaves, i)
645 allPointConnectivity[pTransformSlaves[i]] = pConnectivity;
656 if (pConnectivity.
size() == 0)
658 pConnectivity.
setSize(1, myData[pointi]);
663 globalPointSlavesMap().reverseDistribute
671 void Foam::globalMeshData::calcGlobalPointEdges
677 const edgeList& edges = coupledPatch().edges();
678 const labelListList& pointEdges = coupledPatch().pointEdges();
679 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
681 const labelListList& transformedSlaves = globalPointTransformedSlaves();
686 globalPointEdges.
setSize(globalPointSlavesMap().constructSize());
687 globalPointPoints.
setSize(globalPointSlavesMap().constructSize());
688 forAll(pointEdges, pointi)
690 const labelList& pEdges = pointEdges[pointi];
691 labelList& globalPEdges = globalPointEdges[pointi];
695 globalPEdges[i] = globalEdgeNumbers.
toGlobal(pEdges[i]);
702 label otherPointi = edges[pEdges[i]].otherVertex(pointi);
703 globalPPoints[i] = transforms.
encode 713 globalPointSlavesMap().distribute(globalPointEdges);
714 globalPointSlavesMap().distribute(globalPointPoints);
718 const labelList& pSlaves = slaves[pointi];
719 const labelList& pTransformSlaves = transformedSlaves[pointi];
724 n += globalPointEdges[pSlaves[i]].
size();
726 forAll(pTransformSlaves, i)
728 n += globalPointEdges[pTransformSlaves[i]].
size();
733 labelList& globalPEdges = globalPointEdges[pointi];
738 const labelList& otherData = globalPointEdges[pSlaves[i]];
741 globalPEdges[sz++] = otherData[j];
744 forAll(pTransformSlaves, i)
747 globalPointEdges[pTransformSlaves[i]];
750 globalPEdges[sz++] = otherData[j];
757 globalPointEdges[pSlaves[i]] = globalPEdges;
759 forAll(pTransformSlaves, i)
761 globalPointEdges[pTransformSlaves[i]] = globalPEdges;
775 const labelPairList& otherData = globalPointPoints[pSlaves[i]];
778 globalPPoints[sz++] = otherData[j];
782 forAll(pTransformSlaves, i)
785 label transformI = globalPointSlavesMap().whichTransform
791 globalPointPoints[pTransformSlaves[i]];
798 globalPPoints[sz++] = transforms.
encode 810 globalPointPoints[pSlaves[i]] = globalPPoints;
812 forAll(pTransformSlaves, i)
814 globalPointPoints[pTransformSlaves[i]] = globalPPoints;
819 globalPointSlavesMap().reverseDistribute
825 globalPointSlavesMap().reverseDistribute
837 const label localPoint
843 const label remoteIndex = transforms.
index(remotePoint);
845 label remoteTransformI = -1;
846 label localTransformI = -1;
855 localTransformI = transformI;
860 if (proci == remoteProci && pointi == remoteIndex)
862 remoteTransformI = transformI;
870 if (remoteTransformI == -1 || localTransformI == -1)
873 <<
"Problem. Cannot find " << remotePoint
874 <<
" or " << localPoint <<
" " 875 << coupledPatch().localPoints()[localPoint]
878 <<
"remoteTransformI:" << remoteTransformI <<
endl 879 <<
"localTransformI:" << localTransformI
891 void Foam::globalMeshData::calcGlobalEdgeSlaves()
const 895 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 896 <<
" calculating coupled master to slave edge addressing." <<
endl;
899 const edgeList& edges = coupledPatch().edges();
900 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
915 calcPointConnectivity(allPointConnectivity);
922 calcGlobalPointEdges(globalPointEdges, globalPointPoints);
939 const edge&
e = edges[edgeI];
940 const labelList& pEdges0 = globalPointEdges[e[0]];
942 const labelList& pEdges1 = globalPointEdges[e[1]];
964 pEdges0[i] == pEdges1[j]
965 && pEdges0[i] != globalEdgeNumbers.
toGlobal(edgeI)
977 label transform0 = findTransform
979 allPointConnectivity[e[0]],
983 label transform1 = findTransform
985 allPointConnectivity[e[1]],
990 if (transform0 == transform1)
998 globalEdgeNumbers.
toLocal(proci, pEdges0[i]),
1007 allEdgeConnectivity[edgeI].transfer(eEdges);
1010 allEdgeConnectivity[edgeI],
1022 forAll(allEdgeConnectivity, edgeI)
1025 if (edgeInfo.
size() >= 2)
1027 const labelPair& masterInfo = edgeInfo[0];
1036 && (transforms.
index(masterInfo) == edgeI)
1040 labelList& eEdges = globalEdgeSlaves[edgeI];
1046 label nonTransformI = 0;
1047 label transformI = 0;
1049 for (
label i = 1; i < edgeInfo.
size(); i++)
1061 eEdges[nonTransformI++] = globalEdgeNumbers.
toGlobal 1069 trafoEEdges[transformI++] = info;
1073 eEdges.
setSize(nonTransformI);
1074 trafoEEdges.
setSize(transformI);
1084 globalEdgeSlavesMapPtr_.reset
1093 globalEdgeTransformedSlavesPtr_(),
1102 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 1103 <<
" coupled edges:" << edges.
size()
1104 <<
" additional coupled edges:" 1105 << globalEdgeSlavesMapPtr_().constructSize() - edges.
size()
1111 void Foam::globalMeshData::calcGlobalEdgeOrientation()
const 1115 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1116 <<
" calculating edge orientation w.r.t. master edge." <<
endl;
1129 for (
label pointi = 0; pointi < coupledPatch().nPoints(); pointi++)
1131 masterPoint[pointi] = globalPoints.
toGlobal(pointi);
1136 globalPointSlaves(),
1137 globalPointTransformedSlaves(),
1150 const labelListList& transformedSlaves = globalEdgeTransformedSlaves();
1156 for (
label edgeI = 0; edgeI < coupledPatch().nEdges(); edgeI++)
1161 slaves[edgeI].size()
1162 + transformedSlaves[edgeI].size()
1169 const edge&
e = coupledPatch().edges()[edgeI];
1187 globalEdgeOrientationPtr_.reset
1191 PackedBoolList& globalEdgeOrientation = globalEdgeOrientationPtr_();
1193 forAll(coupledPatch().edges(), edgeI)
1195 const edge&
e = coupledPatch().edges()[edgeI];
1205 masterEdgeVerts[edgeI]
1210 <<
"problem : my edge:" << e
1211 <<
" in master points:" << masterE
1212 <<
" v.s. masterEdgeVerts:" << masterEdgeVerts[edgeI]
1217 globalEdgeOrientation[edgeI] = (stat == 1);
1224 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1225 <<
" finished calculating edge orientation." 1231 void Foam::globalMeshData::calcPointBoundaryFaces
1237 const Map<label>& meshPointMap = coupledPatch().meshPointMap();
1251 const face&
f = pp[i];
1259 if (iter != meshPointMap.
end())
1261 nPointFaces[iter()]++;
1272 forAll(nPointFaces, pointi)
1274 pointBoundaryFaces[pointi].
setSize(nPointFaces[pointi]);
1289 const face&
f = pp[i];
1296 if (iter != meshPointMap.
end())
1299 pp.
start() + i - mesh_.nInternalFaces();
1300 pointBoundaryFaces[iter()][nPointFaces[iter()]++] =
1310 void Foam::globalMeshData::calcGlobalPointBoundaryFaces()
const 1314 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1315 <<
" calculating coupled point to boundary face addressing." 1321 calcPointBoundaryFaces(pointBoundaryFaces);
1325 globalBoundaryFaceNumberingPtr_.reset
1327 new globalIndex(mesh_.nFaces()-mesh_.nInternalFaces())
1329 globalIndex& globalIndices = globalBoundaryFaceNumberingPtr_();
1333 globalPointBoundaryFacesPtr_.reset
1337 labelListList& globalPointBoundaryFaces = globalPointBoundaryFacesPtr_();
1339 forAll(pointBoundaryFaces, pointi)
1341 const labelList& bFaces = pointBoundaryFaces[pointi];
1342 labelList& globalFaces = globalPointBoundaryFaces[pointi];
1346 globalFaces[i] = globalIndices.
toGlobal(bFaces[i]);
1352 globalPointSlavesMap().distribute
1354 globalPointBoundaryFaces,
1363 globalPointTransformedSlaves();
1371 forAll(pointSlaves, pointi)
1373 const labelList& slaves = pointSlaves[pointi];
1374 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1376 if (slaves.
size() > 0)
1378 labelList& myBFaces = globalPointBoundaryFaces[pointi];
1385 n += globalPointBoundaryFaces[slaves[i]].
size();
1393 globalPointBoundaryFaces[slaves[i]];
1400 label slave = slaveBFaces[j];
1403 myBFaces[n++] = slave;
1411 if (transformedSlaves.
size() > 0)
1413 const labelList& untrafoFaces = globalPointBoundaryFaces[pointi];
1420 forAll(transformedSlaves, i)
1422 n += globalPointBoundaryFaces[transformedSlaves[i]].
size();
1427 forAll(transformedSlaves, i)
1429 label transformI = globalPointSlavesMap().whichTransform
1431 transformedSlaves[i]
1435 globalPointBoundaryFaces[transformedSlaves[i]];
1439 label slave = slaveBFaces[j];
1441 if (
findIndex(untrafoFaces, slave)== -1)
1446 myBFaces[n++] = transforms.
encode 1459 if (slaves.
size() + transformedSlaves.
size() == 0)
1461 globalPointBoundaryFaces[pointi].
clear();
1468 globalPointTransformedBoundaryFacesPtr_.reset
1473 globalPointBoundaryFacesMapPtr_.reset
1478 globalPointBoundaryFaces,
1482 globalPointTransformedBoundaryFacesPtr_(),
1488 globalPointTransformedBoundaryFacesPtr_().setSize(coupledPatch().
nPoints());
1492 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1493 <<
" coupled points:" << coupledPatch().nPoints()
1494 <<
" local boundary faces:" << globalIndices.
localSize()
1495 <<
" additional coupled faces:" 1496 << globalPointBoundaryFacesMapPtr_().constructSize()
1503 void Foam::globalMeshData::calcGlobalPointBoundaryCells()
const 1507 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1508 <<
" calculating coupled point to boundary cell addressing." 1522 forAll(coupledPatch().meshPoints(), pointi)
1524 label meshPointi = coupledPatch().meshPoints()[pointi];
1525 const labelList& pCells = mesh_.pointCells(meshPointi);
1527 labelList& bCells = pointBoundaryCells[pointi];
1532 label celli = pCells[i];
1535 if (fnd != meshCellMap.
end())
1541 meshCellMap.
insert(celli, bCelli);
1542 cellMap.append(celli);
1550 boundaryCellsPtr_.reset(
new labelList());
1551 labelList& boundaryCells = boundaryCellsPtr_();
1552 boundaryCells.
transfer(cellMap.shrink());
1558 globalBoundaryCellNumberingPtr_.reset
1562 globalIndex& globalIndices = globalBoundaryCellNumberingPtr_();
1565 globalPointBoundaryCellsPtr_.reset
1569 labelListList& globalPointBoundaryCells = globalPointBoundaryCellsPtr_();
1571 forAll(pointBoundaryCells, pointi)
1573 const labelList& pCells = pointBoundaryCells[pointi];
1574 labelList& globalCells = globalPointBoundaryCells[pointi];
1578 globalCells[i] = globalIndices.
toGlobal(pCells[i]);
1584 globalPointSlavesMap().distribute
1586 globalPointBoundaryCells,
1594 globalPointTransformedSlaves();
1600 forAll(pointSlaves, pointi)
1602 const labelList& slaves = pointSlaves[pointi];
1603 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1605 if (slaves.
size() > 0)
1607 labelList& myBCells = globalPointBoundaryCells[pointi];
1614 n += globalPointBoundaryCells[slaves[i]].
size();
1622 globalPointBoundaryCells[slaves[i]];
1629 label slave = slaveBCells[j];
1632 myBCells[n++] = slave;
1640 if (transformedSlaves.
size() > 0)
1642 const labelList& untrafoCells = globalPointBoundaryCells[pointi];
1649 forAll(transformedSlaves, i)
1651 n += globalPointBoundaryCells[transformedSlaves[i]].
size();
1656 forAll(transformedSlaves, i)
1658 label transformI = globalPointSlavesMap().whichTransform
1660 transformedSlaves[i]
1664 globalPointBoundaryCells[transformedSlaves[i]];
1668 label slave = slaveBCells[j];
1671 if (
findIndex(untrafoCells, slave)== -1)
1675 myBCells[n++] = transforms.
encode 1687 if (slaves.
size() + transformedSlaves.
size() == 0)
1689 globalPointBoundaryCells[pointi].
clear();
1696 globalPointTransformedBoundaryCellsPtr_.reset
1701 globalPointBoundaryCellsMapPtr_.reset
1706 globalPointBoundaryCells,
1710 globalPointTransformedBoundaryCellsPtr_(),
1716 globalPointTransformedBoundaryCellsPtr_().setSize(coupledPatch().
nPoints());
1720 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1721 <<
" coupled points:" << coupledPatch().nPoints()
1722 <<
" local boundary cells:" << globalIndices.
localSize()
1723 <<
" additional coupled cells:" 1724 << globalPointBoundaryCellsMapPtr_().constructSize()
1731 void Foam::globalMeshData::calcGlobalCoPointSlaves()
const 1735 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1736 <<
" calculating coupled master to collocated" 1737 <<
" slave point addressing." <<
endl;
1741 globalPoints globalData(mesh_, coupledPatch(),
true,
false);
1743 globalCoPointSlavesPtr_.reset
1750 globalCoPointSlavesMapPtr_.reset
1754 move(globalData.
map())
1760 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1761 <<
" finished calculating coupled master to collocated" 1762 <<
" slave point addressing." <<
endl;
1776 processorPatches_(0),
1777 processorPatchIndices_(0),
1778 processorPatchNeighbours_(0),
1780 sharedPointLabelsPtr_(nullptr),
1781 sharedPointAddrPtr_(nullptr),
1782 sharedPointGlobalLabelsPtr_(nullptr),
1784 sharedEdgeLabelsPtr_(nullptr),
1785 sharedEdgeAddrPtr_(nullptr)
1802 nGlobalPoints_ = -1;
1803 sharedPointLabelsPtr_.clear();
1804 sharedPointAddrPtr_.clear();
1805 sharedPointGlobalLabelsPtr_.clear();
1809 sharedEdgeLabelsPtr_.clear();
1810 sharedEdgeAddrPtr_.clear();
1813 coupledPatchPtr_.clear();
1814 coupledPatchMeshEdgesPtr_.clear();
1815 coupledPatchMeshEdgeMapPtr_.clear();
1816 globalTransformsPtr_.clear();
1819 globalPointNumberingPtr_.clear();
1820 globalPointSlavesPtr_.clear();
1821 globalPointTransformedSlavesPtr_.clear();
1822 globalPointSlavesMapPtr_.clear();
1824 globalEdgeNumberingPtr_.clear();
1825 globalEdgeSlavesPtr_.clear();
1826 globalEdgeTransformedSlavesPtr_.clear();
1827 globalEdgeOrientationPtr_.clear();
1828 globalEdgeSlavesMapPtr_.clear();
1831 globalBoundaryFaceNumberingPtr_.clear();
1832 globalPointBoundaryFacesPtr_.clear();
1833 globalPointTransformedBoundaryFacesPtr_.clear();
1834 globalPointBoundaryFacesMapPtr_.clear();
1837 boundaryCellsPtr_.clear();
1838 globalBoundaryCellNumberingPtr_.clear();
1839 globalPointBoundaryCellsPtr_.clear();
1840 globalPointTransformedBoundaryCellsPtr_.clear();
1841 globalPointBoundaryCellsMapPtr_.clear();
1844 globalCoPointSlavesPtr_.clear();
1845 globalCoPointSlavesMapPtr_.clear();
1853 if (!sharedPointGlobalLabelsPtr_.valid())
1855 sharedPointGlobalLabelsPtr_.reset
1863 "pointProcAddressing",
1873 Pout<<
"globalMeshData::sharedPointGlobalLabels : " 1874 <<
"Reading pointProcAddressing" <<
endl;
1883 label pointi = pointLabels[i];
1886 sharedPointGlobalLabels[i] = pointProcAddressing[pointi];
1891 Pout<<
"globalMeshData::sharedPointGlobalLabels :" 1892 <<
" Setting pointProcAddressing to -1" <<
endl;
1894 sharedPointGlobalLabels = -1;
1897 return sharedPointGlobalLabelsPtr_();
1916 label sharedPointi = pointAddr[i];
1918 sharedPoints[sharedPointi] = mesh_.
points()[pointLabels[i]];
1933 fromSlave >> nbrSharedPointAddr >> nbrSharedPoints;
1935 forAll(nbrSharedPointAddr, i)
1937 label sharedPointi = nbrSharedPointAddr[i];
1939 sharedPoints[sharedPointi] = nbrSharedPoints[i];
2014 return mergedPoints;
2020 if (nGlobalPoints_ == -1)
2024 return nGlobalPoints_;
2030 if (!sharedPointLabelsPtr_.valid())
2034 return sharedPointLabelsPtr_();
2040 if (!sharedPointAddrPtr_.valid())
2044 return sharedPointAddrPtr_();
2050 if (nGlobalEdges_ == -1)
2054 return nGlobalEdges_;
2060 if (!sharedEdgeLabelsPtr_.valid())
2064 return sharedEdgeLabelsPtr_();
2070 if (!sharedEdgeAddrPtr_.valid())
2074 return sharedEdgeAddrPtr_();
2080 if (!coupledPatchPtr_.valid())
2092 nCoupled += pp.size();
2108 coupledFaces[nCoupled++] = facei++;
2113 coupledPatchPtr_.reset
2128 Pout<<
"globalMeshData::coupledPatch() :" 2129 <<
" constructed coupled faces patch:" 2130 <<
" faces:" << coupledPatchPtr_().size()
2131 <<
" points:" << coupledPatchPtr_().nPoints()
2135 return coupledPatchPtr_();
2141 if (!coupledPatchMeshEdgesPtr_.valid())
2143 coupledPatchMeshEdgesPtr_.reset
2155 return coupledPatchMeshEdgesPtr_();
2162 if (!coupledPatchMeshEdgeMapPtr_.valid())
2167 Map<label>& em = coupledPatchMeshEdgeMapPtr_();
2174 return coupledPatchMeshEdgeMapPtr_();
2180 if (!globalPointNumberingPtr_.valid())
2182 globalPointNumberingPtr_.reset
2187 return globalPointNumberingPtr_();
2194 if (!globalTransformsPtr_.valid())
2198 return globalTransformsPtr_();
2204 if (!globalPointSlavesPtr_.valid())
2206 calcGlobalPointSlaves();
2208 return globalPointSlavesPtr_();
2215 if (!globalPointTransformedSlavesPtr_.valid())
2217 calcGlobalPointSlaves();
2219 return globalPointTransformedSlavesPtr_();
2225 if (!globalPointSlavesMapPtr_.valid())
2227 calcGlobalPointSlaves();
2229 return globalPointSlavesMapPtr_();
2235 if (!globalEdgeNumberingPtr_.valid())
2237 globalEdgeNumberingPtr_.reset
2242 return globalEdgeNumberingPtr_();
2248 if (!globalEdgeSlavesPtr_.valid())
2250 calcGlobalEdgeSlaves();
2252 return globalEdgeSlavesPtr_();
2259 if (!globalEdgeTransformedSlavesPtr_.valid())
2261 calcGlobalEdgeSlaves();
2263 return globalEdgeTransformedSlavesPtr_();
2269 if (!globalEdgeOrientationPtr_.valid())
2271 calcGlobalEdgeOrientation();
2273 return globalEdgeOrientationPtr_();
2279 if (!globalEdgeSlavesMapPtr_.valid())
2281 calcGlobalEdgeSlaves();
2283 return globalEdgeSlavesMapPtr_();
2290 if (!globalBoundaryFaceNumberingPtr_.valid())
2292 calcGlobalPointBoundaryFaces();
2294 return globalBoundaryFaceNumberingPtr_();
2301 if (!globalPointBoundaryFacesPtr_.valid())
2303 calcGlobalPointBoundaryFaces();
2305 return globalPointBoundaryFacesPtr_();
2312 if (!globalPointTransformedBoundaryFacesPtr_.valid())
2314 calcGlobalPointBoundaryFaces();
2316 return globalPointTransformedBoundaryFacesPtr_();
2323 if (!globalPointBoundaryFacesMapPtr_.valid())
2325 calcGlobalPointBoundaryFaces();
2327 return globalPointBoundaryFacesMapPtr_();
2333 if (!boundaryCellsPtr_.valid())
2335 calcGlobalPointBoundaryCells();
2337 return boundaryCellsPtr_();
2344 if (!globalBoundaryCellNumberingPtr_.valid())
2346 calcGlobalPointBoundaryCells();
2348 return globalBoundaryCellNumberingPtr_();
2355 if (!globalPointBoundaryCellsPtr_.valid())
2357 calcGlobalPointBoundaryCells();
2359 return globalPointBoundaryCellsPtr_();
2366 if (!globalPointTransformedBoundaryCellsPtr_.valid())
2368 calcGlobalPointBoundaryCells();
2370 return globalPointTransformedBoundaryCellsPtr_();
2377 if (!globalPointBoundaryCellsMapPtr_.valid())
2379 calcGlobalPointBoundaryCells();
2381 return globalPointBoundaryCellsMapPtr_();
2387 if (!globalCoPointSlavesPtr_.valid())
2389 calcGlobalCoPointSlaves();
2391 return globalCoPointSlavesPtr_();
2397 if (!globalCoPointSlavesMapPtr_.valid())
2399 calcGlobalCoPointSlaves();
2401 return globalCoPointSlavesMapPtr_();
2424 forAll(masterGlobalPoint, pointi)
2426 const labelList& slavePoints = pointSlaves[pointi];
2427 if (slavePoints.
size() > 0)
2429 masterGlobalPoint[pointi] = globalCoupledPoints.
toGlobal(pointi);
2447 forAll(pointSlaves, pointi)
2449 if (masterGlobalPoint[pointi] == -1)
2456 masterGlobalPoint[pointi]
2457 == globalCoupledPoints.
toGlobal(pointi)
2486 uniquePoints.
setSize(myUniquePoints);
2489 forAll(isMaster, meshPointi)
2491 if (isMaster[meshPointi])
2493 pointToGlobal[meshPointi] = globalPointsPtr().toGlobal(nMaster);
2494 uniquePoints[nMaster] = meshPointi;
2504 forAll(pointSlaves, pointi)
2506 const labelList& slaves = pointSlaves[pointi];
2508 if (slaves.
size() > 0)
2512 masterToGlobal[pointi] = pointToGlobal[meshPointi];
2515 masterToGlobal[slaves[i]] = masterToGlobal[pointi];
2524 forAll(pointSlaves, pointi)
2528 if (!isMaster[meshPointi])
2530 pointToGlobal[meshPointi] = masterToGlobal[pointi];
2535 return globalPointsPtr;
2574 forAll(meshPoints, patchPointi)
2576 label meshPointi = meshPoints[patchPointi];
2582 patchToCoupled[patchPointi] = iter();
2583 coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi);
2601 pointSlavesMap.
distribute(coupledToGlobalPatch);
2602 forAll(pointSlaves, coupledPointi)
2604 const labelList& slaves = pointSlaves[coupledPointi];
2606 if (slaves.
size() > 0)
2610 if (coupledToGlobalPatch[coupledPointi] != -1)
2613 masterI = coupledToGlobalPatch[coupledPointi];
2620 label slavePp = coupledToGlobalPatch[slaves[i]];
2621 if (slavePp != -1 && slavePp < masterI)
2631 coupledToGlobalPatch[coupledPointi] = masterI;
2634 coupledToGlobalPatch[slaves[i]] = masterI;
2649 forAll(meshPoints, patchPointi)
2651 if (patchToCoupled[patchPointi] == -1)
2657 label coupledPointi = patchToCoupled[patchPointi];
2660 globalPPoints.toGlobal(patchPointi)
2661 == coupledToGlobalPatch[coupledPointi]
2684 uniqueMeshPoints.
setSize(nMasters);
2691 forAll(meshPoints, patchPointi)
2693 if (patchToCoupled[patchPointi] == -1)
2695 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2699 label coupledPointi = patchToCoupled[patchPointi];
2702 globalPPoints.toGlobal(patchPointi)
2703 == coupledToGlobalPatch[coupledPointi]
2706 globalMaster[coupledPointi] =
2707 globalPointsPtr().toGlobal(nMasters);
2708 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2728 forAll(meshPoints, patchPointi)
2730 if (patchToCoupled[patchPointi] == -1)
2732 pointToGlobal[patchPointi] = globalPointsPtr().toGlobal(nMasters++);
2736 label coupledPointi = patchToCoupled[patchPointi];
2737 pointToGlobal[patchPointi] = globalMaster[coupledPointi];
2741 globalPPoints.toGlobal(patchPointi)
2742 == coupledToGlobalPatch[coupledPointi]
2750 return globalPointsPtr;
2775 Pout<<
"globalMeshData : merge dist:" << tolDim <<
endl;
2798 Pout<<
"globalMeshData : nTotalFaces_:" << nTotalFaces_ <<
endl;
2811 Pout<<
"globalMeshData : nTotalCells_:" << nTotalCells_ <<
endl;
2826 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 & transformedPointPoints() const
Transformed points per point (in mapDistribute indices)
const labelListList & globalPointSlaves() const
const mapDistribute & globalCoPointSlavesMap() 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)
intWM_LABEL_SIZE_t 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
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
pointField geometricSharedPoints() const
Like sharedPoints but keeps cyclic points separate.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
A face is a list of labels corresponding to mesh vertices.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
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.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
const labelListList & globalPointTransformedBoundaryFaces() const
static int firstSlave()
Process index of first slave.
const labelListList & pointEdges() const
const mapDistribute & globalEdgeSlavesMap() const
static const Foam::scalar matchTol_
Geometric tolerance (fraction of bounding box)
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 compare(const Pair< Type > &a, const Pair< Type > &b)
Compare Pairs.
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 mapDistribute & globalPointSlavesMap() const
static bool master(const label communicator=0)
Am I the master process.
const labelListList & globalPointBoundaryCells() const
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
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.
const labelListList & globalPointBoundaryFaces() const
const mapDistribute & map() const
Corresponding map.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
label size() const
Return number of elements in table.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
Determines processor-processor connection. After instantiation contains on all processors the process...
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.
Input inter-processor communications stream operating on external buffer.
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...
A List obtained as a section of another List.
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.
An ordered pair of two objects of type <T> with first() and second() elements.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
void clear()
Clear the list, i.e. set size to zero.
void clear()
Clear all entries from table.
scalar mag() const
The magnitude of the bounding box span.
const globalIndex & globalPointNumbering() const
Numbering of coupled points is according to coupledPatch.
label size() const
Global sum of localSizes.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Pair< label > labelPair
Label pair.
label toLocal(const label i) const
From global to local on current processor.
static const label labelMax
List< label > labelList
A List of labels.
virtual const faceList & faces() const
Return raw faces.
label whichProcID(const label i) const
Which processor does global come from? Binary search.
List< labelPair > labelPairList
List of labelPairs.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
Output inter-processor communications stream operating on external buffer.
Map from edge (expressed as its endpoints) to value.
const labelListList & pointPoints() const
Non-transformed connected points per point (in mapDistribute.
~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,.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
word name(const complex &)
Return a string representation of a complex.
void movePoints(const pointField &newPoints)
Update for moving points.
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
static void syncData(List< Type > &pointData, const labelListList &slaves, const labelListList &transformedSlaves, const mapDistribute &slavesMap, const globalIndexAndTransform &, const CombineOp &cop, const TransformOp &top)
Helper: synchronise data with transforms.
label constructSize() const
Constructed data size.
Calculates points shared by more than two processor patches or cyclic patches.
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.
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.
Class containing processor-to-processor mapping information.
const dimensionedScalar me
Electron mass.
globalMeshData(const polyMesh &mesh)
Construct from mesh, derive rest (does parallel communication!)
prefixOSstream Pout(cout, "Pout")
const polyBoundaryMesh & bMesh
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.
void updateMesh()
Change global mesh data given a topological change. Does a.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
const doubleScalar e
Elementary charge.
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.
const mapDistribute & globalPointBoundaryFacesMap() const
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
pointField sharedPoints() const
Collect coordinates of shared points on all processors.
const mapDistribute & globalPointBoundaryCellsMap() const
label size() const
Return the number of elements in the UList.
A List with indirect addressing.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
Inter-processor communications stream.
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.
dimensionSet transform(const dimensionSet &)
const labelListList & globalCoPointSlaves() const
static int lastSlave(const label communicator=0)
Process index of last slave.
const labelListList & globalEdgeTransformedSlaves() const
void operator()(labelPair &x, const labelPair &y) const
label localSize() const
My local size.
const globalIndex & globalBoundaryFaceNumbering() const
Numbering of boundary faces is face-mesh.nInternalFaces()