57 void Foam::polyTopoChange::renumberReverseMap
60 DynamicList<label>& elems
65 const label val = elems[elemI];
69 elems[elemI] = oldToNew[val];
73 const label mergedVal = -val-2;
74 elems[elemI] = -oldToNew[mergedVal]-2;
80 void Foam::polyTopoChange::renumber
88 for (
const label val : labels)
90 const label newVal = oldToNew[val];
98 labels.transfer(newSet);
103 void Foam::polyTopoChange::renumberCompact
111 for (
const label val : elems)
113 const label newVal = oldToNew[val];
117 elems[nElem++] = newVal;
120 elems.setSize(nElem);
124 void Foam::polyTopoChange::countMap
141 const label oldCelli = map[newCelli];
147 oldCelli < reverseMap.size()
148 && reverseMap[oldCelli] == newCelli
159 else if (oldCelli == -1)
171 forAll(reverseMap, oldCelli)
173 const label newCelli = reverseMap[oldCelli];
179 else if (newCelli == -1)
193 void Foam::polyTopoChange::writeMeshStats(
const polyMesh&
mesh, Ostream&
os)
208 <<
" PatchSizes : " << patchSizes <<
nl 209 <<
" PatchStarts : " << patchStarts <<
nl 214 void Foam::polyTopoChange::getMergeSets
218 List<objectMap>& cellsFromCells
224 forAll(reverseCellMap, oldCelli)
226 const label newCelli = reverseCellMap[oldCelli];
230 label mergeCelli = -newCelli-2;
232 nMerged[mergeCelli]++;
237 labelList cellToMergeSet(cellMap.size(), -1);
243 if (nMerged[celli] > 1)
245 cellToMergeSet[celli] = nSets++;
255 cellsFromCells.setSize(nSets);
257 forAll(reverseCellMap, oldCelli)
259 const label newCelli = reverseCellMap[oldCelli];
263 const label mergeCelli = -newCelli-2;
267 const label setI = cellToMergeSet[mergeCelli];
269 objectMap& mergeSet = cellsFromCells[setI];
271 if (mergeSet.masterObjects().empty())
275 mergeSet.index() = mergeCelli;
276 mergeSet.masterObjects().setSize(nMerged[mergeCelli]);
279 mergeSet.masterObjects()[0] = cellMap[mergeCelli];
282 mergeSet.masterObjects()[1] = oldCelli;
284 nMerged[mergeCelli] = 2;
288 mergeSet.masterObjects()[nMerged[mergeCelli]++] = oldCelli;
295 bool Foam::polyTopoChange::hasValidPoints(
const face&
f)
const 297 for (
const label fp :
f)
299 if (fp < 0 || fp >= points_.size())
313 if (
f[fp] < 0 &&
f[fp] >= points_.
size())
324 void Foam::polyTopoChange::checkFace
336 if (own == -1 && zoneI != -1)
340 else if (patchi == -1 || patchi >= nPatches_)
343 <<
"Face has no neighbour (so external) but does not have" 344 <<
" a valid patch" <<
nl 346 <<
" facei(-1 if added face):" << facei
347 <<
" own:" << own <<
" nei:" << nei
348 <<
" patchi:" << patchi <<
nl;
349 if (hasValidPoints(
f))
352 <<
"points (removed points marked with " 363 <<
"Cannot both have valid patchi and neighbour" <<
nl 365 <<
" facei(-1 if added face):" << facei
366 <<
" own:" << own <<
" nei:" << nei
367 <<
" patchi:" << patchi <<
nl;
368 if (hasValidPoints(
f))
371 <<
"points (removed points marked with " 380 <<
"Owner cell label should be less than neighbour cell label" 383 <<
" facei(-1 if added face):" << facei
384 <<
" own:" << own <<
" nei:" << nei
385 <<
" patchi:" << patchi <<
nl;
386 if (hasValidPoints(
f))
389 <<
"points (removed points marked with " 399 <<
"Illegal vertices in face" 402 <<
" facei(-1 if added face):" << facei
403 <<
" own:" << own <<
" nei:" << nei
404 <<
" patchi:" << patchi <<
nl;
405 if (hasValidPoints(
f))
408 <<
"points (removed points marked with " 413 if (facei >= 0 && facei < faces_.size() && faceRemoved(facei))
416 <<
"Face already marked for removal" 419 <<
" facei(-1 if added face):" << facei
420 <<
" own:" << own <<
" nei:" << nei
421 <<
" patchi:" << patchi <<
nl;
422 if (hasValidPoints(
f))
425 <<
"points (removed points marked with " 432 if (
f[fp] < points_.
size() && pointRemoved(
f[fp]))
435 <<
"Face uses removed vertices" 438 <<
" facei(-1 if added face):" << facei
439 <<
" own:" << own <<
" nei:" << nei
440 <<
" patchi:" << patchi <<
nl;
441 if (hasValidPoints(
f))
444 <<
"points (removed points marked with " 453 void Foam::polyTopoChange::makeCells
455 const label nActiveFaces,
460 cellFaces.setSize(2*nActiveFaces);
461 cellFaceOffsets.setSize(cellMap_.size() + 1);
468 for (label facei = 0; facei < nActiveFaces; facei++)
470 if (faceOwner_[facei] < 0)
473 if (facei < faces_.size())
475 const face&
f = faces_[facei];
479 if (
f[fp] < points_.
size())
481 newPoints[fp] = points_[
f[fp]];
488 <<
"Face " << facei <<
" is active but its owner has" 489 <<
" been deleted. This is usually due to deleting cells" 490 <<
" without modifying exposed faces to be boundary faces." 493 nNbrs[faceOwner_[facei]]++;
495 for (label facei = 0; facei < nActiveFaces; facei++)
497 if (faceNeighbour_[facei] >= 0)
499 nNbrs[faceNeighbour_[facei]]++;
505 cellFaceOffsets[0] = 0;
508 cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli];
516 for (label facei = 0; facei < nActiveFaces; facei++)
518 label celli = faceOwner_[facei];
520 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
523 for (label facei = 0; facei < nActiveFaces; facei++)
525 label celli = faceNeighbour_[facei];
529 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
534 cellFaces.setSize(cellFaceOffsets[cellMap_.size()]);
540 void Foam::polyTopoChange::makeCellCells
542 const label nActiveFaces,
543 CompactListList<label>& cellCells
551 for (label facei = 0; facei < nActiveFaces; facei++)
553 if (faceNeighbour_[facei] >= 0)
555 nNbrs[faceOwner_[facei]]++;
556 nNbrs[faceNeighbour_[facei]]++;
569 for (label facei = 0; facei < nActiveFaces; facei++)
571 label nei = faceNeighbour_[facei];
575 label own = faceOwner_[facei];
576 cellCells(own, nNbrs[own]++) = nei;
577 cellCells(nei, nNbrs[nei]++) = own;
585 Foam::label Foam::polyTopoChange::getCellOrder
587 const CompactListList<label>& cellCellAddressing,
591 const label nOldCells(cellCellAddressing.size());
594 bitSet unvisited(nOldCells,
true);
597 for (label celli = 0; celli < nOldCells; ++celli)
599 if (cellRemoved(celli))
601 unvisited.unset(celli);
613 DynamicList<label> nbrCells;
616 DynamicList<label> nbrOrder;
619 DynamicList<label> weights;
622 CircularBuffer<label> queuedCells(1024);
625 label cellInOrder = 0;
630 label currCelli = -1;
633 for (
const label celli : unvisited)
635 const label nbrCount = cellCellAddressing[celli].size();
637 if (minCount > nbrCount)
652 queuedCells.push_back(currCelli);
659 while (!queuedCells.empty())
662 currCelli = queuedCells.front();
663 queuedCells.pop_front();
665 if (unvisited.test(currCelli))
668 unvisited.unset(currCelli);
671 newOrder[cellInOrder] = currCelli;
675 const auto& neighbours = cellCellAddressing[currCelli];
683 for (
const label nbr : neighbours)
685 const label nbrCount = cellCellAddressing[nbr].size();
687 if (unvisited.test(nbr))
690 nbrCells.append(nbr);
691 weights.append(nbrCount);
696 nbrOrder.resize_nocopy(weights.size());
702 for (
const label nbrIdx : nbrOrder)
704 queuedCells.push_back(nbrCells[nbrIdx]);
711 newOrder.resize(cellInOrder);
714 oldToNew =
invert(nOldCells, newOrder);
723 void Foam::polyTopoChange::getFaceOrder
725 const label nActiveFaces,
734 oldToNew.setSize(faceOwner_.size());
745 label startOfCell = cellFaceOffsets[celli];
746 label nFaces = cellFaceOffsets[celli+1] - startOfCell;
751 for (label i = 0; i < nFaces; i++)
753 label facei = cellFaces[startOfCell + i];
755 label nbrCelli = faceNeighbour_[facei];
757 if (facei >= nActiveFaces)
762 else if (nbrCelli != -1)
765 if (nbrCelli == celli)
767 nbrCelli = faceOwner_[facei];
770 if (celli < nbrCelli)
790 for (
const label index : order)
792 if (nbr[index] != -1)
794 oldToNew[cellFaces[startOfCell + index]] = newFacei++;
801 patchStarts.setSize(nPatches_);
803 patchSizes.setSize(nPatches_);
808 patchStarts[0] = newFacei;
810 for (label facei = 0; facei < nActiveFaces; facei++)
812 if (region_[facei] >= 0)
814 patchSizes[region_[facei]]++;
818 label facei = patchStarts[0];
820 forAll(patchStarts, patchi)
822 patchStarts[patchi] = facei;
823 facei += patchSizes[patchi];
835 for (label facei = 0; facei < nActiveFaces; facei++)
837 if (region_[facei] >= 0)
839 oldToNew[facei] = workPatchStarts[region_[facei]]++;
844 for (label facei = nActiveFaces; facei < oldToNew.size(); facei++)
846 oldToNew[facei] = facei;
852 if (oldToNew[facei] == -1)
855 <<
"Did not determine new position" 856 <<
" for face " << facei
857 <<
" owner " << faceOwner_[facei]
858 <<
" neighbour " << faceNeighbour_[facei]
859 <<
" region " << region_[facei] <<
endl 860 <<
"This is usually caused by not specifying a patch for" 861 <<
" a boundary face." <<
nl 862 <<
"Switch on the polyTopoChange::debug flag to catch" 863 <<
" this error earlier." <<
nl;
864 if (hasValidPoints(faces_[facei]))
867 <<
"points (removed points marked with " 868 <<
vector::max <<
") " << facePoints(faces_[facei]);
877 void Foam::polyTopoChange::reorderCompactFaces
884 faces_.setCapacity(newSize);
887 region_.setCapacity(newSize);
890 faceOwner_.setCapacity(newSize);
892 reorder(oldToNew, faceNeighbour_);
893 faceNeighbour_.setCapacity(newSize);
897 faceMap_.setCapacity(newSize);
899 renumberReverseMap(oldToNew, reverseFaceMap_);
901 renumberKey(oldToNew, faceFromPoint_);
902 renumberKey(oldToNew, faceFromEdge_);
904 flipFaceFlux_.setCapacity(newSize);
905 renumberKey(oldToNew, faceZone_);
907 faceZoneFlip_.setCapacity(newSize);
915 reversePointMap_.shrink();
920 faceNeighbour_.shrink();
922 reverseFaceMap_.shrink();
925 reverseCellMap_.shrink();
934 void Foam::polyTopoChange::compact
936 const bool orderCells,
937 const bool orderPoints,
938 label& nInternalPoints,
946 label nActivePoints = 0;
948 labelList localPointMap(points_.size(), -1);
953 nInternalPoints = -1;
957 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
968 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
980 && faceOwner_[facei] >= 0
981 && faceNeighbour_[facei] < 0
985 const face&
f = faces_[facei];
989 label pointi =
f[fp];
991 if (localPointMap[pointi] == -1)
996 || retiredPoints_.found(pointi)
1000 <<
"Removed or retired point " << pointi
1002 <<
" at position " << facei <<
endl 1003 <<
"Probably face has not been adapted for" 1013 nInternalPoints = nActivePoints - nBoundaryPoints;
1016 forAll(localPointMap, pointi)
1018 if (localPointMap[pointi] != -1)
1020 localPointMap[pointi] += nInternalPoints;
1027 forAll(faceOwner_, facei)
1032 && faceOwner_[facei] >= 0
1033 && faceNeighbour_[facei] >= 0
1037 const face&
f = faces_[facei];
1041 label pointi =
f[fp];
1043 if (localPointMap[pointi] == -1)
1047 pointRemoved(pointi)
1048 || retiredPoints_.found(pointi)
1052 <<
"Removed or retired point " << pointi
1054 <<
" at position " << facei <<
endl 1055 <<
"Probably face has not been adapted for" 1072 for (
const label pointi : retiredPoints_)
1080 Pout<<
"Points : active:" << nActivePoints
1084 reorder(localPointMap, points_);
1088 reorder(localPointMap, pointMap_);
1090 renumberReverseMap(localPointMap, reversePointMap_);
1092 renumberKey(localPointMap, pointZone_);
1093 renumber(localPointMap, retiredPoints_);
1098 face&
f = faces_[facei];
1101 renumberCompact(localPointMap,
f);
1103 if (!faceRemoved(facei) &&
f.
size() < 3)
1106 <<
"Created illegal face " <<
f 1108 <<
" at position:" << facei
1109 <<
" when filtering removed points" 1118 labelList localFaceMap(faces_.size(), -1);
1123 if (!faceRemoved(facei) && faceOwner_[facei] >= 0)
1125 localFaceMap[facei] = newFacei++;
1128 nActiveFaces_ = newFacei;
1132 if (!faceRemoved(facei) && faceOwner_[facei] < 0)
1135 localFaceMap[facei] = newFacei++;
1141 Pout<<
"Faces : active:" << nActiveFaces_
1142 <<
" removed:" << faces_.size()-newFacei <<
endl;
1146 reorderCompactFaces(newFacei, localFaceMap);
1157 CompactListList<label> cellCells;
1158 makeCellCells(nActiveFaces_, cellCells);
1161 newCelli = getCellOrder(cellCells, localCellMap);
1166 localCellMap.setSize(cellMap_.size());
1172 if (!cellRemoved(celli))
1174 localCellMap[celli] = newCelli++;
1181 Pout<<
"Cells : active:" << newCelli
1182 <<
" removed:" << cellMap_.size()-newCelli <<
endl;
1186 if (orderCells || (newCelli != cellMap_.size()))
1188 reorder(localCellMap, cellMap_);
1189 cellMap_.setCapacity(newCelli);
1190 renumberReverseMap(localCellMap, reverseCellMap_);
1192 reorder(localCellMap, cellZone_);
1193 cellZone_.setCapacity(newCelli);
1195 renumberKey(localCellMap, cellFromPoint_);
1196 renumberKey(localCellMap, cellFromEdge_);
1197 renumberKey(localCellMap, cellFromFace_);
1201 forAll(faceOwner_, facei)
1203 label own = faceOwner_[facei];
1204 label nei = faceNeighbour_[facei];
1209 faceOwner_[facei] = localCellMap[own];
1214 faceNeighbour_[facei] = localCellMap[nei];
1219 faceNeighbour_[facei] >= 0
1220 && faceNeighbour_[facei] < faceOwner_[facei]
1223 faces_[facei].flip();
1224 std::swap(faceOwner_[facei], faceNeighbour_[facei]);
1225 flipFaceFlux_.flip(facei);
1226 faceZoneFlip_.flip(facei);
1233 faceNeighbour_[facei] = localCellMap[nei];
1244 makeCells(nActiveFaces_, cellFaces, cellFaceOffsets);
1260 reorderCompactFaces(localFaceMap.size(), localFaceMap);
1274 const primitiveMesh&
mesh,
1276 const bool internalFacesOnly
1283 label facei = faceLabels[i];
1297 collectedFaces = faceLabels;
1301 collectedFaces.
setSize(nFaces);
1307 label facei = faceLabels[i];
1311 collectedFaces[nFaces++] = facei;
1316 return collectedFaces;
1322 void Foam::polyTopoChange::calcPatchPointMap
1324 const UList<Map<label>>& oldPatchMeshPointMaps,
1330 patchPointMap.setSize(patchMap.size());
1334 const label oldPatchi = patchMap[patchi];
1336 if (oldPatchi != -1)
1340 const Map<label>& oldMeshPointMap =
1341 oldPatchMeshPointMaps[oldPatchi];
1343 labelList& curPatchPointRnb = patchPointMap[patchi];
1345 curPatchPointRnb.
setSize(meshPoints.size());
1349 if (meshPoints[i] < pointMap_.size())
1352 curPatchPointRnb[i] = oldMeshPointMap.lookup
1354 pointMap_[meshPoints[i]],
1360 curPatchPointRnb[i] = -1;
1368 void Foam::polyTopoChange::calcFaceInflationMaps
1370 const polyMesh&
mesh,
1371 List<objectMap>& facesFromPoints,
1372 List<objectMap>& facesFromEdges,
1373 List<objectMap>& facesFromFaces
1379 facesFromPoints.setSize(faceFromPoint_.size());
1381 if (faceFromPoint_.size())
1383 label nFacesFromPoints = 0;
1388 const label facei = iter.key();
1389 const label pointi = iter.val();
1392 const bool internal = (region_[facei] == -1);
1394 facesFromPoints[nFacesFromPoints++] = objectMap
1411 facesFromEdges.setSize(faceFromEdge_.size());
1413 if (faceFromEdge_.size())
1415 label nFacesFromEdges = 0;
1420 const label facei = iter.key();
1421 const label edgei = iter.val();
1424 const bool internal = (region_[facei] == -1);
1426 facesFromEdges[nFacesFromEdges++] = objectMap
1452 void Foam::polyTopoChange::calcCellInflationMaps
1454 const polyMesh&
mesh,
1455 List<objectMap>& cellsFromPoints,
1456 List<objectMap>& cellsFromEdges,
1457 List<objectMap>& cellsFromFaces,
1458 List<objectMap>& cellsFromCells
1461 cellsFromPoints.setSize(cellFromPoint_.size());
1463 if (cellFromPoint_.size())
1465 label nCellsFromPoints = 0;
1470 const label celli = iter.key();
1471 const label pointi = iter.val();
1473 cellsFromPoints[nCellsFromPoints++] = objectMap
1482 cellsFromEdges.setSize(cellFromEdge_.size());
1484 if (cellFromEdge_.size())
1486 label nCellsFromEdges = 0;
1491 const label celli = iter.key();
1492 const label edgei = iter.val();
1494 cellsFromEdges[nCellsFromEdges++] = objectMap
1503 cellsFromFaces.setSize(cellFromFace_.size());
1505 if (cellFromFace_.size())
1507 label nCellsFromFaces = 0;
1514 const label celli = iter.key();
1515 const label oldFacei = iter.val();
1521 cellsFromFaces[nCellsFromFaces++] = objectMap
1529 cellsFromFaces[nCellsFromFaces++] = objectMap
1551 void Foam::polyTopoChange::resetZones
1553 const polyMesh&
mesh,
1573 const label pointi = iter.key();
1574 const label zonei = iter.val();
1576 if (zonei < 0 || zonei >= pointZones.size())
1579 <<
"Illegal zoneID " << zonei <<
" for point " 1580 << pointi <<
" coord " <<
mesh.
points()[pointi]
1589 forAll(addressing, zonei)
1591 addressing[zonei].setSize(
nPoints[zonei]);
1597 const label pointi = iter.key();
1598 const label zonei = iter.val();
1600 addressing[zonei][
nPoints[zonei]++] = pointi;
1603 forAll(addressing, zonei)
1610 forAll(addressing, zonei)
1612 const pointZone& oldZone = pointZones[zonei];
1613 const labelList& newZoneAddr = addressing[zonei];
1615 labelList& curPzRnb = pointZoneMap[zonei];
1616 curPzRnb.
setSize(newZoneAddr.size());
1620 if (newZoneAddr[i] < pointMap_.size())
1622 curPzRnb[i] = oldZone.whichPoint(pointMap_[newZoneAddr[i]]);
1632 newMesh.pointZones().clearAddressing();
1633 forAll(newMesh.pointZones(), zonei)
1637 Pout<<
"pointZone:" << zonei
1638 <<
" name:" << newMesh.pointZones()[zonei].
name()
1639 <<
" size:" << addressing[zonei].size()
1643 newMesh.pointZones()[zonei] = addressing[zonei];
1659 const label facei = iter.key();
1660 const label zonei = iter.val();
1662 if (zonei < 0 || zonei >= faceZones.size())
1665 <<
"Illegal zoneID " << zonei <<
" for face " 1675 forAll(addressing, zonei)
1677 addressing[zonei].setSize(nFaces[zonei]);
1678 flipMode[zonei].setSize(nFaces[zonei]);
1684 const label facei = iter.key();
1685 const label zonei = iter.val();
1687 const label index = nFaces[zonei]++;
1689 addressing[zonei][index] = facei;
1690 flipMode[zonei][index] = faceZoneFlip_.test(facei);
1694 forAll(addressing, zonei)
1698 labelList newAddressing(addressing[zonei].size());
1701 newAddressing[i] = addressing[zonei][newToOld[i]];
1703 addressing[zonei].transfer(newAddressing);
1706 boolList newFlipMode(flipMode[zonei].size());
1709 newFlipMode[i] = flipMode[zonei][newToOld[i]];
1711 flipMode[zonei].transfer(newFlipMode);
1717 forAll(addressing, zonei)
1719 const faceZone& oldZone = faceZones[zonei];
1720 const labelList& newZoneAddr = addressing[zonei];
1722 labelList& curFzFaceRnb = faceZoneFaceMap[zonei];
1724 curFzFaceRnb.
setSize(newZoneAddr.size());
1728 if (newZoneAddr[i] < faceMap_.size())
1731 oldZone.whichFace(faceMap_[newZoneAddr[i]]);
1735 curFzFaceRnb[i] = -1;
1742 newMesh.faceZones().clearAddressing();
1743 forAll(newMesh.faceZones(), zonei)
1747 Pout<<
"faceZone:" << zonei
1748 <<
" name:" << newMesh.faceZones()[zonei].
name()
1749 <<
" size:" << addressing[zonei].size()
1753 newMesh.faceZones()[zonei].resetAddressing
1773 const label zonei = cellZone_[celli];
1775 if (zonei >= cellZones.size())
1778 <<
"Illegal zoneID " << zonei <<
" for cell " 1789 forAll(addressing, zonei)
1791 addressing[zonei].setSize(nCells[zonei]);
1797 const label zonei = cellZone_[celli];
1801 addressing[zonei][nCells[zonei]++] = celli;
1805 forAll(addressing, zonei)
1812 forAll(addressing, zonei)
1814 const cellZone& oldZone = cellZones[zonei];
1815 const labelList& newZoneAddr = addressing[zonei];
1817 labelList& curCellRnb = cellZoneMap[zonei];
1819 curCellRnb.
setSize(newZoneAddr.size());
1823 if (newZoneAddr[i] < cellMap_.size())
1826 oldZone.whichCell(cellMap_[newZoneAddr[i]]);
1836 newMesh.cellZones().clearAddressing();
1837 forAll(newMesh.cellZones(), zonei)
1841 Pout<<
"cellZone:" << zonei
1842 <<
" name:" << newMesh.cellZones()[zonei].
name()
1843 <<
" size:" << addressing[zonei].size()
1847 newMesh.cellZones()[zonei] = addressing[zonei];
1853 void Foam::polyTopoChange::calcFaceZonePointMap
1855 const polyMesh&
mesh,
1856 const UList<Map<label>>& oldFaceZoneMeshPointMaps,
1862 faceZonePointMap.
setSize(faceZones.size());
1866 const faceZone& newZone = faceZones[zonei];
1868 const labelList& newZoneMeshPoints = newZone().meshPoints();
1870 const Map<label>& oldZoneMeshPointMap = oldFaceZoneMeshPointMaps[zonei];
1872 labelList& curFzPointRnb = faceZonePointMap[zonei];
1874 curFzPointRnb.
setSize(newZoneMeshPoints.size());
1876 forAll(newZoneMeshPoints, pointi)
1878 if (newZoneMeshPoints[pointi] < pointMap_.size())
1880 curFzPointRnb[pointi] =
1881 oldZoneMeshPointMap.lookup
1883 pointMap_[newZoneMeshPoints[pointi]],
1889 curFzPointRnb[pointi] = -1;
1896 void Foam::polyTopoChange::reorderCoupledFaces
1898 const bool syncParallel,
1899 const polyBoundaryMesh& oldBoundary,
1918 const label oldPatchi = patchMap[patchi];
1923 && (syncParallel || !isA<processorPolyPatch>(oldBoundary[oldPatchi]))
1926 oldBoundary[oldPatchi].initOrder
1945 pBufs.finishedSends();
1950 bool anyChanged =
false;
1954 const label oldPatchi = patchMap[patchi];
1959 && (syncParallel || !isA<processorPolyPatch>(oldBoundary[oldPatchi]))
1962 labelList patchFaceMap(patchSizes[patchi], -1);
1965 const bool changed = oldBoundary[oldPatchi].order
1985 const label start = patchStarts[patchi];
1987 forAll(patchFaceMap, patchFacei)
1989 oldToNew[patchFacei + start] =
1990 start + patchFaceMap[patchFacei];
1993 forAll(patchFaceRotation, patchFacei)
1995 rotation[patchFacei + start] =
1996 patchFaceRotation[patchFacei];
2007 reorderCompactFaces(oldToNew.size(), oldToNew);
2012 if (rotation[facei] != 0)
2014 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
2021 void Foam::polyTopoChange::compactAndReorder
2023 const polyMesh&
mesh,
2025 const bool syncParallel,
2026 const bool orderCells,
2027 const bool orderPoints,
2029 label& nInternalPoints,
2033 List<objectMap>& pointsFromPoints,
2034 List<objectMap>& facesFromPoints,
2035 List<objectMap>& facesFromEdges,
2036 List<objectMap>& facesFromFaces,
2037 List<objectMap>& cellsFromPoints,
2038 List<objectMap>& cellsFromEdges,
2039 List<objectMap>& cellsFromFaces,
2040 List<objectMap>& cellsFromCells,
2041 List<Map<label>>& oldPatchMeshPointMaps,
2044 List<Map<label>>& oldFaceZoneMeshPointMaps
2047 if (patchMap.size() != nPatches_)
2050 <<
"polyTopoChange was constructed with a mesh with " 2051 << nPatches_ <<
" patches." <<
endl 2052 <<
"The mesh now provided has a different number of patches " 2054 <<
" which is illegal" <<
endl 2060 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2064 newPoints.transfer(points_);
2097 calcFaceInflationMaps
2105 calcCellInflationMaps
2116 faceFromPoint_.clearStorage();
2117 faceFromEdge_.clearStorage();
2119 cellFromPoint_.clearStorage();
2120 cellFromEdge_.clearStorage();
2121 cellFromFace_.clearStorage();
2135 oldPatchMeshPointMaps[patchi] =
boundary[patchi].meshPointMap();
2136 oldPatchNMeshPoints[patchi] =
boundary[patchi].meshPoints().
size();
2137 oldPatchStarts[patchi] =
boundary[patchi].start();
2149 oldFaceZoneMeshPointMaps[zonei] = oldZone().meshPointMap();
2163 reversePointMap_(0),
2198 reversePointMap_(0),
2235 points_.clearStorage();
2236 pointMap_.clearStorage();
2237 reversePointMap_.clearStorage();
2238 pointZone_.clearStorage();
2239 retiredPoints_.clearStorage();
2241 faces_.clearStorage();
2242 region_.clearStorage();
2243 faceOwner_.clearStorage();
2244 faceNeighbour_.clearStorage();
2245 faceMap_.clearStorage();
2246 reverseFaceMap_.clearStorage();
2247 faceFromPoint_.clearStorage();
2248 faceFromEdge_.clearStorage();
2249 flipFaceFlux_.clearStorage();
2250 faceZone_.clearStorage();
2251 faceZoneFlip_.clearStorage();
2254 cellMap_.clearStorage();
2255 reverseCellMap_.clearStorage();
2256 cellZone_.clearStorage();
2257 cellFromPoint_.clearStorage();
2258 cellFromEdge_.clearStorage();
2259 cellFromFace_.clearStorage();
2272 label maxRegion = nPatches_ - 1;
2273 for (
const label regioni : patchMap)
2275 maxRegion =
max(maxRegion, regioni);
2277 nPatches_ = maxRegion + 1;
2286 points_.setCapacity(points_.size() +
points.
size());
2287 pointMap_.setCapacity(pointMap_.size() +
points.
size());
2288 reversePointMap_.setCapacity(reversePointMap_.size() +
points.
size());
2294 forAll(pointZones, zonei)
2300 newZoneID[pointi] = pointZoneMap[zonei];
2305 for (label pointi = 0; pointi <
mesh.
nPoints(); pointi++)
2327 cellMap_.setCapacity(cellMap_.size() + nAllCells);
2328 reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
2329 cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/128);
2330 cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/128);
2331 cellFromFace_.resize(cellFromFace_.size() + nAllCells/128);
2332 cellZone_.setCapacity(cellZone_.size() + nAllCells);
2340 const labelList& cellLabels = cellZones[zonei];
2342 for (
const label celli : cellLabels)
2344 if (newZoneID[celli] != -1)
2349 <<
" is in two zones:" 2350 << cellZones[newZoneID[celli]].
name()
2351 <<
" and " << cellZones[zonei].
name() <<
endl 2352 <<
" This is not supported." 2353 <<
" Continuing with first zone only." <<
endl;
2357 newZoneID[celli] = cellZoneMap[zonei];
2363 for (label celli = 0; celli < nAllCells; celli++)
2366 addCell(-1, -1, -1, celli, newZoneID[celli]);
2381 faces_.setCapacity(faces_.size() + nAllFaces);
2382 region_.setCapacity(region_.size() + nAllFaces);
2383 faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
2384 faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
2385 faceMap_.setCapacity(faceMap_.size() + nAllFaces);
2386 reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
2387 faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/128);
2388 faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/128);
2389 flipFaceFlux_.setCapacity(faces_.size() + nAllFaces);
2390 faceZone_.resize(faceZone_.size() + nAllFaces/128);
2391 faceZoneFlip_.setCapacity(faces_.size() + nAllFaces);
2396 boolList zoneFlip(nAllFaces,
false);
2400 const labelList& faceLabels = faceZones[zonei];
2401 const boolList& flipMap = faceZones[zonei].flipMap();
2403 forAll(faceLabels, facei)
2405 newZoneID[faceLabels[facei]] = faceZoneMap[zonei];
2406 zoneFlip[faceLabels[facei]] = flipMap[facei];
2419 faceNeighbour[facei],
2435 if (pp.
start() != faces_.size())
2439 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2441 <<
"Current face counter at " << faces_.size() <<
endl 2442 <<
"Are patches in incremental order?" 2447 const label facei = pp.
start() + patchFacei;
2476 pointMap_.setCapacity(
nPoints);
2477 reversePointMap_.setCapacity(
nPoints);
2478 pointZone_.resize(pointZone_.size() +
nPoints/128);
2480 faces_.setCapacity(nFaces);
2481 region_.setCapacity(nFaces);
2482 faceOwner_.setCapacity(nFaces);
2483 faceNeighbour_.setCapacity(nFaces);
2484 faceMap_.setCapacity(nFaces);
2485 reverseFaceMap_.setCapacity(nFaces);
2486 faceFromPoint_.resize(faceFromPoint_.size() + nFaces/128);
2487 faceFromEdge_.resize(faceFromEdge_.size() + nFaces/128);
2488 flipFaceFlux_.setCapacity(nFaces);
2489 faceZone_.resize(faceZone_.size() + nFaces/128);
2490 faceZoneFlip_.setCapacity(nFaces);
2492 cellMap_.setCapacity(nCells);
2493 reverseCellMap_.setCapacity(nCells);
2494 cellFromPoint_.resize(cellFromPoint_.size() + nCells/128);
2495 cellFromEdge_.resize(cellFromEdge_.size() + nCells/128);
2496 cellFromFace_.resize(cellFromFace_.size() + nCells/128);
2497 cellZone_.setCapacity(nCells);
2503 if (isType<polyAddPoint>(action))
2505 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2515 else if (isType<polyModifyPoint>(action))
2529 else if (isType<polyRemovePoint>(action))
2537 else if (isType<polyAddFace>(action))
2539 const polyAddFace& paf = refCast<const polyAddFace>(action);
2555 else if (isType<polyModifyFace>(action))
2557 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2573 else if (isType<polyRemoveFace>(action))
2575 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2581 else if (isType<polyAddCell>(action))
2583 const polyAddCell& pac = refCast<const polyAddCell>(action);
2594 else if (isType<polyModifyCell>(action))
2596 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2600 modifyCell(pmc.
cellID(), -1);
2609 else if (isType<polyRemoveCell>(action))
2611 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2620 <<
"Unknown type of topoChange: " << action.type()
2632 const label masterPointID,
2637 const label pointi = points_.size();
2640 pointMap_.append(masterPointID);
2641 reversePointMap_.append(pointi);
2645 pointZone_.insert(pointi, zoneID);
2650 retiredPoints_.insert(pointi);
2665 if (pointi < 0 || pointi >= points_.size())
2668 <<
"illegal point label " << pointi <<
endl 2669 <<
"Valid point labels are 0 .. " << points_.size()-1
2672 if (pointRemoved(pointi) || pointMap_[pointi] == -1)
2675 <<
"point " << pointi <<
" already marked for removal" 2678 points_[pointi] = pt;
2682 pointZone_.set(pointi, zoneID);
2686 pointZone_.erase(pointi);
2691 retiredPoints_.erase(pointi);
2695 retiredPoints_.insert(pointi);
2702 if (newPoints.
size() != points_.size())
2705 <<
"illegal pointField size." <<
endl 2706 <<
"Size:" << newPoints.
size() <<
endl 2707 <<
"Points in mesh:" << points_.size()
2713 points_[pointi] = newPoints[pointi];
2721 const label mergePointi
2724 if (pointi < 0 || pointi >= points_.size())
2727 <<
"illegal point label " << pointi <<
endl 2728 <<
"Valid point labels are 0 .. " << points_.size()-1
2735 && (pointRemoved(pointi) || pointMap_[pointi] == -1)
2739 <<
"point " << pointi <<
" already marked for removal" <<
nl 2740 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
2744 if (pointi == mergePointi)
2747 <<
"Cannot remove/merge point " << pointi <<
" onto itself." 2752 pointMap_[pointi] = -1;
2753 if (mergePointi >= 0)
2755 reversePointMap_[pointi] = -mergePointi-2;
2759 reversePointMap_[pointi] = -1;
2761 pointZone_.erase(pointi);
2762 retiredPoints_.erase(pointi);
2771 const label masterPointID,
2772 const label masterEdgeID,
2773 const label masterFaceID,
2774 const bool flipFaceFlux,
2783 checkFace(
f, -1, own, nei,
patchID, zoneID);
2786 label facei = faces_.size();
2790 faceOwner_.append(own);
2791 faceNeighbour_.append(nei);
2793 if (masterPointID >= 0)
2795 faceMap_.append(-1);
2796 faceFromPoint_.insert(facei, masterPointID);
2798 else if (masterEdgeID >= 0)
2800 faceMap_.append(-1);
2801 faceFromEdge_.insert(facei, masterEdgeID);
2803 else if (masterFaceID >= 0)
2805 faceMap_.append(masterFaceID);
2814 faceMap_.append(-1);
2816 reverseFaceMap_.append(facei);
2818 flipFaceFlux_.set(facei, flipFaceFlux);
2822 faceZone_.insert(facei, zoneID);
2824 faceZoneFlip_.set(facei, zoneFlip);
2836 const bool flipFaceFlux,
2845 checkFace(
f, facei, own, nei,
patchID, zoneID);
2849 faceOwner_[facei] = own;
2850 faceNeighbour_[facei] = nei;
2853 flipFaceFlux_.set(facei, flipFaceFlux);
2854 faceZoneFlip_.set(facei, zoneFlip);
2858 faceZone_.set(facei, zoneID);
2862 faceZone_.erase(facei);
2870 const label mergeFacei
2873 if (facei < 0 || facei >= faces_.size())
2876 <<
"illegal face label " << facei <<
endl 2877 <<
"Valid face labels are 0 .. " << faces_.size()-1
2884 && (faceRemoved(facei) || faceMap_[facei] == -1)
2889 <<
" already marked for removal" 2893 faces_[facei].setSize(0);
2894 region_[facei] = -1;
2895 faceOwner_[facei] = -1;
2896 faceNeighbour_[facei] = -1;
2897 faceMap_[facei] = -1;
2898 if (mergeFacei >= 0)
2900 reverseFaceMap_[facei] = -mergeFacei-2;
2904 reverseFaceMap_[facei] = -1;
2906 faceFromEdge_.erase(facei);
2907 faceFromPoint_.erase(facei);
2908 flipFaceFlux_.unset(facei);
2909 faceZoneFlip_.unset(facei);
2910 faceZone_.erase(facei);
2916 const label masterPointID,
2917 const label masterEdgeID,
2918 const label masterFaceID,
2919 const label masterCellID,
2923 label celli = cellMap_.size();
2925 if (masterPointID >= 0)
2927 cellMap_.append(-1);
2928 cellFromPoint_.insert(celli, masterPointID);
2930 else if (masterEdgeID >= 0)
2932 cellMap_.append(-1);
2933 cellFromEdge_.insert(celli, masterEdgeID);
2935 else if (masterFaceID >= 0)
2937 cellMap_.append(-1);
2938 cellFromFace_.insert(celli, masterFaceID);
2942 cellMap_.append(masterCellID);
2944 reverseCellMap_.append(celli);
2945 cellZone_.append(zoneID);
2957 cellZone_[celli] = zoneID;
2964 const label mergeCelli
2967 if (celli < 0 || celli >= cellMap_.size())
2970 <<
"illegal cell label " << celli <<
endl 2971 <<
"Valid cell labels are 0 .. " << cellMap_.size()-1
2975 if (strict_ && cellMap_[celli] == -2)
2979 <<
" already marked for removal" 2983 cellMap_[celli] = -2;
2984 if (mergeCelli >= 0)
2986 reverseCellMap_[celli] = -mergeCelli-2;
2990 reverseCellMap_[celli] = -1;
2992 cellFromPoint_.erase(celli);
2993 cellFromEdge_.erase(celli);
2994 cellFromFace_.erase(celli);
2995 cellZone_[celli] = -1;
3004 const bool syncParallel,
3005 const bool orderCells,
3006 const bool orderPoints
3011 Pout<<
"polyTopoChange::changeMesh" 3012 <<
"(polyMesh&, const bool, const bool, const bool, const bool)" 3018 Pout<<
"Old mesh:" <<
nl;
3025 label nInternalPoints;
3065 oldPatchMeshPointMaps,
3066 oldPatchNMeshPoints,
3068 oldFaceZoneMeshPointMaps
3090 const label oldPointi = pointMap_[
newPointi];
3135 retiredPoints_.clearStorage();
3136 region_.clearStorage();
3143 label nAdd, nInflate, nMerge, nRemove;
3144 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3146 <<
" added(from point):" << nAdd
3147 <<
" added(from nothing):" << nInflate
3148 <<
" merged(into other point):" << nMerge
3149 <<
" removed:" << nRemove
3152 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3154 <<
" added(from face):" << nAdd
3155 <<
" added(inflated):" << nInflate
3156 <<
" merged(into other face):" << nMerge
3157 <<
" removed:" << nRemove
3160 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3162 <<
" added(from cell):" << nAdd
3163 <<
" added(inflated):" << nInflate
3164 <<
" merged(into other cell):" << nMerge
3165 <<
" removed:" << nRemove
3172 Pout<<
"New mesh:" <<
nl;
3187 resetZones(
mesh,
mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3191 pointZone_.clearStorage();
3192 faceZone_.clearStorage();
3193 faceZoneFlip_.clearStorage();
3194 cellZone_.clearStorage();
3204 oldPatchMeshPointMaps,
3212 calcFaceZonePointMap(
mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3253 oldPatchNMeshPoints,
3269 const bool syncParallel,
3270 const bool orderCells,
3271 const bool orderPoints
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const face & newFace() const
Return face.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
void modifyPoint(const label pointi, const point &pt, const label zoneID, const bool inCell)
Modify coordinate.
Class containing data for face removal.
List< labelList > labelListList
A List of labelList.
label zoneID() const
Face zone ID.
label mergePointID() const
label neighbour() const
Return owner cell ID.
void size(const label n)
Older name for setAddressableSize.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
label faceID() const
Return master face ID.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Class describing modification of a face.
A face is a list of labels corresponding to mesh vertices.
label zoneFlip() const
Face zone flip.
const face & newFace() const
Return face.
polyTopoChange(const label nPatches, const bool strict=true)
Construct without mesh. Either specify nPatches or use setNumPatches before trying to make a mesh (ma...
labelList pointLabels(nPoints, -1)
labelHashSet used(const bitSet &select)
Convert a bitset to a labelHashSet of the indices used.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
const word & name() const noexcept
Return the object name.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
constexpr char nl
The newline '\n' character (0x0a)
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
bool inCell() const
Does the point support a cell.
label patchID() const
Boundary patch ID.
label owner() const
Return owner cell ID.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
label zoneID() const
Point zone ID.
label cellID() const
Cell ID.
void resetPrimitives(autoPtr< pointField > &&points, autoPtr< faceList > &&faces, autoPtr< labelList > &&owner, autoPtr< labelList > &&neighbour, const labelUList &patchSizes, const labelUList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
label zoneID() const
Face zone ID.
label masterCellID() const
Return master cell ID.
void stableSort(UList< T > &list)
Stable sort the list.
Class containing data for point addition.
label masterEdgeID() const
Return master edge ID.
label pointID() const
Point ID.
label nFaces() const noexcept
Number of mesh faces.
autoPtr< mapPolyMesh > changeMesh(polyMesh &mesh, const labelUList &patchMap, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
label masterPointID() const
Return master point ID.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Class describing modification of a cell.
A face addition data class. A face can be inflated either from a point or from another face and can e...
void clear()
Clear all storage.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
UList< label > labelUList
A UList of labels.
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
bool removeFromZone() const
const point & newPoint() const
Point location.
label owner() const
Return owner cell.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
label zoneFlip() const
Face zone flip.
const labelListList & edgeCells() const
Class containing data for cell addition.
List< List< bool > > boolListList
A List of boolList.
bool flipFaceFlux() const
Does the face flux need to be flipped.
vectorField pointField
pointField is a vectorField.
Class containing data for cell removal.
void setSize(const label n)
Alias for resize()
label cellID() const
Return cell ID.
label addFace(const face &f, const label own, const label nei, const label masterPointID, const label masterEdgeID, const label masterFaceID, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Add face to cells. Return new face label.
label faceID() const
Return face ID.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
bool inCell() const
Does the point support a cell.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void removeCell(const label celli, const label mergeCelli)
Remove/merge cell.
label size() const noexcept
The number of elements in the list.
label mergeCellID() const
Return cell ID.
label zoneID() const
Cell zone ID.
virtual const labelList & faceOwner() const
Return face owner.
label masterFaceID() const
Return master face ID.
label masterPointID() const
Return master point ID.
label nInternalFaces() const noexcept
Number of internal faces.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
void shrink()
Shrink storage (does not remove any elements; just compacts dynamic lists.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
const labelListList & pointCells() const
A virtual base class for topological actions.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh size for if construct-without-mesh.
bool topoChanging() const noexcept
Is mesh topology changing.
label patchID() const
Boundary patch ID.
const word & name() const noexcept
The patch name.
Class describing modification of a point.
void movePoints(const pointField &newPoints)
Move all points. Incompatible with other topology changes.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
OBJstream os(runTime.globalPath()/outputName)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
void modifyCell(const label celli, const label zoneID)
Modify zone of cell.
void setSize(const label newLen)
Same as resize()
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field...
void resize(const label newLen)
Adjust size of PtrList.
label zoneID() const
Point zone ID.
label zoneID() const
Cell zone ID.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
label masterFaceID() const
Return master face ID.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID, const label zoneID, const bool zoneFlip)
Modify vertices or cell of face.
void addMesh(const polyMesh &mesh, const labelUList &patchMap, const labelUList &pointZoneMap, const labelUList &faceZoneMap, const labelUList &cellZoneMap)
Add all points/faces/cells of mesh. Additional offset for patch or zone ids.
label neighbour() const
Return neighbour cell.
const wordList internal
Standard dimensioned field types (scalar, vector, tensor, etc)
#define WarningInFunction
Report a warning using Foam::Warning.
label nCells() const noexcept
Number of mesh cells.
void removePoint(const label pointi, const label mergePointi)
Remove/merge point.
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & patches
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
"nonBlocking" : (MPI_Isend, MPI_Irecv)
const labelListList & pointFaces() const
const point & newPoint() const
New point location.
label pointID() const
Return point ID.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
label addPoint(const point &pt, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
bool flipFaceFlux() const
Does the face flux need to be flipped.
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
void removeFace(const label facei, const label mergeFacei)
Remove/merge face.
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Class containing data for point removal.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
const labelListList & edgeFaces() const
label mergeFaceID() const
Return merge face ID.
forAllConstIters(mixture.phases(), phase)
label masterEdgeID() const
Return master edge ID.
const scalarField & cellVolumes() const
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
static constexpr const zero Zero
Global zero (0)
label masterPointID() const
Master point label.