55 void Foam::polyTopoChange::renumberReverseMap
58 DynamicList<label>& elems
63 label val = elems[elemI];
67 elems[elemI] = map[val];
71 label mergedVal = -val-2;
72 elems[elemI] = -map[mergedVal]-2;
78 void Foam::polyTopoChange::renumber
88 label newElem = map[iter.key()];
92 newElems.insert(newElem);
96 elems.transfer(newElems);
101 void Foam::polyTopoChange::renumberCompact
111 label newVal = map[elems[elemI]];
115 elems[newElemI++] = newVal;
118 elems.setSize(newElemI);
122 void Foam::polyTopoChange::countMap
139 label oldCelli = map[newCelli];
143 if (reverseMap[oldCelli] == newCelli)
153 else if (oldCelli == -1)
165 forAll(reverseMap, oldCelli)
167 label newCelli = reverseMap[oldCelli];
173 else if (newCelli == -1)
189 const PackedBoolList& lst
204 void Foam::polyTopoChange::writeMeshStats(
const polyMesh& mesh, Ostream& os)
206 const polyBoundaryMesh& patches = mesh.boundaryMesh();
216 os <<
" Points : " << mesh.nPoints() << nl
217 <<
" Faces : " << mesh.nFaces() << nl
218 <<
" Cells : " << mesh.nCells() << nl
219 <<
" PatchSizes : " << patchSizes << nl
220 <<
" PatchStarts : " << patchStarts << nl
225 void Foam::polyTopoChange::getMergeSets
229 List<objectMap>& cellsFromCells
235 forAll(reverseCellMap, oldCelli)
237 label newCelli = reverseCellMap[oldCelli];
241 label mergeCelli = -newCelli-2;
243 nMerged[mergeCelli]++;
248 labelList cellToMergeSet(cellMap.size(), -1);
254 if (nMerged[celli] > 1)
256 cellToMergeSet[celli] = nSets++;
266 cellsFromCells.setSize(nSets);
268 forAll(reverseCellMap, oldCelli)
270 label newCelli = reverseCellMap[oldCelli];
274 label mergeCelli = -newCelli-2;
278 label setI = cellToMergeSet[mergeCelli];
280 objectMap& mergeSet = cellsFromCells[setI];
282 if (mergeSet.masterObjects().empty())
286 mergeSet.index() = mergeCelli;
287 mergeSet.masterObjects().setSize(nMerged[mergeCelli]);
290 mergeSet.masterObjects()[0] = cellMap[mergeCelli];
293 mergeSet.masterObjects()[1] = oldCelli;
295 nMerged[mergeCelli] = 2;
299 mergeSet.masterObjects()[nMerged[mergeCelli]++] = oldCelli;
306 bool Foam::polyTopoChange::hasValidPoints(
const face& f)
const 310 if (f[fp] < 0 || f[fp] >= points_.size())
324 if (f[fp] < 0 && f[fp] >= points_.size())
329 points[fp] = points_[f[fp]];
335 void Foam::polyTopoChange::checkFace
347 if (own == -1 && zoneI != -1)
351 else if (patchi == -1 || patchi >= nPatches_)
354 <<
"Face has no neighbour (so external) but does not have" 355 <<
" a valid patch" << nl
357 <<
" facei(-1 if added face):" << facei
358 <<
" own:" << own <<
" nei:" << nei
359 <<
" patchi:" << patchi <<
nl;
360 if (hasValidPoints(f))
363 <<
"points (removed points marked with " 374 <<
"Cannot both have valid patchi and neighbour" << nl
376 <<
" facei(-1 if added face):" << facei
377 <<
" own:" << own <<
" nei:" << nei
378 <<
" patchi:" << patchi <<
nl;
379 if (hasValidPoints(f))
382 <<
"points (removed points marked with " 391 <<
"Owner cell label should be less than neighbour cell label" 394 <<
" facei(-1 if added face):" << facei
395 <<
" own:" << own <<
" nei:" << nei
396 <<
" patchi:" << patchi <<
nl;
397 if (hasValidPoints(f))
400 <<
"points (removed points marked with " 407 if (f.size() < 3 ||
findIndex(f, -1) != -1)
410 <<
"Illegal vertices in face" 413 <<
" facei(-1 if added face):" << facei
414 <<
" own:" << own <<
" nei:" << nei
415 <<
" patchi:" << patchi <<
nl;
416 if (hasValidPoints(f))
419 <<
"points (removed points marked with " 424 if (facei >= 0 && facei < faces_.size() && faceRemoved(facei))
427 <<
"Face already marked for removal" 430 <<
" facei(-1 if added face):" << facei
431 <<
" own:" << own <<
" nei:" << nei
432 <<
" patchi:" << patchi <<
nl;
433 if (hasValidPoints(f))
436 <<
"points (removed points marked with " 443 if (f[fp] < points_.size() && pointRemoved(f[fp]))
446 <<
"Face uses removed vertices" 449 <<
" facei(-1 if added face):" << facei
450 <<
" own:" << own <<
" nei:" << nei
451 <<
" patchi:" << patchi <<
nl;
452 if (hasValidPoints(f))
455 <<
"points (removed points marked with " 464 void Foam::polyTopoChange::makeCells
466 const label nActiveFaces,
471 cellFaces.setSize(2*nActiveFaces);
472 cellFaceOffsets.setSize(cellMap_.size() + 1);
479 for (
label facei = 0; facei < nActiveFaces; facei++)
481 if (faceOwner_[facei] < 0)
484 <<
"Face " << facei <<
" is active but its owner has" 485 <<
" been deleted. This is usually due to deleting cells" 486 <<
" without modifying exposed faces to be boundary faces." 489 nNbrs[faceOwner_[facei]]++;
491 for (
label facei = 0; facei < nActiveFaces; facei++)
493 if (faceNeighbour_[facei] >= 0)
495 nNbrs[faceNeighbour_[facei]]++;
501 cellFaceOffsets[0] = 0;
504 cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli];
512 for (
label facei = 0; facei < nActiveFaces; facei++)
514 label celli = faceOwner_[facei];
516 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
519 for (
label facei = 0; facei < nActiveFaces; facei++)
521 label celli = faceNeighbour_[facei];
525 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
530 cellFaces.setSize(cellFaceOffsets[cellMap_.size()]);
536 void Foam::polyTopoChange::makeCellCells
538 const label nActiveFaces,
539 CompactListList<label>& cellCells
547 for (
label facei = 0; facei < nActiveFaces; facei++)
549 if (faceNeighbour_[facei] >= 0)
551 nNbrs[faceOwner_[facei]]++;
552 nNbrs[faceNeighbour_[facei]]++;
565 for (
label facei = 0; facei < nActiveFaces; facei++)
567 label nei = faceNeighbour_[facei];
571 label own = faceOwner_[facei];
572 cellCells.m()[cellCells.index(own, nNbrs[own]++)] = nei;
573 cellCells.m()[cellCells.index(nei, nNbrs[nei]++)] = own;
583 const CompactListList<label>& cellCellAddressing,
587 labelList newOrder(cellCellAddressing.size());
590 SLList<label> nextCell;
593 PackedBoolList visited(cellCellAddressing.size());
595 label cellInOrder = 0;
600 DynamicList<label> nbrs;
602 DynamicList<label> weights;
612 label currentCell = -1;
618 if (!cellRemoved(celli) && !visited[celli])
620 if (cellCellAddressing[celli].size() < minWeight)
622 minWeight = cellCellAddressing[celli].size();
629 if (currentCell == -1)
639 nextCell.append(currentCell);
646 while (nextCell.size())
648 currentCell = nextCell.removeHead();
650 if (!visited[currentCell])
652 visited[currentCell] = 1;
655 newOrder[cellInOrder] = currentCell;
659 const labelUList neighbours = cellCellAddressing[currentCell];
669 label nbr = neighbours[nI];
670 if (!cellRemoved(nbr) && !visited[nbr])
674 weights.append(cellCellAddressing[nbr].size());
682 nextCell.append(nbrs[i]);
689 newOrder.setSize(cellInOrder);
692 oldToNew =
invert(cellCellAddressing.size(), newOrder);
701 void Foam::polyTopoChange::getFaceOrder
703 const label nActiveFaces,
712 oldToNew.setSize(faceOwner_.size());
723 label startOfCell = cellFaceOffsets[celli];
724 label nFaces = cellFaceOffsets[celli+1] - startOfCell;
730 for (
label i = 0; i < nFaces; i++)
732 label facei = cellFaces[startOfCell + i];
734 label nbrCelli = faceNeighbour_[facei];
736 if (facei >= nActiveFaces)
741 else if (nbrCelli != -1)
744 if (nbrCelli == celli)
746 nbrCelli = faceOwner_[facei];
749 if (celli < nbrCelli)
768 order.setSize(nFaces);
781 label index = order[i];
782 if (nbr[index] != -1)
784 oldToNew[cellFaces[startOfCell + index]] = newFacei++;
791 patchStarts.setSize(nPatches_);
793 patchSizes.setSize(nPatches_);
798 patchStarts[0] = newFacei;
800 for (
label facei = 0; facei < nActiveFaces; facei++)
802 if (region_[facei] >= 0)
804 patchSizes[region_[facei]]++;
808 label facei = patchStarts[0];
810 forAll(patchStarts, patchi)
812 patchStarts[
patchi] = facei;
813 facei += patchSizes[
patchi];
825 for (
label facei = 0; facei < nActiveFaces; facei++)
827 if (region_[facei] >= 0)
829 oldToNew[facei] = workPatchStarts[region_[facei]]++;
834 for (
label facei = nActiveFaces; facei < oldToNew.size(); facei++)
836 oldToNew[facei] = facei;
842 if (oldToNew[facei] == -1)
845 <<
"Did not determine new position" 846 <<
" for face " << facei
847 <<
" owner " << faceOwner_[facei]
848 <<
" neighbour " << faceNeighbour_[facei]
849 <<
" region " << region_[facei] <<
endl 850 <<
"This is usually caused by not specifying a patch for" 851 <<
" a boundary face." << nl
852 <<
"Switch on the polyTopoChange::debug flag to catch" 853 <<
" this error earlier." <<
nl;
854 if (hasValidPoints(faces_[facei]))
857 <<
"points (removed points marked with " 858 <<
vector::max <<
") " << facePoints(faces_[facei]);
867 void Foam::polyTopoChange::reorderCompactFaces
874 faces_.setCapacity(newSize);
877 region_.setCapacity(newSize);
880 faceOwner_.setCapacity(newSize);
882 reorder(oldToNew, faceNeighbour_);
883 faceNeighbour_.setCapacity(newSize);
887 faceMap_.setCapacity(newSize);
889 renumberReverseMap(oldToNew, reverseFaceMap_);
891 renumberKey(oldToNew, faceFromPoint_);
892 renumberKey(oldToNew, faceFromEdge_);
894 flipFaceFlux_.setCapacity(newSize);
895 renumberKey(oldToNew, faceZone_);
897 faceZoneFlip_.setCapacity(newSize);
905 void Foam::polyTopoChange::compact
907 const bool orderCells,
908 const bool orderPoints,
909 label& nInternalPoints,
916 reversePointMap_.shrink();
921 faceNeighbour_.shrink();
923 reverseFaceMap_.shrink();
926 reverseCellMap_.shrink();
931 label nActivePoints = 0;
933 labelList localPointMap(points_.size(), -1);
938 nInternalPoints = -1;
942 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
944 localPointMap[pointi] = newPointi++;
953 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
965 && faceOwner_[facei] >= 0
966 && faceNeighbour_[facei] < 0
970 const face& f = faces_[facei];
974 label pointi = f[fp];
976 if (localPointMap[pointi] == -1)
981 || retiredPoints_.found(pointi)
985 <<
"Removed or retired point " << pointi
987 <<
" at position " << facei <<
endl 988 <<
"Probably face has not been adapted for" 991 localPointMap[pointi] = newPointi++;
998 nInternalPoints = nActivePoints - nBoundaryPoints;
1001 forAll(localPointMap, pointi)
1003 if (localPointMap[pointi] != -1)
1005 localPointMap[pointi] += nInternalPoints;
1012 forAll(faceOwner_, facei)
1017 && faceOwner_[facei] >= 0
1018 && faceNeighbour_[facei] >= 0
1022 const face& f = faces_[facei];
1026 label pointi = f[fp];
1028 if (localPointMap[pointi] == -1)
1032 pointRemoved(pointi)
1033 || retiredPoints_.found(pointi)
1037 <<
"Removed or retired point " << pointi
1039 <<
" at position " << facei <<
endl 1040 <<
"Probably face has not been adapted for" 1043 localPointMap[pointi] = newPointi++;
1049 if (newPointi != nInternalPoints)
1054 newPointi = nActivePoints;
1059 localPointMap[iter.key()] = newPointi++;
1065 Pout<<
"Points : active:" << nActivePoints
1066 <<
" removed:" << points_.size()-newPointi <<
endl;
1069 reorder(localPointMap, points_);
1070 points_.setCapacity(newPointi);
1073 reorder(localPointMap, pointMap_);
1074 pointMap_.setCapacity(newPointi);
1075 renumberReverseMap(localPointMap, reversePointMap_);
1077 renumberKey(localPointMap, pointZone_);
1078 renumberKey(localPointMap, oldPoints_);
1079 renumber(localPointMap, retiredPoints_);
1084 face& f = faces_[facei];
1087 renumberCompact(localPointMap, f);
1089 if (!faceRemoved(facei) && f.size() < 3)
1092 <<
"Created illegal face " << f
1094 <<
" at position:" << facei
1095 <<
" when filtering removed points" 1104 labelList localFaceMap(faces_.size(), -1);
1109 if (!faceRemoved(facei) && faceOwner_[facei] >= 0)
1111 localFaceMap[facei] = newFacei++;
1114 nActiveFaces_ = newFacei;
1118 if (!faceRemoved(facei) && faceOwner_[facei] < 0)
1121 localFaceMap[facei] = newFacei++;
1127 Pout<<
"Faces : active:" << nActiveFaces_
1128 <<
" removed:" << faces_.size()-newFacei <<
endl;
1132 reorderCompactFaces(newFacei, localFaceMap);
1143 CompactListList<label> cellCells;
1144 makeCellCells(nActiveFaces_, cellCells);
1147 newCelli = getCellOrder(cellCells, localCellMap);
1152 localCellMap.setSize(cellMap_.size());
1158 if (!cellRemoved(celli))
1160 localCellMap[celli] = newCelli++;
1167 Pout<<
"Cells : active:" << newCelli
1168 <<
" removed:" << cellMap_.size()-newCelli <<
endl;
1172 if (orderCells || (newCelli != cellMap_.size()))
1174 reorder(localCellMap, cellMap_);
1175 cellMap_.setCapacity(newCelli);
1176 renumberReverseMap(localCellMap, reverseCellMap_);
1178 reorder(localCellMap, cellZone_);
1179 cellZone_.setCapacity(newCelli);
1181 renumberKey(localCellMap, cellFromPoint_);
1182 renumberKey(localCellMap, cellFromEdge_);
1183 renumberKey(localCellMap, cellFromFace_);
1187 forAll(faceOwner_, facei)
1189 label own = faceOwner_[facei];
1190 label nei = faceNeighbour_[facei];
1195 faceOwner_[facei] = localCellMap[own];
1200 faceNeighbour_[facei] = localCellMap[nei];
1205 faceNeighbour_[facei] >= 0
1206 && faceNeighbour_[facei] < faceOwner_[facei]
1209 faces_[facei].flip();
1210 Swap(faceOwner_[facei], faceNeighbour_[facei]);
1211 flipFaceFlux_[facei] =
1213 flipFaceFlux_[facei]
1217 faceZoneFlip_[facei] =
1219 faceZoneFlip_[facei]
1229 faceNeighbour_[facei] = localCellMap[nei];
1240 makeCells(nActiveFaces_, cellFaces, cellFaceOffsets);
1256 reorderCompactFaces(localFaceMap.size(), localFaceMap);
1270 const primitiveMesh& mesh,
1272 const bool internalFacesOnly
1279 label facei = faceLabels[i];
1281 if (internalFacesOnly == mesh.isInternalFace(facei))
1293 collectedFaces = faceLabels;
1297 collectedFaces.
setSize(nFaces);
1303 label facei = faceLabels[i];
1305 if (internalFacesOnly == mesh.isInternalFace(facei))
1307 collectedFaces[nFaces++] = facei;
1312 return collectedFaces;
1318 void Foam::polyTopoChange::calcPatchPointMap
1320 const List<Map<label>>& oldPatchMeshPointMaps,
1321 const polyBoundaryMesh& boundary,
1325 patchPointMap.setSize(boundary.size());
1331 const Map<label>& oldMeshPointMap = oldPatchMeshPointMaps[
patchi];
1335 curPatchPointRnb.
setSize(meshPoints.size());
1339 if (meshPoints[i] < pointMap_.size())
1344 pointMap_[meshPoints[i]]
1347 if (ozmpmIter != oldMeshPointMap.end())
1349 curPatchPointRnb[i] = ozmpmIter();
1353 curPatchPointRnb[i] = -1;
1358 curPatchPointRnb[i] = -1;
1365 void Foam::polyTopoChange::calcFaceInflationMaps
1367 const polyMesh& mesh,
1368 List<objectMap>& facesFromPoints,
1369 List<objectMap>& facesFromEdges,
1370 List<objectMap>& facesFromFaces
1376 facesFromPoints.setSize(faceFromPoint_.size());
1378 if (faceFromPoint_.size())
1380 label nFacesFromPoints = 0;
1385 label newFacei = iter.key();
1387 if (region_[newFacei] == -1)
1390 facesFromPoints[nFacesFromPoints++] = objectMap
1396 mesh.pointFaces()[iter()],
1404 facesFromPoints[nFacesFromPoints++] = objectMap
1410 mesh.pointFaces()[iter()],
1422 facesFromEdges.setSize(faceFromEdge_.size());
1424 if (faceFromEdge_.size())
1426 label nFacesFromEdges = 0;
1431 label newFacei = iter.key();
1433 if (region_[newFacei] == -1)
1436 facesFromEdges[nFacesFromEdges++] = objectMap
1442 mesh.edgeFaces(iter()),
1450 facesFromEdges[nFacesFromEdges++] = objectMap
1456 mesh.edgeFaces(iter()),
1477 void Foam::polyTopoChange::calcCellInflationMaps
1479 const polyMesh& mesh,
1480 List<objectMap>& cellsFromPoints,
1481 List<objectMap>& cellsFromEdges,
1482 List<objectMap>& cellsFromFaces,
1483 List<objectMap>& cellsFromCells
1486 cellsFromPoints.setSize(cellFromPoint_.size());
1488 if (cellFromPoint_.size())
1490 label nCellsFromPoints = 0;
1495 cellsFromPoints[nCellsFromPoints++] = objectMap
1498 mesh.pointCells()[iter()]
1504 cellsFromEdges.setSize(cellFromEdge_.size());
1506 if (cellFromEdge_.size())
1508 label nCellsFromEdges = 0;
1513 cellsFromEdges[nCellsFromEdges++] = objectMap
1516 mesh.edgeCells()[iter()]
1522 cellsFromFaces.setSize(cellFromFace_.size());
1524 if (cellFromFace_.size())
1526 label nCellsFromFaces = 0;
1533 label oldFacei = iter();
1535 if (mesh.isInternalFace(oldFacei))
1537 twoCells[0] = mesh.faceOwner()[oldFacei];
1538 twoCells[1] = mesh.faceNeighbour()[oldFacei];
1539 cellsFromFaces[nCellsFromFaces++] = objectMap
1547 cellsFromFaces[nCellsFromFaces++] = objectMap
1550 labelList(1, mesh.faceOwner()[oldFacei])
1569 void Foam::polyTopoChange::resetZones
1571 const polyMesh& mesh,
1581 pointZoneMap.setSize(mesh.pointZones().size());
1591 label zoneI = iter();
1593 if (zoneI < 0 || zoneI >= pointZones.size())
1596 <<
"Illegal zoneID " << zoneI <<
" for point " 1597 << iter.key() <<
" coord " << mesh.points()[iter.key()]
1606 forAll(addressing, zoneI)
1608 addressing[zoneI].setSize(nPoints[zoneI]);
1614 label zoneI = iter();
1616 addressing[zoneI][nPoints[zoneI]++] = iter.key();
1619 forAll(addressing, zoneI)
1626 forAll(addressing, zoneI)
1628 const pointZone& oldZone = pointZones[zoneI];
1629 const labelList& newZoneAddr = addressing[zoneI];
1631 labelList& curPzRnb = pointZoneMap[zoneI];
1632 curPzRnb.
setSize(newZoneAddr.size());
1636 if (newZoneAddr[i] < pointMap_.size())
1638 curPzRnb[i] = oldZone.whichPoint(pointMap_[newZoneAddr[i]]);
1648 newMesh.pointZones().clearAddressing();
1649 forAll(newMesh.pointZones(), zoneI)
1653 Pout<<
"pointZone:" << zoneI
1654 <<
" name:" << newMesh.pointZones()[zoneI].
name()
1655 <<
" size:" << addressing[zoneI].size()
1659 newMesh.pointZones()[zoneI] = addressing[zoneI];
1667 faceZoneFaceMap.setSize(mesh.faceZones().size());
1675 label zoneI = iter();
1677 if (zoneI < 0 || zoneI >= faceZones.size())
1680 <<
"Illegal zoneID " << zoneI <<
" for face " 1690 forAll(addressing, zoneI)
1692 addressing[zoneI].setSize(nFaces[zoneI]);
1693 flipMode[zoneI].setSize(nFaces[zoneI]);
1699 label zoneI = iter();
1700 label facei = iter.key();
1702 label index = nFaces[zoneI]++;
1704 addressing[zoneI][index] = facei;
1705 flipMode[zoneI][index] = faceZoneFlip_[facei];
1708 forAll(addressing, zoneI)
1713 labelList newAddressing(addressing[zoneI].size());
1716 newAddressing[i] = addressing[zoneI][newToOld[i]];
1718 addressing[zoneI].transfer(newAddressing);
1721 boolList newFlipMode(flipMode[zoneI].size());
1724 newFlipMode[i] = flipMode[zoneI][newToOld[i]];
1726 flipMode[zoneI].transfer(newFlipMode);
1732 forAll(addressing, zoneI)
1734 const faceZone& oldZone = faceZones[zoneI];
1735 const labelList& newZoneAddr = addressing[zoneI];
1737 labelList& curFzFaceRnb = faceZoneFaceMap[zoneI];
1739 curFzFaceRnb.
setSize(newZoneAddr.size());
1743 if (newZoneAddr[i] < faceMap_.size())
1746 oldZone.whichFace(faceMap_[newZoneAddr[i]]);
1750 curFzFaceRnb[i] = -1;
1757 newMesh.faceZones().clearAddressing();
1758 forAll(newMesh.faceZones(), zoneI)
1762 Pout<<
"faceZone:" << zoneI
1763 <<
" name:" << newMesh.faceZones()[zoneI].
name()
1764 <<
" size:" << addressing[zoneI].size()
1768 newMesh.faceZones()[zoneI].resetAddressing
1780 cellZoneMap.setSize(mesh.cellZones().size());
1788 label zoneI = cellZone_[celli];
1790 if (zoneI >= cellZones.size())
1793 <<
"Illegal zoneID " << zoneI <<
" for cell " 1804 forAll(addressing, zoneI)
1806 addressing[zoneI].setSize(nCells[zoneI]);
1812 label zoneI = cellZone_[celli];
1816 addressing[zoneI][nCells[zoneI]++] = celli;
1820 forAll(addressing, zoneI)
1827 forAll(addressing, zoneI)
1829 const cellZone& oldZone = cellZones[zoneI];
1830 const labelList& newZoneAddr = addressing[zoneI];
1832 labelList& curCellRnb = cellZoneMap[zoneI];
1834 curCellRnb.
setSize(newZoneAddr.size());
1838 if (newZoneAddr[i] < cellMap_.size())
1841 oldZone.whichCell(cellMap_[newZoneAddr[i]]);
1851 newMesh.cellZones().clearAddressing();
1852 forAll(newMesh.cellZones(), zoneI)
1856 Pout<<
"cellZone:" << zoneI
1857 <<
" name:" << newMesh.cellZones()[zoneI].
name()
1858 <<
" size:" << addressing[zoneI].size()
1862 newMesh.cellZones()[zoneI] = addressing[zoneI];
1868 void Foam::polyTopoChange::calcFaceZonePointMap
1870 const polyMesh& mesh,
1871 const List<Map<label>>& oldFaceZoneMeshPointMaps,
1877 faceZonePointMap.
setSize(faceZones.size());
1881 const faceZone& newZone = faceZones[zoneI];
1883 const labelList& newZoneMeshPoints = newZone().meshPoints();
1885 const Map<label>& oldZoneMeshPointMap = oldFaceZoneMeshPointMaps[zoneI];
1887 labelList& curFzPointRnb = faceZonePointMap[zoneI];
1889 curFzPointRnb.
setSize(newZoneMeshPoints.size());
1891 forAll(newZoneMeshPoints, pointi)
1893 if (newZoneMeshPoints[pointi] < pointMap_.size())
1896 oldZoneMeshPointMap.find
1898 pointMap_[newZoneMeshPoints[pointi]]
1901 if (ozmpmIter != oldZoneMeshPointMap.end())
1903 curFzPointRnb[pointi] = ozmpmIter();
1907 curFzPointRnb[pointi] = -1;
1912 curFzPointRnb[pointi] = -1;
1919 void Foam::polyTopoChange::reorderCoupledFaces
1921 const bool syncParallel,
1922 const polyBoundaryMesh& boundary,
1940 if (syncParallel || !isA<processorPolyPatch>(boundary[patchi]))
1942 boundary[
patchi].initOrder
1961 pBufs.finishedSends();
1966 bool anyChanged =
false;
1970 if (syncParallel || !isA<processorPolyPatch>(boundary[patchi]))
1972 labelList patchFaceMap(patchSizes[patchi], -1);
1973 labelList patchFaceRotation(patchSizes[patchi], 0);
1975 bool changed = boundary[
patchi].order
1997 forAll(patchFaceMap, patchFacei)
1999 oldToNew[patchFacei + start] =
2000 start + patchFaceMap[patchFacei];
2003 forAll(patchFaceRotation, patchFacei)
2005 rotation[patchFacei + start] =
2006 patchFaceRotation[patchFacei];
2016 reduce(anyChanged, orOp<bool>());
2022 reorderCompactFaces(oldToNew.size(), oldToNew);
2027 if (rotation[facei] != 0)
2029 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
2036 void Foam::polyTopoChange::compactAndReorder
2038 const polyMesh& mesh,
2039 const bool syncParallel,
2040 const bool orderCells,
2041 const bool orderPoints,
2043 label& nInternalPoints,
2047 List<objectMap>& pointsFromPoints,
2048 List<objectMap>& facesFromPoints,
2049 List<objectMap>& facesFromEdges,
2050 List<objectMap>& facesFromFaces,
2051 List<objectMap>& cellsFromPoints,
2052 List<objectMap>& cellsFromEdges,
2053 List<objectMap>& cellsFromFaces,
2054 List<objectMap>& cellsFromCells,
2055 List<Map<label>>& oldPatchMeshPointMaps,
2058 List<Map<label>>& oldFaceZoneMeshPointMaps
2061 if (mesh.boundaryMesh().size() != nPatches_)
2064 <<
"polyTopoChange was constructed with a mesh with " 2065 << nPatches_ <<
" patches." <<
endl 2066 <<
"The mesh now provided has a different number of patches " 2067 << mesh.boundaryMesh().size()
2068 <<
" which is illegal" <<
endl 2074 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2078 newPoints.transfer(points_);
2084 mesh.boundaryMesh(),
2110 calcFaceInflationMaps
2118 calcCellInflationMaps
2129 faceFromPoint_.clearStorage();
2130 faceFromEdge_.clearStorage();
2132 cellFromPoint_.clearStorage();
2133 cellFromEdge_.clearStorage();
2134 cellFromFace_.clearStorage();
2138 const polyBoundaryMesh& boundary = mesh.boundaryMesh();
2141 oldPatchMeshPointMaps.setSize(boundary.size());
2142 oldPatchNMeshPoints.setSize(boundary.size());
2143 oldPatchStarts.setSize(boundary.size());
2148 oldPatchMeshPointMaps[
patchi] = boundary[
patchi].meshPointMap();
2149 oldPatchNMeshPoints[
patchi] = boundary[
patchi].meshPoints().size();
2156 oldFaceZoneMeshPointMaps.setSize(mesh.faceZones().size());
2158 forAll(mesh.faceZones(), zoneI)
2160 const faceZone& oldZone = mesh.faceZones()[zoneI];
2162 oldFaceZoneMeshPointMaps[zoneI] = oldZone().meshPointMap();
2173 nPatches_(nPatches),
2176 reversePointMap_(0),
2212 reversePointMap_(0),
2250 points_.clearStorage();
2255 oldPoints_.clearStorage();
2257 faces_.clearStorage();
2288 label maxRegion = nPatches_ - 1;
2291 maxRegion =
max(maxRegion, patchMap[i]);
2293 nPatches_ = maxRegion + 1;
2302 points_.setCapacity(points_.size() + points.
size());
2311 forAll(pointZones, zoneI)
2317 newZoneID[pointLabels[j]] = pointZoneMap[zoneI];
2322 for (
label pointi = 0; pointi < mesh.
nPoints(); pointi++)
2346 cellFromPoint_.
resize(cellFromPoint_.
size() + nAllCells/100);
2347 cellFromEdge_.
resize(cellFromEdge_.
size() + nAllCells/100);
2348 cellFromFace_.
resize(cellFromFace_.
size() + nAllCells/100);
2357 const labelList& cellLabels = cellZones[zoneI];
2361 label celli = cellLabels[j];
2363 if (newZoneID[celli] != -1)
2368 <<
" is in two zones:" 2369 << cellZones[newZoneID[celli]].
name()
2370 <<
" and " << cellZones[zoneI].
name() <<
endl 2371 <<
" This is not supported." 2372 <<
" Continuing with first zone only." <<
endl;
2376 newZoneID[celli] = cellZoneMap[zoneI];
2382 for (
label celli = 0; celli < nAllCells; celli++)
2385 addCell(-1, -1, -1, celli, newZoneID[celli]);
2400 faces_.setCapacity(faces_.size() + nAllFaces);
2406 faceFromPoint_.
resize(faceFromPoint_.
size() + nAllFaces/100);
2407 faceFromEdge_.
resize(faceFromEdge_.
size() + nAllFaces/100);
2408 flipFaceFlux_.
setCapacity(faces_.size() + nAllFaces);
2409 faceZone_.
resize(faceZone_.
size() + nAllFaces/100);
2410 faceZoneFlip_.
setCapacity(faces_.size() + nAllFaces);
2415 boolList zoneFlip(nAllFaces,
false);
2419 const labelList& faceLabels = faceZones[zoneI];
2420 const boolList& flipMap = faceZones[zoneI].flipMap();
2424 newZoneID[faceLabels[j]] = faceZoneMap[zoneI];
2425 zoneFlip[faceLabels[j]] = flipMap[j];
2438 faceNeighbour[facei],
2454 if (pp.
start() != faces_.size())
2458 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2460 <<
"Current face counter at " << faces_.size() <<
endl 2461 <<
"Are patches in incremental order?" 2489 const label nPoints,
2494 points_.setCapacity(nPoints);
2497 pointZone_.
resize(pointZone_.
size() + nPoints/100);
2499 faces_.setCapacity(nFaces);
2505 faceFromPoint_.
resize(faceFromPoint_.
size() + nFaces/100);
2506 faceFromEdge_.
resize(faceFromEdge_.
size() + nFaces/100);
2508 faceZone_.
resize(faceZone_.
size() + nFaces/100);
2513 cellFromPoint_.
resize(cellFromPoint_.
size() + nCells/100);
2514 cellFromEdge_.
resize(cellFromEdge_.
size() + nCells/100);
2515 cellFromFace_.
resize(cellFromFace_.
size() + nCells/100);
2522 if (isType<polyAddPoint>(action))
2524 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2534 else if (isType<polyModifyPoint>(action))
2548 else if (isType<polyRemovePoint>(action))
2556 else if (isType<polyAddFace>(action))
2558 const polyAddFace& paf = refCast<const polyAddFace>(action);
2574 else if (isType<polyModifyFace>(action))
2576 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2592 else if (isType<polyRemoveFace>(action))
2594 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2600 else if (isType<polyAddCell>(action))
2602 const polyAddCell& pac = refCast<const polyAddCell>(action);
2613 else if (isType<polyModifyCell>(action))
2615 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2628 else if (isType<polyRemoveCell>(action))
2630 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2639 <<
"Unknown type of topoChange: " << action.type()
2651 const label masterPointID,
2656 label pointi = points_.size();
2659 pointMap_.
append(masterPointID);
2660 reversePointMap_.
append(pointi);
2664 pointZone_.
insert(pointi, zoneID);
2669 retiredPoints_.
insert(pointi);
2680 const label newZoneID,
2684 if (pointi < 0 || pointi >= points_.size())
2687 <<
"illegal point label " << pointi <<
endl 2688 <<
"Valid point labels are 0 .. " << points_.size()-1
2694 <<
"point " << pointi <<
" already marked for removal" 2697 points_[pointi] = pt;
2701 if (pointFnd != pointZone_.
end())
2705 pointFnd() = newZoneID;
2709 pointZone_.
erase(pointFnd);
2712 else if (newZoneID >= 0)
2714 pointZone_.
insert(pointi, newZoneID);
2719 retiredPoints_.
erase(pointi);
2723 retiredPoints_.
insert(pointi);
2726 oldPoints_.erase(pointi);
2734 const label masterPointID,
2738 label pointi = points_.size();
2741 pointMap_.
append(masterPointID);
2742 reversePointMap_.
append(pointi);
2746 pointZone_.
insert(pointi, zoneID);
2749 oldPoints_.insert(pointi, oldPt);
2760 const label newZoneID
2763 if (pointi < 0 || pointi >= points_.size())
2766 <<
"illegal point label " << pointi <<
endl 2767 <<
"Valid point labels are 0 .. " << points_.size()-1
2773 <<
"point " << pointi <<
" already marked for removal" 2776 points_[pointi] = pt;
2780 if (pointFnd != pointZone_.
end())
2784 pointFnd() = newZoneID;
2788 pointZone_.
erase(pointFnd);
2791 else if (newZoneID >= 0)
2793 pointZone_.
insert(pointi, newZoneID);
2797 retiredPoints_.
erase(pointi);
2800 oldPoints_.set(pointi, oldPt);
2806 if (newPoints.
size() != points_.size())
2809 <<
"illegal pointField size." <<
endl 2810 <<
"Size:" << newPoints.
size() <<
endl 2811 <<
"Points in mesh:" << points_.size()
2817 points_[pointi] = newPoints[pointi];
2825 const label mergePointi
2828 if (pointi < 0 || pointi >= points_.size())
2831 <<
"illegal point label " << pointi <<
endl 2832 <<
"Valid point labels are 0 .. " << points_.size()-1
2843 <<
"point " << pointi <<
" already marked for removal" << nl
2844 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
2848 if (pointi == mergePointi)
2851 <<
"Cannot remove/merge point " << pointi <<
" onto itself." 2856 pointMap_[pointi] = -1;
2857 if (mergePointi >= 0)
2859 reversePointMap_[pointi] = -mergePointi-2;
2863 reversePointMap_[pointi] = -1;
2865 pointZone_.
erase(pointi);
2866 retiredPoints_.
erase(pointi);
2867 oldPoints_.erase(pointi);
2876 const label masterPointID,
2877 const label masterEdgeID,
2878 const label masterFaceID,
2879 const bool flipFaceFlux,
2880 const label patchID,
2888 checkFace(f, -1, own, nei, patchID, zoneID);
2891 label facei = faces_.size();
2896 faceNeighbour_.
append(nei);
2898 if (masterPointID >= 0)
2901 faceFromPoint_.
insert(facei, masterPointID);
2903 else if (masterEdgeID >= 0)
2906 faceFromEdge_.
insert(facei, masterEdgeID);
2908 else if (masterFaceID >= 0)
2910 faceMap_.
append(masterFaceID);
2921 reverseFaceMap_.
append(facei);
2923 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2927 faceZone_.
insert(facei, zoneID);
2929 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2941 const bool flipFaceFlux,
2942 const label patchID,
2950 checkFace(f, facei, own, nei, patchID, zoneID);
2954 faceOwner_[facei] = own;
2955 faceNeighbour_[facei] = nei;
2956 region_[facei] = patchID;
2958 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2962 if (faceFnd != faceZone_.
end())
2970 faceZone_.
erase(faceFnd);
2973 else if (zoneID >= 0)
2975 faceZone_.
insert(facei, zoneID);
2977 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2983 if (facei < 0 || facei >= faces_.size())
2986 <<
"illegal face label " << facei <<
endl 2987 <<
"Valid face labels are 0 .. " << faces_.size()-1
2999 <<
" already marked for removal" 3003 faces_[facei].setSize(0);
3004 region_[facei] = -1;
3005 faceOwner_[facei] = -1;
3006 faceNeighbour_[facei] = -1;
3007 faceMap_[facei] = -1;
3008 if (mergeFacei >= 0)
3010 reverseFaceMap_[facei] = -mergeFacei-2;
3014 reverseFaceMap_[facei] = -1;
3016 faceFromEdge_.
erase(facei);
3017 faceFromPoint_.
erase(facei);
3018 flipFaceFlux_[facei] = 0;
3019 faceZone_.
erase(facei);
3020 faceZoneFlip_[facei] = 0;
3026 const label masterPointID,
3027 const label masterEdgeID,
3028 const label masterFaceID,
3029 const label masterCellID,
3035 if (masterPointID >= 0)
3038 cellFromPoint_.
insert(celli, masterPointID);
3040 else if (masterEdgeID >= 0)
3043 cellFromEdge_.
insert(celli, masterEdgeID);
3045 else if (masterFaceID >= 0)
3048 cellFromFace_.
insert(celli, masterFaceID);
3052 cellMap_.
append(masterCellID);
3054 reverseCellMap_.
append(celli);
3055 cellZone_.
append(zoneID);
3067 cellZone_[celli] = zoneID;
3073 if (celli < 0 || celli >= cellMap_.
size())
3076 <<
"illegal cell label " << celli <<
endl 3077 <<
"Valid cell labels are 0 .. " << cellMap_.
size()-1
3081 if (strict_ && cellMap_[celli] == -2)
3085 <<
" already marked for removal" 3089 cellMap_[celli] = -2;
3090 if (mergeCelli >= 0)
3092 reverseCellMap_[celli] = -mergeCelli-2;
3096 reverseCellMap_[celli] = -1;
3098 cellFromPoint_.
erase(celli);
3099 cellFromEdge_.
erase(celli);
3100 cellFromFace_.
erase(celli);
3101 cellZone_[celli] = -1;
3109 const bool syncParallel,
3110 const bool orderCells,
3111 const bool orderPoints
3116 Pout<<
"polyTopoChange::changeMesh" 3117 <<
"(polyMesh&, const bool, const bool, const bool, const bool)" 3123 Pout<<
"Old mesh:" <<
nl;
3124 writeMeshStats(mesh,
Pout);
3130 label nInternalPoints;
3169 oldPatchMeshPointMaps,
3170 oldPatchNMeshPoints,
3172 oldFaceZoneMeshPointMaps
3193 forAll(pointMap_, newPointi)
3196 if (iter != oldPoints_.end())
3198 renumberedMeshPoints[
newPointi] = iter();
3217 move(renumberedMeshPoints),
3220 move(faceNeighbour_),
3238 move(faceNeighbour_),
3249 oldPoints_.clearStorage();
3257 label nAdd, nInflate, nMerge, nRemove;
3258 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3260 <<
" added(from point):" << nAdd
3261 <<
" added(from nothing):" << nInflate
3262 <<
" merged(into other point):" << nMerge
3263 <<
" removed:" << nRemove
3266 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3268 <<
" added(from face):" << nAdd
3269 <<
" added(inflated):" << nInflate
3270 <<
" merged(into other face):" << nMerge
3271 <<
" removed:" << nRemove
3274 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3276 <<
" added(from cell):" << nAdd
3277 <<
" added(inflated):" << nInflate
3278 <<
" merged(into other cell):" << nMerge
3279 <<
" removed:" << nRemove
3286 Pout<<
"New mesh:" <<
nl;
3287 writeMeshStats(mesh,
Pout);
3301 resetZones(mesh, mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3318 oldPatchMeshPointMaps,
3325 calcFaceZonePointMap(mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3327 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3368 oldPatchNMeshPoints,
3386 const bool syncParallel,
3387 const bool orderCells,
3388 const bool orderPoints
3393 Pout<<
"polyTopoChange::changeMesh" 3394 <<
"(autoPtr<fvMesh>&, const IOobject&, const fvMesh&" 3395 <<
", const bool, const bool, const bool)" 3401 Pout<<
"Old mesh:" <<
nl;
3402 writeMeshStats(mesh,
Pout);
3408 label nInternalPoints;
3448 oldPatchMeshPointMaps,
3449 oldPatchNMeshPoints,
3451 oldFaceZoneMeshPointMaps
3473 move(faceNeighbour_)
3476 fvMesh& newMesh = newMeshPtr();
3481 oldPoints_.clearStorage();
3489 label nAdd, nInflate, nMerge, nRemove;
3490 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3492 <<
" added(from point):" << nAdd
3493 <<
" added(from nothing):" << nInflate
3494 <<
" merged(into other point):" << nMerge
3495 <<
" removed:" << nRemove
3498 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3500 <<
" added(from face):" << nAdd
3501 <<
" added(inflated):" << nInflate
3502 <<
" merged(into other face):" << nMerge
3503 <<
" removed:" << nRemove
3506 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3508 <<
" added(from cell):" << nAdd
3509 <<
" added(inflated):" << nInflate
3510 <<
" merged(into other cell):" << nMerge
3511 <<
" removed:" << nRemove
3522 forAll(oldPatches, patchi)
3547 oldPointZones[i].
name(),
3562 oldFaceZones[i].
name(),
3578 oldCellZones[i].
name(),
3586 newMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
3595 resetZones(mesh, newMesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3611 oldPatchMeshPointMaps,
3618 calcFaceZonePointMap(newMesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3622 Pout<<
"New mesh:" <<
nl;
3623 writeMeshStats(mesh,
Pout);
3626 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3667 oldPatchNMeshPoints,
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
const face & newFace() const
Return face.
virtual const fileName & name() const
Return the name of the stream.
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 inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
autoPtr< IOobject > clone() const
Clone.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
List< List< bool > > boolListList
const word & name() const
Return name.
const word & name() const
Return name.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
const DynamicList< label > & faceNeighbour() const
label faceID() const
Return master face ID.
const DynamicList< face > & faces() const
An STL-conforming const_iterator.
const faceZoneMesh & faceZones() const
Return face zone mesh.
static const Vector< scalar > max
errorManipArg< error, int > exit(error &err, const int errNo=1)
Class describing modification of a face.
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
A face is a list of labels corresponding to mesh vertices.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
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.
labelList pointLabels(nPoints, -1)
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
autoPtr< mapPolyMesh > 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 addFvPatches(const List< polyPatch *> &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
void size(const label)
Override size to be inconsistent with allocated storage.
void setCapacity(const label)
Alter the size of the underlying storage.
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.
label zoneID() const
Point zone ID.
label cellID() const
Cell ID.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
label zoneID() const
Face zone ID.
label masterCellID() const
Return master cell ID.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
Class containing data for point addition.
label masterEdgeID() const
Return master edge ID.
void removePoint(const label, const label)
Remove/merge point.
label pointID() const
Point ID.
label masterPointID() const
Return master point ID.
bool insert(const Key &key)
Insert a new entry.
Class describing modification of a cell.
void removeFace(const label, const label)
Remove/merge face.
label size() const
Return number of elements in table.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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.
UList< label > labelUList
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
Various functions to operate on Lists.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
virtual const pointField & points() const
Return raw points.
List< bool > boolList
Bool container classes.
bool removeFromZone() const
const point & newPoint() const
Point location.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
label owner() const
Return owner cell.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
label zoneFlip() const
Face zone flip.
Class containing data for cell addition.
bool flipFaceFlux() const
Does the face flux need to be flipped.
vectorField pointField
pointField is a vectorField.
Class containing data for cell removal.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
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.
Pre-declare SubField and related Field type.
bool inCell() const
Does the point support a cell.
const pointZoneMesh & pointZones() const
Return point zone mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
void setCapacity(const label)
Alter the size of the underlying storage.
label mergeCellID() const
Return cell ID.
label zoneID() const
Cell zone ID.
virtual const labelList & faceOwner() const
Return face owner.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
label masterFaceID() const
Return master face ID.
label masterPointID() const
Return master point ID.
static const label labelMax
List< label > labelList
A List of labels.
label addPoint(const point &, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
virtual const faceList & faces() const
Return raw faces.
void addZones(const List< pointZone *> &pz, const List< faceZone *> &fz, const List< cellZone *> &cz)
Add mesh zones.
const vectorField & cellCentres() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
A virtual base class for topological actions.
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh.
ListType reorder(const labelUList &oldToNew, const ListType &)
Reorder the elements (indices, not values) of a list.
label patchID() const
Boundary patch ID.
Class describing modification of a point.
void movePoints(const pointField &newPoints)
Move all points. Incompatible with other topology changes.
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.
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
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)
word name(const complex &)
Return a string representation of a complex.
label zoneID() const
Point zone ID.
label size() const
Return the number of elements in the UPtrList.
label zoneID() const
Cell zone ID.
void setSize(const label)
Reset size of List.
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.
label neighbour() const
Return neighour cell.
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list...
#define WarningInFunction
Report a warning using Foam::Warning.
prefixOSstream Pout(cout, "Pout")
Mesh data needed to do the Finite Volume discretisation.
bool topoChanging() const
Is mesh topology changing.
label start() const
Return start label of this patch in the polyMesh face list.
void clearStorage()
Clear the list and delete storage.
void modifyPoint(const label, const point &, const label newZoneID, const bool inCell)
Modify coordinate.
bool pointRemoved(const label pointi) const
Is point removed?
const point & newPoint() const
New point location.
label pointID() const
Return point ID.
void resize(const label newSize)
Resize the hash table for efficiency.
void clearStorage()
Clear the list and delete storage.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Mesh consisting of general polyhedral cells.
A subset of mesh faces organised as a primitive patch.
autoPtr< mapPolyMesh > 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.
bool flipFaceFlux() const
Does the face flux need to be flipped.
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.
void modifyCell(const label, const label zoneID)
Modify zone of cell.
A patch is a list of labels that address the faces in the global face list.
bool faceRemoved(const label facei) const
Is face removed?
void stableSort(UList< T > &)
readOption readOpt() const
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const DynamicList< label > & faceOwner() const
Class containing data for point removal.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
static const Vector< scalar > zero
void removeCell(const label, const label)
Remove/merge cell.
label mergeFaceID() const
Return merge face ID.
label masterEdgeID() const
Return master edge ID.
void clearStorage()
Clear the table entries and the table itself.
const scalarField & cellVolumes() const
A HashTable to objects of type <T> with a label key.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
label masterPointID() const
Master point label.