54 void Foam::polyTopoChange::renumberReverseMap
57 DynamicList<label>& elems
62 label val = elems[elemI];
66 elems[elemI] = map[val];
70 label mergedVal = -val-2;
71 elems[elemI] = -map[mergedVal]-2;
77 void Foam::polyTopoChange::renumber
87 label newElem = map[iter.key()];
91 newElems.insert(newElem);
95 elems.transfer(newElems);
99 void Foam::polyTopoChange::renumberCompact
109 label newVal = map[elems[elemI]];
113 elems[newElemI++] = newVal;
116 elems.setSize(newElemI);
120 void Foam::polyTopoChange::countMap
137 label oldCelli = map[newCelli];
141 if (reverseMap[oldCelli] == newCelli)
151 else if (oldCelli == -1)
163 forAll(reverseMap, oldCelli)
165 label newCelli = reverseMap[oldCelli];
171 else if (newCelli == -1)
187 const PackedBoolList& lst
202 void Foam::polyTopoChange::writeMeshStats(
const polyMesh& mesh, Ostream& os)
204 const polyBoundaryMesh&
patches = mesh.boundaryMesh();
214 os <<
" Points : " << mesh.nPoints() <<
nl
215 <<
" Faces : " << mesh.nFaces() <<
nl
216 <<
" Cells : " << mesh.nCells() <<
nl
217 <<
" PatchSizes : " << patchSizes <<
nl
218 <<
" PatchStarts : " << patchStarts <<
nl
223 void Foam::polyTopoChange::getMergeSets
227 List<objectMap>& cellsFromCells
233 forAll(reverseCellMap, oldCelli)
235 label newCelli = reverseCellMap[oldCelli];
239 label mergeCelli = -newCelli-2;
241 nMerged[mergeCelli]++;
246 labelList cellToMergeSet(cellMap.size(), -1);
252 if (nMerged[celli] > 1)
254 cellToMergeSet[celli] = nSets++;
264 cellsFromCells.setSize(nSets);
266 forAll(reverseCellMap, oldCelli)
268 label newCelli = reverseCellMap[oldCelli];
272 label mergeCelli = -newCelli-2;
276 label setI = cellToMergeSet[mergeCelli];
278 objectMap& mergeSet = cellsFromCells[setI];
280 if (mergeSet.masterObjects().empty())
284 mergeSet.index() = mergeCelli;
285 mergeSet.masterObjects().setSize(nMerged[mergeCelli]);
288 mergeSet.masterObjects()[0] = cellMap[mergeCelli];
291 mergeSet.masterObjects()[1] = oldCelli;
293 nMerged[mergeCelli] = 2;
297 mergeSet.masterObjects()[nMerged[mergeCelli]++] = oldCelli;
304 bool Foam::polyTopoChange::hasValidPoints(
const face&
f)
const
308 if (
f[fp] < 0 ||
f[fp] >= points_.
size())
322 if (
f[fp] < 0 &&
f[fp] >= points_.
size())
333 void Foam::polyTopoChange::checkFace
345 if (own == -1 && zoneI != -1)
352 <<
"Face has no neighbour (so external) but does not have"
353 <<
" a valid patch" <<
nl
355 <<
" facei(-1 if added face):" << facei
356 <<
" own:" << own <<
" nei:" << nei
358 if (hasValidPoints(
f))
361 <<
"points (removed points marked with "
372 <<
"Cannot both have valid patchi and neighbour" <<
nl
374 <<
" facei(-1 if added face):" << facei
375 <<
" own:" << own <<
" nei:" << nei
377 if (hasValidPoints(
f))
380 <<
"points (removed points marked with "
389 <<
"Owner cell label should be less than neighbour cell label"
392 <<
" facei(-1 if added face):" << facei
393 <<
" own:" << own <<
" nei:" << nei
395 if (hasValidPoints(
f))
398 <<
"points (removed points marked with "
408 <<
"Illegal vertices in face"
411 <<
" facei(-1 if added face):" << facei
412 <<
" own:" << own <<
" nei:" << nei
414 if (hasValidPoints(
f))
417 <<
"points (removed points marked with "
422 if (facei >= 0 && facei < faces_.size() && faceRemoved(facei))
425 <<
"Face already marked for removal"
428 <<
" facei(-1 if added face):" << facei
429 <<
" own:" << own <<
" nei:" << nei
431 if (hasValidPoints(
f))
434 <<
"points (removed points marked with "
441 if (
f[fp] < points_.
size() && pointRemoved(
f[fp]))
444 <<
"Face uses removed vertices"
447 <<
" facei(-1 if added face):" << facei
448 <<
" own:" << own <<
" nei:" << nei
450 if (hasValidPoints(
f))
453 <<
"points (removed points marked with "
462 void Foam::polyTopoChange::makeCells
464 const label nActiveFaces,
469 cellFaces.setSize(2*nActiveFaces);
470 cellFaceOffsets.setSize(cellMap_.size() + 1);
477 for (
label facei = 0; facei < nActiveFaces; facei++)
479 if (faceOwner_[facei] < 0)
482 <<
"Face " << facei <<
" is active but its owner has"
483 <<
" been deleted. This is usually due to deleting cells"
484 <<
" without modifying exposed faces to be boundary faces."
487 nNbrs[faceOwner_[facei]]++;
489 for (
label facei = 0; facei < nActiveFaces; facei++)
491 if (faceNeighbour_[facei] >= 0)
493 nNbrs[faceNeighbour_[facei]]++;
499 cellFaceOffsets[0] = 0;
502 cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli];
510 for (
label facei = 0; facei < nActiveFaces; facei++)
512 label celli = faceOwner_[facei];
514 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
517 for (
label facei = 0; facei < nActiveFaces; facei++)
519 label celli = faceNeighbour_[facei];
523 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
528 cellFaces.setSize(cellFaceOffsets[cellMap_.size()]);
532 void Foam::polyTopoChange::makeCellCells
534 const label nActiveFaces,
535 CompactListList<label>& cellCells
543 for (
label facei = 0; facei < nActiveFaces; facei++)
545 if (faceNeighbour_[facei] >= 0)
547 nNbrs[faceOwner_[facei]]++;
548 nNbrs[faceNeighbour_[facei]]++;
553 cellCells.setSize(nNbrs);
561 for (
label facei = 0; facei < nActiveFaces; facei++)
563 label nei = faceNeighbour_[facei];
567 label own = faceOwner_[facei];
568 cellCells.m()[cellCells.index(own, nNbrs[own]++)] = nei;
569 cellCells.m()[cellCells.index(nei, nNbrs[nei]++)] = own;
577 const CompactListList<label>& cellCellAddressing,
581 labelList newOrder(cellCellAddressing.size());
584 SLList<label> nextCell;
587 PackedBoolList visited(cellCellAddressing.size());
589 label cellInOrder = 0;
594 DynamicList<label> nbrs;
596 DynamicList<label> weights;
606 label currentCell = -1;
612 if (!cellRemoved(celli) && !visited[celli])
614 if (cellCellAddressing[celli].size() < minWeight)
616 minWeight = cellCellAddressing[celli].size();
623 if (currentCell == -1)
633 nextCell.append(currentCell);
640 while (nextCell.size())
642 currentCell = nextCell.removeHead();
644 if (!visited[currentCell])
646 visited[currentCell] = 1;
649 newOrder[cellInOrder] = currentCell;
653 const labelUList neighbours = cellCellAddressing[currentCell];
663 label nbr = neighbours[nI];
664 if (!cellRemoved(nbr) && !visited[nbr])
668 weights.append(cellCellAddressing[nbr].size());
676 nextCell.append(nbrs[i]);
683 newOrder.setSize(cellInOrder);
686 oldToNew =
invert(cellCellAddressing.size(), newOrder);
692 void Foam::polyTopoChange::getFaceOrder
694 const label nActiveFaces,
703 oldToNew.setSize(faceOwner_.size());
714 label startOfCell = cellFaceOffsets[celli];
715 label nFaces = cellFaceOffsets[celli+1] - startOfCell;
721 for (
label i = 0; i < nFaces; i++)
723 label facei = cellFaces[startOfCell + i];
725 label nbrCelli = faceNeighbour_[facei];
727 if (facei >= nActiveFaces)
732 else if (nbrCelli != -1)
735 if (nbrCelli == celli)
737 nbrCelli = faceOwner_[facei];
740 if (celli < nbrCelli)
759 order.setSize(nFaces);
773 if (nbr[index] != -1)
775 oldToNew[cellFaces[startOfCell + index]] = newFacei++;
782 patchStarts.setSize(nPatches_);
784 patchSizes.setSize(nPatches_);
789 patchStarts[0] = newFacei;
791 for (
label facei = 0; facei < nActiveFaces; facei++)
793 if (region_[facei] >= 0)
795 patchSizes[region_[facei]]++;
799 label facei = patchStarts[0];
803 patchStarts[
patchi] = facei;
804 facei += patchSizes[
patchi];
816 for (
label facei = 0; facei < nActiveFaces; facei++)
818 if (region_[facei] >= 0)
820 oldToNew[facei] = workPatchStarts[region_[facei]]++;
825 for (
label facei = nActiveFaces; facei < oldToNew.size(); facei++)
827 oldToNew[facei] = facei;
833 if (oldToNew[facei] == -1)
836 <<
"Did not determine new position"
837 <<
" for face " << facei
838 <<
" owner " << faceOwner_[facei]
839 <<
" neighbour " << faceNeighbour_[facei]
840 <<
" region " << region_[facei] <<
endl
841 <<
"This is usually caused by not specifying a patch for"
842 <<
" a boundary face." <<
nl
843 <<
"Switch on the polyTopoChange::debug flag to catch"
844 <<
" this error earlier." <<
nl;
845 if (hasValidPoints(faces_[facei]))
848 <<
"points (removed points marked with "
849 <<
vector::max <<
") " << facePoints(faces_[facei]);
857 void Foam::polyTopoChange::reorderCompactFaces
864 faces_.setCapacity(newSize);
867 region_.setCapacity(newSize);
870 faceOwner_.setCapacity(newSize);
872 reorder(oldToNew, faceNeighbour_);
873 faceNeighbour_.setCapacity(newSize);
877 faceMap_.setCapacity(newSize);
879 renumberReverseMap(oldToNew, reverseFaceMap_);
881 renumberKey(oldToNew, faceFromPoint_);
882 renumberKey(oldToNew, faceFromEdge_);
884 flipFaceFlux_.setCapacity(newSize);
885 renumberKey(oldToNew, faceZone_);
887 faceZoneFlip_.setCapacity(newSize);
891 void Foam::polyTopoChange::compact
893 const bool orderCells,
894 const bool orderPoints,
895 label& nInternalPoints,
902 reversePointMap_.shrink();
907 faceNeighbour_.shrink();
909 reverseFaceMap_.shrink();
912 reverseCellMap_.shrink();
917 label nActivePoints = 0;
919 labelList localPointMap(points_.size(), -1);
924 nInternalPoints = -1;
928 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
939 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
951 && faceOwner_[facei] >= 0
952 && faceNeighbour_[facei] < 0
956 const face&
f = faces_[facei];
962 if (localPointMap[pointi] == -1)
967 || retiredPoints_.found(pointi)
971 <<
"Removed or retired point " << pointi
973 <<
" at position " << facei <<
endl
974 <<
"Probably face has not been adapted for"
984 nInternalPoints = nActivePoints - nBoundaryPoints;
987 forAll(localPointMap, pointi)
989 if (localPointMap[pointi] != -1)
991 localPointMap[pointi] += nInternalPoints;
1003 && faceOwner_[facei] >= 0
1004 && faceNeighbour_[facei] >= 0
1008 const face&
f = faces_[facei];
1014 if (localPointMap[pointi] == -1)
1018 pointRemoved(pointi)
1019 || retiredPoints_.found(pointi)
1023 <<
"Removed or retired point " << pointi
1025 <<
" at position " << facei <<
endl
1026 <<
"Probably face has not been adapted for"
1045 localPointMap[iter.key()] =
newPointi++;
1051 Pout<<
"Points : active:" << nActivePoints
1055 reorder(localPointMap, points_);
1059 reorder(localPointMap, pointMap_);
1061 renumberReverseMap(localPointMap, reversePointMap_);
1063 renumberKey(localPointMap, pointZone_);
1064 renumberKey(localPointMap, oldPoints_);
1065 renumber(localPointMap, retiredPoints_);
1070 face&
f = faces_[facei];
1073 renumberCompact(localPointMap,
f);
1075 if (!faceRemoved(facei) &&
f.
size() < 3)
1078 <<
"Created illegal face " <<
f
1080 <<
" at position:" << facei
1081 <<
" when filtering removed points"
1090 labelList localFaceMap(faces_.size(), -1);
1095 if (!faceRemoved(facei) && faceOwner_[facei] >= 0)
1097 localFaceMap[facei] = newFacei++;
1100 nActiveFaces_ = newFacei;
1104 if (!faceRemoved(facei) && faceOwner_[facei] < 0)
1107 localFaceMap[facei] = newFacei++;
1113 Pout<<
"Faces : active:" << nActiveFaces_
1114 <<
" removed:" << faces_.size()-newFacei <<
endl;
1118 reorderCompactFaces(newFacei, localFaceMap);
1129 CompactListList<label> cellCells;
1130 makeCellCells(nActiveFaces_, cellCells);
1133 newCelli = getCellOrder(cellCells, localCellMap);
1138 localCellMap.setSize(cellMap_.size());
1144 if (!cellRemoved(celli))
1146 localCellMap[celli] = newCelli++;
1153 Pout<<
"Cells : active:" << newCelli
1154 <<
" removed:" << cellMap_.size()-newCelli <<
endl;
1158 if (orderCells || (newCelli != cellMap_.size()))
1160 reorder(localCellMap, cellMap_);
1161 cellMap_.setCapacity(newCelli);
1162 renumberReverseMap(localCellMap, reverseCellMap_);
1164 reorder(localCellMap, cellZone_);
1165 cellZone_.setCapacity(newCelli);
1167 renumberKey(localCellMap, cellFromPoint_);
1168 renumberKey(localCellMap, cellFromEdge_);
1169 renumberKey(localCellMap, cellFromFace_);
1173 forAll(faceOwner_, facei)
1175 label own = faceOwner_[facei];
1176 label nei = faceNeighbour_[facei];
1181 faceOwner_[facei] = localCellMap[own];
1186 faceNeighbour_[facei] = localCellMap[nei];
1191 faceNeighbour_[facei] >= 0
1192 && faceNeighbour_[facei] < faceOwner_[facei]
1195 faces_[facei].flip();
1196 Swap(faceOwner_[facei], faceNeighbour_[facei]);
1197 flipFaceFlux_[facei] =
1199 flipFaceFlux_[facei]
1203 faceZoneFlip_[facei] =
1205 faceZoneFlip_[facei]
1215 faceNeighbour_[facei] = localCellMap[nei];
1226 makeCells(nActiveFaces_, cellFaces, cellFaceOffsets);
1242 reorderCompactFaces(localFaceMap.size(), localFaceMap);
1249 const primitiveMesh& mesh,
1251 const bool internalFacesOnly
1258 label facei = faceLabels[i];
1260 if (internalFacesOnly == mesh.isInternalFace(facei))
1272 collectedFaces = faceLabels;
1276 collectedFaces.
setSize(nFaces);
1282 label facei = faceLabels[i];
1284 if (internalFacesOnly == mesh.isInternalFace(facei))
1286 collectedFaces[nFaces++] = facei;
1291 return collectedFaces;
1295 void Foam::polyTopoChange::calcPatchPointMap
1297 const List<Map<label>>& oldPatchMeshPointMaps,
1308 const Map<label>& oldMeshPointMap = oldPatchMeshPointMaps[
patchi];
1312 curPatchPointRnb.
setSize(meshPoints.size());
1316 if (meshPoints[i] < pointMap_.size())
1321 pointMap_[meshPoints[i]]
1324 if (ozmpmIter != oldMeshPointMap.end())
1326 curPatchPointRnb[i] = ozmpmIter();
1330 curPatchPointRnb[i] = -1;
1335 curPatchPointRnb[i] = -1;
1342 void Foam::polyTopoChange::calcFaceInflationMaps
1344 const polyMesh& mesh,
1345 List<objectMap>& facesFromPoints,
1346 List<objectMap>& facesFromEdges,
1347 List<objectMap>& facesFromFaces
1353 facesFromPoints.setSize(faceFromPoint_.size());
1355 if (faceFromPoint_.size())
1357 label nFacesFromPoints = 0;
1362 label newFacei = iter.key();
1364 if (region_[newFacei] == -1)
1367 facesFromPoints[nFacesFromPoints++] = objectMap
1373 mesh.pointFaces()[iter()],
1381 facesFromPoints[nFacesFromPoints++] = objectMap
1387 mesh.pointFaces()[iter()],
1399 facesFromEdges.setSize(faceFromEdge_.size());
1401 if (faceFromEdge_.size())
1403 label nFacesFromEdges = 0;
1408 label newFacei = iter.key();
1410 if (region_[newFacei] == -1)
1413 facesFromEdges[nFacesFromEdges++] = objectMap
1419 mesh.edgeFaces(iter()),
1427 facesFromEdges[nFacesFromEdges++] = objectMap
1433 mesh.edgeFaces(iter()),
1454 void Foam::polyTopoChange::calcCellInflationMaps
1456 const polyMesh& mesh,
1457 List<objectMap>& cellsFromPoints,
1458 List<objectMap>& cellsFromEdges,
1459 List<objectMap>& cellsFromFaces,
1460 List<objectMap>& cellsFromCells
1463 cellsFromPoints.setSize(cellFromPoint_.size());
1465 if (cellFromPoint_.size())
1467 label nCellsFromPoints = 0;
1472 cellsFromPoints[nCellsFromPoints++] = objectMap
1475 mesh.pointCells()[iter()]
1481 cellsFromEdges.setSize(cellFromEdge_.size());
1483 if (cellFromEdge_.size())
1485 label nCellsFromEdges = 0;
1490 cellsFromEdges[nCellsFromEdges++] = objectMap
1493 mesh.edgeCells()[iter()]
1499 cellsFromFaces.setSize(cellFromFace_.size());
1501 if (cellFromFace_.size())
1503 label nCellsFromFaces = 0;
1510 label oldFacei = iter();
1512 if (mesh.isInternalFace(oldFacei))
1514 twoCells[0] = mesh.faceOwner()[oldFacei];
1515 twoCells[1] = mesh.faceNeighbour()[oldFacei];
1516 cellsFromFaces[nCellsFromFaces++] = objectMap
1524 cellsFromFaces[nCellsFromFaces++] = objectMap
1527 labelList(1, mesh.faceOwner()[oldFacei])
1546 void Foam::polyTopoChange::resetZones
1548 const polyMesh& mesh,
1558 pointZoneMap.setSize(mesh.pointZones().size());
1568 label zoneI = iter();
1570 if (zoneI < 0 || zoneI >= pointZones.size())
1573 <<
"Illegal zoneID " << zoneI <<
" for point "
1574 << iter.key() <<
" coord " << mesh.points()[iter.key()]
1583 forAll(addressing, zoneI)
1585 addressing[zoneI].setSize(
nPoints[zoneI]);
1591 label zoneI = iter();
1593 addressing[zoneI][
nPoints[zoneI]++] = iter.key();
1596 forAll(addressing, zoneI)
1603 forAll(addressing, zoneI)
1605 const pointZone& oldZone = pointZones[zoneI];
1606 const labelList& newZoneAddr = addressing[zoneI];
1608 labelList& curPzRnb = pointZoneMap[zoneI];
1609 curPzRnb.
setSize(newZoneAddr.size());
1613 if (newZoneAddr[i] < pointMap_.size())
1615 curPzRnb[i] = oldZone.whichPoint(pointMap_[newZoneAddr[i]]);
1625 newMesh.pointZones().clearAddressing();
1626 forAll(newMesh.pointZones(), zoneI)
1630 Pout<<
"pointZone:" << zoneI
1631 <<
" name:" << newMesh.pointZones()[zoneI].
name()
1632 <<
" size:" << addressing[zoneI].size()
1636 newMesh.pointZones()[zoneI] = addressing[zoneI];
1644 faceZoneFaceMap.setSize(mesh.faceZones().size());
1652 label zoneI = iter();
1654 if (zoneI < 0 || zoneI >= faceZones.size())
1657 <<
"Illegal zoneID " << zoneI <<
" for face "
1667 forAll(addressing, zoneI)
1669 addressing[zoneI].setSize(nFaces[zoneI]);
1670 flipMode[zoneI].setSize(nFaces[zoneI]);
1676 label zoneI = iter();
1677 label facei = iter.key();
1679 label index = nFaces[zoneI]++;
1681 addressing[zoneI][index] = facei;
1682 flipMode[zoneI][index] = faceZoneFlip_[facei];
1685 forAll(addressing, zoneI)
1690 labelList newAddressing(addressing[zoneI].size());
1693 newAddressing[i] = addressing[zoneI][newToOld[i]];
1695 addressing[zoneI].transfer(newAddressing);
1698 boolList newFlipMode(flipMode[zoneI].size());
1701 newFlipMode[i] = flipMode[zoneI][newToOld[i]];
1703 flipMode[zoneI].transfer(newFlipMode);
1709 forAll(addressing, zoneI)
1711 const faceZone& oldZone = faceZones[zoneI];
1712 const labelList& newZoneAddr = addressing[zoneI];
1714 labelList& curFzFaceRnb = faceZoneFaceMap[zoneI];
1716 curFzFaceRnb.
setSize(newZoneAddr.size());
1720 if (newZoneAddr[i] < faceMap_.size())
1723 oldZone.whichFace(faceMap_[newZoneAddr[i]]);
1727 curFzFaceRnb[i] = -1;
1734 newMesh.faceZones().clearAddressing();
1735 forAll(newMesh.faceZones(), zoneI)
1739 Pout<<
"faceZone:" << zoneI
1740 <<
" name:" << newMesh.faceZones()[zoneI].
name()
1741 <<
" size:" << addressing[zoneI].size()
1745 newMesh.faceZones()[zoneI].resetAddressing
1757 cellZoneMap.setSize(mesh.cellZones().size());
1765 label zoneI = cellZone_[celli];
1767 if (zoneI >= cellZones.size())
1770 <<
"Illegal zoneID " << zoneI <<
" for cell "
1781 forAll(addressing, zoneI)
1783 addressing[zoneI].setSize(nCells[zoneI]);
1789 label zoneI = cellZone_[celli];
1793 addressing[zoneI][nCells[zoneI]++] = celli;
1797 forAll(addressing, zoneI)
1804 forAll(addressing, zoneI)
1806 const cellZone& oldZone = cellZones[zoneI];
1807 const labelList& newZoneAddr = addressing[zoneI];
1809 labelList& curCellRnb = cellZoneMap[zoneI];
1811 curCellRnb.
setSize(newZoneAddr.size());
1815 if (newZoneAddr[i] < cellMap_.size())
1818 oldZone.whichCell(cellMap_[newZoneAddr[i]]);
1828 newMesh.cellZones().clearAddressing();
1829 forAll(newMesh.cellZones(), zoneI)
1833 Pout<<
"cellZone:" << zoneI
1834 <<
" name:" << newMesh.cellZones()[zoneI].
name()
1835 <<
" size:" << addressing[zoneI].size()
1839 newMesh.cellZones()[zoneI] = addressing[zoneI];
1845 void Foam::polyTopoChange::calcFaceZonePointMap
1847 const polyMesh& mesh,
1848 const List<Map<label>>& oldMeshFaceZonesPointMaps,
1854 faceZonePointMap.
setSize(faceZones.size());
1858 const faceZone& newZone = faceZones[zoneI];
1860 const labelList& newMeshZonePoints = newZone().meshPoints();
1862 const Map<label>& oldMeshZonePointMap =
1863 oldMeshFaceZonesPointMaps[zoneI];
1865 labelList& curFzPointRnb = faceZonePointMap[zoneI];
1867 curFzPointRnb.
setSize(newMeshZonePoints.size());
1869 forAll(newMeshZonePoints, pointi)
1871 if (newMeshZonePoints[pointi] < pointMap_.size())
1874 oldMeshZonePointMap.find
1876 pointMap_[newMeshZonePoints[pointi]]
1879 if (ozmpmIter != oldMeshZonePointMap.end())
1881 curFzPointRnb[pointi] = ozmpmIter();
1885 curFzPointRnb[pointi] = -1;
1890 curFzPointRnb[pointi] = -1;
1897 void Foam::polyTopoChange::reorderCoupledFaces
1899 const bool syncParallel,
1939 pBufs.finishedSends();
1944 bool anyChanged =
false;
1975 forAll(patchFaceMap, patchFacei)
1977 oldToNew[patchFacei + start] =
1978 start + patchFaceMap[patchFacei];
1981 forAll(patchFaceRotation, patchFacei)
1983 rotation[patchFacei + start] =
1984 patchFaceRotation[patchFacei];
1994 reduce(anyChanged, orOp<bool>());
2000 reorderCompactFaces(oldToNew.size(), oldToNew);
2005 if (rotation[facei] != 0)
2007 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
2014 void Foam::polyTopoChange::compactAndReorder
2016 const polyMesh& mesh,
2017 const bool syncParallel,
2018 const bool orderCells,
2019 const bool orderPoints,
2021 label& nInternalPoints,
2025 List<objectMap>& pointsFromPoints,
2026 List<objectMap>& facesFromPoints,
2027 List<objectMap>& facesFromEdges,
2028 List<objectMap>& facesFromFaces,
2029 List<objectMap>& cellsFromPoints,
2030 List<objectMap>& cellsFromEdges,
2031 List<objectMap>& cellsFromFaces,
2032 List<objectMap>& cellsFromCells,
2033 List<Map<label>>& oldPatchMeshPointMaps,
2036 List<Map<label>>& oldMeshFaceZonesPointMaps
2039 if (mesh.boundaryMesh().size() != nPatches_)
2042 <<
"polyTopoChange was constructed with a mesh with "
2043 << nPatches_ <<
" patches." <<
endl
2044 <<
"The mesh now provided has a different number of patches "
2045 << mesh.boundaryMesh().size()
2046 <<
" which is illegal" <<
endl
2052 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2056 newPoints.transfer(points_);
2062 mesh.boundaryMesh(),
2088 calcFaceInflationMaps
2096 calcCellInflationMaps
2107 faceFromPoint_.clearStorage();
2108 faceFromEdge_.clearStorage();
2110 cellFromPoint_.clearStorage();
2111 cellFromEdge_.clearStorage();
2112 cellFromFace_.clearStorage();
2116 const polyBoundaryMesh&
boundary = mesh.boundaryMesh();
2134 oldMeshFaceZonesPointMaps.
setSize(mesh.faceZones().size());
2136 forAll(mesh.faceZones(), zoneI)
2138 const faceZone& oldZone = mesh.faceZones()[zoneI];
2140 oldMeshFaceZonesPointMaps[zoneI] = oldZone().meshPointMap();
2153 reversePointMap_(0),
2188 reversePointMap_(0),
2226 points_.clearStorage();
2227 pointMap_.clearStorage();
2228 reversePointMap_.clearStorage();
2229 pointZone_.clearStorage();
2230 retiredPoints_.clearStorage();
2231 oldPoints_.clearStorage();
2233 faces_.clearStorage();
2234 region_.clearStorage();
2235 faceOwner_.clearStorage();
2236 faceNeighbour_.clearStorage();
2237 faceMap_.clearStorage();
2238 reverseFaceMap_.clearStorage();
2239 faceFromPoint_.clearStorage();
2240 faceFromEdge_.clearStorage();
2241 flipFaceFlux_.clearStorage();
2242 faceZone_.clearStorage();
2243 faceZoneFlip_.clearStorage();
2246 cellMap_.clearStorage();
2247 reverseCellMap_.clearStorage();
2248 cellZone_.clearStorage();
2249 cellFromPoint_.clearStorage();
2250 cellFromEdge_.clearStorage();
2251 cellFromFace_.clearStorage();
2264 label maxRegion = nPatches_ - 1;
2267 maxRegion =
max(maxRegion, patchMap[i]);
2269 nPatches_ = maxRegion + 1;
2278 points_.setCapacity(points_.size() +
points.
size());
2279 pointMap_.setCapacity(pointMap_.size() +
points.
size());
2280 reversePointMap_.setCapacity(reversePointMap_.size() +
points.
size());
2287 forAll(pointZones, zoneI)
2298 for (
label pointi = 0; pointi < mesh.
nPoints(); pointi++)
2320 cellMap_.setCapacity(cellMap_.size() + nAllCells);
2321 reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
2322 cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100);
2323 cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100);
2324 cellFromFace_.resize(cellFromFace_.size() + nAllCells/100);
2325 cellZone_.setCapacity(cellZone_.size() + nAllCells);
2333 const labelList& cellLabels = cellZones[zoneI];
2337 label celli = cellLabels[j];
2339 if (newZoneID[celli] != -1)
2344 <<
" is in two zones:"
2345 << cellZones[newZoneID[celli]].
name()
2346 <<
" and " << cellZones[zoneI].
name() <<
endl
2347 <<
" This is not supported."
2348 <<
" Continuing with first zone only." <<
endl;
2352 newZoneID[celli] = cellZoneMap[zoneI];
2358 for (
label celli = 0; celli < nAllCells; celli++)
2361 addCell(-1, -1, -1, celli, newZoneID[celli]);
2376 faces_.setCapacity(faces_.size() + nAllFaces);
2377 region_.setCapacity(region_.size() + nAllFaces);
2378 faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
2379 faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
2380 faceMap_.setCapacity(faceMap_.size() + nAllFaces);
2381 reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
2382 faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100);
2383 faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100);
2384 flipFaceFlux_.setCapacity(faces_.size() + nAllFaces);
2385 faceZone_.resize(faceZone_.size() + nAllFaces/100);
2386 faceZoneFlip_.setCapacity(faces_.size() + nAllFaces);
2391 boolList zoneFlip(nAllFaces,
false);
2395 const labelList& faceLabels = faceZones[zoneI];
2396 const boolList& flipMap = faceZones[zoneI].flipMap();
2400 newZoneID[faceLabels[j]] = faceZoneMap[zoneI];
2401 zoneFlip[faceLabels[j]] = flipMap[j];
2414 faceNeighbour[facei],
2430 if (pp.
start() != faces_.size())
2434 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2436 <<
"Current face counter at " << faces_.size() <<
endl
2437 <<
"Are patches in incremental order?"
2471 pointMap_.setCapacity(
nPoints);
2472 reversePointMap_.setCapacity(
nPoints);
2473 pointZone_.resize(pointZone_.size() +
nPoints/100);
2475 faces_.setCapacity(nFaces);
2476 region_.setCapacity(nFaces);
2477 faceOwner_.setCapacity(nFaces);
2478 faceNeighbour_.setCapacity(nFaces);
2479 faceMap_.setCapacity(nFaces);
2480 reverseFaceMap_.setCapacity(nFaces);
2481 faceFromPoint_.resize(faceFromPoint_.size() + nFaces/100);
2482 faceFromEdge_.resize(faceFromEdge_.size() + nFaces/100);
2483 flipFaceFlux_.setCapacity(nFaces);
2484 faceZone_.resize(faceZone_.size() + nFaces/100);
2485 faceZoneFlip_.setCapacity(nFaces);
2487 cellMap_.setCapacity(nCells);
2488 reverseCellMap_.setCapacity(nCells);
2489 cellFromPoint_.resize(cellFromPoint_.size() + nCells/100);
2490 cellFromEdge_.resize(cellFromEdge_.size() + nCells/100);
2491 cellFromFace_.resize(cellFromFace_.size() + nCells/100);
2492 cellZone_.setCapacity(nCells);
2498 if (isType<polyAddPoint>(action))
2500 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2510 else if (isType<polyModifyPoint>(action))
2524 else if (isType<polyRemovePoint>(action))
2532 else if (isType<polyAddFace>(action))
2534 const polyAddFace& paf = refCast<const polyAddFace>(action);
2550 else if (isType<polyModifyFace>(action))
2552 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2568 else if (isType<polyRemoveFace>(action))
2570 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2576 else if (isType<polyAddCell>(action))
2578 const polyAddCell& pac = refCast<const polyAddCell>(action);
2589 else if (isType<polyModifyCell>(action))
2591 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2595 modifyCell(pmc.
cellID(), -1);
2604 else if (isType<polyRemoveCell>(action))
2606 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2615 <<
"Unknown type of topoChange: " << action.type()
2627 const label masterPointID,
2632 label pointi = points_.size();
2635 pointMap_.append(masterPointID);
2636 reversePointMap_.append(pointi);
2640 pointZone_.insert(pointi, zoneID);
2645 retiredPoints_.insert(pointi);
2656 const label newZoneID,
2660 if (pointi < 0 || pointi >= points_.size())
2663 <<
"illegal point label " << pointi <<
endl
2664 <<
"Valid point labels are 0 .. " << points_.size()-1
2667 if (pointRemoved(pointi) || pointMap_[pointi] == -1)
2670 <<
"point " << pointi <<
" already marked for removal"
2673 points_[pointi] = pt;
2677 if (pointFnd != pointZone_.
end())
2681 pointFnd() = newZoneID;
2685 pointZone_.
erase(pointFnd);
2688 else if (newZoneID >= 0)
2690 pointZone_.insert(pointi, newZoneID);
2695 retiredPoints_.erase(pointi);
2699 retiredPoints_.insert(pointi);
2702 oldPoints_.erase(pointi);
2710 const label masterPointID,
2714 label pointi = points_.size();
2717 pointMap_.append(masterPointID);
2718 reversePointMap_.append(pointi);
2722 pointZone_.insert(pointi, zoneID);
2725 oldPoints_.insert(pointi, oldPt);
2736 const label newZoneID
2739 if (pointi < 0 || pointi >= points_.size())
2742 <<
"illegal point label " << pointi <<
endl
2743 <<
"Valid point labels are 0 .. " << points_.size()-1
2746 if (pointRemoved(pointi) || pointMap_[pointi] == -1)
2749 <<
"point " << pointi <<
" already marked for removal"
2752 points_[pointi] = pt;
2756 if (pointFnd != pointZone_.
end())
2760 pointFnd() = newZoneID;
2764 pointZone_.
erase(pointFnd);
2767 else if (newZoneID >= 0)
2769 pointZone_.insert(pointi, newZoneID);
2773 retiredPoints_.erase(pointi);
2776 oldPoints_.set(pointi, oldPt);
2782 if (newPoints.
size() != points_.size())
2785 <<
"illegal pointField size." <<
endl
2786 <<
"Size:" << newPoints.
size() <<
endl
2787 <<
"Points in mesh:" << points_.size()
2793 points_[pointi] = newPoints[pointi];
2801 const label mergePointi
2804 if (pointi < 0 || pointi >= points_.size())
2807 <<
"illegal point label " << pointi <<
endl
2808 <<
"Valid point labels are 0 .. " << points_.size()-1
2815 && (pointRemoved(pointi) || pointMap_[pointi] == -1)
2819 <<
"point " << pointi <<
" already marked for removal" <<
nl
2820 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
2824 if (pointi == mergePointi)
2827 <<
"Cannot remove/merge point " << pointi <<
" onto itself."
2832 pointMap_[pointi] = -1;
2833 if (mergePointi >= 0)
2835 reversePointMap_[pointi] = -mergePointi-2;
2839 reversePointMap_[pointi] = -1;
2841 pointZone_.erase(pointi);
2842 retiredPoints_.erase(pointi);
2843 oldPoints_.erase(pointi);
2852 const label masterPointID,
2853 const label masterEdgeID,
2854 const label masterFaceID,
2855 const bool flipFaceFlux,
2856 const label patchID,
2864 checkFace(
f, -1, own, nei, patchID, zoneID);
2867 label facei = faces_.size();
2870 region_.append(patchID);
2871 faceOwner_.append(own);
2872 faceNeighbour_.append(nei);
2874 if (masterPointID >= 0)
2876 faceMap_.append(-1);
2877 faceFromPoint_.insert(facei, masterPointID);
2879 else if (masterEdgeID >= 0)
2881 faceMap_.append(-1);
2882 faceFromEdge_.insert(facei, masterEdgeID);
2884 else if (masterFaceID >= 0)
2886 faceMap_.append(masterFaceID);
2895 faceMap_.append(-1);
2897 reverseFaceMap_.append(facei);
2899 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2903 faceZone_.insert(facei, zoneID);
2905 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2917 const bool flipFaceFlux,
2918 const label patchID,
2926 checkFace(
f, facei, own, nei, patchID, zoneID);
2930 faceOwner_[facei] = own;
2931 faceNeighbour_[facei] = nei;
2932 region_[facei] = patchID;
2934 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2938 if (faceFnd != faceZone_.
end())
2946 faceZone_.
erase(faceFnd);
2949 else if (zoneID >= 0)
2951 faceZone_.insert(facei, zoneID);
2953 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2959 if (facei < 0 || facei >= faces_.size())
2962 <<
"illegal face label " << facei <<
endl
2963 <<
"Valid face labels are 0 .. " << faces_.size()-1
2970 && (faceRemoved(facei) || faceMap_[facei] == -1)
2975 <<
" already marked for removal"
2979 faces_[facei].setSize(0);
2980 region_[facei] = -1;
2981 faceOwner_[facei] = -1;
2982 faceNeighbour_[facei] = -1;
2983 faceMap_[facei] = -1;
2984 if (mergeFacei >= 0)
2986 reverseFaceMap_[facei] = -mergeFacei-2;
2990 reverseFaceMap_[facei] = -1;
2992 faceFromEdge_.erase(facei);
2993 faceFromPoint_.erase(facei);
2994 flipFaceFlux_[facei] = 0;
2995 faceZone_.erase(facei);
2996 faceZoneFlip_[facei] = 0;
3002 const label masterPointID,
3003 const label masterEdgeID,
3004 const label masterFaceID,
3005 const label masterCellID,
3009 label celli = cellMap_.size();
3011 if (masterPointID >= 0)
3013 cellMap_.append(-1);
3014 cellFromPoint_.insert(celli, masterPointID);
3016 else if (masterEdgeID >= 0)
3018 cellMap_.append(-1);
3019 cellFromEdge_.insert(celli, masterEdgeID);
3021 else if (masterFaceID >= 0)
3023 cellMap_.append(-1);
3024 cellFromFace_.insert(celli, masterFaceID);
3028 cellMap_.append(masterCellID);
3030 reverseCellMap_.append(celli);
3031 cellZone_.append(zoneID);
3043 cellZone_[celli] = zoneID;
3049 if (celli < 0 || celli >= cellMap_.size())
3052 <<
"illegal cell label " << celli <<
endl
3053 <<
"Valid cell labels are 0 .. " << cellMap_.size()-1
3057 if (strict_ && cellMap_[celli] == -2)
3061 <<
" already marked for removal"
3065 cellMap_[celli] = -2;
3066 if (mergeCelli >= 0)
3068 reverseCellMap_[celli] = -mergeCelli-2;
3072 reverseCellMap_[celli] = -1;
3074 cellFromPoint_.erase(celli);
3075 cellFromEdge_.erase(celli);
3076 cellFromFace_.erase(celli);
3077 cellZone_[celli] = -1;
3085 const bool syncParallel,
3086 const bool orderCells,
3087 const bool orderPoints
3092 Pout<<
"polyTopoChange::changeMesh"
3093 <<
"(polyMesh&, const bool, const bool, const bool, const bool)"
3099 Pout<<
"Old mesh:" <<
nl;
3100 writeMeshStats(mesh,
Pout);
3106 label nInternalPoints;
3145 oldPatchMeshPointMaps,
3146 oldPatchNMeshPoints,
3148 oldMeshFaceZonesPointMaps
3172 if (iter != oldPoints_.end())
3174 renumberedMeshPoints[
newPointi] = iter();
3193 move(renumberedMeshPoints),
3196 move(faceNeighbour_),
3210 move(faceNeighbour_),
3219 retiredPoints_.clearStorage();
3220 oldPoints_.clearStorage();
3221 region_.clearStorage();
3228 label nAdd, nInflate, nMerge, nRemove;
3229 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3231 <<
" added(from point):" << nAdd
3232 <<
" added(from nothing):" << nInflate
3233 <<
" merged(into other point):" << nMerge
3234 <<
" removed:" << nRemove
3237 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3239 <<
" added(from face):" << nAdd
3240 <<
" added(inflated):" << nInflate
3241 <<
" merged(into other face):" << nMerge
3242 <<
" removed:" << nRemove
3245 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3247 <<
" added(from cell):" << nAdd
3248 <<
" added(inflated):" << nInflate
3249 <<
" merged(into other cell):" << nMerge
3250 <<
" removed:" << nRemove
3257 Pout<<
"New mesh:" <<
nl;
3258 writeMeshStats(mesh,
Pout);
3272 resetZones(mesh, mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3276 pointZone_.clearStorage();
3277 faceZone_.clearStorage();
3278 faceZoneFlip_.clearStorage();
3279 cellZone_.clearStorage();
3289 oldPatchMeshPointMaps,
3296 calcFaceZonePointMap(mesh, oldMeshFaceZonesPointMaps, faceZonePointMap);
3298 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3339 oldPatchNMeshPoints,
3357 const bool syncParallel,
3358 const bool orderCells,
3359 const bool orderPoints
3364 Pout<<
"polyTopoChange::changeMesh"
3365 <<
"(autoPtr<fvMesh>&, const IOobject&, const fvMesh&"
3366 <<
", const bool, const bool, const bool)"
3372 Pout<<
"Old mesh:" <<
nl;
3373 writeMeshStats(mesh,
Pout);
3379 label nInternalPoints;
3419 oldPatchMeshPointMaps,
3420 oldPatchNMeshPoints,
3422 oldMeshFaceZonesPointMaps
3444 move(faceNeighbour_)
3447 fvMesh& newMesh = newMeshPtr();
3451 retiredPoints_.clearStorage();
3452 oldPoints_.clearStorage();
3453 region_.clearStorage();
3460 label nAdd, nInflate, nMerge, nRemove;
3461 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3463 <<
" added(from point):" << nAdd
3464 <<
" added(from nothing):" << nInflate
3465 <<
" merged(into other point):" << nMerge
3466 <<
" removed:" << nRemove
3469 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3471 <<
" added(from face):" << nAdd
3472 <<
" added(inflated):" << nInflate
3473 <<
" merged(into other face):" << nMerge
3474 <<
" removed:" << nRemove
3477 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3479 <<
" added(from cell):" << nAdd
3480 <<
" added(inflated):" << nInflate
3481 <<
" merged(into other cell):" << nMerge
3482 <<
" removed:" << nRemove
3518 oldPointZones[i].
name(),
3533 oldFaceZones[i].
name(),
3549 oldCellZones[i].
name(),
3557 newMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
3566 resetZones(mesh, newMesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3570 pointZone_.clearStorage();
3571 faceZone_.clearStorage();
3572 faceZoneFlip_.clearStorage();
3573 cellZone_.clearStorage();
3582 oldPatchMeshPointMaps,
3589 calcFaceZonePointMap(newMesh, oldMeshFaceZonesPointMaps, faceZonePointMap);
3593 Pout<<
"New mesh:" <<
nl;
3594 writeMeshStats(mesh,
Pout);
3597 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3638 oldPatchNMeshPoints,
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
An STL-conforming const_iterator.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
readOption readOpt() const
autoPtr< IOobject > clone() const
Clone.
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
virtual const fileName & name() const
Return the name of the stream.
void resize(const label)
Alias for setSize(const label)
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
label size() const
Return the number of elements in the UPtrList.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
Mesh data needed to do the Finite Volume discretisation.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const word & name() const
Return name.
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list.
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.
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.
const face & newFace() const
Return face.
Class containing data for point addition.
label zoneID() const
Point zone ID.
bool inCell() const
Does the point support a cell.
label masterPointID() const
Master point label.
const point & newPoint() const
Point location.
Mesh consisting of general polyhedral cells.
const meshFaceZones & faceZones() const
Return face zones.
virtual const faceList & faces() const
Return raw faces.
void resetPrimitives(pointField &&points, faceList &&faces, labelList &&owner, labelList &&neighbour, const labelList &patchSizes, const labelList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
virtual const labelList & faceOwner() const
Return face owner.
const meshPointZones & pointZones() const
Return point zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
virtual const pointField & points() const
Return raw points.
const meshCellZones & cellZones() const
Return cell zones.
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.
label patchID() const
Boundary patch ID.
label zoneFlip() const
Face zone flip.
label neighbour() const
Return owner cell ID.
const face & newFace() const
Return face.
label faceID() const
Return master face ID.
Class describing modification of a point.
label zoneID() const
Point zone ID.
bool inCell() const
Does the point support a cell.
const point & newPoint() const
New point location.
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.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Direct mesh changes based on v1.3 polyTopoChange syntax.
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
void removePoint(const label, const label)
Remove/merge point.
void movePoints(const pointField &newPoints)
Move all points. Incompatible with other topology changes.
autoPtr< polyTopoChangeMap > makeMesh(autoPtr< fvMesh > &newMesh, const IOobject &io, const polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Create new mesh with old mesh patches.
void addMesh(const polyMesh &, const labelList &patchMap, const labelList &pointZoneMap, const labelList &faceZoneMap, const labelList &cellZoneMap)
Add all points/faces/cells of mesh. Additional offset for patch.
polyTopoChange(const label nPatches, const bool strict=true)
Construct without mesh. Either specify nPatches or use.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
void removeFace(const label, const label)
Remove/merge face.
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh.
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
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 modifyCell(const label, const label zoneID)
Modify zone of cell.
label addPoint(const point &, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
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.
void clear()
Clear all storage.
void removeCell(const label, const label)
Remove/merge cell.
void modifyPoint(const label, const point &, const label newZoneID, const bool inCell)
Modify coordinate.
const scalarField & cellVolumes() const
const vectorField & cellCentres() const
label nInternalFaces() const
A virtual base class for topological actions.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
#define WarningInFunction
Report a warning using Foam::Warning.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
int order(const scalar s)
errorManip< error > abort(error &err)
MeshZones< cellZone, polyMesh > meshCellZones
A MeshZones with the type cellZone.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
List< bool > boolList
Bool container classes.
MeshZones< pointZone, polyMesh > meshPointZones
A MeshZones with the type pointZone.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
List< labelList > labelListList
A List of labelList.
List< List< bool > > boolListList
defineTypeNameAndDebug(combustionModel, 0)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void stableSort(UList< T > &)
ListType reorder(const labelUList &oldToNew, const ListType &)
Reorder the elements (indices, not values) of a list.
static const label labelMax
MeshZones< faceZone, polyMesh > meshFaceZones
A MeshZones with the type faceZone.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
UList< label > labelUList
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
faceListList boundary(nPatches)
labelList pointLabels(nPoints, -1)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable