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 renumber(localPointMap, retiredPoints_);
1083 face& f = faces_[facei];
1086 renumberCompact(localPointMap, f);
1088 if (!faceRemoved(facei) && f.size() < 3)
1091 <<
"Created illegal face " << f
1093 <<
" at position:" << facei
1094 <<
" when filtering removed points" 1103 labelList localFaceMap(faces_.size(), -1);
1108 if (!faceRemoved(facei) && faceOwner_[facei] >= 0)
1110 localFaceMap[facei] = newFacei++;
1113 nActiveFaces_ = newFacei;
1117 if (!faceRemoved(facei) && faceOwner_[facei] < 0)
1120 localFaceMap[facei] = newFacei++;
1126 Pout<<
"Faces : active:" << nActiveFaces_
1127 <<
" removed:" << faces_.size()-newFacei <<
endl;
1131 reorderCompactFaces(newFacei, localFaceMap);
1142 CompactListList<label> cellCells;
1143 makeCellCells(nActiveFaces_, cellCells);
1146 newCelli = getCellOrder(cellCells, localCellMap);
1151 localCellMap.setSize(cellMap_.size());
1157 if (!cellRemoved(celli))
1159 localCellMap[celli] = newCelli++;
1166 Pout<<
"Cells : active:" << newCelli
1167 <<
" removed:" << cellMap_.size()-newCelli <<
endl;
1171 if (orderCells || (newCelli != cellMap_.size()))
1173 reorder(localCellMap, cellMap_);
1174 cellMap_.setCapacity(newCelli);
1175 renumberReverseMap(localCellMap, reverseCellMap_);
1177 reorder(localCellMap, cellZone_);
1178 cellZone_.setCapacity(newCelli);
1180 renumberKey(localCellMap, cellFromPoint_);
1181 renumberKey(localCellMap, cellFromEdge_);
1182 renumberKey(localCellMap, cellFromFace_);
1186 forAll(faceOwner_, facei)
1188 label own = faceOwner_[facei];
1189 label nei = faceNeighbour_[facei];
1194 faceOwner_[facei] = localCellMap[own];
1199 faceNeighbour_[facei] = localCellMap[nei];
1204 faceNeighbour_[facei] >= 0
1205 && faceNeighbour_[facei] < faceOwner_[facei]
1208 faces_[facei].flip();
1209 Swap(faceOwner_[facei], faceNeighbour_[facei]);
1210 flipFaceFlux_[facei] =
1212 flipFaceFlux_[facei]
1216 faceZoneFlip_[facei] =
1218 faceZoneFlip_[facei]
1228 faceNeighbour_[facei] = localCellMap[nei];
1239 makeCells(nActiveFaces_, cellFaces, cellFaceOffsets);
1255 reorderCompactFaces(localFaceMap.size(), localFaceMap);
1269 const primitiveMesh& mesh,
1271 const bool internalFacesOnly
1278 label facei = faceLabels[i];
1280 if (internalFacesOnly == mesh.isInternalFace(facei))
1292 collectedFaces = faceLabels;
1296 collectedFaces.
setSize(nFaces);
1302 label facei = faceLabels[i];
1304 if (internalFacesOnly == mesh.isInternalFace(facei))
1306 collectedFaces[nFaces++] = facei;
1311 return collectedFaces;
1317 void Foam::polyTopoChange::calcPatchPointMap
1319 const List<Map<label>>& oldPatchMeshPointMaps,
1320 const polyBoundaryMesh& boundary,
1324 patchPointMap.setSize(boundary.size());
1330 const Map<label>& oldMeshPointMap = oldPatchMeshPointMaps[
patchi];
1334 curPatchPointRnb.
setSize(meshPoints.size());
1338 if (meshPoints[i] < pointMap_.size())
1343 pointMap_[meshPoints[i]]
1346 if (ozmpmIter != oldMeshPointMap.end())
1348 curPatchPointRnb[i] = ozmpmIter();
1352 curPatchPointRnb[i] = -1;
1357 curPatchPointRnb[i] = -1;
1364 void Foam::polyTopoChange::calcFaceInflationMaps
1366 const polyMesh& mesh,
1367 List<objectMap>& facesFromPoints,
1368 List<objectMap>& facesFromEdges,
1369 List<objectMap>& facesFromFaces
1375 facesFromPoints.setSize(faceFromPoint_.size());
1377 if (faceFromPoint_.size())
1379 label nFacesFromPoints = 0;
1384 label newFacei = iter.key();
1386 if (region_[newFacei] == -1)
1389 facesFromPoints[nFacesFromPoints++] = objectMap
1395 mesh.pointFaces()[iter()],
1403 facesFromPoints[nFacesFromPoints++] = objectMap
1409 mesh.pointFaces()[iter()],
1421 facesFromEdges.setSize(faceFromEdge_.size());
1423 if (faceFromEdge_.size())
1425 label nFacesFromEdges = 0;
1430 label newFacei = iter.key();
1432 if (region_[newFacei] == -1)
1435 facesFromEdges[nFacesFromEdges++] = objectMap
1441 mesh.edgeFaces(iter()),
1449 facesFromEdges[nFacesFromEdges++] = objectMap
1455 mesh.edgeFaces(iter()),
1476 void Foam::polyTopoChange::calcCellInflationMaps
1478 const polyMesh& mesh,
1479 List<objectMap>& cellsFromPoints,
1480 List<objectMap>& cellsFromEdges,
1481 List<objectMap>& cellsFromFaces,
1482 List<objectMap>& cellsFromCells
1485 cellsFromPoints.setSize(cellFromPoint_.size());
1487 if (cellFromPoint_.size())
1489 label nCellsFromPoints = 0;
1494 cellsFromPoints[nCellsFromPoints++] = objectMap
1497 mesh.pointCells()[iter()]
1503 cellsFromEdges.setSize(cellFromEdge_.size());
1505 if (cellFromEdge_.size())
1507 label nCellsFromEdges = 0;
1512 cellsFromEdges[nCellsFromEdges++] = objectMap
1515 mesh.edgeCells()[iter()]
1521 cellsFromFaces.setSize(cellFromFace_.size());
1523 if (cellFromFace_.size())
1525 label nCellsFromFaces = 0;
1532 label oldFacei = iter();
1534 if (mesh.isInternalFace(oldFacei))
1536 twoCells[0] = mesh.faceOwner()[oldFacei];
1537 twoCells[1] = mesh.faceNeighbour()[oldFacei];
1538 cellsFromFaces[nCellsFromFaces++] = objectMap
1546 cellsFromFaces[nCellsFromFaces++] = objectMap
1549 labelList(1, mesh.faceOwner()[oldFacei])
1568 void Foam::polyTopoChange::resetZones
1570 const polyMesh& mesh,
1580 pointZoneMap.setSize(mesh.pointZones().size());
1590 label zoneI = iter();
1592 if (zoneI < 0 || zoneI >= pointZones.size())
1595 <<
"Illegal zoneID " << zoneI <<
" for point " 1596 << iter.key() <<
" coord " << mesh.points()[iter.key()]
1605 forAll(addressing, zoneI)
1607 addressing[zoneI].setSize(nPoints[zoneI]);
1613 label zoneI = iter();
1615 addressing[zoneI][nPoints[zoneI]++] = iter.key();
1618 forAll(addressing, zoneI)
1625 forAll(addressing, zoneI)
1627 const pointZone& oldZone = pointZones[zoneI];
1628 const labelList& newZoneAddr = addressing[zoneI];
1630 labelList& curPzRnb = pointZoneMap[zoneI];
1631 curPzRnb.
setSize(newZoneAddr.size());
1635 if (newZoneAddr[i] < pointMap_.size())
1637 curPzRnb[i] = oldZone.whichPoint(pointMap_[newZoneAddr[i]]);
1647 newMesh.pointZones().clearAddressing();
1648 forAll(newMesh.pointZones(), zoneI)
1652 Pout<<
"pointZone:" << zoneI
1653 <<
" name:" << newMesh.pointZones()[zoneI].
name()
1654 <<
" size:" << addressing[zoneI].size()
1658 newMesh.pointZones()[zoneI] = addressing[zoneI];
1666 faceZoneFaceMap.setSize(mesh.faceZones().size());
1674 label zoneI = iter();
1676 if (zoneI < 0 || zoneI >= faceZones.size())
1679 <<
"Illegal zoneID " << zoneI <<
" for face " 1689 forAll(addressing, zoneI)
1691 addressing[zoneI].setSize(nFaces[zoneI]);
1692 flipMode[zoneI].setSize(nFaces[zoneI]);
1698 label zoneI = iter();
1699 label facei = iter.key();
1701 label index = nFaces[zoneI]++;
1703 addressing[zoneI][index] = facei;
1704 flipMode[zoneI][index] = faceZoneFlip_[facei];
1707 forAll(addressing, zoneI)
1712 labelList newAddressing(addressing[zoneI].size());
1715 newAddressing[i] = addressing[zoneI][newToOld[i]];
1717 addressing[zoneI].transfer(newAddressing);
1720 boolList newFlipMode(flipMode[zoneI].size());
1723 newFlipMode[i] = flipMode[zoneI][newToOld[i]];
1725 flipMode[zoneI].transfer(newFlipMode);
1731 forAll(addressing, zoneI)
1733 const faceZone& oldZone = faceZones[zoneI];
1734 const labelList& newZoneAddr = addressing[zoneI];
1736 labelList& curFzFaceRnb = faceZoneFaceMap[zoneI];
1738 curFzFaceRnb.
setSize(newZoneAddr.size());
1742 if (newZoneAddr[i] < faceMap_.size())
1745 oldZone.whichFace(faceMap_[newZoneAddr[i]]);
1749 curFzFaceRnb[i] = -1;
1756 newMesh.faceZones().clearAddressing();
1757 forAll(newMesh.faceZones(), zoneI)
1761 Pout<<
"faceZone:" << zoneI
1762 <<
" name:" << newMesh.faceZones()[zoneI].
name()
1763 <<
" size:" << addressing[zoneI].size()
1767 newMesh.faceZones()[zoneI].resetAddressing
1779 cellZoneMap.setSize(mesh.cellZones().size());
1787 label zoneI = cellZone_[celli];
1789 if (zoneI >= cellZones.size())
1792 <<
"Illegal zoneID " << zoneI <<
" for cell " 1803 forAll(addressing, zoneI)
1805 addressing[zoneI].setSize(nCells[zoneI]);
1811 label zoneI = cellZone_[celli];
1815 addressing[zoneI][nCells[zoneI]++] = celli;
1819 forAll(addressing, zoneI)
1826 forAll(addressing, zoneI)
1828 const cellZone& oldZone = cellZones[zoneI];
1829 const labelList& newZoneAddr = addressing[zoneI];
1831 labelList& curCellRnb = cellZoneMap[zoneI];
1833 curCellRnb.
setSize(newZoneAddr.size());
1837 if (newZoneAddr[i] < cellMap_.size())
1840 oldZone.whichCell(cellMap_[newZoneAddr[i]]);
1850 newMesh.cellZones().clearAddressing();
1851 forAll(newMesh.cellZones(), zoneI)
1855 Pout<<
"cellZone:" << zoneI
1856 <<
" name:" << newMesh.cellZones()[zoneI].
name()
1857 <<
" size:" << addressing[zoneI].size()
1861 newMesh.cellZones()[zoneI] = addressing[zoneI];
1867 void Foam::polyTopoChange::calcFaceZonePointMap
1869 const polyMesh& mesh,
1870 const List<Map<label>>& oldFaceZoneMeshPointMaps,
1876 faceZonePointMap.
setSize(faceZones.size());
1880 const faceZone& newZone = faceZones[zoneI];
1882 const labelList& newZoneMeshPoints = newZone().meshPoints();
1884 const Map<label>& oldZoneMeshPointMap = oldFaceZoneMeshPointMaps[zoneI];
1886 labelList& curFzPointRnb = faceZonePointMap[zoneI];
1888 curFzPointRnb.
setSize(newZoneMeshPoints.size());
1890 forAll(newZoneMeshPoints, pointi)
1892 if (newZoneMeshPoints[pointi] < pointMap_.size())
1895 oldZoneMeshPointMap.find
1897 pointMap_[newZoneMeshPoints[pointi]]
1900 if (ozmpmIter != oldZoneMeshPointMap.end())
1902 curFzPointRnb[pointi] = ozmpmIter();
1906 curFzPointRnb[pointi] = -1;
1911 curFzPointRnb[pointi] = -1;
1918 void Foam::polyTopoChange::reorderCoupledFaces
1920 const bool syncParallel,
1921 const polyBoundaryMesh& boundary,
1939 if (syncParallel || !isA<processorPolyPatch>(boundary[patchi]))
1941 boundary[
patchi].initOrder
1960 pBufs.finishedSends();
1965 bool anyChanged =
false;
1969 if (syncParallel || !isA<processorPolyPatch>(boundary[patchi]))
1971 labelList patchFaceMap(patchSizes[patchi], -1);
1972 labelList patchFaceRotation(patchSizes[patchi], 0);
1974 bool changed = boundary[
patchi].order
1996 forAll(patchFaceMap, patchFacei)
1998 oldToNew[patchFacei + start] =
1999 start + patchFaceMap[patchFacei];
2002 forAll(patchFaceRotation, patchFacei)
2004 rotation[patchFacei + start] =
2005 patchFaceRotation[patchFacei];
2015 reduce(anyChanged, orOp<bool>());
2021 reorderCompactFaces(oldToNew.size(), oldToNew);
2026 if (rotation[facei] != 0)
2028 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
2035 void Foam::polyTopoChange::compactAndReorder
2037 const polyMesh& mesh,
2038 const bool syncParallel,
2039 const bool orderCells,
2040 const bool orderPoints,
2042 label& nInternalPoints,
2046 List<objectMap>& pointsFromPoints,
2047 List<objectMap>& facesFromPoints,
2048 List<objectMap>& facesFromEdges,
2049 List<objectMap>& facesFromFaces,
2050 List<objectMap>& cellsFromPoints,
2051 List<objectMap>& cellsFromEdges,
2052 List<objectMap>& cellsFromFaces,
2053 List<objectMap>& cellsFromCells,
2054 List<Map<label>>& oldPatchMeshPointMaps,
2057 List<Map<label>>& oldFaceZoneMeshPointMaps
2060 if (mesh.boundaryMesh().size() != nPatches_)
2063 <<
"polyTopoChange was constructed with a mesh with " 2064 << nPatches_ <<
" patches." <<
endl 2065 <<
"The mesh now provided has a different number of patches " 2066 << mesh.boundaryMesh().size()
2067 <<
" which is illegal" <<
endl 2073 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2077 newPoints.transfer(points_);
2083 mesh.boundaryMesh(),
2109 calcFaceInflationMaps
2117 calcCellInflationMaps
2128 faceFromPoint_.clearStorage();
2129 faceFromEdge_.clearStorage();
2131 cellFromPoint_.clearStorage();
2132 cellFromEdge_.clearStorage();
2133 cellFromFace_.clearStorage();
2137 const polyBoundaryMesh& boundary = mesh.boundaryMesh();
2140 oldPatchMeshPointMaps.setSize(boundary.size());
2141 oldPatchNMeshPoints.setSize(boundary.size());
2142 oldPatchStarts.setSize(boundary.size());
2147 oldPatchMeshPointMaps[
patchi] = boundary[
patchi].meshPointMap();
2148 oldPatchNMeshPoints[
patchi] = boundary[
patchi].meshPoints().size();
2155 oldFaceZoneMeshPointMaps.setSize(mesh.faceZones().size());
2157 forAll(mesh.faceZones(), zoneI)
2159 const faceZone& oldZone = mesh.faceZones()[zoneI];
2161 oldFaceZoneMeshPointMaps[zoneI] = oldZone().meshPointMap();
2172 nPatches_(nPatches),
2175 reversePointMap_(0),
2210 reversePointMap_(0),
2247 points_.clearStorage();
2253 faces_.clearStorage();
2284 label maxRegion = nPatches_ - 1;
2287 maxRegion =
max(maxRegion, patchMap[i]);
2289 nPatches_ = maxRegion + 1;
2298 points_.setCapacity(points_.size() + points.
size());
2306 forAll(pointZones, zoneI)
2312 newZoneID[pointLabels[j]] = pointZoneMap[zoneI];
2317 for (
label pointi = 0; pointi < mesh.
nPoints(); pointi++)
2341 cellFromPoint_.
resize(cellFromPoint_.
size() + nAllCells/100);
2342 cellFromEdge_.
resize(cellFromEdge_.
size() + nAllCells/100);
2343 cellFromFace_.
resize(cellFromFace_.
size() + nAllCells/100);
2352 const labelList& cellLabels = cellZones[zoneI];
2356 label celli = cellLabels[j];
2358 if (newZoneID[celli] != -1)
2363 <<
" is in two zones:" 2364 << cellZones[newZoneID[celli]].
name()
2365 <<
" and " << cellZones[zoneI].
name() <<
endl 2366 <<
" This is not supported." 2367 <<
" Continuing with first zone only." <<
endl;
2371 newZoneID[celli] = cellZoneMap[zoneI];
2377 for (
label celli = 0; celli < nAllCells; celli++)
2380 addCell(-1, -1, -1, celli, newZoneID[celli]);
2395 faces_.setCapacity(faces_.size() + nAllFaces);
2401 faceFromPoint_.
resize(faceFromPoint_.
size() + nAllFaces/100);
2402 faceFromEdge_.
resize(faceFromEdge_.
size() + nAllFaces/100);
2403 flipFaceFlux_.
setCapacity(faces_.size() + nAllFaces);
2404 faceZone_.
resize(faceZone_.
size() + nAllFaces/100);
2405 faceZoneFlip_.
setCapacity(faces_.size() + nAllFaces);
2410 boolList zoneFlip(nAllFaces,
false);
2414 const labelList& faceLabels = faceZones[zoneI];
2415 const boolList& flipMap = faceZones[zoneI].flipMap();
2419 newZoneID[faceLabels[j]] = faceZoneMap[zoneI];
2420 zoneFlip[faceLabels[j]] = flipMap[j];
2433 faceNeighbour[facei],
2449 if (pp.
start() != faces_.size())
2453 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2455 <<
"Current face counter at " << faces_.size() <<
endl 2456 <<
"Are patches in incremental order?" 2484 const label nPoints,
2489 points_.setCapacity(nPoints);
2492 pointZone_.
resize(pointZone_.
size() + nPoints/100);
2494 faces_.setCapacity(nFaces);
2500 faceFromPoint_.
resize(faceFromPoint_.
size() + nFaces/100);
2501 faceFromEdge_.
resize(faceFromEdge_.
size() + nFaces/100);
2503 faceZone_.
resize(faceZone_.
size() + nFaces/100);
2508 cellFromPoint_.
resize(cellFromPoint_.
size() + nCells/100);
2509 cellFromEdge_.
resize(cellFromEdge_.
size() + nCells/100);
2510 cellFromFace_.
resize(cellFromFace_.
size() + nCells/100);
2517 if (isType<polyAddPoint>(action))
2519 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2529 else if (isType<polyModifyPoint>(action))
2543 else if (isType<polyRemovePoint>(action))
2551 else if (isType<polyAddFace>(action))
2553 const polyAddFace& paf = refCast<const polyAddFace>(action);
2569 else if (isType<polyModifyFace>(action))
2571 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2587 else if (isType<polyRemoveFace>(action))
2589 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2595 else if (isType<polyAddCell>(action))
2597 const polyAddCell& pac = refCast<const polyAddCell>(action);
2608 else if (isType<polyModifyCell>(action))
2610 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2623 else if (isType<polyRemoveCell>(action))
2625 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2634 <<
"Unknown type of topoChange: " << action.type()
2646 const label masterPointID,
2651 label pointi = points_.size();
2654 pointMap_.
append(masterPointID);
2655 reversePointMap_.
append(pointi);
2659 pointZone_.
insert(pointi, zoneID);
2664 retiredPoints_.
insert(pointi);
2675 const label newZoneID,
2679 if (pointi < 0 || pointi >= points_.size())
2682 <<
"illegal point label " << pointi <<
endl 2683 <<
"Valid point labels are 0 .. " << points_.size()-1
2689 <<
"point " << pointi <<
" already marked for removal" 2692 points_[pointi] = pt;
2696 if (pointFnd != pointZone_.
end())
2700 pointFnd() = newZoneID;
2704 pointZone_.
erase(pointFnd);
2707 else if (newZoneID >= 0)
2709 pointZone_.
insert(pointi, newZoneID);
2714 retiredPoints_.
erase(pointi);
2718 retiredPoints_.
insert(pointi);
2725 if (newPoints.
size() != points_.size())
2728 <<
"illegal pointField size." <<
endl 2729 <<
"Size:" << newPoints.
size() <<
endl 2730 <<
"Points in mesh:" << points_.size()
2736 points_[pointi] = newPoints[pointi];
2744 const label mergePointi
2747 if (pointi < 0 || pointi >= points_.size())
2750 <<
"illegal point label " << pointi <<
endl 2751 <<
"Valid point labels are 0 .. " << points_.size()-1
2762 <<
"point " << pointi <<
" already marked for removal" << nl
2763 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
2767 if (pointi == mergePointi)
2770 <<
"Cannot remove/merge point " << pointi <<
" onto itself." 2775 pointMap_[pointi] = -1;
2776 if (mergePointi >= 0)
2778 reversePointMap_[pointi] = -mergePointi-2;
2782 reversePointMap_[pointi] = -1;
2784 pointZone_.
erase(pointi);
2785 retiredPoints_.
erase(pointi);
2794 const label masterPointID,
2795 const label masterEdgeID,
2796 const label masterFaceID,
2797 const bool flipFaceFlux,
2798 const label patchID,
2806 checkFace(f, -1, own, nei, patchID, zoneID);
2809 label facei = faces_.size();
2814 faceNeighbour_.
append(nei);
2816 if (masterPointID >= 0)
2819 faceFromPoint_.
insert(facei, masterPointID);
2821 else if (masterEdgeID >= 0)
2824 faceFromEdge_.
insert(facei, masterEdgeID);
2826 else if (masterFaceID >= 0)
2828 faceMap_.
append(masterFaceID);
2839 reverseFaceMap_.
append(facei);
2841 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2845 faceZone_.
insert(facei, zoneID);
2847 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2859 const bool flipFaceFlux,
2860 const label patchID,
2868 checkFace(f, facei, own, nei, patchID, zoneID);
2872 faceOwner_[facei] = own;
2873 faceNeighbour_[facei] = nei;
2874 region_[facei] = patchID;
2876 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
2880 if (faceFnd != faceZone_.
end())
2888 faceZone_.
erase(faceFnd);
2891 else if (zoneID >= 0)
2893 faceZone_.
insert(facei, zoneID);
2895 faceZoneFlip_[facei] = (zoneFlip ? 1 : 0);
2901 if (facei < 0 || facei >= faces_.size())
2904 <<
"illegal face label " << facei <<
endl 2905 <<
"Valid face labels are 0 .. " << faces_.size()-1
2917 <<
" already marked for removal" 2921 faces_[facei].setSize(0);
2922 region_[facei] = -1;
2923 faceOwner_[facei] = -1;
2924 faceNeighbour_[facei] = -1;
2925 faceMap_[facei] = -1;
2926 if (mergeFacei >= 0)
2928 reverseFaceMap_[facei] = -mergeFacei-2;
2932 reverseFaceMap_[facei] = -1;
2934 faceFromEdge_.
erase(facei);
2935 faceFromPoint_.
erase(facei);
2936 flipFaceFlux_[facei] = 0;
2937 faceZone_.
erase(facei);
2938 faceZoneFlip_[facei] = 0;
2944 const label masterPointID,
2945 const label masterEdgeID,
2946 const label masterFaceID,
2947 const label masterCellID,
2953 if (masterPointID >= 0)
2956 cellFromPoint_.
insert(celli, masterPointID);
2958 else if (masterEdgeID >= 0)
2961 cellFromEdge_.
insert(celli, masterEdgeID);
2963 else if (masterFaceID >= 0)
2966 cellFromFace_.
insert(celli, masterFaceID);
2970 cellMap_.
append(masterCellID);
2972 reverseCellMap_.
append(celli);
2973 cellZone_.
append(zoneID);
2985 cellZone_[celli] = zoneID;
2991 if (celli < 0 || celli >= cellMap_.
size())
2994 <<
"illegal cell label " << celli <<
endl 2995 <<
"Valid cell labels are 0 .. " << cellMap_.
size()-1
2999 if (strict_ && cellMap_[celli] == -2)
3003 <<
" already marked for removal" 3007 cellMap_[celli] = -2;
3008 if (mergeCelli >= 0)
3010 reverseCellMap_[celli] = -mergeCelli-2;
3014 reverseCellMap_[celli] = -1;
3016 cellFromPoint_.
erase(celli);
3017 cellFromEdge_.
erase(celli);
3018 cellFromFace_.
erase(celli);
3019 cellZone_[celli] = -1;
3027 const bool syncParallel,
3028 const bool orderCells,
3029 const bool orderPoints
3034 Pout<<
"polyTopoChange::changeMesh" 3035 <<
"(polyMesh&, const bool, const bool, const bool, const bool)" 3041 Pout<<
"Old mesh:" <<
nl;
3042 writeMeshStats(mesh,
Pout);
3048 label nInternalPoints;
3087 oldPatchMeshPointMaps,
3088 oldPatchNMeshPoints,
3090 oldFaceZoneMeshPointMaps
3110 forAll(pointMap_, newPointi)
3129 faceNeighbour_.
xfer(),
3147 faceNeighbour_.
xfer(),
3165 label nAdd, nInflate, nMerge, nRemove;
3166 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3168 <<
" added(from point):" << nAdd
3169 <<
" added(from nothing):" << nInflate
3170 <<
" merged(into other point):" << nMerge
3171 <<
" removed:" << nRemove
3174 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3176 <<
" added(from face):" << nAdd
3177 <<
" added(inflated):" << nInflate
3178 <<
" merged(into other face):" << nMerge
3179 <<
" removed:" << nRemove
3182 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3184 <<
" added(from cell):" << nAdd
3185 <<
" added(inflated):" << nInflate
3186 <<
" merged(into other cell):" << nMerge
3187 <<
" removed:" << nRemove
3194 Pout<<
"New mesh:" <<
nl;
3195 writeMeshStats(mesh,
Pout);
3209 resetZones(mesh, mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3226 oldPatchMeshPointMaps,
3233 calcFaceZonePointMap(mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3235 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3276 oldPatchNMeshPoints,
3294 const bool syncParallel,
3295 const bool orderCells,
3296 const bool orderPoints
3301 Pout<<
"polyTopoChange::changeMesh" 3302 <<
"(autoPtr<fvMesh>&, const IOobject&, const fvMesh&" 3303 <<
", const bool, const bool, const bool)" 3309 Pout<<
"Old mesh:" <<
nl;
3310 writeMeshStats(mesh,
Pout);
3316 label nInternalPoints;
3356 oldPatchMeshPointMaps,
3357 oldPatchNMeshPoints,
3359 oldFaceZoneMeshPointMaps
3381 faceNeighbour_.
xfer()
3384 fvMesh& newMesh = newMeshPtr();
3396 label nAdd, nInflate, nMerge, nRemove;
3397 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3399 <<
" added(from point):" << nAdd
3400 <<
" added(from nothing):" << nInflate
3401 <<
" merged(into other point):" << nMerge
3402 <<
" removed:" << nRemove
3405 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3407 <<
" added(from face):" << nAdd
3408 <<
" added(inflated):" << nInflate
3409 <<
" merged(into other face):" << nMerge
3410 <<
" removed:" << nRemove
3413 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3415 <<
" added(from cell):" << nAdd
3416 <<
" added(inflated):" << nInflate
3417 <<
" merged(into other cell):" << nMerge
3418 <<
" removed:" << nRemove
3429 forAll(oldPatches, patchi)
3454 oldPointZones[i].
name(),
3469 oldFaceZones[i].
name(),
3485 oldCellZones[i].
name(),
3493 newMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
3502 resetZones(mesh, newMesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3518 oldPatchMeshPointMaps,
3525 calcFaceZonePointMap(newMesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3529 Pout<<
"New mesh:" <<
nl;
3530 writeMeshStats(mesh,
Pout);
3533 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3574 oldPatchNMeshPoints,
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
static const Vector< scalar > max
const point & newPoint() const
Point location.
Class containing data for face removal.
List< labelList > labelListList
A List of labelList.
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
#define forAll(list, i)
Loop across all elements in list.
bool removeFromZone() const
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
label zoneID() const
Cell zone ID.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Class describing modification of a face.
A face is a list of labels corresponding to mesh vertices.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
label faceID() const
Return face ID.
polyTopoChange(const label nPatches, const bool strict=true)
Construct without mesh. Either specify nPatches or use.
label masterFaceID() const
Return master face ID.
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.
label patchID() const
Boundary patch ID.
label zoneID() const
Cell zone ID.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label zoneID() const
Point zone ID.
label zoneID() const
Face zone ID.
labelList pointLabels(nPoints,-1)
void size(const label)
Override size to be inconsistent with allocated storage.
void setCapacity(const label)
Alter the size of the underlying storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label pointID() const
Point ID.
bool faceRemoved(const label facei) const
Is face removed?
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
Class containing data for point addition.
label size() const
Return number of elements in table.
label owner() const
Return owner cell ID.
void removePoint(const label, const label)
Remove/merge point.
label masterPointID() const
Master point label.
bool pointRemoved(const label pointi) const
Is point removed?
bool flipFaceFlux() const
Does the face flux need to be flipped.
label masterEdgeID() const
Return master edge ID.
label zoneID() const
Face zone ID.
label masterPointID() const
Return master point ID.
bool insert(const Key &key)
Insert a new entry.
label mergeCellID() const
Return cell ID.
Class describing modification of a cell.
void removeFace(const label, const label)
Remove/merge face.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
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
const DynamicList< label > & faceOwner() const
virtual const pointField & points() const
Return raw points.
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.
bool inCell() const
Does the point support a cell.
label neighbour() const
Return owner cell ID.
List< bool > boolList
Bool container classes.
label cellID() const
Cell ID.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
label zoneID() const
Point zone ID.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
label masterFaceID() const
Return master face ID.
const point & newPoint() const
New point location.
Class containing data for cell addition.
label patchID() const
Boundary patch ID.
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.
void reset(T *=0)
If object pointer already set, delete object and set to given.
label start() const
Return start label of this patch in the polyMesh face list.
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.
Pre-declare SubField and related Field type.
void resetPrimitives(const Xfer< pointField > &points, const Xfer< faceList > &faces, const Xfer< labelList > &owner, const Xfer< labelList > &neighbour, const labelList &patchSizes, const labelList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
Xfer< T > xferMove(T &)
Construct by transferring the contents of the arg.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const fileName & name() const
Return the name of the stream.
void setCapacity(const label)
Alter the size of the underlying storage.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container as a plain List.
Foam::autoPtr< IOobject > clone() const
Clone.
const DynamicList< label > & faceNeighbour() const
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
const vectorField & cellCentres() const
label masterCellID() const
Return master cell ID.
label faceID() const
Return master face 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.
label masterPointID() const
Return master point ID.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
const word & name() const
Return name.
label mergeFaceID() const
Return merge face ID.
const face & newFace() const
Return face.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
label owner() const
Return owner cell.
label zoneFlip() const
Face zone flip.
label cellID() const
Return cell ID.
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.
bool inCell() const
Does the point support a cell.
Class describing modification of a point.
prefixOSstream Pout(cout,"Pout")
label masterEdgeID() const
Return master edge ID.
void movePoints(const pointField &newPoints)
Move all points. Incompatible with other topology changes.
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
const DynamicList< face > & faces() const
const scalarField & cellVolumes() const
const pointZoneMesh & pointZones() const
Return point zone mesh.
PrimitivePatch< face, SubList, 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.
const face & newFace() const
Return face.
void setSize(const label)
Reset size of List.
bool topoChanging() const
Is mesh topology changing.
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.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
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.
Mesh data needed to do the Finite Volume discretisation.
bool flipFaceFlux() const
Does the face flux need to be flipped.
readOption readOpt() const
void clearStorage()
Clear the list and delete storage.
void modifyPoint(const label, const point &, const label newZoneID, const bool inCell)
Modify coordinate.
void resize(const label newSize)
Resize the hash table for efficiency.
const faceZoneMesh & faceZones() const
Return face zone mesh.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
void clearStorage()
Clear the list and delete storage.
label neighbour() const
Return neighour cell.
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.
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.
virtual const labelList & faceOwner() const
Return face owner.
A patch is a list of labels that address the faces in the global face list.
label zoneFlip() const
Face zone flip.
virtual const faceList & faces() const
Return raw faces.
label mergePointID() const
void stableSort(UList< T > &)
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
label nInternalFaces() const
Class containing data for point removal.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
const word & name() const
Return name.
void removeCell(const label, const label)
Remove/merge cell.
label pointID() const
Return point ID.
label size() const
Return the number of elements in the UPtrList.
void clearStorage()
Clear the table entries and the table itself.
A HashTable to objects of type <T> with a label key.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.