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>>& oldMeshFaceZonesPointMaps,
1877 faceZonePointMap.
setSize(faceZones.size());
1881 const faceZone& newZone = faceZones[zoneI];
1883 const labelList& newMeshZonePoints = newZone().meshPoints();
1885 const Map<label>& oldMeshZonePointMap =
1886 oldMeshFaceZonesPointMaps[zoneI];
1888 labelList& curFzPointRnb = faceZonePointMap[zoneI];
1890 curFzPointRnb.
setSize(newMeshZonePoints.size());
1892 forAll(newMeshZonePoints, pointi)
1894 if (newMeshZonePoints[pointi] < pointMap_.size())
1897 oldMeshZonePointMap.find
1899 pointMap_[newMeshZonePoints[pointi]]
1902 if (ozmpmIter != oldMeshZonePointMap.end())
1904 curFzPointRnb[pointi] = ozmpmIter();
1908 curFzPointRnb[pointi] = -1;
1913 curFzPointRnb[pointi] = -1;
1920 void Foam::polyTopoChange::reorderCoupledFaces
1922 const bool syncParallel,
1923 const polyBoundaryMesh& boundary,
1941 if (syncParallel || !isA<processorPolyPatch>(boundary[patchi]))
1943 boundary[
patchi].initOrder
1962 pBufs.finishedSends();
1967 bool anyChanged =
false;
1971 if (syncParallel || !isA<processorPolyPatch>(boundary[patchi]))
1973 labelList patchFaceMap(patchSizes[patchi], -1);
1974 labelList patchFaceRotation(patchSizes[patchi], 0);
1976 bool changed = boundary[
patchi].order
1998 forAll(patchFaceMap, patchFacei)
2000 oldToNew[patchFacei + start] =
2001 start + patchFaceMap[patchFacei];
2004 forAll(patchFaceRotation, patchFacei)
2006 rotation[patchFacei + start] =
2007 patchFaceRotation[patchFacei];
2017 reduce(anyChanged, orOp<bool>());
2023 reorderCompactFaces(oldToNew.size(), oldToNew);
2028 if (rotation[facei] != 0)
2030 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
2037 void Foam::polyTopoChange::compactAndReorder
2039 const polyMesh& mesh,
2040 const bool syncParallel,
2041 const bool orderCells,
2042 const bool orderPoints,
2044 label& nInternalPoints,
2048 List<objectMap>& pointsFromPoints,
2049 List<objectMap>& facesFromPoints,
2050 List<objectMap>& facesFromEdges,
2051 List<objectMap>& facesFromFaces,
2052 List<objectMap>& cellsFromPoints,
2053 List<objectMap>& cellsFromEdges,
2054 List<objectMap>& cellsFromFaces,
2055 List<objectMap>& cellsFromCells,
2056 List<Map<label>>& oldPatchMeshPointMaps,
2059 List<Map<label>>& oldMeshFaceZonesPointMaps
2062 if (mesh.boundaryMesh().size() != nPatches_)
2065 <<
"polyTopoChange was constructed with a mesh with " 2066 << nPatches_ <<
" patches." <<
endl 2067 <<
"The mesh now provided has a different number of patches " 2068 << mesh.boundaryMesh().size()
2069 <<
" which is illegal" <<
endl 2075 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2079 newPoints.transfer(points_);
2085 mesh.boundaryMesh(),
2111 calcFaceInflationMaps
2119 calcCellInflationMaps
2130 faceFromPoint_.clearStorage();
2131 faceFromEdge_.clearStorage();
2133 cellFromPoint_.clearStorage();
2134 cellFromEdge_.clearStorage();
2135 cellFromFace_.clearStorage();
2139 const polyBoundaryMesh& boundary = mesh.boundaryMesh();
2142 oldPatchMeshPointMaps.setSize(boundary.size());
2143 oldPatchNMeshPoints.setSize(boundary.size());
2144 oldPatchStarts.setSize(boundary.size());
2149 oldPatchMeshPointMaps[
patchi] = boundary[
patchi].meshPointMap();
2150 oldPatchNMeshPoints[
patchi] = boundary[
patchi].meshPoints().size();
2157 oldMeshFaceZonesPointMaps.setSize(mesh.faceZones().size());
2159 forAll(mesh.faceZones(), zoneI)
2161 const faceZone& oldZone = mesh.faceZones()[zoneI];
2163 oldMeshFaceZonesPointMaps[zoneI] = oldZone().meshPointMap();
2174 nPatches_(nPatches),
2177 reversePointMap_(0),
2213 reversePointMap_(0),
2251 points_.clearStorage();
2252 pointMap_.clearStorage();
2253 reversePointMap_.clearStorage();
2256 oldPoints_.clearStorage();
2258 faces_.clearStorage();
2259 region_.clearStorage();
2260 faceOwner_.clearStorage();
2261 faceNeighbour_.clearStorage();
2262 faceMap_.clearStorage();
2263 reverseFaceMap_.clearStorage();
2271 cellMap_.clearStorage();
2272 reverseCellMap_.clearStorage();
2273 cellZone_.clearStorage();
2289 label maxRegion = nPatches_ - 1;
2292 maxRegion =
max(maxRegion, patchMap[i]);
2294 nPatches_ = maxRegion + 1;
2303 points_.setCapacity(points_.size() + points.
size());
2304 pointMap_.setCapacity(pointMap_.size() + points.
size());
2305 reversePointMap_.setCapacity(reversePointMap_.size() + points.
size());
2312 forAll(pointZones, zoneI)
2318 newZoneID[pointLabels[j]] = pointZoneMap[zoneI];
2323 for (
label pointi = 0; pointi < mesh.
nPoints(); pointi++)
2345 cellMap_.setCapacity(cellMap_.size() + nAllCells);
2346 reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
2347 cellFromPoint_.
resize(cellFromPoint_.
size() + nAllCells/100);
2348 cellFromEdge_.
resize(cellFromEdge_.
size() + nAllCells/100);
2349 cellFromFace_.
resize(cellFromFace_.
size() + nAllCells/100);
2350 cellZone_.setCapacity(cellZone_.size() + nAllCells);
2358 const labelList& cellLabels = cellZones[zoneI];
2362 label celli = cellLabels[j];
2364 if (newZoneID[celli] != -1)
2369 <<
" is in two zones:" 2370 << cellZones[newZoneID[celli]].
name()
2371 <<
" and " << cellZones[zoneI].
name() <<
endl 2372 <<
" This is not supported." 2373 <<
" Continuing with first zone only." <<
endl;
2377 newZoneID[celli] = cellZoneMap[zoneI];
2383 for (
label celli = 0; celli < nAllCells; celli++)
2386 addCell(-1, -1, -1, celli, newZoneID[celli]);
2401 faces_.setCapacity(faces_.size() + nAllFaces);
2402 region_.setCapacity(region_.size() + nAllFaces);
2403 faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
2404 faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
2405 faceMap_.setCapacity(faceMap_.size() + nAllFaces);
2406 reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
2407 faceFromPoint_.
resize(faceFromPoint_.
size() + nAllFaces/100);
2408 faceFromEdge_.
resize(faceFromEdge_.
size() + nAllFaces/100);
2409 flipFaceFlux_.
setCapacity(faces_.size() + nAllFaces);
2410 faceZone_.
resize(faceZone_.
size() + nAllFaces/100);
2411 faceZoneFlip_.
setCapacity(faces_.size() + nAllFaces);
2416 boolList zoneFlip(nAllFaces,
false);
2420 const labelList& faceLabels = faceZones[zoneI];
2421 const boolList& flipMap = faceZones[zoneI].flipMap();
2425 newZoneID[faceLabels[j]] = faceZoneMap[zoneI];
2426 zoneFlip[faceLabels[j]] = flipMap[j];
2439 faceNeighbour[facei],
2455 if (pp.
start() != faces_.size())
2459 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2461 <<
"Current face counter at " << faces_.size() <<
endl 2462 <<
"Are patches in incremental order?" 2490 const label nPoints,
2495 points_.setCapacity(nPoints);
2496 pointMap_.setCapacity(nPoints);
2497 reversePointMap_.setCapacity(nPoints);
2498 pointZone_.
resize(pointZone_.
size() + nPoints/100);
2500 faces_.setCapacity(nFaces);
2501 region_.setCapacity(nFaces);
2502 faceOwner_.setCapacity(nFaces);
2503 faceNeighbour_.setCapacity(nFaces);
2504 faceMap_.setCapacity(nFaces);
2505 reverseFaceMap_.setCapacity(nFaces);
2506 faceFromPoint_.
resize(faceFromPoint_.
size() + nFaces/100);
2507 faceFromEdge_.
resize(faceFromEdge_.
size() + nFaces/100);
2509 faceZone_.
resize(faceZone_.
size() + nFaces/100);
2512 cellMap_.setCapacity(nCells);
2513 reverseCellMap_.setCapacity(nCells);
2514 cellFromPoint_.
resize(cellFromPoint_.
size() + nCells/100);
2515 cellFromEdge_.
resize(cellFromEdge_.
size() + nCells/100);
2516 cellFromFace_.
resize(cellFromFace_.
size() + nCells/100);
2517 cellZone_.setCapacity(nCells);
2523 if (isType<polyAddPoint>(action))
2525 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2535 else if (isType<polyModifyPoint>(action))
2549 else if (isType<polyRemovePoint>(action))
2557 else if (isType<polyAddFace>(action))
2559 const polyAddFace& paf = refCast<const polyAddFace>(action);
2575 else if (isType<polyModifyFace>(action))
2577 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2593 else if (isType<polyRemoveFace>(action))
2595 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2601 else if (isType<polyAddCell>(action))
2603 const polyAddCell& pac = refCast<const polyAddCell>(action);
2614 else if (isType<polyModifyCell>(action))
2616 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2629 else if (isType<polyRemoveCell>(action))
2631 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2640 <<
"Unknown type of topoChange: " << action.type()
2652 const label masterPointID,
2657 label pointi = points_.size();
2660 pointMap_.append(masterPointID);
2661 reversePointMap_.append(pointi);
2665 pointZone_.
insert(pointi, zoneID);
2670 retiredPoints_.
insert(pointi);
2681 const label newZoneID,
2685 if (pointi < 0 || pointi >= points_.size())
2688 <<
"illegal point label " << pointi <<
endl 2689 <<
"Valid point labels are 0 .. " << points_.size()-1
2695 <<
"point " << pointi <<
" already marked for removal" 2698 points_[pointi] = pt;
2702 if (pointFnd != pointZone_.
end())
2706 pointFnd() = newZoneID;
2710 pointZone_.
erase(pointFnd);
2713 else if (newZoneID >= 0)
2715 pointZone_.
insert(pointi, newZoneID);
2720 retiredPoints_.
erase(pointi);
2724 retiredPoints_.
insert(pointi);
2727 oldPoints_.erase(pointi);
2735 const label masterPointID,
2739 label pointi = points_.size();
2742 pointMap_.append(masterPointID);
2743 reversePointMap_.append(pointi);
2747 pointZone_.
insert(pointi, zoneID);
2750 oldPoints_.insert(pointi, oldPt);
2761 const label newZoneID
2764 if (pointi < 0 || pointi >= points_.size())
2767 <<
"illegal point label " << pointi <<
endl 2768 <<
"Valid point labels are 0 .. " << points_.size()-1
2774 <<
"point " << pointi <<
" already marked for removal" 2777 points_[pointi] = pt;
2781 if (pointFnd != pointZone_.
end())
2785 pointFnd() = newZoneID;
2789 pointZone_.
erase(pointFnd);
2792 else if (newZoneID >= 0)
2794 pointZone_.
insert(pointi, newZoneID);
2798 retiredPoints_.
erase(pointi);
2801 oldPoints_.set(pointi, oldPt);
2807 if (newPoints.
size() != points_.size())
2810 <<
"illegal pointField size." <<
endl 2811 <<
"Size:" << newPoints.
size() <<
endl 2812 <<
"Points in mesh:" << points_.size()
2818 points_[pointi] = newPoints[pointi];
2826 const label mergePointi
2829 if (pointi < 0 || pointi >= points_.size())
2832 <<
"illegal point label " << pointi <<
endl 2833 <<
"Valid point labels are 0 .. " << points_.size()-1
2844 <<
"point " << pointi <<
" already marked for removal" << nl
2845 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
2849 if (pointi == mergePointi)
2852 <<
"Cannot remove/merge point " << pointi <<
" onto itself." 2857 pointMap_[pointi] = -1;
2858 if (mergePointi >= 0)
2860 reversePointMap_[pointi] = -mergePointi-2;
2864 reversePointMap_[pointi] = -1;
2866 pointZone_.
erase(pointi);
2867 retiredPoints_.
erase(pointi);
2868 oldPoints_.erase(pointi);
2877 const label masterPointID,
2878 const label masterEdgeID,
2879 const label masterFaceID,
2880 const bool flipFaceFlux,
2881 const label patchID,
2889 checkFace(f, -1, own, nei, patchID, zoneID);
2892 label facei = faces_.size();
2895 region_.append(patchID);
2896 faceOwner_.append(own);
2897 faceNeighbour_.append(nei);
2899 if (masterPointID >= 0)
2901 faceMap_.append(-1);
2902 faceFromPoint_.
insert(facei, masterPointID);
2904 else if (masterEdgeID >= 0)
2906 faceMap_.append(-1);
2907 faceFromEdge_.
insert(facei, masterEdgeID);
2909 else if (masterFaceID >= 0)
2911 faceMap_.append(masterFaceID);
2920 faceMap_.append(-1);
2922 reverseFaceMap_.append(facei);
2924 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2928 faceZone_.
insert(facei, zoneID);
2930 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2942 const bool flipFaceFlux,
2943 const label patchID,
2951 checkFace(f, facei, own, nei, patchID, zoneID);
2955 faceOwner_[facei] = own;
2956 faceNeighbour_[facei] = nei;
2957 region_[facei] = patchID;
2959 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2963 if (faceFnd != faceZone_.
end())
2971 faceZone_.
erase(faceFnd);
2974 else if (zoneID >= 0)
2976 faceZone_.
insert(facei, zoneID);
2978 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2984 if (facei < 0 || facei >= faces_.size())
2987 <<
"illegal face label " << facei <<
endl 2988 <<
"Valid face labels are 0 .. " << faces_.size()-1
3000 <<
" already marked for removal" 3004 faces_[facei].setSize(0);
3005 region_[facei] = -1;
3006 faceOwner_[facei] = -1;
3007 faceNeighbour_[facei] = -1;
3008 faceMap_[facei] = -1;
3009 if (mergeFacei >= 0)
3011 reverseFaceMap_[facei] = -mergeFacei-2;
3015 reverseFaceMap_[facei] = -1;
3017 faceFromEdge_.
erase(facei);
3018 faceFromPoint_.
erase(facei);
3019 flipFaceFlux_[facei] = 0;
3020 faceZone_.
erase(facei);
3021 faceZoneFlip_[facei] = 0;
3027 const label masterPointID,
3028 const label masterEdgeID,
3029 const label masterFaceID,
3030 const label masterCellID,
3034 label celli = cellMap_.size();
3036 if (masterPointID >= 0)
3038 cellMap_.append(-1);
3039 cellFromPoint_.
insert(celli, masterPointID);
3041 else if (masterEdgeID >= 0)
3043 cellMap_.append(-1);
3044 cellFromEdge_.
insert(celli, masterEdgeID);
3046 else if (masterFaceID >= 0)
3048 cellMap_.append(-1);
3049 cellFromFace_.
insert(celli, masterFaceID);
3053 cellMap_.append(masterCellID);
3055 reverseCellMap_.append(celli);
3056 cellZone_.append(zoneID);
3068 cellZone_[celli] = zoneID;
3074 if (celli < 0 || celli >= cellMap_.size())
3077 <<
"illegal cell label " << celli <<
endl 3078 <<
"Valid cell labels are 0 .. " << cellMap_.size()-1
3082 if (strict_ && cellMap_[celli] == -2)
3086 <<
" already marked for removal" 3090 cellMap_[celli] = -2;
3091 if (mergeCelli >= 0)
3093 reverseCellMap_[celli] = -mergeCelli-2;
3097 reverseCellMap_[celli] = -1;
3099 cellFromPoint_.
erase(celli);
3100 cellFromEdge_.
erase(celli);
3101 cellFromFace_.
erase(celli);
3102 cellZone_[celli] = -1;
3110 const bool syncParallel,
3111 const bool orderCells,
3112 const bool orderPoints
3117 Pout<<
"polyTopoChange::changeMesh" 3118 <<
"(polyMesh&, const bool, const bool, const bool, const bool)" 3124 Pout<<
"Old mesh:" <<
nl;
3125 writeMeshStats(mesh,
Pout);
3131 label nInternalPoints;
3170 oldPatchMeshPointMaps,
3171 oldPatchNMeshPoints,
3173 oldMeshFaceZonesPointMaps
3194 forAll(pointMap_, newPointi)
3197 if (iter != oldPoints_.end())
3199 renumberedMeshPoints[
newPointi] = iter();
3218 move(renumberedMeshPoints),
3221 move(faceNeighbour_),
3235 move(faceNeighbour_),
3245 oldPoints_.clearStorage();
3246 region_.clearStorage();
3253 label nAdd, nInflate, nMerge, nRemove;
3254 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3256 <<
" added(from point):" << nAdd
3257 <<
" added(from nothing):" << nInflate
3258 <<
" merged(into other point):" << nMerge
3259 <<
" removed:" << nRemove
3262 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3264 <<
" added(from face):" << nAdd
3265 <<
" added(inflated):" << nInflate
3266 <<
" merged(into other face):" << nMerge
3267 <<
" removed:" << nRemove
3270 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3272 <<
" added(from cell):" << nAdd
3273 <<
" added(inflated):" << nInflate
3274 <<
" merged(into other cell):" << nMerge
3275 <<
" removed:" << nRemove
3282 Pout<<
"New mesh:" <<
nl;
3283 writeMeshStats(mesh,
Pout);
3297 resetZones(mesh, mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3304 cellZone_.clearStorage();
3314 oldPatchMeshPointMaps,
3321 calcFaceZonePointMap(mesh, oldMeshFaceZonesPointMaps, faceZonePointMap);
3323 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3364 oldPatchNMeshPoints,
3382 const bool syncParallel,
3383 const bool orderCells,
3384 const bool orderPoints
3389 Pout<<
"polyTopoChange::changeMesh" 3390 <<
"(autoPtr<fvMesh>&, const IOobject&, const fvMesh&" 3391 <<
", const bool, const bool, const bool)" 3397 Pout<<
"Old mesh:" <<
nl;
3398 writeMeshStats(mesh,
Pout);
3404 label nInternalPoints;
3444 oldPatchMeshPointMaps,
3445 oldPatchNMeshPoints,
3447 oldMeshFaceZonesPointMaps
3469 move(faceNeighbour_)
3472 fvMesh& newMesh = newMeshPtr();
3477 oldPoints_.clearStorage();
3478 region_.clearStorage();
3485 label nAdd, nInflate, nMerge, nRemove;
3486 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3488 <<
" added(from point):" << nAdd
3489 <<
" added(from nothing):" << nInflate
3490 <<
" merged(into other point):" << nMerge
3491 <<
" removed:" << nRemove
3494 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3496 <<
" added(from face):" << nAdd
3497 <<
" added(inflated):" << nInflate
3498 <<
" merged(into other face):" << nMerge
3499 <<
" removed:" << nRemove
3502 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3504 <<
" added(from cell):" << nAdd
3505 <<
" added(inflated):" << nInflate
3506 <<
" merged(into other cell):" << nMerge
3507 <<
" removed:" << nRemove
3518 forAll(oldPatches, patchi)
3543 oldPointZones[i].
name(),
3558 oldFaceZones[i].
name(),
3574 oldCellZones[i].
name(),
3582 newMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
3591 resetZones(mesh, newMesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3598 cellZone_.clearStorage();
3607 oldPatchMeshPointMaps,
3614 calcFaceZonePointMap(newMesh, oldMeshFaceZonesPointMaps, faceZonePointMap);
3618 Pout<<
"New mesh:" <<
nl;
3619 writeMeshStats(mesh,
Pout);
3622 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3663 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.
#define forAll(list, i)
Loop across all elements in list.
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.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
FvWallInfoData< WallInfo, label > 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.
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)
const meshCellZones & cellZones() const
Return cell zones.
void addFvPatches(const List< polyPatch *> &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
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.
Holds information (coordinate and normal) regarding nearest wall point.
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.
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.
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.
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
const meshPointZones & pointZones() const
Return point zones.
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.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label mergeCellID() const
Return cell ID.
label zoneID() const
Cell zone ID.
virtual const labelList & faceOwner() const
Return face owner.
label masterFaceID() const
Return master face ID.
label masterPointID() const
Return master point ID.
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.
virtual const faceList & faces() const
Return raw faces.
MeshZones< pointZone, polyMesh > meshPointZones
A MeshZones with the type pointZone.
void addZones(const List< pointZone *> &pz, const List< faceZone *> &fz, const List< cellZone *> &cz)
Add mesh zones.
const vectorField & cellCentres() const
errorManip< error > abort(error &err)
MeshZones< cellZone, polyMesh > meshCellZones
A MeshZones with the type cellZone.
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.
MeshZones< faceZone, polyMesh > meshFaceZones
A MeshZones with the type faceZone.
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 neighbour 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")
const meshFaceZones & faceZones() const
Return face zones.
Mesh data needed to do the Finite Volume discretisation.
label start() const
Return start label of this patch in the polyMesh face list.
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.
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.
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.