57void Foam::polyTopoChange::renumberReverseMap
59 const labelUList& oldToNew,
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;
80void Foam::polyTopoChange::renumber
88 for (
const label val : labels)
90 const label newVal = oldToNew[val];
94 newSet.insert(newVal);
98 labels.transfer(newSet);
103void Foam::polyTopoChange::renumberCompact
111 for (
const label val : elems)
113 const label newVal = oldToNew[val];
117 elems[nElem++] = newVal;
120 elems.setSize(nElem);
124void 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)
193void Foam::polyTopoChange::writeMeshStats(
const polyMesh&
mesh, Ostream&
os)
208 <<
" PatchSizes : " << patchSizes <<
nl
209 <<
" PatchStarts : " << patchStarts <<
nl
214void 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;
295bool 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())
324void 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 "
453void 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()]);
540void 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]]++;
561 cellCells.setSize(nNbrs);
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;
585Foam::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.append(currCelli);
659 while (!queuedCells.empty())
662 currCelli = queuedCells.first();
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.append(nbrCells[nbrIdx]);
711 newOrder.resize(cellInOrder);
714 oldToNew =
invert(nOldCells, newOrder);
723void 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]);
877void 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();
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;
1307 label facei = faceLabels[i];
1311 collectedFaces[
nFaces++] = facei;
1316 return collectedFaces;
1322void 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;
1368void 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
1452void 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
1551void 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];
1853void 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;
1896void 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];
2006 reduce(anyChanged, orOp<bool>());
2012 reorderCompactFaces(oldToNew.size(), oldToNew);
2017 if (rotation[facei] != 0)
2019 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
2026void Foam::polyTopoChange::compactAndReorder
2028 const polyMesh&
mesh,
2030 const bool syncParallel,
2031 const bool orderCells,
2032 const bool orderPoints,
2034 label& nInternalPoints,
2038 List<objectMap>& pointsFromPoints,
2039 List<objectMap>& facesFromPoints,
2040 List<objectMap>& facesFromEdges,
2041 List<objectMap>& facesFromFaces,
2042 List<objectMap>& cellsFromPoints,
2043 List<objectMap>& cellsFromEdges,
2044 List<objectMap>& cellsFromFaces,
2045 List<objectMap>& cellsFromCells,
2046 List<Map<label>>& oldPatchMeshPointMaps,
2049 List<Map<label>>& oldFaceZoneMeshPointMaps
2052 if (patchMap.size() != nPatches_)
2055 <<
"polyTopoChange was constructed with a mesh with "
2056 << nPatches_ <<
" patches." <<
endl
2057 <<
"The mesh now provided has a different number of patches "
2059 <<
" which is illegal" <<
endl
2065 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2069 newPoints.transfer(points_);
2102 calcFaceInflationMaps
2110 calcCellInflationMaps
2121 faceFromPoint_.clearStorage();
2122 faceFromEdge_.clearStorage();
2124 cellFromPoint_.clearStorage();
2125 cellFromEdge_.clearStorage();
2126 cellFromFace_.clearStorage();
2140 oldPatchMeshPointMaps[patchi] =
boundary[patchi].meshPointMap();
2141 oldPatchNMeshPoints[patchi] =
boundary[patchi].meshPoints().
size();
2142 oldPatchStarts[patchi] =
boundary[patchi].start();
2154 oldFaceZoneMeshPointMaps[zonei] = oldZone().meshPointMap();
2168 reversePointMap_(0),
2203 reversePointMap_(0),
2240 points_.clearStorage();
2241 pointMap_.clearStorage();
2242 reversePointMap_.clearStorage();
2243 pointZone_.clearStorage();
2244 retiredPoints_.clearStorage();
2246 faces_.clearStorage();
2247 region_.clearStorage();
2248 faceOwner_.clearStorage();
2249 faceNeighbour_.clearStorage();
2250 faceMap_.clearStorage();
2251 reverseFaceMap_.clearStorage();
2252 faceFromPoint_.clearStorage();
2253 faceFromEdge_.clearStorage();
2254 flipFaceFlux_.clearStorage();
2255 faceZone_.clearStorage();
2256 faceZoneFlip_.clearStorage();
2259 cellMap_.clearStorage();
2260 reverseCellMap_.clearStorage();
2261 cellZone_.clearStorage();
2262 cellFromPoint_.clearStorage();
2263 cellFromEdge_.clearStorage();
2264 cellFromFace_.clearStorage();
2277 label maxRegion = nPatches_ - 1;
2278 for (
const label regioni : patchMap)
2280 maxRegion =
max(maxRegion, regioni);
2282 nPatches_ = maxRegion + 1;
2291 points_.setCapacity(points_.size() +
points.
size());
2292 pointMap_.setCapacity(pointMap_.size() +
points.
size());
2293 reversePointMap_.setCapacity(reversePointMap_.size() +
points.
size());
2299 forAll(pointZones, zonei)
2305 newZoneID[pointi] = pointZoneMap[zonei];
2310 for (label pointi = 0; pointi <
mesh.
nPoints(); pointi++)
2332 cellMap_.setCapacity(cellMap_.size() + nAllCells);
2333 reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
2334 cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/128);
2335 cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/128);
2336 cellFromFace_.resize(cellFromFace_.size() + nAllCells/128);
2337 cellZone_.setCapacity(cellZone_.size() + nAllCells);
2345 const labelList& cellLabels = cellZones[zonei];
2347 for (
const label celli : cellLabels)
2349 if (newZoneID[celli] != -1)
2354 <<
" is in two zones:"
2355 << cellZones[newZoneID[celli]].
name()
2356 <<
" and " << cellZones[zonei].
name() <<
endl
2357 <<
" This is not supported."
2358 <<
" Continuing with first zone only." <<
endl;
2362 newZoneID[celli] = cellZoneMap[zonei];
2368 for (label celli = 0; celli < nAllCells; celli++)
2371 addCell(-1, -1, -1, celli, newZoneID[celli]);
2386 faces_.setCapacity(faces_.size() + nAllFaces);
2387 region_.setCapacity(region_.size() + nAllFaces);
2388 faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
2389 faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
2390 faceMap_.setCapacity(faceMap_.size() + nAllFaces);
2391 reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
2392 faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/128);
2393 faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/128);
2394 flipFaceFlux_.setCapacity(faces_.size() + nAllFaces);
2395 faceZone_.resize(faceZone_.size() + nAllFaces/128);
2396 faceZoneFlip_.setCapacity(faces_.size() + nAllFaces);
2401 boolList zoneFlip(nAllFaces,
false);
2405 const labelList& faceLabels = faceZones[zonei];
2406 const boolList& flipMap = faceZones[zonei].flipMap();
2408 forAll(faceLabels, facei)
2410 newZoneID[faceLabels[facei]] = faceZoneMap[zonei];
2411 zoneFlip[faceLabels[facei]] = flipMap[facei];
2424 faceNeighbour[facei],
2440 if (pp.
start() != faces_.size())
2444 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2446 <<
"Current face counter at " << faces_.size() <<
endl
2447 <<
"Are patches in incremental order?"
2452 const label facei = pp.
start() + patchFacei;
2481 pointMap_.setCapacity(
nPoints);
2482 reversePointMap_.setCapacity(
nPoints);
2483 pointZone_.resize(pointZone_.size() +
nPoints/128);
2485 faces_.setCapacity(
nFaces);
2486 region_.setCapacity(
nFaces);
2487 faceOwner_.setCapacity(
nFaces);
2488 faceNeighbour_.setCapacity(
nFaces);
2489 faceMap_.setCapacity(
nFaces);
2490 reverseFaceMap_.setCapacity(
nFaces);
2491 faceFromPoint_.resize(faceFromPoint_.size() +
nFaces/128);
2492 faceFromEdge_.resize(faceFromEdge_.size() +
nFaces/128);
2493 flipFaceFlux_.setCapacity(
nFaces);
2494 faceZone_.resize(faceZone_.size() +
nFaces/128);
2495 faceZoneFlip_.setCapacity(
nFaces);
2497 cellMap_.setCapacity(nCells);
2498 reverseCellMap_.setCapacity(nCells);
2499 cellFromPoint_.resize(cellFromPoint_.size() + nCells/128);
2500 cellFromEdge_.resize(cellFromEdge_.size() + nCells/128);
2501 cellFromFace_.resize(cellFromFace_.size() + nCells/128);
2502 cellZone_.setCapacity(nCells);
2508 if (isType<polyAddPoint>(action))
2510 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2520 else if (isType<polyModifyPoint>(action))
2534 else if (isType<polyRemovePoint>(action))
2542 else if (isType<polyAddFace>(action))
2544 const polyAddFace& paf = refCast<const polyAddFace>(action);
2560 else if (isType<polyModifyFace>(action))
2562 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2578 else if (isType<polyRemoveFace>(action))
2580 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2586 else if (isType<polyAddCell>(action))
2588 const polyAddCell& pac = refCast<const polyAddCell>(action);
2599 else if (isType<polyModifyCell>(action))
2601 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2605 modifyCell(pmc.
cellID(), -1);
2614 else if (isType<polyRemoveCell>(action))
2616 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2625 <<
"Unknown type of topoChange: " << action.type()
2637 const label masterPointID,
2642 const label pointi = points_.size();
2645 pointMap_.append(masterPointID);
2646 reversePointMap_.append(pointi);
2650 pointZone_.insert(pointi,
zoneID);
2655 retiredPoints_.insert(pointi);
2670 if (pointi < 0 || pointi >= points_.size())
2673 <<
"illegal point label " << pointi <<
endl
2674 <<
"Valid point labels are 0 .. " << points_.size()-1
2677 if (pointRemoved(pointi) || pointMap_[pointi] == -1)
2680 <<
"point " << pointi <<
" already marked for removal"
2683 points_[pointi] = pt;
2687 pointZone_.set(pointi,
zoneID);
2691 pointZone_.erase(pointi);
2696 retiredPoints_.erase(pointi);
2700 retiredPoints_.insert(pointi);
2707 if (newPoints.
size() != points_.size())
2710 <<
"illegal pointField size." <<
endl
2711 <<
"Size:" << newPoints.
size() <<
endl
2712 <<
"Points in mesh:" << points_.size()
2718 points_[pointi] = newPoints[pointi];
2726 const label mergePointi
2729 if (pointi < 0 || pointi >= points_.size())
2732 <<
"illegal point label " << pointi <<
endl
2733 <<
"Valid point labels are 0 .. " << points_.size()-1
2740 && (pointRemoved(pointi) || pointMap_[pointi] == -1)
2744 <<
"point " << pointi <<
" already marked for removal" <<
nl
2745 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
2749 if (pointi == mergePointi)
2752 <<
"Cannot remove/merge point " << pointi <<
" onto itself."
2757 pointMap_[pointi] = -1;
2758 if (mergePointi >= 0)
2760 reversePointMap_[pointi] = -mergePointi-2;
2764 reversePointMap_[pointi] = -1;
2766 pointZone_.erase(pointi);
2767 retiredPoints_.erase(pointi);
2776 const label masterPointID,
2777 const label masterEdgeID,
2778 const label masterFaceID,
2779 const bool flipFaceFlux,
2791 label facei = faces_.size();
2795 faceOwner_.append(own);
2796 faceNeighbour_.append(nei);
2798 if (masterPointID >= 0)
2800 faceMap_.append(-1);
2801 faceFromPoint_.insert(facei, masterPointID);
2803 else if (masterEdgeID >= 0)
2805 faceMap_.append(-1);
2806 faceFromEdge_.insert(facei, masterEdgeID);
2808 else if (masterFaceID >= 0)
2810 faceMap_.append(masterFaceID);
2819 faceMap_.append(-1);
2821 reverseFaceMap_.append(facei);
2823 flipFaceFlux_.set(facei, flipFaceFlux);
2827 faceZone_.insert(facei,
zoneID);
2829 faceZoneFlip_.set(facei, zoneFlip);
2841 const bool flipFaceFlux,
2854 faceOwner_[facei] = own;
2855 faceNeighbour_[facei] = nei;
2858 flipFaceFlux_.set(facei, flipFaceFlux);
2859 faceZoneFlip_.set(facei, zoneFlip);
2863 faceZone_.set(facei,
zoneID);
2867 faceZone_.erase(facei);
2875 const label mergeFacei
2878 if (facei < 0 || facei >= faces_.size())
2881 <<
"illegal face label " << facei <<
endl
2882 <<
"Valid face labels are 0 .. " << faces_.size()-1
2889 && (faceRemoved(facei) || faceMap_[facei] == -1)
2894 <<
" already marked for removal"
2898 faces_[facei].setSize(0);
2899 region_[facei] = -1;
2900 faceOwner_[facei] = -1;
2901 faceNeighbour_[facei] = -1;
2902 faceMap_[facei] = -1;
2903 if (mergeFacei >= 0)
2905 reverseFaceMap_[facei] = -mergeFacei-2;
2909 reverseFaceMap_[facei] = -1;
2911 faceFromEdge_.erase(facei);
2912 faceFromPoint_.erase(facei);
2913 flipFaceFlux_.unset(facei);
2914 faceZoneFlip_.unset(facei);
2915 faceZone_.erase(facei);
2921 const label masterPointID,
2922 const label masterEdgeID,
2923 const label masterFaceID,
2924 const label masterCellID,
2928 label celli = cellMap_.size();
2930 if (masterPointID >= 0)
2932 cellMap_.append(-1);
2933 cellFromPoint_.insert(celli, masterPointID);
2935 else if (masterEdgeID >= 0)
2937 cellMap_.append(-1);
2938 cellFromEdge_.insert(celli, masterEdgeID);
2940 else if (masterFaceID >= 0)
2942 cellMap_.append(-1);
2943 cellFromFace_.insert(celli, masterFaceID);
2947 cellMap_.append(masterCellID);
2949 reverseCellMap_.append(celli);
2950 cellZone_.append(
zoneID);
2962 cellZone_[celli] =
zoneID;
2969 const label mergeCelli
2972 if (celli < 0 || celli >= cellMap_.size())
2975 <<
"illegal cell label " << celli <<
endl
2976 <<
"Valid cell labels are 0 .. " << cellMap_.size()-1
2980 if (strict_ && cellMap_[celli] == -2)
2984 <<
" already marked for removal"
2988 cellMap_[celli] = -2;
2989 if (mergeCelli >= 0)
2991 reverseCellMap_[celli] = -mergeCelli-2;
2995 reverseCellMap_[celli] = -1;
2997 cellFromPoint_.erase(celli);
2998 cellFromEdge_.erase(celli);
2999 cellFromFace_.erase(celli);
3000 cellZone_[celli] = -1;
3009 const bool syncParallel,
3010 const bool orderCells,
3011 const bool orderPoints
3016 Pout<<
"polyTopoChange::changeMesh"
3017 <<
"(polyMesh&, const bool, const bool, const bool, const bool)"
3023 Pout<<
"Old mesh:" <<
nl;
3030 label nInternalPoints;
3070 oldPatchMeshPointMaps,
3071 oldPatchNMeshPoints,
3073 oldFaceZoneMeshPointMaps
3095 const label oldPointi = pointMap_[
newPointi];
3140 retiredPoints_.clearStorage();
3141 region_.clearStorage();
3148 label nAdd, nInflate, nMerge, nRemove;
3149 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3151 <<
" added(from point):" << nAdd
3152 <<
" added(from nothing):" << nInflate
3153 <<
" merged(into other point):" << nMerge
3154 <<
" removed:" << nRemove
3157 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3159 <<
" added(from face):" << nAdd
3160 <<
" added(inflated):" << nInflate
3161 <<
" merged(into other face):" << nMerge
3162 <<
" removed:" << nRemove
3165 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3167 <<
" added(from cell):" << nAdd
3168 <<
" added(inflated):" << nInflate
3169 <<
" merged(into other cell):" << nMerge
3170 <<
" removed:" << nRemove
3177 Pout<<
"New mesh:" <<
nl;
3192 resetZones(
mesh,
mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3196 pointZone_.clearStorage();
3197 faceZone_.clearStorage();
3198 faceZoneFlip_.clearStorage();
3199 cellZone_.clearStorage();
3209 oldPatchMeshPointMaps,
3217 calcFaceZonePointMap(
mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3258 oldPatchNMeshPoints,
3274 const bool syncParallel,
3275 const bool orderCells,
3276 const bool orderPoints
const word & name() const noexcept
Return the object name.
void setSize(const label n)
Alias for resize()
virtual const fileName & name() const
Get the name of the stream.
void setSize(const label newLen)
Same as resize()
void resize(const label newLen)
Adjust size of PtrList.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type test(const label i) const
void size(const label n)
Older name for setAddressableSize.
@ nonBlocking
"nonBlocking"
label size() const noexcept
The number of elements in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
const DynamicList< point > & facePoints()
Returns the points of the cutting PLICface.
A face is a list of labels corresponding to mesh vertices.
void movePoints()
Update for new mesh geometry.
static const complex max
complex (VGREAT,VGREAT)
const word & name() const noexcept
The patch name.
Class containing data for cell addition.
label zoneID() const
Cell zone ID.
label masterFaceID() const
Return master face ID.
label masterPointID() const
Return master point ID.
label masterCellID() const
Return master cell ID.
label masterEdgeID() const
Return master edge ID.
A face addition data class. A face can be inflated either from a point or from another face and can e...
bool flipFaceFlux() const
Does the face flux need to be flipped.
label owner() const
Return owner cell.
label zoneID() const
Face zone ID.
label masterFaceID() const
Return master face ID.
label masterPointID() const
Return master point ID.
const face & newFace() const
Return face.
label patchID() const
Boundary patch ID.
label zoneFlip() const
Face zone flip.
label neighbour() const
Return neighbour cell.
label masterEdgeID() const
Return master edge ID.
Class containing data for point addition.
label zoneID() const
Point zone ID.
const point & newPoint() const
Point location.
bool inCell() const
Does the point support a cell.
label masterPointID() const
Master point label.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
Mesh consisting of general polyhedral cells.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
bool topoChanging() const noexcept
Is mesh topology changing.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
virtual const pointField & points() const
Return raw points.
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.
Class describing modification of a cell.
bool removeFromZone() const
label zoneID() const
Cell zone ID.
label cellID() const
Cell ID.
Class describing modification of a face.
bool flipFaceFlux() const
Does the face flux need to be flipped.
label owner() const
Return owner cell ID.
label zoneID() const
Face zone ID.
const face & newFace() const
Return face.
label patchID() const
Boundary patch ID.
label zoneFlip() const
Face zone flip.
label neighbour() const
Return owner cell ID.
label faceID() const
Return master face ID.
Class describing modification of a point.
label zoneID() const
Point zone ID.
const point & newPoint() const
New point location.
bool inCell() const
Does the point support a cell.
label pointID() const
Point ID.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
Class containing data for cell removal.
label cellID() const
Return cell ID.
label mergeCellID() const
Return cell ID.
Class containing data for face removal.
label faceID() const
Return face ID.
label mergeFaceID() const
Return merge face ID.
Class containing data for point removal.
label mergePointID() const
label pointID() const
Return point ID.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label addPoint(const point &pt, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
void removeCell(const label celli, const label mergeCelli)
Remove/merge cell.
void modifyPoint(const label pointi, const point &pt, const label zoneID, const bool inCell)
Modify coordinate.
void setCapacity(const label nPoints, const label nFaces, const label nCells)
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
void addMesh(const polyMesh &mesh, const labelUList &patchMap, const labelUList &pointZoneMap, const labelUList &faceZoneMap, const labelUList &cellZoneMap)
void removePoint(const label pointi, const label mergePointi)
Remove/merge point.
void modifyCell(const label celli, const label zoneID)
Modify zone of cell.
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 removeFace(const label facei, const label mergeFacei)
Remove/merge face.
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.
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.
void clear()
Clear all storage.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const labelListList & pointCells() const
const scalarField & cellVolumes() const
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
label nPoints() const noexcept
Number of mesh points.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
const labelListList & pointFaces() const
const labelListList & edgeFaces() const
const labelListList & edgeCells() const
void compact()
Compact splitCells_. Removes all freeSplitCells_ elements.
A virtual base class for topological actions.
setAction
Enumeration defining various actions.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
const labelIOList & zoneID
#define WarningInFunction
Report a warning using Foam::Warning.
labelHashSet used(const bitSet &select)
Convert a bitset to a labelHashSet of the indices used.
const wordList internal
Standard dimensioned field types (scalar, vector, tensor, etc)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
List< label > labelList
A List of labels.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< List< bool > > boolListList
A List of boolList.
void inplaceReorder(const labelUList &oldToNew, ListType &input, const bool prune=false)
Inplace reorder the elements of a list.
List< labelList > labelListList
A List of labelList.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
errorManip< error > abort(error &err)
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
void stableSort(UList< T > &list)
Stable sort the list.
constexpr char nl
The newline '\n' character (0x0a)
labelList pointLabels(nPoints, -1)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.