57 x[0] =
min(x[0], y[0]);
58 x[1] =
min(x[1], y[1]);
67 void Foam::globalMeshData::initProcAddr()
69 processorPatchIndices_.setSize(mesh_.boundaryMesh().size());
70 processorPatchIndices_ = -1;
72 processorPatchNeighbours_.setSize(mesh_.boundaryMesh().size());
73 processorPatchNeighbours_ = -1;
77 processorPatches_.setSize(mesh_.boundaryMesh().size());
79 label nNeighbours = 0;
83 if (isA<processorPolyPatch>(mesh_.boundaryMesh()[
patchi]))
85 processorPatches_[nNeighbours] =
patchi;
86 processorPatchIndices_[
patchi] = nNeighbours++;
89 processorPatches_.setSize(nNeighbours);
97 forAll(processorPatches_, i)
103 refCast<const processorPolyPatch>
105 mesh_.boundaryMesh()[
patchi]
110 toNeighbour << processorPatchIndices_[
patchi];
115 forAll(processorPatches_, i)
121 refCast<const processorPolyPatch>
123 mesh_.boundaryMesh()[
patchi]
128 fromNeighbour >> processorPatchNeighbours_[
patchi];
134 void Foam::globalMeshData::calcSharedPoints()
const 139 || sharedPointLabelsPtr_.valid()
140 || sharedPointAddrPtr_.valid()
159 if (pPoints.
size()+transPPoints.
size() > 0)
168 nGlobalPoints_ = masterNumbering.
size();
182 if (pPoints.
size()+transPPoints.
size() > 0)
184 master[i] = masterNumbering.
toGlobal(nMaster);
187 master[pPoints[j]] = master[i];
191 master[transPPoints[j]] = master[i];
226 sharedPointLabelsPtr_.reset(
new labelList(nMaster));
227 labelList& sharedPointLabels = sharedPointLabelsPtr_();
228 sharedPointAddrPtr_.reset(
new labelList(nMaster));
229 labelList& sharedPointAddr = sharedPointAddrPtr_();
237 sharedPointLabels[nMaster] = i;
238 sharedPointAddr[nMaster] = master[i];
245 Pout<<
"globalMeshData : nGlobalPoints_:" << nGlobalPoints_ <<
nl 246 <<
"globalMeshData : sharedPointLabels_:" 247 << sharedPointLabelsPtr_().size() <<
nl 248 <<
"globalMeshData : sharedPointAddr_:" 249 << sharedPointAddrPtr_().size() <<
endl;
255 void Foam::globalMeshData::countSharedEdges
265 const edge&
e = iter.key();
269 if (globalFnd == globalShared.
end())
272 if (iter().size() == 1)
275 globalShared.
insert(e, -1);
281 globalShared.
insert(e, sharedEdgeI++);
286 if (globalFnd() == -1)
290 globalFnd() = sharedEdgeI++;
301 void Foam::globalMeshData::calcSharedEdges()
const 306 || sharedEdgeLabelsPtr_.valid()
307 || sharedEdgeAddrPtr_.valid()
315 const labelList& sharedPtAddr = sharedPointAddr();
316 const labelList& sharedPtLabels = sharedPointLabels();
323 meshToShared.insert(sharedPtLabels[i], i);
331 const edgeList& edges = mesh_.edges();
335 const edge&
e = edges[edgeI];
339 if (e0Fnd != meshToShared.
end())
343 if (e1Fnd != meshToShared.
end())
351 sharedPtAddr[e0Fnd()],
352 sharedPtAddr[e1Fnd()]
356 localShared.
find(sharedEdge);
358 if (iter == localShared.
end())
361 localShared.insert(sharedEdge,
labelList(1, edgeI));
370 edgeLabels[sz] = edgeI;
390 label sharedEdgeI = 0;
395 Pout<<
"globalMeshData::calcSharedEdges : Merging in from proc0 : " 396 << localShared.size() <<
endl;
398 countSharedEdges(localShared, globalShared, sharedEdgeI);
416 Pout<<
"globalMeshData::calcSharedEdges : " 417 <<
"Merging in from proc" 421 countSharedEdges(procSharedEdges, globalShared, sharedEdgeI);
431 globalShared.
clear();
437 globalShared.
insert(iter.key(), iter());
442 Pout<<
"globalMeshData::calcSharedEdges : Filtered " 443 << oldSharedEdges.
size()
444 <<
" down to " << globalShared.
size() <<
endl;
461 toSlave << globalShared;
471 toMaster << localShared;
477 fromMaster >> globalShared;
484 nGlobalEdges_ = globalShared.
size();
491 const edge&
e = iter.key();
495 if (edgeFnd != globalShared.
end())
504 dynSharedEdgeLabels.append(edgeLabels[i]);
507 dynSharedEdgeAddr.append(edgeFnd());
512 sharedEdgeLabelsPtr_.reset(
new labelList());
513 labelList& sharedEdgeLabels = sharedEdgeLabelsPtr_();
514 sharedEdgeLabels.
transfer(dynSharedEdgeLabels);
516 sharedEdgeAddrPtr_.reset(
new labelList());
517 labelList& sharedEdgeAddr = sharedEdgeAddrPtr_();
518 sharedEdgeAddr.
transfer(dynSharedEdgeAddr);
522 Pout<<
"globalMeshData : nGlobalEdges_:" << nGlobalEdges_ <<
nl 523 <<
"globalMeshData : sharedEdgeLabels:" << sharedEdgeLabels.
size()
525 <<
"globalMeshData : sharedEdgeAddr:" << sharedEdgeAddr.
size()
531 void Foam::globalMeshData::calcGlobalPointSlaves()
const 535 Pout<<
"globalMeshData::calcGlobalPointSlaves() :" 536 <<
" calculating coupled master to slave point addressing." 541 globalPoints globalData(mesh_, coupledPatch(),
true,
true);
543 globalPointSlavesPtr_.reset
550 globalPointTransformedSlavesPtr_.reset
558 globalPointSlavesMapPtr_.reset
568 void Foam::globalMeshData::calcPointConnectivity
575 const labelListList& transformedSlaves = globalPointTransformedSlaves();
579 labelPairList myData(globalPointSlavesMap().constructSize());
590 globalPointSlavesMap().distribute(myData);
594 allPointConnectivity.
setSize(globalPointSlavesMap().constructSize());
598 const labelList& pSlaves = slaves[pointI];
599 const labelList& pTransformSlaves = transformedSlaves[pointI];
605 pConnectivity[connI++] = myData[pointI];
609 pConnectivity[connI++] = myData[pSlaves[i]];
612 forAll(pTransformSlaves, i)
615 label transformI = globalPointSlavesMap().whichTransform
620 const labelPair&
n = myData[pTransformSlaves[i]];
634 allPointConnectivity[pSlaves[i]] = pConnectivity;
636 forAll(pTransformSlaves, i)
638 allPointConnectivity[pTransformSlaves[i]] = pConnectivity;
641 globalPointSlavesMap().reverseDistribute
643 allPointConnectivity.
size(),
649 void Foam::globalMeshData::calcGlobalPointEdges
655 const edgeList& edges = coupledPatch().edges();
656 const labelListList& pointEdges = coupledPatch().pointEdges();
657 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
659 const labelListList& transformedSlaves = globalPointTransformedSlaves();
662 globalPointEdges.
setSize(globalPointSlavesMap().constructSize());
663 globalPointPoints.
setSize(globalPointSlavesMap().constructSize());
664 forAll(pointEdges, pointI)
666 const labelList& pEdges = pointEdges[pointI];
667 labelList& globalPEdges = globalPointEdges[pointI];
671 globalPEdges[i] = globalEdgeNumbers.
toGlobal(pEdges[i]);
678 label otherPointI = edges[pEdges[i]].otherVertex(pointI);
683 globalTransforms().nullTransformIndex()
689 globalPointSlavesMap().distribute(globalPointEdges);
690 globalPointSlavesMap().distribute(globalPointPoints);
694 const labelList& pSlaves = slaves[pointI];
695 const labelList& pTransformSlaves = transformedSlaves[pointI];
700 n += globalPointEdges[pSlaves[i]].
size();
702 forAll(pTransformSlaves, i)
704 n += globalPointEdges[pTransformSlaves[i]].
size();
709 labelList& globalPEdges = globalPointEdges[pointI];
714 const labelList& otherData = globalPointEdges[pSlaves[i]];
717 globalPEdges[sz++] = otherData[j];
720 forAll(pTransformSlaves, i)
723 globalPointEdges[pTransformSlaves[i]];
726 globalPEdges[sz++] = otherData[j];
733 globalPointEdges[pSlaves[i]] = globalPEdges;
735 forAll(pTransformSlaves, i)
737 globalPointEdges[pTransformSlaves[i]] = globalPEdges;
751 const labelPairList& otherData = globalPointPoints[pSlaves[i]];
754 globalPPoints[sz++] = otherData[j];
758 forAll(pTransformSlaves, i)
761 label transformI = globalPointSlavesMap().whichTransform
767 globalPointPoints[pTransformSlaves[i]];
786 globalPointPoints[pSlaves[i]] = globalPPoints;
788 forAll(pTransformSlaves, i)
790 globalPointPoints[pTransformSlaves[i]] = globalPPoints;
795 globalPointSlavesMap().reverseDistribute
797 globalPointEdges.
size(),
801 globalPointSlavesMap().reverseDistribute
803 globalPointPoints.
size(),
815 const label localPoint
821 label remoteTransformI = -1;
822 label localTransformI = -1;
831 localTransformI = transformI;
836 if (procI == remoteProcI && pointI == remoteIndex)
838 remoteTransformI = transformI;
846 if (remoteTransformI == -1 || localTransformI == -1)
849 <<
"Problem. Cannot find " << remotePoint
850 <<
" or " << localPoint <<
" " 851 << coupledPatch().localPoints()[localPoint]
854 <<
"remoteTransformI:" << remoteTransformI <<
endl 855 <<
"localTransformI:" << localTransformI
859 return globalTransforms().subtractTransformIndex
867 void Foam::globalMeshData::calcGlobalEdgeSlaves()
const 871 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 872 <<
" calculating coupled master to slave edge addressing." <<
endl;
875 const edgeList& edges = coupledPatch().edges();
876 const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
890 calcPointConnectivity(allPointConnectivity);
897 calcGlobalPointEdges(globalPointEdges, globalPointPoints);
914 const edge&
e = edges[edgeI];
915 const labelList& pEdges0 = globalPointEdges[e[0]];
917 const labelList& pEdges1 = globalPointEdges[e[1]];
929 globalTransforms().nullTransformIndex()
939 pEdges0[i] == pEdges1[j]
940 && pEdges0[i] != globalEdgeNumbers.
toGlobal(edgeI)
952 label transform0 = findTransform
954 allPointConnectivity[e[0]],
958 label transform1 = findTransform
960 allPointConnectivity[e[1]],
965 if (transform0 == transform1)
973 globalEdgeNumbers.
toLocal(procI, pEdges0[i]),
982 allEdgeConnectivity[edgeI].transfer(eEdges);
993 forAll(allEdgeConnectivity, edgeI)
996 if (edgeInfo.
size() >= 2)
998 const labelPair& masterInfo = edgeInfo[0];
1011 labelList& eEdges = globalEdgeSlaves[edgeI];
1017 label nonTransformI = 0;
1018 label transformI = 0;
1020 for (
label i = 1; i < edgeInfo.
size(); i++)
1030 if (transform == globalTransforms().nullTransformIndex())
1032 eEdges[nonTransformI++] = globalEdgeNumbers.
toGlobal 1040 trafoEEdges[transformI++] = info;
1044 eEdges.
setSize(nonTransformI);
1045 trafoEEdges.
setSize(transformI);
1055 globalEdgeSlavesMapPtr_.reset
1064 globalEdgeTransformedSlavesPtr_(),
1073 Pout<<
"globalMeshData::calcGlobalEdgeSlaves() :" 1074 <<
" coupled edges:" << edges.
size()
1075 <<
" additional coupled edges:" 1076 << globalEdgeSlavesMapPtr_().constructSize() - edges.
size()
1082 void Foam::globalMeshData::calcGlobalEdgeOrientation()
const 1086 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1087 <<
" calculating edge orientation w.r.t. master edge." <<
endl;
1100 for (
label pointI = 0; pointI < coupledPatch().nPoints(); pointI++)
1102 masterPoint[pointI] = globalPoints.
toGlobal(pointI);
1107 globalPointSlaves(),
1108 globalPointTransformedSlaves(),
1121 const labelListList& transformedSlaves = globalEdgeTransformedSlaves();
1127 for (
label edgeI = 0; edgeI < coupledPatch().nEdges(); edgeI++)
1132 slaves[edgeI].size()
1133 + transformedSlaves[edgeI].size()
1140 const edge&
e = coupledPatch().edges()[edgeI];
1158 globalEdgeOrientationPtr_.reset
1162 PackedBoolList& globalEdgeOrientation = globalEdgeOrientationPtr_();
1164 forAll(coupledPatch().edges(), edgeI)
1166 const edge&
e = coupledPatch().edges()[edgeI];
1176 masterEdgeVerts[edgeI]
1182 "globalMeshData::calcGlobalEdgeOrientation() const" 1183 ) <<
"problem : my edge:" << e
1184 <<
" in master points:" << masterE
1185 <<
" v.s. masterEdgeVerts:" << masterEdgeVerts[edgeI]
1190 globalEdgeOrientation[edgeI] = (stat == 1);
1197 Pout<<
"globalMeshData::calcGlobalEdgeOrientation() :" 1198 <<
" finished calculating edge orientation." 1206 void Foam::globalMeshData::calcPointBoundaryFaces
1212 const Map<label>& meshPointMap = coupledPatch().meshPointMap();
1226 const face&
f = pp[i];
1234 if (iter != meshPointMap.
end())
1236 nPointFaces[iter()]++;
1247 forAll(nPointFaces, pointI)
1249 pointBoundaryFaces[pointI].
setSize(nPointFaces[pointI]);
1264 const face&
f = pp[i];
1271 if (iter != meshPointMap.
end())
1274 pp.
start() + i - mesh_.nInternalFaces();
1275 pointBoundaryFaces[iter()][nPointFaces[iter()]++] =
1285 void Foam::globalMeshData::calcGlobalPointBoundaryFaces()
const 1289 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1290 <<
" calculating coupled point to boundary face addressing." 1296 calcPointBoundaryFaces(pointBoundaryFaces);
1300 globalBoundaryFaceNumberingPtr_.reset
1302 new globalIndex(mesh_.nFaces()-mesh_.nInternalFaces())
1304 globalIndex& globalIndices = globalBoundaryFaceNumberingPtr_();
1308 globalPointBoundaryFacesPtr_.reset
1312 labelListList& globalPointBoundaryFaces = globalPointBoundaryFacesPtr_();
1314 forAll(pointBoundaryFaces, pointI)
1316 const labelList& bFaces = pointBoundaryFaces[pointI];
1317 labelList& globalFaces = globalPointBoundaryFaces[pointI];
1321 globalFaces[i] = globalIndices.
toGlobal(bFaces[i]);
1327 globalPointSlavesMap().distribute
1329 globalPointBoundaryFaces,
1338 globalPointTransformedSlaves();
1345 forAll(pointSlaves, pointI)
1347 const labelList& slaves = pointSlaves[pointI];
1348 const labelList& transformedSlaves = pointTransformSlaves[pointI];
1350 if (slaves.
size() > 0)
1352 labelList& myBFaces = globalPointBoundaryFaces[pointI];
1359 n += globalPointBoundaryFaces[slaves[i]].
size();
1367 globalPointBoundaryFaces[slaves[i]];
1374 label slave = slaveBFaces[j];
1377 myBFaces[n++] = slave;
1385 if (transformedSlaves.
size() > 0)
1387 const labelList& untrafoFaces = globalPointBoundaryFaces[pointI];
1394 forAll(transformedSlaves, i)
1396 n += globalPointBoundaryFaces[transformedSlaves[i]].
size();
1401 forAll(transformedSlaves, i)
1403 label transformI = globalPointSlavesMap().whichTransform
1405 transformedSlaves[i]
1409 globalPointBoundaryFaces[transformedSlaves[i]];
1413 label slave = slaveBFaces[j];
1415 if (
findIndex(untrafoFaces, slave)== -1)
1433 if (slaves.
size() + transformedSlaves.
size() == 0)
1435 globalPointBoundaryFaces[pointI].
clear();
1442 globalPointTransformedBoundaryFacesPtr_.reset
1447 globalPointBoundaryFacesMapPtr_.reset
1452 globalPointBoundaryFaces,
1456 globalPointTransformedBoundaryFacesPtr_(),
1462 globalPointTransformedBoundaryFacesPtr_().setSize(coupledPatch().
nPoints());
1466 Pout<<
"globalMeshData::calcGlobalPointBoundaryFaces() :" 1467 <<
" coupled points:" << coupledPatch().nPoints()
1468 <<
" local boundary faces:" << globalIndices.
localSize()
1469 <<
" additional coupled faces:" 1470 << globalPointBoundaryFacesMapPtr_().constructSize()
1477 void Foam::globalMeshData::calcGlobalPointBoundaryCells()
const 1481 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1482 <<
" calculating coupled point to boundary cell addressing." 1496 forAll(coupledPatch().meshPoints(), pointI)
1498 label meshPointI = coupledPatch().meshPoints()[pointI];
1499 const labelList& pCells = mesh_.pointCells(meshPointI);
1501 labelList& bCells = pointBoundaryCells[pointI];
1506 label cellI = pCells[i];
1509 if (fnd != meshCellMap.
end())
1515 meshCellMap.
insert(cellI, bCellI);
1516 cellMap.append(cellI);
1524 boundaryCellsPtr_.reset(
new labelList());
1525 labelList& boundaryCells = boundaryCellsPtr_();
1526 boundaryCells.
transfer(cellMap.shrink());
1532 globalBoundaryCellNumberingPtr_.reset
1536 globalIndex& globalIndices = globalBoundaryCellNumberingPtr_();
1539 globalPointBoundaryCellsPtr_.reset
1543 labelListList& globalPointBoundaryCells = globalPointBoundaryCellsPtr_();
1545 forAll(pointBoundaryCells, pointI)
1547 const labelList& pCells = pointBoundaryCells[pointI];
1548 labelList& globalCells = globalPointBoundaryCells[pointI];
1552 globalCells[i] = globalIndices.
toGlobal(pCells[i]);
1558 globalPointSlavesMap().distribute
1560 globalPointBoundaryCells,
1568 globalPointTransformedSlaves();
1573 forAll(pointSlaves, pointI)
1575 const labelList& slaves = pointSlaves[pointI];
1576 const labelList& transformedSlaves = pointTransformSlaves[pointI];
1578 if (slaves.
size() > 0)
1580 labelList& myBCells = globalPointBoundaryCells[pointI];
1587 n += globalPointBoundaryCells[slaves[i]].
size();
1595 globalPointBoundaryCells[slaves[i]];
1602 label slave = slaveBCells[j];
1605 myBCells[n++] = slave;
1613 if (transformedSlaves.
size() > 0)
1615 const labelList& untrafoCells = globalPointBoundaryCells[pointI];
1622 forAll(transformedSlaves, i)
1624 n += globalPointBoundaryCells[transformedSlaves[i]].
size();
1629 forAll(transformedSlaves, i)
1631 label transformI = globalPointSlavesMap().whichTransform
1633 transformedSlaves[i]
1637 globalPointBoundaryCells[transformedSlaves[i]];
1641 label slave = slaveBCells[j];
1644 if (
findIndex(untrafoCells, slave)== -1)
1660 if (slaves.
size() + transformedSlaves.
size() == 0)
1662 globalPointBoundaryCells[pointI].
clear();
1669 globalPointTransformedBoundaryCellsPtr_.reset
1674 globalPointBoundaryCellsMapPtr_.reset
1679 globalPointBoundaryCells,
1683 globalPointTransformedBoundaryCellsPtr_(),
1689 globalPointTransformedBoundaryCellsPtr_().setSize(coupledPatch().
nPoints());
1693 Pout<<
"globalMeshData::calcGlobalPointBoundaryCells() :" 1694 <<
" coupled points:" << coupledPatch().nPoints()
1695 <<
" local boundary cells:" << globalIndices.
localSize()
1696 <<
" additional coupled cells:" 1697 << globalPointBoundaryCellsMapPtr_().constructSize()
1704 void Foam::globalMeshData::calcGlobalCoPointSlaves()
const 1708 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1709 <<
" calculating coupled master to collocated" 1710 <<
" slave point addressing." <<
endl;
1714 globalPoints globalData(mesh_, coupledPatch(),
true,
false);
1716 globalCoPointSlavesPtr_.reset
1723 globalCoPointSlavesMapPtr_.reset
1733 Pout<<
"globalMeshData::calcGlobalCoPointSlaves() :" 1734 <<
" finished calculating coupled master to collocated" 1735 <<
" slave point addressing." <<
endl;
1750 processorPatches_(0),
1751 processorPatchIndices_(0),
1752 processorPatchNeighbours_(0),
1754 sharedPointLabelsPtr_(NULL),
1755 sharedPointAddrPtr_(NULL),
1756 sharedPointGlobalLabelsPtr_(NULL),
1758 sharedEdgeLabelsPtr_(NULL),
1759 sharedEdgeAddrPtr_(NULL)
1776 nGlobalPoints_ = -1;
1777 sharedPointLabelsPtr_.clear();
1778 sharedPointAddrPtr_.clear();
1779 sharedPointGlobalLabelsPtr_.clear();
1783 sharedEdgeLabelsPtr_.clear();
1784 sharedEdgeAddrPtr_.clear();
1787 coupledPatchPtr_.clear();
1788 coupledPatchMeshEdgesPtr_.clear();
1789 coupledPatchMeshEdgeMapPtr_.clear();
1790 globalTransformsPtr_.clear();
1793 globalPointNumberingPtr_.clear();
1794 globalPointSlavesPtr_.clear();
1795 globalPointTransformedSlavesPtr_.clear();
1796 globalPointSlavesMapPtr_.clear();
1798 globalEdgeNumberingPtr_.clear();
1799 globalEdgeSlavesPtr_.clear();
1800 globalEdgeTransformedSlavesPtr_.clear();
1801 globalEdgeOrientationPtr_.clear();
1802 globalEdgeSlavesMapPtr_.clear();
1805 globalBoundaryFaceNumberingPtr_.clear();
1806 globalPointBoundaryFacesPtr_.clear();
1807 globalPointTransformedBoundaryFacesPtr_.clear();
1808 globalPointBoundaryFacesMapPtr_.clear();
1811 boundaryCellsPtr_.clear();
1812 globalBoundaryCellNumberingPtr_.clear();
1813 globalPointBoundaryCellsPtr_.clear();
1814 globalPointTransformedBoundaryCellsPtr_.clear();
1815 globalPointBoundaryCellsMapPtr_.clear();
1818 globalCoPointSlavesPtr_.clear();
1819 globalCoPointSlavesMapPtr_.clear();
1828 if (!sharedPointGlobalLabelsPtr_.valid())
1830 sharedPointGlobalLabelsPtr_.reset
1838 "pointProcAddressing",
1844 if (addrHeader.headerOk())
1848 Pout<<
"globalMeshData::sharedPointGlobalLabels : " 1849 <<
"Reading pointProcAddressing" <<
endl;
1858 label pointI = pointLabels[i];
1861 sharedPointGlobalLabels[i] = pointProcAddressing[pointI];
1866 Pout<<
"globalMeshData::sharedPointGlobalLabels :" 1867 <<
" Setting pointProcAddressing to -1" <<
endl;
1869 sharedPointGlobalLabels = -1;
1872 return sharedPointGlobalLabelsPtr_();
1892 label sharedPointI = pointAddr[i];
1894 sharedPoints[sharedPointI] = mesh_.
points()[pointLabels[i]];
1909 fromSlave >> nbrSharedPointAddr >> nbrSharedPoints;
1911 forAll(nbrSharedPointAddr, i)
1913 label sharedPointI = nbrSharedPointAddr[i];
1915 sharedPoints[sharedPointI] = nbrSharedPoints[i];
1984 return mergedPoints;
1990 if (nGlobalPoints_ == -1)
1994 return nGlobalPoints_;
2000 if (!sharedPointLabelsPtr_.valid())
2004 return sharedPointLabelsPtr_();
2010 if (!sharedPointAddrPtr_.valid())
2014 return sharedPointAddrPtr_();
2020 if (nGlobalEdges_ == -1)
2024 return nGlobalEdges_;
2030 if (!sharedEdgeLabelsPtr_.valid())
2034 return sharedEdgeLabelsPtr_();
2040 if (!sharedEdgeAddrPtr_.valid())
2044 return sharedEdgeAddrPtr_();
2050 if (!coupledPatchPtr_.valid())
2062 nCoupled += pp.size();
2078 coupledFaces[nCoupled++] = faceI++;
2083 coupledPatchPtr_.reset
2098 Pout<<
"globalMeshData::coupledPatch() :" 2099 <<
" constructed coupled faces patch:" 2100 <<
" faces:" << coupledPatchPtr_().size()
2101 <<
" points:" << coupledPatchPtr_().nPoints()
2105 return coupledPatchPtr_();
2111 if (!coupledPatchMeshEdgesPtr_.valid())
2113 coupledPatchMeshEdgesPtr_.reset
2125 return coupledPatchMeshEdgesPtr_();
2132 if (!coupledPatchMeshEdgeMapPtr_.valid())
2137 Map<label>& em = coupledPatchMeshEdgeMapPtr_();
2144 return coupledPatchMeshEdgeMapPtr_();
2150 if (!globalPointNumberingPtr_.valid())
2152 globalPointNumberingPtr_.reset
2157 return globalPointNumberingPtr_();
2164 if (!globalTransformsPtr_.valid())
2168 return globalTransformsPtr_();
2174 if (!globalPointSlavesPtr_.valid())
2176 calcGlobalPointSlaves();
2178 return globalPointSlavesPtr_();
2185 if (!globalPointTransformedSlavesPtr_.valid())
2187 calcGlobalPointSlaves();
2189 return globalPointTransformedSlavesPtr_();
2195 if (!globalPointSlavesMapPtr_.valid())
2197 calcGlobalPointSlaves();
2199 return globalPointSlavesMapPtr_();
2205 if (!globalEdgeNumberingPtr_.valid())
2207 globalEdgeNumberingPtr_.reset
2212 return globalEdgeNumberingPtr_();
2218 if (!globalEdgeSlavesPtr_.valid())
2220 calcGlobalEdgeSlaves();
2222 return globalEdgeSlavesPtr_();
2229 if (!globalEdgeTransformedSlavesPtr_.valid())
2231 calcGlobalEdgeSlaves();
2233 return globalEdgeTransformedSlavesPtr_();
2239 if (!globalEdgeOrientationPtr_.valid())
2241 calcGlobalEdgeOrientation();
2243 return globalEdgeOrientationPtr_();
2249 if (!globalEdgeSlavesMapPtr_.valid())
2251 calcGlobalEdgeSlaves();
2253 return globalEdgeSlavesMapPtr_();
2260 if (!globalBoundaryFaceNumberingPtr_.valid())
2262 calcGlobalPointBoundaryFaces();
2264 return globalBoundaryFaceNumberingPtr_();
2271 if (!globalPointBoundaryFacesPtr_.valid())
2273 calcGlobalPointBoundaryFaces();
2275 return globalPointBoundaryFacesPtr_();
2282 if (!globalPointTransformedBoundaryFacesPtr_.valid())
2284 calcGlobalPointBoundaryFaces();
2286 return globalPointTransformedBoundaryFacesPtr_();
2293 if (!globalPointBoundaryFacesMapPtr_.valid())
2295 calcGlobalPointBoundaryFaces();
2297 return globalPointBoundaryFacesMapPtr_();
2303 if (!boundaryCellsPtr_.valid())
2305 calcGlobalPointBoundaryCells();
2307 return boundaryCellsPtr_();
2314 if (!globalBoundaryCellNumberingPtr_.valid())
2316 calcGlobalPointBoundaryCells();
2318 return globalBoundaryCellNumberingPtr_();
2325 if (!globalPointBoundaryCellsPtr_.valid())
2327 calcGlobalPointBoundaryCells();
2329 return globalPointBoundaryCellsPtr_();
2336 if (!globalPointTransformedBoundaryCellsPtr_.valid())
2338 calcGlobalPointBoundaryCells();
2340 return globalPointTransformedBoundaryCellsPtr_();
2347 if (!globalPointBoundaryCellsMapPtr_.valid())
2349 calcGlobalPointBoundaryCells();
2351 return globalPointBoundaryCellsMapPtr_();
2357 if (!globalCoPointSlavesPtr_.valid())
2359 calcGlobalCoPointSlaves();
2361 return globalCoPointSlavesPtr_();
2367 if (!globalCoPointSlavesMapPtr_.valid())
2369 calcGlobalCoPointSlaves();
2371 return globalCoPointSlavesMapPtr_();
2394 forAll(masterGlobalPoint, pointI)
2396 const labelList& slavePoints = pointSlaves[pointI];
2397 if (slavePoints.
size() > 0)
2399 masterGlobalPoint[pointI] = globalCoupledPoints.
toGlobal(pointI);
2417 forAll(pointSlaves, pointI)
2419 if (masterGlobalPoint[pointI] == -1)
2426 masterGlobalPoint[pointI]
2427 == globalCoupledPoints.
toGlobal(pointI)
2456 uniquePoints.
setSize(myUniquePoints);
2459 forAll(isMaster, meshPointI)
2461 if (isMaster[meshPointI])
2463 pointToGlobal[meshPointI] = globalPointsPtr().toGlobal(nMaster);
2464 uniquePoints[nMaster] = meshPointI;
2474 forAll(pointSlaves, pointI)
2476 const labelList& slaves = pointSlaves[pointI];
2478 if (slaves.
size() > 0)
2482 masterToGlobal[pointI] = pointToGlobal[meshPointI];
2485 masterToGlobal[slaves[i]] = masterToGlobal[pointI];
2494 forAll(pointSlaves, pointI)
2498 if (!isMaster[meshPointI])
2500 pointToGlobal[meshPointI] = masterToGlobal[pointI];
2505 return globalPointsPtr;
2544 forAll(meshPoints, patchPointI)
2546 label meshPointI = meshPoints[patchPointI];
2552 patchToCoupled[patchPointI] = iter();
2553 coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointI);
2571 pointSlavesMap.
distribute(coupledToGlobalPatch);
2572 forAll(pointSlaves, coupledPointI)
2574 const labelList& slaves = pointSlaves[coupledPointI];
2576 if (slaves.
size() > 0)
2580 if (coupledToGlobalPatch[coupledPointI] != -1)
2583 masterI = coupledToGlobalPatch[coupledPointI];
2590 label slavePp = coupledToGlobalPatch[slaves[i]];
2591 if (slavePp != -1 && slavePp < masterI)
2601 coupledToGlobalPatch[coupledPointI] = masterI;
2604 coupledToGlobalPatch[slaves[i]] = masterI;
2619 forAll(meshPoints, patchPointI)
2621 if (patchToCoupled[patchPointI] == -1)
2627 label coupledPointI = patchToCoupled[patchPointI];
2630 globalPPoints.toGlobal(patchPointI)
2631 == coupledToGlobalPatch[coupledPointI]
2654 uniqueMeshPoints.
setSize(nMasters);
2661 forAll(meshPoints, patchPointI)
2663 if (patchToCoupled[patchPointI] == -1)
2665 uniqueMeshPoints[nMasters++] = meshPoints[patchPointI];
2669 label coupledPointI = patchToCoupled[patchPointI];
2672 globalPPoints.toGlobal(patchPointI)
2673 == coupledToGlobalPatch[coupledPointI]
2676 globalMaster[coupledPointI] =
2677 globalPointsPtr().toGlobal(nMasters);
2678 uniqueMeshPoints[nMasters++] = meshPoints[patchPointI];
2698 forAll(meshPoints, patchPointI)
2700 if (patchToCoupled[patchPointI] == -1)
2702 pointToGlobal[patchPointI] = globalPointsPtr().toGlobal(nMasters++);
2706 label coupledPointI = patchToCoupled[patchPointI];
2707 pointToGlobal[patchPointI] = globalMaster[coupledPointI];
2711 globalPPoints.toGlobal(patchPointI)
2712 == coupledToGlobalPatch[coupledPointI]
2720 return globalPointsPtr;
2746 Pout<<
"globalMeshData : merge dist:" << tolDim <<
endl;
2769 Pout<<
"globalMeshData : nTotalFaces_:" << nTotalFaces_ <<
endl;
2782 Pout<<
"globalMeshData : nTotalCells_:" << nTotalCells_ <<
endl;
2797 Pout<<
"globalMeshData : nTotalPoints_:" << nTotalPoints_ <<
endl;
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void clearOut()
Remove all demand driven data.
static bool & parRun()
Is this a parallel run?
A List with indirect addressing.
const labelListList & globalPointSlaves() const
const mapDistribute & globalEdgeSlavesMap() const
Determination and storage of the possible independent transforms introduced by coupledPolyPatches, as well as all of the possible permutations of these transforms generated by the presence of multiple coupledPolyPatches, i.e. more than one cyclic boundary.
const mapDistribute & globalCoPointSlavesMap() const
label size() const
Global sum of localSizes.
Inter-processor communications stream.
const labelListList & globalPointBoundaryCells() const
labelList pointLabels(nPoints,-1)
Map from edge (expressed as its endpoints) to value.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const labelList & coupledPatchMeshEdges() const
Return map from coupledPatch edges to mesh edges.
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
label localSize() const
My local size.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
An ordered pair of two objects of type <T> with first() and second() elements.
const indirectPrimitivePatch & coupledPatch() const
Return patch of all coupled faces.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const labelListList &constructMap, List< T > &, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for Pstream::scheduled.
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
word name(const complex &)
Return a string representation of a complex.
Output inter-processor communications stream operating on external buffer.
Input inter-processor communications stream operating on external buffer.
const labelListList & pointEdges() const
~globalMeshData()
Destructor.
scalar mag() const
The magnitude of the bounding box span.
const dimensionedScalar me
Electron mass.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
label nGlobalEdges() const
Return number of globally shared edges. Demand-driven.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container.
Class containing processor-to-processor mapping information.
const Map< label > & meshPointMap() const
Mesh point map. Given the global point index find its.
const labelList & sharedPointLabels() const
Return indices of local points that are globally shared.
const globalIndex & globalBoundaryFaceNumbering() const
Numbering of boundary faces is face-mesh.nInternalFaces()
Less function class used in sorting encoded transforms and indices.
const labelListList & globalCoPointSlaves() const
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
void updateMesh()
Change global mesh data given a topological change. Does a.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
const globalIndexAndTransform & globalTransforms() const
Global transforms numbering.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Output inter-processor communications stream.
pointField geometricSharedPoints() const
Like sharedPoints but keeps cyclic points separate.
const mapDistribute & globalPointBoundaryFacesMap() const
void movePoints(const pointField &newPoints)
Update for moving points.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const labelListList & globalPointTransformedSlaves() const
label nPoints() const
Return number of points supporting patch faces.
void operator()(labelPair &x, const labelPair &y) const
A patch is a list of labels that address the faces in the global face list.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
void reverseDistribute(const label constructSize, List< T > &, const bool dummyTransform=true, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
A face is a list of labels corresponding to mesh vertices.
Determines processor-processor connection. After instantiation contains on all processors the process...
static label nProcs(const label communicator=0)
Number of processes in parallel run.
void clear()
Clear the list, i.e. set size to zero.
const labelListList & pointPoints() const
Non-transformed connected points per point (in mapDistribute.
const double e
Elementary charge.
static int compare(const Pair< Type > &a, const Pair< Type > &b)
Compare Pairs.
Calculates points shared by more than two processor patches or cyclic patches.
void setSize(const label)
Reset size of List.
const mapDistribute & globalPointSlavesMap() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
const globalIndex & globalPointNumbering() const
Numbering of coupled points is according to coupledPatch.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
void clear()
Clear all entries from table.
const labelListList & globalEdgeTransformedSlaves() const
virtual const pointField & points() const
Return raw points.
A List with indirect addressing.
dimensionSet transform(const dimensionSet &)
pointField sharedPoints() const
Collect coordinates of shared points on all processors.
const labelListList & globalPointTransformedBoundaryFaces() const
const PackedBoolList & globalEdgeOrientation() const
Is my edge same orientation as master edge.
const mapDistribute & globalPointBoundaryCellsMap() const
const labelList & meshPoints() const
Return labelList of mesh points in patch. They are constructed.
static const Foam::scalar matchTol_
Geometric tolerance (fraction of bounding box)
const labelList & boundaryCells() const
From boundary cell to mesh cell.
label nullTransformIndex() const
Return the transformIndex (index in transformPermutations)
const labelListList & globalEdgeSlaves() const
static int & msgType()
Message tag of standard messages.
Template functions to aid in the implementation of demand driven data.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label size() const
Return number of elements in table.
Xfer< mapDistribute > xfer()
Transfer contents to the Xfer container.
errorManip< error > abort(error &err)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A list of faces which address into the list of points.
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 fileName & facesInstance() const
Return the current instance directory for faces.
const globalIndex & globalBoundaryCellNumbering() const
Numbering of boundary cells is according to boundaryCells()
Mesh consisting of general polyhedral cells.
label toGlobal(const label i) const
From local to global.
Determine correspondence between points. See below.
const boundBox & bounds() const
Return mesh bounding box.
Input inter-processor communications stream.
label toLocal(const label i) const
From global to local on current processor.
static int masterNo()
Process index of the master.
List< label > labelList
A List of labels.
const labelListList & transformedPointPoints() const
Transformed points per point (in mapDistribute indices)
const labelList & sharedPointGlobalLabels() const
Return shared point global labels. Tries to read.
Pair< label > labelPair
Label pair.
label size() const
Return the number of elements in the UList.
const labelList & sharedEdgeAddr() const
Return addressing into the complete globally shared edge.
autoPtr< globalIndex > mergePoints(labelList &pointToGlobal, labelList &uniquePoints) const
Helper for merging (collocated!) mesh point data.
static bool master(const label communicator=0)
Am I the master process.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
label nGlobalPoints() const
Return number of globally shared 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.
A List obtained as a section of another List.
static int firstSlave()
Process index of first slave.
static int lastSlave(const label communicator=0)
Process index of last slave.
const labelList & sharedEdgeLabels() const
Return indices of local edges that are globally shared.
const globalIndex & globalEdgeNumbering() const
const labelListList & globalPointBoundaryFaces() const
virtual const faceList & faces() const
Return raw faces.
static label index(const labelPair &globalIAndTransform)
Index carried by the object.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void combineReduce(const List< UPstream::commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm)
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
List< labelList > labelListList
A List of labelList.
static label worldComm
Default communicator (all processors)
static label transformIndex(const labelPair &globalIAndTransform)
Transform carried by the object.
static labelPair encode(const label index, const label transformIndex)
Encode index and bare index as components on own processor.
const mapDistribute & map() const
Corresponding map.
const Map< label > & coupledPatchMeshEdgeMap() const
Return map from mesh edges to coupledPatch edges.
static label processor(const labelPair &globalIAndTransform)
Which processor does this come from?
label whichProcID(const label i) const
Which processor does global come from? Binary search.
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
defineTypeNameAndDebug(combustionModel, 0)
const labelList & sharedPointAddr() const
Return addressing into the complete globally shared points.
prefixOSstream Pout(cout,"Pout")
const labelListList & globalPointTransformedBoundaryCells() const
label constructSize() const
Constructed data size.
static const label labelMax