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();
212 patchSizes[patchI] = patches[patchI].size();
213 patchStarts[patchI] = patches[patchI].start();
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())
326 FatalErrorIn(
"polyTopoChange::facePoints(const face&) const")
329 points[fp] = points_[f[fp]];
335 void Foam::polyTopoChange::checkFace
347 if (own == -1 && zoneI != -1)
351 else if (patchI == -1 || patchI >= nPatches_)
355 "polyTopoChange::checkFace(const face&, const label" 356 ", const label, const label, const label)" 357 ) <<
"Face has no neighbour (so external) but does not have" 358 <<
" a valid patch" << nl
360 <<
" faceI(-1 if added face):" << faceI
361 <<
" own:" << own <<
" nei:" << nei
362 <<
" patchI:" << patchI <<
nl;
363 if (hasValidPoints(f))
366 <<
"points (removed points marked with " 378 "polyTopoChange::checkFace(const face&, const label" 379 ", const label, const label, const label)" 380 ) <<
"Cannot both have valid patchI and neighbour" << nl
382 <<
" faceI(-1 if added face):" << faceI
383 <<
" own:" << own <<
" nei:" << nei
384 <<
" patchI:" << patchI <<
nl;
385 if (hasValidPoints(f))
388 <<
"points (removed points marked with " 398 "polyTopoChange::checkFace(const face&, const label" 399 ", const label, const label, const label)" 400 ) <<
"Owner cell label should be less than neighbour cell label" 403 <<
" faceI(-1 if added face):" << faceI
404 <<
" own:" << own <<
" nei:" << nei
405 <<
" patchI:" << patchI <<
nl;
406 if (hasValidPoints(f))
409 <<
"points (removed points marked with " 416 if (f.size() < 3 ||
findIndex(f, -1) != -1)
420 "polyTopoChange::checkFace(const face&, const label" 421 ", const label, const label, const label)" 422 ) <<
"Illegal vertices in face" 425 <<
" faceI(-1 if added face):" << faceI
426 <<
" own:" << own <<
" nei:" << nei
427 <<
" patchI:" << patchI <<
nl;
428 if (hasValidPoints(f))
431 <<
"points (removed points marked with " 436 if (faceI >= 0 && faceI < faces_.size() && faceRemoved(faceI))
440 "polyTopoChange::checkFace(const face&, const label" 441 ", const label, const label, const label)" 442 ) <<
"Face already marked for removal" 445 <<
" faceI(-1 if added face):" << faceI
446 <<
" own:" << own <<
" nei:" << nei
447 <<
" patchI:" << patchI <<
nl;
448 if (hasValidPoints(f))
451 <<
"points (removed points marked with " 458 if (f[fp] < points_.size() && pointRemoved(f[fp]))
462 "polyTopoChange::checkFace(const face&, const label" 463 ", const label, const label, const label)" 464 ) <<
"Face uses removed vertices" 467 <<
" faceI(-1 if added face):" << faceI
468 <<
" own:" << own <<
" nei:" << nei
469 <<
" patchI:" << patchI <<
nl;
470 if (hasValidPoints(f))
473 <<
"points (removed points marked with " 482 void Foam::polyTopoChange::makeCells
484 const label nActiveFaces,
489 cellFaces.setSize(2*nActiveFaces);
490 cellFaceOffsets.setSize(cellMap_.size() + 1);
497 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
499 if (faceOwner_[faceI] < 0)
503 "polyTopoChange::makeCells\n" 509 ) <<
"Face " << faceI <<
" is active but its owner has" 510 <<
" been deleted. This is usually due to deleting cells" 511 <<
" without modifying exposed faces to be boundary faces." 514 nNbrs[faceOwner_[faceI]]++;
516 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
518 if (faceNeighbour_[faceI] >= 0)
520 nNbrs[faceNeighbour_[faceI]]++;
526 cellFaceOffsets[0] = 0;
529 cellFaceOffsets[cellI+1] = cellFaceOffsets[cellI] + nNbrs[cellI];
537 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
539 label cellI = faceOwner_[faceI];
541 cellFaces[cellFaceOffsets[cellI] + nNbrs[cellI]++] = faceI;
544 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
546 label cellI = faceNeighbour_[faceI];
550 cellFaces[cellFaceOffsets[cellI] + nNbrs[cellI]++] = faceI;
555 cellFaces.setSize(cellFaceOffsets[cellMap_.size()]);
561 void Foam::polyTopoChange::makeCellCells
563 const label nActiveFaces,
564 CompactListList<label>& cellCells
572 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
574 if (faceNeighbour_[faceI] >= 0)
576 nNbrs[faceOwner_[faceI]]++;
577 nNbrs[faceNeighbour_[faceI]]++;
590 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
592 label nei = faceNeighbour_[faceI];
596 label own = faceOwner_[faceI];
597 cellCells.m()[cellCells.index(own, nNbrs[own]++)] = nei;
598 cellCells.m()[cellCells.index(nei, nNbrs[nei]++)] = own;
608 const CompactListList<label>& cellCellAddressing,
612 labelList newOrder(cellCellAddressing.size());
615 SLList<label> nextCell;
618 PackedBoolList visited(cellCellAddressing.size());
620 label cellInOrder = 0;
625 DynamicList<label> nbrs;
627 DynamicList<label> weights;
637 label currentCell = -1;
643 if (!cellRemoved(cellI) && !visited[cellI])
645 if (cellCellAddressing[cellI].size() < minWeight)
647 minWeight = cellCellAddressing[cellI].size();
654 if (currentCell == -1)
664 nextCell.append(currentCell);
671 while (nextCell.size())
673 currentCell = nextCell.removeHead();
675 if (!visited[currentCell])
677 visited[currentCell] = 1;
680 newOrder[cellInOrder] = currentCell;
684 const labelUList neighbours = cellCellAddressing[currentCell];
694 label nbr = neighbours[nI];
695 if (!cellRemoved(nbr) && !visited[nbr])
699 weights.append(cellCellAddressing[nbr].size());
707 nextCell.append(nbrs[i]);
714 newOrder.setSize(cellInOrder);
717 oldToNew =
invert(cellCellAddressing.size(), newOrder);
726 void Foam::polyTopoChange::getFaceOrder
728 const label nActiveFaces,
737 oldToNew.setSize(faceOwner_.size());
748 label startOfCell = cellFaceOffsets[cellI];
749 label nFaces = cellFaceOffsets[cellI+1] - startOfCell;
755 for (
label i = 0; i < nFaces; i++)
757 label faceI = cellFaces[startOfCell + i];
759 label nbrCellI = faceNeighbour_[faceI];
761 if (faceI >= nActiveFaces)
766 else if (nbrCellI != -1)
769 if (nbrCellI == cellI)
771 nbrCellI = faceOwner_[faceI];
774 if (cellI < nbrCellI)
793 order.setSize(nFaces);
806 label index = order[i];
807 if (nbr[index] != -1)
809 oldToNew[cellFaces[startOfCell + index]] = newFaceI++;
816 patchStarts.setSize(nPatches_);
818 patchSizes.setSize(nPatches_);
823 patchStarts[0] = newFaceI;
825 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
827 if (region_[faceI] >= 0)
829 patchSizes[region_[faceI]]++;
833 label faceI = patchStarts[0];
835 forAll(patchStarts, patchI)
837 patchStarts[patchI] = faceI;
838 faceI += patchSizes[patchI];
850 for (
label faceI = 0; faceI < nActiveFaces; faceI++)
852 if (region_[faceI] >= 0)
854 oldToNew[faceI] = workPatchStarts[region_[faceI]]++;
859 for (
label faceI = nActiveFaces; faceI < oldToNew.size(); faceI++)
861 oldToNew[faceI] = faceI;
867 if (oldToNew[faceI] == -1)
871 "polyTopoChange::getFaceOrder" 872 "(const label, const labelList&, const labelList&)" 874 ) <<
"Did not determine new position" 875 <<
" for face " << faceI
876 <<
" owner " << faceOwner_[faceI]
877 <<
" neighbour " << faceNeighbour_[faceI]
878 <<
" region " << region_[faceI] <<
endl 879 <<
"This is usually caused by not specifying a patch for" 880 <<
" a boundary face." << nl
881 <<
"Switch on the polyTopoChange::debug flag to catch" 882 <<
" this error earlier." <<
nl;
883 if (hasValidPoints(faces_[faceI]))
886 <<
"points (removed points marked with " 887 <<
vector::max <<
") " << facePoints(faces_[faceI]);
896 void Foam::polyTopoChange::reorderCompactFaces
903 faces_.setCapacity(newSize);
906 region_.setCapacity(newSize);
909 faceOwner_.setCapacity(newSize);
911 reorder(oldToNew, faceNeighbour_);
912 faceNeighbour_.setCapacity(newSize);
916 faceMap_.setCapacity(newSize);
918 renumberReverseMap(oldToNew, reverseFaceMap_);
920 renumberKey(oldToNew, faceFromPoint_);
921 renumberKey(oldToNew, faceFromEdge_);
923 flipFaceFlux_.setCapacity(newSize);
924 renumberKey(oldToNew, faceZone_);
926 faceZoneFlip_.setCapacity(newSize);
934 void Foam::polyTopoChange::compact
936 const bool orderCells,
937 const bool orderPoints,
938 label& nInternalPoints,
945 reversePointMap_.shrink();
950 faceNeighbour_.shrink();
952 reverseFaceMap_.shrink();
955 reverseCellMap_.shrink();
960 label nActivePoints = 0;
962 labelList localPointMap(points_.size(), -1);
967 nInternalPoints = -1;
971 if (!pointRemoved(pointI) && !retiredPoints_.found(pointI))
973 localPointMap[pointI] = newPointI++;
976 nActivePoints = newPointI;
982 if (!pointRemoved(pointI) && !retiredPoints_.found(pointI))
994 && faceOwner_[faceI] >= 0
995 && faceNeighbour_[faceI] < 0
999 const face& f = faces_[faceI];
1003 label pointI = f[fp];
1005 if (localPointMap[pointI] == -1)
1009 pointRemoved(pointI)
1010 || retiredPoints_.found(pointI)
1014 <<
"Removed or retired point " << pointI
1016 <<
" at position " << faceI <<
endl 1017 <<
"Probably face has not been adapted for" 1020 localPointMap[pointI] = newPointI++;
1026 label nBoundaryPoints = newPointI;
1027 nInternalPoints = nActivePoints - nBoundaryPoints;
1030 forAll(localPointMap, pointI)
1032 if (localPointMap[pointI] != -1)
1034 localPointMap[pointI] += nInternalPoints;
1041 forAll(faceOwner_, faceI)
1046 && faceOwner_[faceI] >= 0
1047 && faceNeighbour_[faceI] >= 0
1051 const face& f = faces_[faceI];
1055 label pointI = f[fp];
1057 if (localPointMap[pointI] == -1)
1061 pointRemoved(pointI)
1062 || retiredPoints_.found(pointI)
1066 <<
"Removed or retired point " << pointI
1068 <<
" at position " << faceI <<
endl 1069 <<
"Probably face has not been adapted for" 1072 localPointMap[pointI] = newPointI++;
1078 if (newPointI != nInternalPoints)
1083 newPointI = nActivePoints;
1088 localPointMap[iter.key()] = newPointI++;
1094 Pout<<
"Points : active:" << nActivePoints
1095 <<
" removed:" << points_.size()-newPointI <<
endl;
1098 reorder(localPointMap, points_);
1099 points_.setCapacity(newPointI);
1102 reorder(localPointMap, pointMap_);
1103 pointMap_.setCapacity(newPointI);
1104 renumberReverseMap(localPointMap, reversePointMap_);
1106 renumberKey(localPointMap, pointZone_);
1107 renumber(localPointMap, retiredPoints_);
1112 face& f = faces_[faceI];
1115 renumberCompact(localPointMap, f);
1117 if (!faceRemoved(faceI) && f.size() < 3)
1120 <<
"Created illegal face " << f
1122 <<
" at position:" << faceI
1123 <<
" when filtering removed points" 1132 labelList localFaceMap(faces_.size(), -1);
1137 if (!faceRemoved(faceI) && faceOwner_[faceI] >= 0)
1139 localFaceMap[faceI] = newFaceI++;
1142 nActiveFaces_ = newFaceI;
1146 if (!faceRemoved(faceI) && faceOwner_[faceI] < 0)
1149 localFaceMap[faceI] = newFaceI++;
1155 Pout<<
"Faces : active:" << nActiveFaces_
1156 <<
" removed:" << faces_.size()-newFaceI <<
endl;
1160 reorderCompactFaces(newFaceI, localFaceMap);
1171 CompactListList<label> cellCells;
1172 makeCellCells(nActiveFaces_, cellCells);
1175 newCellI = getCellOrder(cellCells, localCellMap);
1180 localCellMap.setSize(cellMap_.size());
1186 if (!cellRemoved(cellI))
1188 localCellMap[cellI] = newCellI++;
1195 Pout<<
"Cells : active:" << newCellI
1196 <<
" removed:" << cellMap_.size()-newCellI <<
endl;
1200 if (orderCells || (newCellI != cellMap_.size()))
1202 reorder(localCellMap, cellMap_);
1203 cellMap_.setCapacity(newCellI);
1204 renumberReverseMap(localCellMap, reverseCellMap_);
1206 reorder(localCellMap, cellZone_);
1207 cellZone_.setCapacity(newCellI);
1209 renumberKey(localCellMap, cellFromPoint_);
1210 renumberKey(localCellMap, cellFromEdge_);
1211 renumberKey(localCellMap, cellFromFace_);
1215 forAll(faceOwner_, faceI)
1217 label own = faceOwner_[faceI];
1218 label nei = faceNeighbour_[faceI];
1223 faceOwner_[faceI] = localCellMap[own];
1228 faceNeighbour_[faceI] = localCellMap[nei];
1233 faceNeighbour_[faceI] >= 0
1234 && faceNeighbour_[faceI] < faceOwner_[faceI]
1237 faces_[faceI].flip();
1238 Swap(faceOwner_[faceI], faceNeighbour_[faceI]);
1239 flipFaceFlux_[faceI] =
1241 flipFaceFlux_[faceI]
1245 faceZoneFlip_[faceI] =
1247 faceZoneFlip_[faceI]
1257 faceNeighbour_[faceI] = localCellMap[nei];
1268 makeCells(nActiveFaces_, cellFaces, cellFaceOffsets);
1284 reorderCompactFaces(localFaceMap.size(), localFaceMap);
1298 const primitiveMesh& mesh,
1300 const bool internalFacesOnly
1307 label faceI = faceLabels[i];
1309 if (internalFacesOnly == mesh.isInternalFace(faceI))
1321 collectedFaces = faceLabels;
1325 collectedFaces.
setSize(nFaces);
1331 label faceI = faceLabels[i];
1333 if (internalFacesOnly == mesh.isInternalFace(faceI))
1335 collectedFaces[nFaces++] = faceI;
1340 return collectedFaces;
1346 void Foam::polyTopoChange::calcPatchPointMap
1348 const List<Map<label> >& oldPatchMeshPointMaps,
1349 const polyBoundaryMesh& boundary,
1353 patchPointMap.setSize(boundary.size());
1357 const labelList& meshPoints = boundary[patchI].meshPoints();
1359 const Map<label>& oldMeshPointMap = oldPatchMeshPointMaps[patchI];
1361 labelList& curPatchPointRnb = patchPointMap[patchI];
1363 curPatchPointRnb.
setSize(meshPoints.size());
1367 if (meshPoints[i] < pointMap_.size())
1372 pointMap_[meshPoints[i]]
1375 if (ozmpmIter != oldMeshPointMap.end())
1377 curPatchPointRnb[i] = ozmpmIter();
1381 curPatchPointRnb[i] = -1;
1386 curPatchPointRnb[i] = -1;
1393 void Foam::polyTopoChange::calcFaceInflationMaps
1395 const polyMesh& mesh,
1396 List<objectMap>& facesFromPoints,
1397 List<objectMap>& facesFromEdges,
1398 List<objectMap>& facesFromFaces
1404 facesFromPoints.setSize(faceFromPoint_.size());
1406 if (faceFromPoint_.size())
1408 label nFacesFromPoints = 0;
1413 label newFaceI = iter.key();
1415 if (region_[newFaceI] == -1)
1418 facesFromPoints[nFacesFromPoints++] = objectMap
1424 mesh.pointFaces()[iter()],
1432 facesFromPoints[nFacesFromPoints++] = objectMap
1438 mesh.pointFaces()[iter()],
1450 facesFromEdges.setSize(faceFromEdge_.size());
1452 if (faceFromEdge_.size())
1454 label nFacesFromEdges = 0;
1459 label newFaceI = iter.key();
1461 if (region_[newFaceI] == -1)
1464 facesFromEdges[nFacesFromEdges++] = objectMap
1470 mesh.edgeFaces(iter()),
1478 facesFromEdges[nFacesFromEdges++] = objectMap
1484 mesh.edgeFaces(iter()),
1505 void Foam::polyTopoChange::calcCellInflationMaps
1507 const polyMesh& mesh,
1508 List<objectMap>& cellsFromPoints,
1509 List<objectMap>& cellsFromEdges,
1510 List<objectMap>& cellsFromFaces,
1511 List<objectMap>& cellsFromCells
1514 cellsFromPoints.setSize(cellFromPoint_.size());
1516 if (cellFromPoint_.size())
1518 label nCellsFromPoints = 0;
1523 cellsFromPoints[nCellsFromPoints++] = objectMap
1526 mesh.pointCells()[iter()]
1532 cellsFromEdges.setSize(cellFromEdge_.size());
1534 if (cellFromEdge_.size())
1536 label nCellsFromEdges = 0;
1541 cellsFromEdges[nCellsFromEdges++] = objectMap
1544 mesh.edgeCells()[iter()]
1550 cellsFromFaces.setSize(cellFromFace_.size());
1552 if (cellFromFace_.size())
1554 label nCellsFromFaces = 0;
1561 label oldFaceI = iter();
1563 if (mesh.isInternalFace(oldFaceI))
1565 twoCells[0] = mesh.faceOwner()[oldFaceI];
1566 twoCells[1] = mesh.faceNeighbour()[oldFaceI];
1567 cellsFromFaces[nCellsFromFaces++] = objectMap
1575 cellsFromFaces[nCellsFromFaces++] = objectMap
1578 labelList(1, mesh.faceOwner()[oldFaceI])
1597 void Foam::polyTopoChange::resetZones
1599 const polyMesh& mesh,
1609 pointZoneMap.setSize(mesh.pointZones().size());
1619 label zoneI = iter();
1621 if (zoneI < 0 || zoneI >= pointZones.size())
1625 "resetZones(const polyMesh&, polyMesh&, labelListList&" 1626 "labelListList&, labelListList&)" 1627 ) <<
"Illegal zoneID " << zoneI <<
" for point " 1628 << iter.key() <<
" coord " << mesh.points()[iter.key()]
1637 forAll(addressing, zoneI)
1639 addressing[zoneI].setSize(nPoints[zoneI]);
1645 label zoneI = iter();
1647 addressing[zoneI][nPoints[zoneI]++] = iter.key();
1650 forAll(addressing, zoneI)
1657 forAll(addressing, zoneI)
1659 const pointZone& oldZone = pointZones[zoneI];
1660 const labelList& newZoneAddr = addressing[zoneI];
1662 labelList& curPzRnb = pointZoneMap[zoneI];
1663 curPzRnb.
setSize(newZoneAddr.size());
1667 if (newZoneAddr[i] < pointMap_.size())
1669 curPzRnb[i] = oldZone.whichPoint(pointMap_[newZoneAddr[i]]);
1679 newMesh.pointZones().clearAddressing();
1680 forAll(newMesh.pointZones(), zoneI)
1684 Pout<<
"pointZone:" << zoneI
1685 <<
" name:" << newMesh.pointZones()[zoneI].
name()
1686 <<
" size:" << addressing[zoneI].size()
1690 newMesh.pointZones()[zoneI] = addressing[zoneI];
1698 faceZoneFaceMap.setSize(mesh.faceZones().size());
1706 label zoneI = iter();
1708 if (zoneI < 0 || zoneI >= faceZones.size())
1712 "resetZones(const polyMesh&, polyMesh&, labelListList&" 1713 "labelListList&, labelListList&)" 1714 ) <<
"Illegal zoneID " << zoneI <<
" for face " 1724 forAll(addressing, zoneI)
1726 addressing[zoneI].setSize(nFaces[zoneI]);
1727 flipMode[zoneI].setSize(nFaces[zoneI]);
1733 label zoneI = iter();
1734 label faceI = iter.key();
1736 label index = nFaces[zoneI]++;
1738 addressing[zoneI][index] = faceI;
1739 flipMode[zoneI][index] = faceZoneFlip_[faceI];
1742 forAll(addressing, zoneI)
1747 labelList newAddressing(addressing[zoneI].size());
1750 newAddressing[i] = addressing[zoneI][newToOld[i]];
1752 addressing[zoneI].transfer(newAddressing);
1755 boolList newFlipMode(flipMode[zoneI].size());
1758 newFlipMode[i] = flipMode[zoneI][newToOld[i]];
1760 flipMode[zoneI].transfer(newFlipMode);
1766 forAll(addressing, zoneI)
1768 const faceZone& oldZone = faceZones[zoneI];
1769 const labelList& newZoneAddr = addressing[zoneI];
1771 labelList& curFzFaceRnb = faceZoneFaceMap[zoneI];
1773 curFzFaceRnb.
setSize(newZoneAddr.size());
1777 if (newZoneAddr[i] < faceMap_.size())
1780 oldZone.whichFace(faceMap_[newZoneAddr[i]]);
1784 curFzFaceRnb[i] = -1;
1791 newMesh.faceZones().clearAddressing();
1792 forAll(newMesh.faceZones(), zoneI)
1796 Pout<<
"faceZone:" << zoneI
1797 <<
" name:" << newMesh.faceZones()[zoneI].
name()
1798 <<
" size:" << addressing[zoneI].size()
1802 newMesh.faceZones()[zoneI].resetAddressing
1814 cellZoneMap.setSize(mesh.cellZones().size());
1822 label zoneI = cellZone_[cellI];
1824 if (zoneI >= cellZones.size())
1828 "resetZones(const polyMesh&, polyMesh&, labelListList&" 1829 "labelListList&, labelListList&)" 1830 ) <<
"Illegal zoneID " << zoneI <<
" for cell " 1841 forAll(addressing, zoneI)
1843 addressing[zoneI].setSize(nCells[zoneI]);
1849 label zoneI = cellZone_[cellI];
1853 addressing[zoneI][nCells[zoneI]++] = cellI;
1857 forAll(addressing, zoneI)
1864 forAll(addressing, zoneI)
1866 const cellZone& oldZone = cellZones[zoneI];
1867 const labelList& newZoneAddr = addressing[zoneI];
1869 labelList& curCellRnb = cellZoneMap[zoneI];
1871 curCellRnb.
setSize(newZoneAddr.size());
1875 if (newZoneAddr[i] < cellMap_.size())
1878 oldZone.whichCell(cellMap_[newZoneAddr[i]]);
1888 newMesh.cellZones().clearAddressing();
1889 forAll(newMesh.cellZones(), zoneI)
1893 Pout<<
"cellZone:" << zoneI
1894 <<
" name:" << newMesh.cellZones()[zoneI].
name()
1895 <<
" size:" << addressing[zoneI].size()
1899 newMesh.cellZones()[zoneI] = addressing[zoneI];
1905 void Foam::polyTopoChange::calcFaceZonePointMap
1907 const polyMesh& mesh,
1908 const List<Map<label> >& oldFaceZoneMeshPointMaps,
1914 faceZonePointMap.
setSize(faceZones.size());
1918 const faceZone& newZone = faceZones[zoneI];
1920 const labelList& newZoneMeshPoints = newZone().meshPoints();
1922 const Map<label>& oldZoneMeshPointMap = oldFaceZoneMeshPointMaps[zoneI];
1924 labelList& curFzPointRnb = faceZonePointMap[zoneI];
1926 curFzPointRnb.
setSize(newZoneMeshPoints.size());
1928 forAll(newZoneMeshPoints, pointI)
1930 if (newZoneMeshPoints[pointI] < pointMap_.size())
1933 oldZoneMeshPointMap.find
1935 pointMap_[newZoneMeshPoints[pointI]]
1938 if (ozmpmIter != oldZoneMeshPointMap.end())
1940 curFzPointRnb[pointI] = ozmpmIter();
1944 curFzPointRnb[pointI] = -1;
1949 curFzPointRnb[pointI] = -1;
1956 void Foam::polyTopoChange::reorderCoupledFaces
1958 const bool syncParallel,
1959 const polyBoundaryMesh& boundary,
1977 if (syncParallel || !isA<processorPolyPatch>(boundary[patchI]))
1979 boundary[patchI].initOrder
1998 pBufs.finishedSends();
2003 bool anyChanged =
false;
2007 if (syncParallel || !isA<processorPolyPatch>(boundary[patchI]))
2009 labelList patchFaceMap(patchSizes[patchI], -1);
2010 labelList patchFaceRotation(patchSizes[patchI], 0);
2012 bool changed = boundary[patchI].order
2032 label start = patchStarts[patchI];
2034 forAll(patchFaceMap, patchFaceI)
2036 oldToNew[patchFaceI + start] =
2037 start + patchFaceMap[patchFaceI];
2040 forAll(patchFaceRotation, patchFaceI)
2042 rotation[patchFaceI + start] =
2043 patchFaceRotation[patchFaceI];
2053 reduce(anyChanged, orOp<bool>());
2059 reorderCompactFaces(oldToNew.size(), oldToNew);
2064 if (rotation[faceI] != 0)
2066 inplaceRotateList<List, label>(faces_[faceI], rotation[faceI]);
2073 void Foam::polyTopoChange::compactAndReorder
2075 const polyMesh& mesh,
2076 const bool syncParallel,
2077 const bool orderCells,
2078 const bool orderPoints,
2080 label& nInternalPoints,
2084 List<objectMap>& pointsFromPoints,
2085 List<objectMap>& facesFromPoints,
2086 List<objectMap>& facesFromEdges,
2087 List<objectMap>& facesFromFaces,
2088 List<objectMap>& cellsFromPoints,
2089 List<objectMap>& cellsFromEdges,
2090 List<objectMap>& cellsFromFaces,
2091 List<objectMap>& cellsFromCells,
2092 List<Map<label> >& oldPatchMeshPointMaps,
2095 List<Map<label> >& oldFaceZoneMeshPointMaps
2098 if (mesh.boundaryMesh().size() != nPatches_)
2101 <<
"polyTopoChange was constructed with a mesh with " 2102 << nPatches_ <<
" patches." <<
endl 2103 <<
"The mesh now provided has a different number of patches " 2104 << mesh.boundaryMesh().size()
2105 <<
" which is illegal" <<
endl 2111 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
2115 newPoints.transfer(points_);
2121 mesh.boundaryMesh(),
2147 calcFaceInflationMaps
2155 calcCellInflationMaps
2166 faceFromPoint_.clearStorage();
2167 faceFromEdge_.clearStorage();
2169 cellFromPoint_.clearStorage();
2170 cellFromEdge_.clearStorage();
2171 cellFromFace_.clearStorage();
2175 const polyBoundaryMesh& boundary = mesh.boundaryMesh();
2178 oldPatchMeshPointMaps.setSize(boundary.size());
2179 oldPatchNMeshPoints.setSize(boundary.size());
2180 oldPatchStarts.setSize(boundary.size());
2185 oldPatchMeshPointMaps[patchI] = boundary[patchI].meshPointMap();
2186 oldPatchNMeshPoints[patchI] = boundary[patchI].meshPoints().size();
2187 oldPatchStarts[patchI] = boundary[patchI].start();
2193 oldFaceZoneMeshPointMaps.setSize(mesh.faceZones().size());
2195 forAll(mesh.faceZones(), zoneI)
2197 const faceZone& oldZone = mesh.faceZones()[zoneI];
2199 oldFaceZoneMeshPointMaps[zoneI] = oldZone().meshPointMap();
2210 nPatches_(nPatches),
2213 reversePointMap_(0),
2248 reversePointMap_(0),
2285 points_.clearStorage();
2291 faces_.clearStorage();
2322 label maxRegion = nPatches_ - 1;
2325 maxRegion =
max(maxRegion, patchMap[i]);
2327 nPatches_ = maxRegion + 1;
2336 points_.setCapacity(points_.size() + points.
size());
2344 forAll(pointZones, zoneI)
2350 newZoneID[pointLabels[j]] = pointZoneMap[zoneI];
2355 for (
label pointI = 0; pointI < mesh.
nPoints(); pointI++)
2379 cellFromPoint_.
resize(cellFromPoint_.
size() + nAllCells/100);
2380 cellFromEdge_.
resize(cellFromEdge_.
size() + nAllCells/100);
2381 cellFromFace_.
resize(cellFromFace_.
size() + nAllCells/100);
2390 const labelList& cellLabels = cellZones[zoneI];
2394 label cellI = cellLabels[j];
2396 if (newZoneID[cellI] != -1)
2400 "polyTopoChange::addMesh" 2401 "(const polyMesh&, const labelList&," 2402 "const labelList&, const labelList&," 2404 ) <<
"Cell:" << cellI
2406 <<
" is in two zones:" 2407 << cellZones[newZoneID[cellI]].
name()
2408 <<
" and " << cellZones[zoneI].
name() <<
endl 2409 <<
" This is not supported." 2410 <<
" Continuing with first zone only." <<
endl;
2414 newZoneID[cellI] = cellZoneMap[zoneI];
2420 for (
label cellI = 0; cellI < nAllCells; cellI++)
2423 addCell(-1, -1, -1, cellI, newZoneID[cellI]);
2438 faces_.setCapacity(faces_.size() + nAllFaces);
2444 faceFromPoint_.
resize(faceFromPoint_.
size() + nAllFaces/100);
2445 faceFromEdge_.
resize(faceFromEdge_.
size() + nAllFaces/100);
2446 flipFaceFlux_.
setCapacity(faces_.size() + nAllFaces);
2447 faceZone_.
resize(faceZone_.
size() + nAllFaces/100);
2448 faceZoneFlip_.
setCapacity(faces_.size() + nAllFaces);
2453 boolList zoneFlip(nAllFaces,
false);
2457 const labelList& faceLabels = faceZones[zoneI];
2458 const boolList& flipMap = faceZones[zoneI].flipMap();
2462 newZoneID[faceLabels[j]] = faceZoneMap[zoneI];
2463 zoneFlip[faceLabels[j]] = flipMap[j];
2476 faceNeighbour[faceI],
2492 if (pp.
start() != faces_.size())
2496 "polyTopoChange::polyTopoChange" 2497 "(const polyMesh& mesh, const bool strict)" 2499 <<
"Patch " << pp.
name() <<
" starts at " << pp.
start()
2501 <<
"Current face counter at " << faces_.size() <<
endl 2502 <<
"Are patches in incremental order?" 2530 const label nPoints,
2535 points_.setCapacity(nPoints);
2538 pointZone_.
resize(pointZone_.
size() + nPoints/100);
2540 faces_.setCapacity(nFaces);
2546 faceFromPoint_.
resize(faceFromPoint_.
size() + nFaces/100);
2547 faceFromEdge_.
resize(faceFromEdge_.
size() + nFaces/100);
2549 faceZone_.
resize(faceZone_.
size() + nFaces/100);
2554 cellFromPoint_.
resize(cellFromPoint_.
size() + nCells/100);
2555 cellFromEdge_.
resize(cellFromEdge_.
size() + nCells/100);
2556 cellFromFace_.
resize(cellFromFace_.
size() + nCells/100);
2563 if (isType<polyAddPoint>(action))
2565 const polyAddPoint& pap = refCast<const polyAddPoint>(action);
2575 else if (isType<polyModifyPoint>(action))
2589 else if (isType<polyRemovePoint>(action))
2597 else if (isType<polyAddFace>(action))
2599 const polyAddFace& paf = refCast<const polyAddFace>(action);
2615 else if (isType<polyModifyFace>(action))
2617 const polyModifyFace& pmf = refCast<const polyModifyFace>(action);
2633 else if (isType<polyRemoveFace>(action))
2635 const polyRemoveFace& prf = refCast<const polyRemoveFace>(action);
2641 else if (isType<polyAddCell>(action))
2643 const polyAddCell& pac = refCast<const polyAddCell>(action);
2654 else if (isType<polyModifyCell>(action))
2656 const polyModifyCell& pmc = refCast<const polyModifyCell>(action);
2669 else if (isType<polyRemoveCell>(action))
2671 const polyRemoveCell& prc = refCast<const polyRemoveCell>(action);
2681 "label polyTopoChange::setAction(const topoAction& action)" 2682 ) <<
"Unknown type of topoChange: " << action.type()
2694 const label masterPointID,
2699 label pointI = points_.size();
2702 pointMap_.
append(masterPointID);
2703 reversePointMap_.
append(pointI);
2707 pointZone_.
insert(pointI, zoneID);
2712 retiredPoints_.
insert(pointI);
2723 const label newZoneID,
2727 if (pointI < 0 || pointI >= points_.size())
2731 "polyTopoChange::modifyPoint(const label, const point&)" 2732 ) <<
"illegal point label " << pointI <<
endl 2733 <<
"Valid point labels are 0 .. " << points_.size()-1
2740 "polyTopoChange::modifyPoint(const label, const point&)" 2741 ) <<
"point " << pointI <<
" already marked for removal" 2744 points_[pointI] = pt;
2748 if (pointFnd != pointZone_.
end())
2752 pointFnd() = newZoneID;
2756 pointZone_.
erase(pointFnd);
2759 else if (newZoneID >= 0)
2761 pointZone_.
insert(pointI, newZoneID);
2766 retiredPoints_.
erase(pointI);
2770 retiredPoints_.
insert(pointI);
2777 if (newPoints.
size() != points_.size())
2779 FatalErrorIn(
"polyTopoChange::movePoints(const pointField&)")
2780 <<
"illegal pointField size." <<
endl 2781 <<
"Size:" << newPoints.
size() <<
endl 2782 <<
"Points in mesh:" << points_.size()
2788 points_[pointI] = newPoints[pointI];
2796 const label mergePointI
2799 if (pointI < 0 || pointI >= points_.size())
2801 FatalErrorIn(
"polyTopoChange::removePoint(const label, const label)")
2802 <<
"illegal point label " << pointI <<
endl 2803 <<
"Valid point labels are 0 .. " << points_.size()-1
2813 FatalErrorIn(
"polyTopoChange::removePoint(const label, const label)")
2814 <<
"point " << pointI <<
" already marked for removal" << nl
2815 <<
"Point:" << points_[pointI] <<
" pointMap:" << pointMap_[pointI]
2819 if (pointI == mergePointI)
2821 FatalErrorIn(
"polyTopoChange::removePoint(const label, const label)")
2822 <<
"Cannot remove/merge point " << pointI <<
" onto itself." 2827 pointMap_[pointI] = -1;
2828 if (mergePointI >= 0)
2830 reversePointMap_[pointI] = -mergePointI-2;
2834 reversePointMap_[pointI] = -1;
2836 pointZone_.
erase(pointI);
2837 retiredPoints_.
erase(pointI);
2846 const label masterPointID,
2847 const label masterEdgeID,
2848 const label masterFaceID,
2849 const bool flipFaceFlux,
2850 const label patchID,
2858 checkFace(f, -1, own, nei, patchID, zoneID);
2861 label faceI = faces_.size();
2866 faceNeighbour_.
append(nei);
2868 if (masterPointID >= 0)
2871 faceFromPoint_.
insert(faceI, masterPointID);
2873 else if (masterEdgeID >= 0)
2876 faceFromEdge_.
insert(faceI, masterEdgeID);
2878 else if (masterFaceID >= 0)
2880 faceMap_.
append(masterFaceID);
2891 reverseFaceMap_.
append(faceI);
2893 flipFaceFlux_[faceI] = (flipFaceFlux ? 1 : 0);
2897 faceZone_.
insert(faceI, zoneID);
2899 faceZoneFlip_[faceI] = (zoneFlip ? 1 : 0);
2911 const bool flipFaceFlux,
2912 const label patchID,
2920 checkFace(f, faceI, own, nei, patchID, zoneID);
2924 faceOwner_[faceI] = own;
2925 faceNeighbour_[faceI] = nei;
2926 region_[faceI] = patchID;
2928 flipFaceFlux_[faceI] = (flipFaceFlux ? 1 : 0);
2932 if (faceFnd != faceZone_.
end())
2940 faceZone_.
erase(faceFnd);
2943 else if (zoneID >= 0)
2945 faceZone_.
insert(faceI, zoneID);
2947 faceZoneFlip_[faceI] = (zoneFlip ? 1 : 0);
2953 if (faceI < 0 || faceI >= faces_.size())
2955 FatalErrorIn(
"polyTopoChange::removeFace(const label, const label)")
2956 <<
"illegal face label " << faceI <<
endl 2957 <<
"Valid face labels are 0 .. " << faces_.size()-1
2967 FatalErrorIn(
"polyTopoChange::removeFace(const label, const label)")
2969 <<
" already marked for removal" 2973 faces_[faceI].setSize(0);
2974 region_[faceI] = -1;
2975 faceOwner_[faceI] = -1;
2976 faceNeighbour_[faceI] = -1;
2977 faceMap_[faceI] = -1;
2978 if (mergeFaceI >= 0)
2980 reverseFaceMap_[faceI] = -mergeFaceI-2;
2984 reverseFaceMap_[faceI] = -1;
2986 faceFromEdge_.
erase(faceI);
2987 faceFromPoint_.
erase(faceI);
2988 flipFaceFlux_[faceI] = 0;
2989 faceZone_.
erase(faceI);
2990 faceZoneFlip_[faceI] = 0;
2996 const label masterPointID,
2997 const label masterEdgeID,
2998 const label masterFaceID,
2999 const label masterCellID,
3005 if (masterPointID >= 0)
3008 cellFromPoint_.
insert(cellI, masterPointID);
3010 else if (masterEdgeID >= 0)
3013 cellFromEdge_.
insert(cellI, masterEdgeID);
3015 else if (masterFaceID >= 0)
3018 cellFromFace_.
insert(cellI, masterFaceID);
3022 cellMap_.
append(masterCellID);
3024 reverseCellMap_.
append(cellI);
3025 cellZone_.
append(zoneID);
3037 cellZone_[cellI] = zoneID;
3043 if (cellI < 0 || cellI >= cellMap_.
size())
3045 FatalErrorIn(
"polyTopoChange::removeCell(const label, const label)")
3046 <<
"illegal cell label " << cellI <<
endl 3047 <<
"Valid cell labels are 0 .. " << cellMap_.
size()-1
3051 if (strict_ && cellMap_[cellI] == -2)
3053 FatalErrorIn(
"polyTopoChange::removeCell(const label, const label)")
3055 <<
" already marked for removal" 3059 cellMap_[cellI] = -2;
3060 if (mergeCellI >= 0)
3062 reverseCellMap_[cellI] = -mergeCellI-2;
3066 reverseCellMap_[cellI] = -1;
3068 cellFromPoint_.
erase(cellI);
3069 cellFromEdge_.
erase(cellI);
3070 cellFromFace_.
erase(cellI);
3071 cellZone_[cellI] = -1;
3079 const bool syncParallel,
3080 const bool orderCells,
3081 const bool orderPoints
3086 Pout<<
"polyTopoChange::changeMesh" 3087 <<
"(polyMesh&, const bool, const bool, const bool, const bool)" 3093 Pout<<
"Old mesh:" <<
nl;
3094 writeMeshStats(mesh,
Pout);
3100 label nInternalPoints;
3139 oldPatchMeshPointMaps,
3140 oldPatchNMeshPoints,
3142 oldFaceZoneMeshPointMaps
3162 forAll(pointMap_, newPointI)
3164 label oldPointI = pointMap_[newPointI];
3168 renumberedMeshPoints[newPointI] = mesh.
points()[oldPointI];
3181 faceNeighbour_.
xfer(),
3199 faceNeighbour_.
xfer(),
3217 label nAdd, nInflate, nMerge, nRemove;
3218 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3220 <<
" added(from point):" << nAdd
3221 <<
" added(from nothing):" << nInflate
3222 <<
" merged(into other point):" << nMerge
3223 <<
" removed:" << nRemove
3226 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3228 <<
" added(from face):" << nAdd
3229 <<
" added(inflated):" << nInflate
3230 <<
" merged(into other face):" << nMerge
3231 <<
" removed:" << nRemove
3234 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3236 <<
" added(from cell):" << nAdd
3237 <<
" added(inflated):" << nInflate
3238 <<
" merged(into other cell):" << nMerge
3239 <<
" removed:" << nRemove
3246 Pout<<
"New mesh:" <<
nl;
3247 writeMeshStats(mesh,
Pout);
3261 resetZones(mesh, mesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3278 oldPatchMeshPointMaps,
3285 calcFaceZonePointMap(mesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3287 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3328 oldPatchNMeshPoints,
3346 const bool syncParallel,
3347 const bool orderCells,
3348 const bool orderPoints
3353 Pout<<
"polyTopoChange::changeMesh" 3354 <<
"(autoPtr<fvMesh>&, const IOobject&, const fvMesh&" 3355 <<
", const bool, const bool, const bool)" 3361 Pout<<
"Old mesh:" <<
nl;
3362 writeMeshStats(mesh,
Pout);
3368 label nInternalPoints;
3408 oldPatchMeshPointMaps,
3409 oldPatchNMeshPoints,
3411 oldFaceZoneMeshPointMaps
3433 faceNeighbour_.
xfer()
3436 fvMesh& newMesh = newMeshPtr();
3448 label nAdd, nInflate, nMerge, nRemove;
3449 countMap(pointMap_, reversePointMap_, nAdd, nInflate, nMerge, nRemove);
3451 <<
" added(from point):" << nAdd
3452 <<
" added(from nothing):" << nInflate
3453 <<
" merged(into other point):" << nMerge
3454 <<
" removed:" << nRemove
3457 countMap(faceMap_, reverseFaceMap_, nAdd, nInflate, nMerge, nRemove);
3459 <<
" added(from face):" << nAdd
3460 <<
" added(inflated):" << nInflate
3461 <<
" merged(into other face):" << nMerge
3462 <<
" removed:" << nRemove
3465 countMap(cellMap_, reverseCellMap_, nAdd, nInflate, nMerge, nRemove);
3467 <<
" added(from cell):" << nAdd
3468 <<
" added(inflated):" << nInflate
3469 <<
" merged(into other cell):" << nMerge
3470 <<
" removed:" << nRemove
3481 forAll(oldPatches, patchI)
3483 newBoundary[patchI] = oldPatches[patchI].
clone 3506 oldPointZones[i].
name(),
3521 oldFaceZones[i].
name(),
3537 oldCellZones[i].
name(),
3545 newMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
3554 resetZones(mesh, newMesh, pointZoneMap, faceZoneFaceMap, cellZoneMap);
3570 oldPatchMeshPointMaps,
3577 calcFaceZonePointMap(newMesh, oldFaceZoneMeshPointMaps, faceZonePointMap);
3581 Pout<<
"New mesh:" <<
nl;
3582 writeMeshStats(mesh,
Pout);
3585 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
3626 oldPatchNMeshPoints,
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const cellZoneMesh & cellZones() const
Return cell zone mesh.
bool flipFaceFlux() const
Does the face flux need to be flipped.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const pointField & points
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
const faceZoneMesh & faceZones() const
Return face zone mesh.
bool removeFromZone() const
UList< label > labelUList
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
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.
A face addition data class. A face can be inflated either from a point or from another face and can e...
labelList pointLabels(nPoints,-1)
label addCell(const label masterPointID, const label masterEdgeID, const label masterFaceID, const label masterCellID, const label zoneID)
Add cell. Return new cell label.
void setCapacity(const label)
Alter the size of the underlying storage.
Mesh data needed to do the Finite Volume discretisation.
readOption readOpt() const
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
label size() const
Return the number of elements in the PtrList.
Foam::autoPtr< IOobject > clone() const
Clone.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
const word & name() const
Return name.
bool erase(const iterator &)
Erase a hashedEntry specified by given iterator.
void modifyCell(const label, const label zoneID)
Modify zone of cell.
word name(const complex &)
Return a string representation of a complex.
A virtual base class for topological actions.
label masterPointID() const
Master point label.
Class containing data for point removal.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
label zoneFlip() const
Face zone flip.
void clearStorage()
Clear the list and delete storage.
label patchID() const
Boundary patch ID.
Class containing data for cell removal.
void reset(T *=0)
If object pointer already set, delete object and set to given.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
A subset of mesh points. The labels of points in the zone can be obtained from the addressing() list...
const DynamicList< label > & faceNeighbour() const
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
label zoneFlip() const
Face zone flip.
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.
List< List< bool > > boolListList
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
A HashTable to objects of type <T> with a label key.
A subset of mesh faces organised as a primitive patch.
label patchID() const
Boundary patch ID.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Class describing modification of a point.
void resize(const label newSize)
Resize the hash table for efficiency.
bool topoChanging() const
Is mesh topology changing.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
label zoneID() const
Point zone ID.
Various functions to operate on Lists.
const face & newFace() const
Return face.
const pointZoneMesh & pointZones() const
Return point zone mesh.
label masterPointID() const
Return master point ID.
label mergeCellID() const
Return cell ID.
void setCapacity(const label)
Alter the size of the underlying storage.
const vectorField & cellCentres() const
label masterEdgeID() const
Return master edge ID.
label masterPointID() const
Return master point ID.
void modifyPoint(const label, const point &, const label newZoneID, const bool inCell)
Modify coordinate.
const face & newFace() const
Return face.
vectorField pointField
pointField is a vectorField.
Class containing data for face removal.
A patch is a list of labels that address the faces in the global face list.
label owner() const
Return owner cell.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void movePoints(const pointField &newPoints)
Move all points. Incompatible with other topology changes.
Class containing data for cell addition.
void clearStorage()
Clear the table entries and the table itself.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
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.
label pointID() const
Point ID.
A face is a list of labels corresponding to mesh vertices.
label faceID() const
Return face ID.
label cellID() const
Return cell ID.
polyTopoChange(const label nPatches, const bool strict=true)
Construct without mesh. Either specify nPatches or use.
label zoneID() const
Cell zone ID.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
#define WarningIn(functionName)
Report a warning using Foam::Warning.
virtual const pointField & points() const
Return raw points.
label cellID() const
Cell ID.
Xfer< List< T > > xfer()
Transfer contents to the Xfer container as a plain List.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
bool inCell() const
Does the point support a cell.
label addPoint(const point &, const label masterPointID, const label zoneID, const bool inCell)
Add point. Return new point label.
label masterEdgeID() const
Return master edge ID.
void removeCell(const label, const label)
Remove/merge cell.
label neighbour() const
Return neighour cell.
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
void clear()
Clear all storage.
label mergePointID() const
bool faceRemoved(const label faceI) const
Is face removed?
label faceID() const
Return master face ID.
label owner() const
Return owner cell ID.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
Class describing modification of a face.
label size() const
Return number of elements in table.
const point & newPoint() const
New point location.
label mergeFaceID() const
Return merge face ID.
errorManip< error > abort(error &err)
label zoneID() const
Point zone ID.
const word & name() const
Return name.
virtual const labelList & faceOwner() const
Return face owner.
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.
virtual const fileName & name() const
Return the name of the stream.
const point & newPoint() const
Point location.
ZoneMesh< pointZone, polyMesh > pointZoneMesh
A ZoneMesh with the type pointZone.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
bool flipFaceFlux() const
Does the face flux need to be flipped.
label neighbour() const
Return owner cell ID.
label start() const
Return start label of this patch in the polyMesh face list.
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh.
label nInternalFaces() const
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.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
void removeFace(const label, const label)
Remove/merge face.
label masterCellID() const
Return master cell ID.
Mesh consisting of general polyhedral cells.
label pointID() const
Return point ID.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with the type faceZone.
List< label > labelList
A List of labels.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
label zoneID() const
Face zone ID.
void stableSort(UList< T > &)
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
label zoneID() const
Cell zone ID.
void removePoint(const label, const label)
Remove/merge point.
void clearStorage()
Clear the list and delete storage.
Class describing modification of a cell.
bool pointRemoved(const label pointI) const
Is point removed?
Class containing data for point addition.
PrimitivePatch< face, SubList, const pointField & > primitivePatch
Addressing for a faceList slice.
virtual const faceList & faces() const
Return raw faces.
label zoneID() const
Face zone ID.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
const scalarField & cellVolumes() const
bool inCell() const
Does the point support a cell.
label masterFaceID() const
Return master face ID.
List< labelList > labelListList
A List of labelList.
virtual const labelList & faceNeighbour() const
Return face neighbour.
ListType reorder(const labelUList &oldToNew, const ListType &)
Reorder the elements (indices, not values) of a list.
HashTable< label, label, Hash< label > >::const_iterator const_iterator
label masterFaceID() const
Return master face ID.
const DynamicList< label > & faceOwner() const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
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.
const DynamicList< face > & faces() const
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
List< bool > boolList
Bool container classes.
static const label labelMax
bool insert(const Key &key)
Insert a new entry.