56 x[0] =
min(x[0], y[0]);
57 x[1] =
min(x[1], y[1]);
65 void Foam::globalMeshData::initProcAddr()
67 processorPatchIndices_.setSize(mesh_.boundaryMesh().size());
68 processorPatchIndices_ = -1;
70 processorPatchNeighbours_.setSize(mesh_.boundaryMesh().size());
71 processorPatchNeighbours_ = -1;
75 processorPatches_.setSize(mesh_.boundaryMesh().size());
77 label nNeighbours = 0;
81 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
83 processorPatches_[nNeighbours] =
patchi;
84 processorPatchIndices_[
patchi] = nNeighbours++;
87 processorPatches_.setSize(nNeighbours);
95 forAll(processorPatches_, i)
101 refCast<const processorPolyPatch>
103 mesh_.boundaryMesh()[
patchi]
108 toNeighbour << processorPatchIndices_[
patchi];
113 forAll(processorPatches_, i)
119 refCast<const processorPolyPatch>
121 mesh_.boundaryMesh()[
patchi]
126 fromNeighbour >> processorPatchNeighbours_[
patchi];
132 void Foam::globalMeshData::calcSharedPoints()
const 137 || sharedPointLabelsPtr_.valid()
138 || sharedPointAddrPtr_.valid()
157 if (pPoints.
size()+transPPoints.
size() > 0)
166 nGlobalPoints_ = masterNumbering.
size();
180 if (pPoints.
size()+transPPoints.
size() > 0)
182 master[i] = masterNumbering.
toGlobal(nMaster);
185 master[pPoints[j]] = master[i];
189 master[transPPoints[j]] = master[i];
224 sharedPointLabelsPtr_.reset(
new labelList(nMaster));
225 labelList& sharedPointLabels = sharedPointLabelsPtr_();
226 sharedPointAddrPtr_.reset(
new labelList(nMaster));
227 labelList& sharedPointAddr = sharedPointAddrPtr_();
235 sharedPointLabels[nMaster] = i;
236 sharedPointAddr[nMaster] = master[i];
243 Pout<<
"globalMeshData : nGlobalPoints_:" << nGlobalPoints_ <<
nl 244 <<
"globalMeshData : sharedPointLabels_:" 245 << sharedPointLabelsPtr_().size() <<
nl 246 <<
"globalMeshData : sharedPointAddr_:" 247 << sharedPointAddrPtr_().size() <<
endl;
252 void Foam::globalMeshData::countSharedEdges
262 const edge&
e = iter.key();
266 if (globalFnd == globalShared.
end())
269 if (iter().size() == 1)
272 globalShared.
insert(e, -1);
278 globalShared.
insert(e, sharedEdgeI++);
283 if (globalFnd() == -1)
287 globalFnd() = sharedEdgeI++;
294 void Foam::globalMeshData::calcSharedEdges()
const 304 || sharedEdgeLabelsPtr_.valid()
305 || sharedEdgeAddrPtr_.valid()
313 const labelList& sharedPtAddr = sharedPointAddr();
314 const labelList& sharedPtLabels = sharedPointLabels();
321 meshToShared.insert(sharedPtLabels[i], i);
329 const edgeList& edges = mesh_.edges();
333 const edge&
e = edges[edgeI];
337 if (e0Fnd != meshToShared.
end())
341 if (e1Fnd != meshToShared.
end())
349 sharedPtAddr[e0Fnd()],
350 sharedPtAddr[e1Fnd()]
354 localShared.
find(sharedEdge);
356 if (iter == localShared.
end())
359 localShared.insert(sharedEdge,
labelList(1, edgeI));
368 edgeLabels[sz] = edgeI;
388 label sharedEdgeI = 0;
393 Pout<<
"globalMeshData::calcSharedEdges : Merging in from proc0 : " 394 << localShared.size() <<
endl;
396 countSharedEdges(localShared, globalShared, sharedEdgeI);
414 Pout<<
"globalMeshData::calcSharedEdges : " 415 <<
"Merging in from proc" 419 countSharedEdges(procSharedEdges, globalShared, sharedEdgeI);
429 globalShared.
clear();
435 globalShared.
insert(iter.key(), iter());
440 Pout<<
"globalMeshData::calcSharedEdges : Filtered " 441 << oldSharedEdges.
size()
442 <<
" down to " << globalShared.
size() <<
endl;
459 toSlave << globalShared;
469 toMaster << localShared;
475 fromMaster >> globalShared;
482 nGlobalEdges_ = globalShared.
size();
489 const edge&
e = iter.key();
493 if (edgeFnd != globalShared.
end())
502 dynSharedEdgeLabels.append(edgeLabels[i]);
505 dynSharedEdgeAddr.append(edgeFnd());
510 sharedEdgeLabelsPtr_.reset(
new labelList());
511 labelList& sharedEdgeLabels = sharedEdgeLabelsPtr_();
512 sharedEdgeLabels.
transfer(dynSharedEdgeLabels);
514 sharedEdgeAddrPtr_.reset(
new labelList());
515 labelList& sharedEdgeAddr = sharedEdgeAddrPtr_();
516 sharedEdgeAddr.
transfer(dynSharedEdgeAddr);
520 Pout<<
"globalMeshData : nGlobalEdges_:" << nGlobalEdges_ <<
nl 521 <<
"globalMeshData : sharedEdgeLabels:" << sharedEdgeLabels.
size()
523 <<
"globalMeshData : sharedEdgeAddr:" << sharedEdgeAddr.
size()
529 void Foam::globalMeshData::calcGlobalPointSlaves()
const 533 Pout<<
"globalMeshData::calcGlobalPointSlaves() :" 534 <<
" calculating coupled master to slave point addressing." 539 globalPoints globalData(mesh_, coupledPatch(),
true,
true);
541 globalPointSlavesPtr_.reset
548 globalPointTransformedSlavesPtr_.reset
556 globalPointSlavesMapPtr_.reset
566 void Foam::globalMeshData::calcPointConnectivity
573 const labelListList& transformedSlaves = globalPointTransformedSlaves();
577 labelPairList myData(globalPointSlavesMap().constructSize());
588 globalPointSlavesMap().distribute(myData);
592 allPointConnectivity.
setSize(globalPointSlavesMap().constructSize());
600 const labelList& pSlaves = slaves[pointi];
601 const labelList& pTransformSlaves = transformedSlaves[pointi];
603 if (pSlaves.
size()+pTransformSlaves.
size())
611 pConnectivity[connI++] = myData[pointi];
615 pConnectivity[connI++] = myData[pSlaves[i]];
618 forAll(pTransformSlaves, i)
621 label transformI = globalPointSlavesMap().whichTransform
626 const labelPair&
n = myData[pTransformSlaves[i]];
640 allPointConnectivity[pSlaves[i]] = pConnectivity;
642 forAll(pTransformSlaves, i)
644 allPointConnectivity[pTransformSlaves[i]] = pConnectivity;
655 if (pConnectivity.
size() == 0)
657 pConnectivity.
setSize(1, myData[pointi]);
662 globalPointSlavesMap().reverseDistribute
670 void Foam::globalMeshData::calcGlobalPointEdges
676 const edgeList& edges = coupledPatch().edges();
677 const labelListList& pointEdges = coupledPatch().pointEdges();
678 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
680 const labelListList& transformedSlaves = globalPointTransformedSlaves();
683 globalPointEdges.
setSize(globalPointSlavesMap().constructSize());
684 globalPointPoints.
setSize(globalPointSlavesMap().constructSize());
685 forAll(pointEdges, pointi)
687 const labelList& pEdges = pointEdges[pointi];
688 labelList& globalPEdges = globalPointEdges[pointi];
692 globalPEdges[i] = globalEdgeNumbers.
toGlobal(pEdges[i]);
699 label otherPointi = edges[pEdges[i]].otherVertex(pointi);
704 globalTransforms().nullTransformIndex()
710 globalPointSlavesMap().distribute(globalPointEdges);
711 globalPointSlavesMap().distribute(globalPointPoints);
715 const labelList& pSlaves = slaves[pointi];
716 const labelList& pTransformSlaves = transformedSlaves[pointi];
721 n += globalPointEdges[pSlaves[i]].
size();
723 forAll(pTransformSlaves, i)
725 n += globalPointEdges[pTransformSlaves[i]].
size();
730 labelList& globalPEdges = globalPointEdges[pointi];
735 const labelList& otherData = globalPointEdges[pSlaves[i]];
738 globalPEdges[sz++] = otherData[j];
741 forAll(pTransformSlaves, i)
744 globalPointEdges[pTransformSlaves[i]];
747 globalPEdges[sz++] = otherData[j];
754 globalPointEdges[pSlaves[i]] = globalPEdges;
756 forAll(pTransformSlaves, i)
758 globalPointEdges[pTransformSlaves[i]] = globalPEdges;
772 const labelPairList& otherData = globalPointPoints[pSlaves[i]];
775 globalPPoints[sz++] = otherData[j];
779 forAll(pTransformSlaves, i)
782 label transformI = globalPointSlavesMap().whichTransform
788 globalPointPoints[pTransformSlaves[i]];
807 globalPointPoints[pSlaves[i]] = globalPPoints;
809 forAll(pTransformSlaves, i)
811 globalPointPoints[pTransformSlaves[i]] = globalPPoints;
816 globalPointSlavesMap().reverseDistribute
822 globalPointSlavesMap().reverseDistribute
834 const label localPoint
840 label remoteTransformI = -1;
841 label localTransformI = -1;
850 localTransformI = transformI;
855 if (proci == remoteProci && pointi == remoteIndex)
857 remoteTransformI = transformI;
865 if (remoteTransformI == -1 || localTransformI == -1)
868 <<
"Problem. Cannot find " << remotePoint
869 <<
" or " << localPoint <<
" " 870 << coupledPatch().localPoints()[localPoint]
873 <<
"remoteTransformI:" << remoteTransformI <<
endl 874 <<
"localTransformI:" << localTransformI
878 return globalTransforms().subtractTransformIndex
886 void Foam::globalMeshData::calcGlobalEdgeSlaves()
const 890 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 891 <<
" calculating coupled master to slave edge addressing." <<
endl;
894 const edgeList& edges = coupledPatch().edges();
895 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
909 calcPointConnectivity(allPointConnectivity);
916 calcGlobalPointEdges(globalPointEdges, globalPointPoints);
933 const edge&
e = edges[edgeI];
934 const labelList& pEdges0 = globalPointEdges[e[0]];
936 const labelList& pEdges1 = globalPointEdges[e[1]];
948 globalTransforms().nullTransformIndex()
958 pEdges0[i] == pEdges1[j]
959 && pEdges0[i] != globalEdgeNumbers.
toGlobal(edgeI)
971 label transform0 = findTransform
973 allPointConnectivity[e[0]],
977 label transform1 = findTransform
979 allPointConnectivity[e[1]],
984 if (transform0 == transform1)
992 globalEdgeNumbers.
toLocal(proci, pEdges0[i]),
1001 allEdgeConnectivity[edgeI].transfer(eEdges);
1012 forAll(allEdgeConnectivity, edgeI)
1015 if (edgeInfo.
size() >= 2)
1017 const labelPair& masterInfo = edgeInfo[0];
1030 labelList& eEdges = globalEdgeSlaves[edgeI];
1036 label nonTransformI = 0;
1037 label transformI = 0;
1039 for (
label i = 1; i < edgeInfo.
size(); i++)
1049 if (transform == globalTransforms().nullTransformIndex())
1051 eEdges[nonTransformI++] = globalEdgeNumbers.
toGlobal 1059 trafoEEdges[transformI++] = info;
1063 eEdges.
setSize(nonTransformI);
1064 trafoEEdges.
setSize(transformI);
1074 globalEdgeSlavesMapPtr_.reset
1083 globalEdgeTransformedSlavesPtr_(),
1092 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 1093 <<
" coupled edges:" << edges.
size()
1094 <<
" additional coupled edges:" 1095 << globalEdgeSlavesMapPtr_().constructSize() - edges.
size()
1101 void Foam::globalMeshData::calcGlobalEdgeOrientation()
const 1105 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1106 <<
" calculating edge orientation w.r.t. master edge." <<
endl;
1119 for (
label pointi = 0; pointi < coupledPatch().nPoints(); pointi++)
1121 masterPoint[pointi] = globalPoints.
toGlobal(pointi);
1126 globalPointSlaves(),
1127 globalPointTransformedSlaves(),
1140 const labelListList& transformedSlaves = globalEdgeTransformedSlaves();
1146 for (
label edgeI = 0; edgeI < coupledPatch().nEdges(); edgeI++)
1151 slaves[edgeI].size()
1152 + transformedSlaves[edgeI].size()
1159 const edge&
e = coupledPatch().edges()[edgeI];
1177 globalEdgeOrientationPtr_.reset
1181 PackedBoolList& globalEdgeOrientation = globalEdgeOrientationPtr_();
1183 forAll(coupledPatch().edges(), edgeI)
1185 const edge&
e = coupledPatch().edges()[edgeI];
1195 masterEdgeVerts[edgeI]
1200 <<
"problem : my edge:" << e
1201 <<
" in master points:" << masterE
1202 <<
" v.s. masterEdgeVerts:" << masterEdgeVerts[edgeI]
1207 globalEdgeOrientation[edgeI] = (stat == 1);
1214 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1215 <<
" finished calculating edge orientation." 1221 void Foam::globalMeshData::calcPointBoundaryFaces
1227 const Map<label>& meshPointMap = coupledPatch().meshPointMap();
1241 const face&
f = pp[i];
1249 if (iter != meshPointMap.
end())
1251 nPointFaces[iter()]++;
1262 forAll(nPointFaces, pointi)
1264 pointBoundaryFaces[pointi].
setSize(nPointFaces[pointi]);
1279 const face&
f = pp[i];
1286 if (iter != meshPointMap.
end())
1289 pp.
start() + i - mesh_.nInternalFaces();
1290 pointBoundaryFaces[iter()][nPointFaces[iter()]++] =
1300 void Foam::globalMeshData::calcGlobalPointBoundaryFaces()
const 1304 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1305 <<
" calculating coupled point to boundary face addressing." 1311 calcPointBoundaryFaces(pointBoundaryFaces);
1315 globalBoundaryFaceNumberingPtr_.reset
1317 new globalIndex(mesh_.nFaces()-mesh_.nInternalFaces())
1319 globalIndex& globalIndices = globalBoundaryFaceNumberingPtr_();
1323 globalPointBoundaryFacesPtr_.reset
1327 labelListList& globalPointBoundaryFaces = globalPointBoundaryFacesPtr_();
1329 forAll(pointBoundaryFaces, pointi)
1331 const labelList& bFaces = pointBoundaryFaces[pointi];
1332 labelList& globalFaces = globalPointBoundaryFaces[pointi];
1336 globalFaces[i] = globalIndices.
toGlobal(bFaces[i]);
1342 globalPointSlavesMap().distribute
1344 globalPointBoundaryFaces,
1353 globalPointTransformedSlaves();
1360 forAll(pointSlaves, pointi)
1362 const labelList& slaves = pointSlaves[pointi];
1363 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1365 if (slaves.
size() > 0)
1367 labelList& myBFaces = globalPointBoundaryFaces[pointi];
1374 n += globalPointBoundaryFaces[slaves[i]].
size();
1382 globalPointBoundaryFaces[slaves[i]];
1389 label slave = slaveBFaces[j];
1392 myBFaces[n++] = slave;
1400 if (transformedSlaves.
size() > 0)
1402 const labelList& untrafoFaces = globalPointBoundaryFaces[pointi];
1409 forAll(transformedSlaves, i)
1411 n += globalPointBoundaryFaces[transformedSlaves[i]].
size();
1416 forAll(transformedSlaves, i)
1418 label transformI = globalPointSlavesMap().whichTransform
1420 transformedSlaves[i]
1424 globalPointBoundaryFaces[transformedSlaves[i]];
1428 label slave = slaveBFaces[j];
1430 if (
findIndex(untrafoFaces, slave)== -1)
1448 if (slaves.
size() + transformedSlaves.
size() == 0)
1450 globalPointBoundaryFaces[pointi].
clear();
1457 globalPointTransformedBoundaryFacesPtr_.reset
1462 globalPointBoundaryFacesMapPtr_.reset
1467 globalPointBoundaryFaces,
1471 globalPointTransformedBoundaryFacesPtr_(),
1477 globalPointTransformedBoundaryFacesPtr_().setSize(coupledPatch().
nPoints());
1481 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1482 <<
" coupled points:" << coupledPatch().nPoints()
1483 <<
" local boundary faces:" << globalIndices.
localSize()
1484 <<
" additional coupled faces:" 1485 << globalPointBoundaryFacesMapPtr_().constructSize()
1492 void Foam::globalMeshData::calcGlobalPointBoundaryCells()
const 1496 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1497 <<
" calculating coupled point to boundary cell addressing." 1511 forAll(coupledPatch().meshPoints(), pointi)
1513 label meshPointi = coupledPatch().meshPoints()[pointi];
1514 const labelList& pCells = mesh_.pointCells(meshPointi);
1516 labelList& bCells = pointBoundaryCells[pointi];
1521 label celli = pCells[i];
1524 if (fnd != meshCellMap.
end())
1530 meshCellMap.
insert(celli, bCelli);
1531 cellMap.append(celli);
1539 boundaryCellsPtr_.reset(
new labelList());
1540 labelList& boundaryCells = boundaryCellsPtr_();
1541 boundaryCells.
transfer(cellMap.shrink());
1547 globalBoundaryCellNumberingPtr_.reset
1551 globalIndex& globalIndices = globalBoundaryCellNumberingPtr_();
1554 globalPointBoundaryCellsPtr_.reset
1558 labelListList& globalPointBoundaryCells = globalPointBoundaryCellsPtr_();
1560 forAll(pointBoundaryCells, pointi)
1562 const labelList& pCells = pointBoundaryCells[pointi];
1563 labelList& globalCells = globalPointBoundaryCells[pointi];
1567 globalCells[i] = globalIndices.
toGlobal(pCells[i]);
1573 globalPointSlavesMap().distribute
1575 globalPointBoundaryCells,
1583 globalPointTransformedSlaves();
1588 forAll(pointSlaves, pointi)
1590 const labelList& slaves = pointSlaves[pointi];
1591 const labelList& transformedSlaves = pointTransformSlaves[pointi];
1593 if (slaves.
size() > 0)
1595 labelList& myBCells = globalPointBoundaryCells[pointi];
1602 n += globalPointBoundaryCells[slaves[i]].
size();
1610 globalPointBoundaryCells[slaves[i]];
1617 label slave = slaveBCells[j];
1620 myBCells[n++] = slave;
1628 if (transformedSlaves.
size() > 0)
1630 const labelList& untrafoCells = globalPointBoundaryCells[pointi];
1637 forAll(transformedSlaves, i)
1639 n += globalPointBoundaryCells[transformedSlaves[i]].
size();
1644 forAll(transformedSlaves, i)
1646 label transformI = globalPointSlavesMap().whichTransform
1648 transformedSlaves[i]
1652 globalPointBoundaryCells[transformedSlaves[i]];
1656 label slave = slaveBCells[j];
1659 if (
findIndex(untrafoCells, slave)== -1)
1675 if (slaves.
size() + transformedSlaves.
size() == 0)
1677 globalPointBoundaryCells[pointi].
clear();
1684 globalPointTransformedBoundaryCellsPtr_.reset
1689 globalPointBoundaryCellsMapPtr_.reset
1694 globalPointBoundaryCells,
1698 globalPointTransformedBoundaryCellsPtr_(),
1704 globalPointTransformedBoundaryCellsPtr_().setSize(coupledPatch().
nPoints());
1708 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1709 <<
" coupled points:" << coupledPatch().nPoints()
1710 <<
" local boundary cells:" << globalIndices.
localSize()
1711 <<
" additional coupled cells:" 1712 << globalPointBoundaryCellsMapPtr_().constructSize()
1719 void Foam::globalMeshData::calcGlobalCoPointSlaves()
const 1723 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1724 <<
" calculating coupled master to collocated" 1725 <<
" slave point addressing." <<
endl;
1729 globalPoints globalData(mesh_, coupledPatch(),
true,
false);
1731 globalCoPointSlavesPtr_.reset
1738 globalCoPointSlavesMapPtr_.reset
1748 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1749 <<
" finished calculating coupled master to collocated" 1750 <<
" slave point addressing." <<
endl;
1764 processorPatches_(0),
1765 processorPatchIndices_(0),
1766 processorPatchNeighbours_(0),
1768 sharedPointLabelsPtr_(NULL),
1769 sharedPointAddrPtr_(NULL),
1770 sharedPointGlobalLabelsPtr_(NULL),
1772 sharedEdgeLabelsPtr_(NULL),
1773 sharedEdgeAddrPtr_(NULL)
1790 nGlobalPoints_ = -1;
1791 sharedPointLabelsPtr_.clear();
1792 sharedPointAddrPtr_.clear();
1793 sharedPointGlobalLabelsPtr_.clear();
1797 sharedEdgeLabelsPtr_.clear();
1798 sharedEdgeAddrPtr_.clear();
1801 coupledPatchPtr_.clear();
1802 coupledPatchMeshEdgesPtr_.clear();
1803 coupledPatchMeshEdgeMapPtr_.clear();
1804 globalTransformsPtr_.clear();
1807 globalPointNumberingPtr_.clear();
1808 globalPointSlavesPtr_.clear();
1809 globalPointTransformedSlavesPtr_.clear();
1810 globalPointSlavesMapPtr_.clear();
1812 globalEdgeNumberingPtr_.clear();
1813 globalEdgeSlavesPtr_.clear();
1814 globalEdgeTransformedSlavesPtr_.clear();
1815 globalEdgeOrientationPtr_.clear();
1816 globalEdgeSlavesMapPtr_.clear();
1819 globalBoundaryFaceNumberingPtr_.clear();
1820 globalPointBoundaryFacesPtr_.clear();
1821 globalPointTransformedBoundaryFacesPtr_.clear();
1822 globalPointBoundaryFacesMapPtr_.clear();
1825 boundaryCellsPtr_.clear();
1826 globalBoundaryCellNumberingPtr_.clear();
1827 globalPointBoundaryCellsPtr_.clear();
1828 globalPointTransformedBoundaryCellsPtr_.clear();
1829 globalPointBoundaryCellsMapPtr_.clear();
1832 globalCoPointSlavesPtr_.clear();
1833 globalCoPointSlavesMapPtr_.clear();
1841 if (!sharedPointGlobalLabelsPtr_.valid())
1843 sharedPointGlobalLabelsPtr_.reset
1851 "pointProcAddressing",
1857 if (addrHeader.headerOk())
1861 Pout<<
"globalMeshData::sharedPointGlobalLabels : " 1862 <<
"Reading pointProcAddressing" <<
endl;
1871 label pointi = pointLabels[i];
1874 sharedPointGlobalLabels[i] = pointProcAddressing[pointi];
1879 Pout<<
"globalMeshData::sharedPointGlobalLabels :" 1880 <<
" Setting pointProcAddressing to -1" <<
endl;
1882 sharedPointGlobalLabels = -1;
1885 return sharedPointGlobalLabelsPtr_();
1904 label sharedPointi = pointAddr[i];
1906 sharedPoints[sharedPointi] = mesh_.
points()[pointLabels[i]];
1921 fromSlave >> nbrSharedPointAddr >> nbrSharedPoints;
1923 forAll(nbrSharedPointAddr, i)
1925 label sharedPointi = nbrSharedPointAddr[i];
1927 sharedPoints[sharedPointi] = nbrSharedPoints[i];
1995 return mergedPoints;
2001 if (nGlobalPoints_ == -1)
2005 return nGlobalPoints_;
2011 if (!sharedPointLabelsPtr_.valid())
2015 return sharedPointLabelsPtr_();
2021 if (!sharedPointAddrPtr_.valid())
2025 return sharedPointAddrPtr_();
2031 if (nGlobalEdges_ == -1)
2035 return nGlobalEdges_;
2041 if (!sharedEdgeLabelsPtr_.valid())
2045 return sharedEdgeLabelsPtr_();
2051 if (!sharedEdgeAddrPtr_.valid())
2055 return sharedEdgeAddrPtr_();
2061 if (!coupledPatchPtr_.valid())
2073 nCoupled += pp.size();
2089 coupledFaces[nCoupled++] = facei++;
2094 coupledPatchPtr_.reset
2109 Pout<<
"globalMeshData::coupledPatch() :" 2110 <<
" constructed coupled faces patch:" 2111 <<
" faces:" << coupledPatchPtr_().size()
2112 <<
" points:" << coupledPatchPtr_().nPoints()
2116 return coupledPatchPtr_();
2122 if (!coupledPatchMeshEdgesPtr_.valid())
2124 coupledPatchMeshEdgesPtr_.reset
2136 return coupledPatchMeshEdgesPtr_();
2143 if (!coupledPatchMeshEdgeMapPtr_.valid())
2148 Map<label>& em = coupledPatchMeshEdgeMapPtr_();
2155 return coupledPatchMeshEdgeMapPtr_();
2161 if (!globalPointNumberingPtr_.valid())
2163 globalPointNumberingPtr_.reset
2168 return globalPointNumberingPtr_();
2175 if (!globalTransformsPtr_.valid())
2179 return globalTransformsPtr_();
2185 if (!globalPointSlavesPtr_.valid())
2187 calcGlobalPointSlaves();
2189 return globalPointSlavesPtr_();
2196 if (!globalPointTransformedSlavesPtr_.valid())
2198 calcGlobalPointSlaves();
2200 return globalPointTransformedSlavesPtr_();
2206 if (!globalPointSlavesMapPtr_.valid())
2208 calcGlobalPointSlaves();
2210 return globalPointSlavesMapPtr_();
2216 if (!globalEdgeNumberingPtr_.valid())
2218 globalEdgeNumberingPtr_.reset
2223 return globalEdgeNumberingPtr_();
2229 if (!globalEdgeSlavesPtr_.valid())
2231 calcGlobalEdgeSlaves();
2233 return globalEdgeSlavesPtr_();
2240 if (!globalEdgeTransformedSlavesPtr_.valid())
2242 calcGlobalEdgeSlaves();
2244 return globalEdgeTransformedSlavesPtr_();
2250 if (!globalEdgeOrientationPtr_.valid())
2252 calcGlobalEdgeOrientation();
2254 return globalEdgeOrientationPtr_();
2260 if (!globalEdgeSlavesMapPtr_.valid())
2262 calcGlobalEdgeSlaves();
2264 return globalEdgeSlavesMapPtr_();
2271 if (!globalBoundaryFaceNumberingPtr_.valid())
2273 calcGlobalPointBoundaryFaces();
2275 return globalBoundaryFaceNumberingPtr_();
2282 if (!globalPointBoundaryFacesPtr_.valid())
2284 calcGlobalPointBoundaryFaces();
2286 return globalPointBoundaryFacesPtr_();
2293 if (!globalPointTransformedBoundaryFacesPtr_.valid())
2295 calcGlobalPointBoundaryFaces();
2297 return globalPointTransformedBoundaryFacesPtr_();
2304 if (!globalPointBoundaryFacesMapPtr_.valid())
2306 calcGlobalPointBoundaryFaces();
2308 return globalPointBoundaryFacesMapPtr_();
2314 if (!boundaryCellsPtr_.valid())
2316 calcGlobalPointBoundaryCells();
2318 return boundaryCellsPtr_();
2325 if (!globalBoundaryCellNumberingPtr_.valid())
2327 calcGlobalPointBoundaryCells();
2329 return globalBoundaryCellNumberingPtr_();
2336 if (!globalPointBoundaryCellsPtr_.valid())
2338 calcGlobalPointBoundaryCells();
2340 return globalPointBoundaryCellsPtr_();
2347 if (!globalPointTransformedBoundaryCellsPtr_.valid())
2349 calcGlobalPointBoundaryCells();
2351 return globalPointTransformedBoundaryCellsPtr_();
2358 if (!globalPointBoundaryCellsMapPtr_.valid())
2360 calcGlobalPointBoundaryCells();
2362 return globalPointBoundaryCellsMapPtr_();
2368 if (!globalCoPointSlavesPtr_.valid())
2370 calcGlobalCoPointSlaves();
2372 return globalCoPointSlavesPtr_();
2378 if (!globalCoPointSlavesMapPtr_.valid())
2380 calcGlobalCoPointSlaves();
2382 return globalCoPointSlavesMapPtr_();
2405 forAll(masterGlobalPoint, pointi)
2407 const labelList& slavePoints = pointSlaves[pointi];
2408 if (slavePoints.
size() > 0)
2410 masterGlobalPoint[pointi] = globalCoupledPoints.
toGlobal(pointi);
2428 forAll(pointSlaves, pointi)
2430 if (masterGlobalPoint[pointi] == -1)
2437 masterGlobalPoint[pointi]
2438 == globalCoupledPoints.
toGlobal(pointi)
2467 uniquePoints.
setSize(myUniquePoints);
2470 forAll(isMaster, meshPointi)
2472 if (isMaster[meshPointi])
2474 pointToGlobal[meshPointi] = globalPointsPtr().toGlobal(nMaster);
2475 uniquePoints[nMaster] = meshPointi;
2485 forAll(pointSlaves, pointi)
2487 const labelList& slaves = pointSlaves[pointi];
2489 if (slaves.
size() > 0)
2493 masterToGlobal[pointi] = pointToGlobal[meshPointi];
2496 masterToGlobal[slaves[i]] = masterToGlobal[pointi];
2505 forAll(pointSlaves, pointi)
2509 if (!isMaster[meshPointi])
2511 pointToGlobal[meshPointi] = masterToGlobal[pointi];
2516 return globalPointsPtr;
2555 forAll(meshPoints, patchPointi)
2557 label meshPointi = meshPoints[patchPointi];
2563 patchToCoupled[patchPointi] = iter();
2564 coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointi);
2582 pointSlavesMap.
distribute(coupledToGlobalPatch);
2583 forAll(pointSlaves, coupledPointi)
2585 const labelList& slaves = pointSlaves[coupledPointi];
2587 if (slaves.
size() > 0)
2591 if (coupledToGlobalPatch[coupledPointi] != -1)
2594 masterI = coupledToGlobalPatch[coupledPointi];
2601 label slavePp = coupledToGlobalPatch[slaves[i]];
2602 if (slavePp != -1 && slavePp < masterI)
2612 coupledToGlobalPatch[coupledPointi] = masterI;
2615 coupledToGlobalPatch[slaves[i]] = masterI;
2630 forAll(meshPoints, patchPointi)
2632 if (patchToCoupled[patchPointi] == -1)
2638 label coupledPointi = patchToCoupled[patchPointi];
2641 globalPPoints.toGlobal(patchPointi)
2642 == coupledToGlobalPatch[coupledPointi]
2665 uniqueMeshPoints.
setSize(nMasters);
2672 forAll(meshPoints, patchPointi)
2674 if (patchToCoupled[patchPointi] == -1)
2676 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2680 label coupledPointi = patchToCoupled[patchPointi];
2683 globalPPoints.toGlobal(patchPointi)
2684 == coupledToGlobalPatch[coupledPointi]
2687 globalMaster[coupledPointi] =
2688 globalPointsPtr().toGlobal(nMasters);
2689 uniqueMeshPoints[nMasters++] = meshPoints[patchPointi];
2709 forAll(meshPoints, patchPointi)
2711 if (patchToCoupled[patchPointi] == -1)
2713 pointToGlobal[patchPointi] = globalPointsPtr().toGlobal(nMasters++);
2717 label coupledPointi = patchToCoupled[patchPointi];
2718 pointToGlobal[patchPointi] = globalMaster[coupledPointi];
2722 globalPPoints.toGlobal(patchPointi)
2723 == coupledToGlobalPatch[coupledPointi]
2731 return globalPointsPtr;
2756 Pout<<
"globalMeshData : merge dist:" << tolDim <<
endl;
2779 Pout<<
"globalMeshData : nTotalFaces_:" << nTotalFaces_ <<
endl;
2792 Pout<<
"globalMeshData : nTotalCells_:" << nTotalCells_ <<
endl;
2807 Pout<<
"globalMeshData : nTotalPoints_:" << nTotalPoints_ <<
endl;
const globalIndex & globalEdgeNumbering() const
List< labelList > labelListList
A List of labelList.
label nPoints() const
Return number of points supporting patch faces.
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
#define forAll(list, i)
Loop across all elements in list.
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
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.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
void operator()(labelPair &x, const labelPair &y) const
label toGlobal(const label i) const
From local to global.
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const boundBox & bounds() const
Return mesh bounding box.
A face is a list of labels corresponding to mesh vertices.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
const double e
Elementary charge.
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
const fileName & facesInstance() const
Return the current instance directory for faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
const mapDistribute & map() const
Corresponding map.
const labelListList & globalPointTransformedBoundaryFaces() const
static int firstSlave()
Process index of first slave.
const globalIndex & globalBoundaryCellNumbering() const
Numbering of boundary cells is according to boundaryCells()
const mapDistribute & globalPointSlavesMap() const
static const Foam::scalar matchTol_
Geometric tolerance (fraction of bounding box)
label nGlobalEdges() const
Return number of globally shared edges. Demand-driven.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
labelList pointLabels(nPoints,-1)
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
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.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
const labelList & sharedEdgeLabels() const
Return indices of local edges that are globally shared.
static int & msgType()
Message tag of standard messages.
label size() const
Return number of elements in table.
static label worldComm
Default communicator (all processors)
const labelListList & globalPointSlaves() const
const dimensionedScalar me
Electron mass.
const labelListList & transformedPointPoints() const
Transformed points per point (in mapDistribute indices)
const labelListList & globalPointTransformedBoundaryCells() const
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
Determine correspondence between points. See below.
const labelListList & pointPoints() const
Non-transformed connected points per point (in mapDistribute.
Determines processor-processor connection. After instantiation contains on all processors the process...
virtual const pointField & points() const
Return raw points.
const globalIndex & globalPointNumbering() const
Numbering of coupled points is according to coupledPatch.
label size() const
Global sum of localSizes.
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.
scalar mag() const
The magnitude of the bounding box span.
Input inter-processor communications stream operating on external buffer.
pointField sharedPoints() const
Collect coordinates of shared points on all processors.
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 & globalBoundaryFaceNumbering() const
Numbering of boundary faces is face-mesh.nInternalFaces()
const labelListList & globalCoPointSlaves() const
An ordered pair of two objects of type <T> with first() and second() elements.
label start() const
Return start label of this patch in the polyMesh face list.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
void clear()
Clear the list, i.e. set size to zero.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
const labelListList & globalPointBoundaryCells() const
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
void clear()
Clear all entries from table.
pointField geometricSharedPoints() const
Like sharedPoints but keeps cyclic points separate.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label whichProcID(const label i) const
Which processor does global come from? Binary search.
Pair< label > labelPair
Label pair.
static const label labelMax
List< label > labelList
A List of labels.
const labelListList & pointEdges() const
const mapDistribute & globalPointBoundaryCellsMap() const
List< labelPair > labelPairList
List of labelPairs.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
const mapDistribute & globalEdgeSlavesMap() const
Output inter-processor communications stream operating on external buffer.
prefixOSstream Pout(cout,"Pout")
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
Map from edge (expressed as its endpoints) to value.
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
~globalMeshData()
Destructor.
defineTypeNameAndDebug(combustionModel, 0)
const mapDistribute & globalCoPointSlavesMap() const
Output inter-processor communications stream.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const labelListList & globalEdgeTransformedSlaves() const
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
label size() const
Return the number of elements in the UList.
const labelList & boundaryCells() const
From boundary cell to mesh cell.
void distribute(List< T > &fld, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Distribute data using default commsType.
word name(const complex &)
Return a string representation of a complex.
void movePoints(const pointField &newPoints)
Update for moving points.
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.
Calculates points shared by more than two processor patches or cyclic patches.
void setSize(const label)
Reset size of List.
Template functions to aid in the implementation of demand driven data.
const labelListList & globalPointTransformedSlaves() const
static bool & parRun()
Is this a parallel run?
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const labelList & sharedEdgeAddr() const
Return addressing into the complete globally shared edge.
Class containing processor-to-processor mapping information.
label localSize() const
My local size.
A List with indirect addressing.
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 labelListList & globalEdgeSlaves() const
void updateMesh()
Change global mesh data given a topological change. Does a.
Xfer< mapDistribute > xfer()
Transfer contents to the Xfer container.
const labelListList & globalPointBoundaryFaces() 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.
label toLocal(const label i) const
From global to local on current processor.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
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 Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
virtual const faceList & faces() const
Return raw faces.
label constructSize() const
Constructed data size.
const mapDistribute & globalPointBoundaryFacesMap() const
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label nGlobalPoints() const
Return number of globally shared points.
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 & sharedPointGlobalLabels() const
Return shared point global labels. Tries to read.
dimensionSet transform(const dimensionSet &)
static int lastSlave(const label communicator=0)
Process index of last slave.