45 void Foam::polyTopoChange::renumberReverseMap
48 DynamicList<label>& elems
53 label val = elems[elemI];
57 elems[elemI] = map[val];
61 label mergedVal = -val-2;
62 elems[elemI] = -map[mergedVal]-2;
68 void Foam::polyTopoChange::renumber
78 label newElem = map[iter.key()];
82 newElems.insert(newElem);
86 elems.transfer(newElems);
90 void Foam::polyTopoChange::renumberCompact
100 label newVal = map[elems[elemI]];
104 elems[newElemI++] = newVal;
107 elems.setSize(newElemI);
111 void Foam::polyTopoChange::countMap
128 label oldCelli = map[newCelli];
132 if (reverseMap[oldCelli] == newCelli)
142 else if (oldCelli == -1)
154 forAll(reverseMap, oldCelli)
156 label newCelli = reverseMap[oldCelli];
162 else if (newCelli == -1)
178 const PackedBoolList& lst
193 void Foam::polyTopoChange::writeMeshStats(
const polyMesh&
mesh, Ostream& os)
208 <<
" PatchSizes : " << patchSizes <<
nl
209 <<
" PatchStarts : " << patchStarts <<
nl
214 void Foam::polyTopoChange::getMergeSets
218 List<objectMap>& cellsFromCells
224 forAll(reverseCellMap, oldCelli)
226 label newCelli = reverseCellMap[oldCelli];
230 label mergeCelli = -newCelli-2;
232 nMerged[mergeCelli]++;
237 labelList cellToMergeSet(cellMap.size(), -1);
243 if (nMerged[celli] > 1)
245 cellToMergeSet[celli] = nSets++;
255 cellsFromCells.setSize(nSets);
257 forAll(reverseCellMap, oldCelli)
259 label newCelli = reverseCellMap[oldCelli];
263 label mergeCelli = -newCelli-2;
267 label setI = cellToMergeSet[mergeCelli];
269 objectMap& mergeSet = cellsFromCells[setI];
271 if (mergeSet.masterObjects().empty())
275 mergeSet.index() = mergeCelli;
276 mergeSet.masterObjects().setSize(nMerged[mergeCelli]);
279 mergeSet.masterObjects()[0] = cellMap[mergeCelli];
282 mergeSet.masterObjects()[1] = oldCelli;
284 nMerged[mergeCelli] = 2;
288 mergeSet.masterObjects()[nMerged[mergeCelli]++] = oldCelli;
295 bool Foam::polyTopoChange::hasValidPoints(
const face&
f)
const
299 if (
f[fp] < 0 ||
f[fp] >= points_.
size())
313 if (
f[fp] < 0 &&
f[fp] >= points_.
size())
324 void Foam::polyTopoChange::checkFace
342 <<
"Face has no neighbour (so external) but does not have"
343 <<
" a valid patch" <<
nl
345 <<
" facei(-1 if added face):" << facei
346 <<
" own:" << own <<
" nei:" << nei
348 if (hasValidPoints(
f))
351 <<
"points (removed points marked with "
362 <<
"Cannot both have valid patchi and neighbour" <<
nl
364 <<
" facei(-1 if added face):" << facei
365 <<
" own:" << own <<
" nei:" << nei
367 if (hasValidPoints(
f))
370 <<
"points (removed points marked with "
379 <<
"Owner cell label should be less than neighbour cell label"
382 <<
" facei(-1 if added face):" << facei
383 <<
" own:" << own <<
" nei:" << nei
385 if (hasValidPoints(
f))
388 <<
"points (removed points marked with "
398 <<
"Illegal vertices in face"
401 <<
" facei(-1 if added face):" << facei
402 <<
" own:" << own <<
" nei:" << nei
404 if (hasValidPoints(
f))
407 <<
"points (removed points marked with "
412 if (facei >= 0 && facei < faces_.size() && faceRemoved(facei))
415 <<
"Face already marked for removal"
418 <<
" facei(-1 if added face):" << facei
419 <<
" own:" << own <<
" nei:" << nei
421 if (hasValidPoints(
f))
424 <<
"points (removed points marked with "
431 if (
f[fp] < points_.
size() && pointRemoved(
f[fp]))
434 <<
"Face uses removed vertices"
437 <<
" facei(-1 if added face):" << facei
438 <<
" own:" << own <<
" nei:" << nei
440 if (hasValidPoints(
f))
443 <<
"points (removed points marked with "
452 void Foam::polyTopoChange::makeCells
454 const label nActiveFaces,
459 cellFaces.setSize(2*nActiveFaces);
460 cellFaceOffsets.setSize(cellMap_.size() + 1);
467 for (
label facei = 0; facei < nActiveFaces; facei++)
469 if (faceOwner_[facei] < 0)
472 <<
"Face " << facei <<
" is active but its owner has"
473 <<
" been deleted. This is usually due to deleting cells"
474 <<
" without modifying exposed faces to be boundary faces."
477 nNbrs[faceOwner_[facei]]++;
479 for (
label facei = 0; facei < nActiveFaces; facei++)
481 if (faceNeighbour_[facei] >= 0)
483 nNbrs[faceNeighbour_[facei]]++;
489 cellFaceOffsets[0] = 0;
492 cellFaceOffsets[celli+1] = cellFaceOffsets[celli] + nNbrs[celli];
500 for (
label facei = 0; facei < nActiveFaces; facei++)
502 label celli = faceOwner_[facei];
504 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
507 for (
label facei = 0; facei < nActiveFaces; facei++)
509 label celli = faceNeighbour_[facei];
513 cellFaces[cellFaceOffsets[celli] + nNbrs[celli]++] = facei;
518 cellFaces.setSize(cellFaceOffsets[cellMap_.size()]);
522 void Foam::polyTopoChange::makeCellCells
524 const label nActiveFaces,
525 CompactListList<label>& cellCells
533 for (
label facei = 0; facei < nActiveFaces; facei++)
535 if (faceNeighbour_[facei] >= 0)
537 nNbrs[faceOwner_[facei]]++;
538 nNbrs[faceNeighbour_[facei]]++;
543 cellCells.setSize(nNbrs);
551 for (
label facei = 0; facei < nActiveFaces; facei++)
553 label nei = faceNeighbour_[facei];
557 label own = faceOwner_[facei];
558 cellCells.m()[cellCells.index(own, nNbrs[own]++)] = nei;
559 cellCells.m()[cellCells.index(nei, nNbrs[nei]++)] = own;
567 const CompactListList<label>& cellCellAddressing,
571 labelList newOrder(cellCellAddressing.size());
574 SLList<label> nextCell;
577 PackedBoolList visited(cellCellAddressing.size());
579 label cellInOrder = 0;
584 DynamicList<label> nbrs;
587 DynamicList<label> weights;
597 label currentCell = -1;
603 if (!cellRemoved(celli) && !visited[celli])
605 if (cellCellAddressing[celli].size() < minWeight)
607 minWeight = cellCellAddressing[celli].size();
614 if (currentCell == -1)
624 nextCell.append(currentCell);
631 while (nextCell.size())
633 currentCell = nextCell.removeHead();
635 if (!visited[currentCell])
637 visited[currentCell] = 1;
640 newOrder[cellInOrder] = currentCell;
644 const labelUList neighbours = cellCellAddressing[currentCell];
654 label nbr = neighbours[nI];
655 if (!cellRemoved(nbr) && !visited[nbr])
659 weights.append(cellCellAddressing[nbr].size());
667 nextCell.append(nbrs[i]);
674 newOrder.setSize(cellInOrder);
677 oldToNew =
invert(cellCellAddressing.size(), newOrder);
683 void Foam::polyTopoChange::getFaceOrder
685 const label nActiveFaces,
694 oldToNew.setSize(faceOwner_.size());
705 label startOfCell = cellFaceOffsets[celli];
706 label nFaces = cellFaceOffsets[celli+1] - startOfCell;
712 for (
label i = 0; i < nFaces; i++)
714 label facei = cellFaces[startOfCell + i];
716 label nbrCelli = faceNeighbour_[facei];
718 if (facei >= nActiveFaces)
723 else if (nbrCelli != -1)
726 if (nbrCelli == celli)
728 nbrCelli = faceOwner_[facei];
731 if (celli < nbrCelli)
750 order.setSize(nFaces);
756 if (nbr[index] != -1)
758 oldToNew[cellFaces[startOfCell + index]] = newFacei++;
765 patchStarts.setSize(nPatches_);
767 patchSizes.setSize(nPatches_);
772 patchStarts[0] = newFacei;
774 for (
label facei = 0; facei < nActiveFaces; facei++)
776 if (region_[facei] >= 0)
778 patchSizes[region_[facei]]++;
782 label facei = patchStarts[0];
786 patchStarts[
patchi] = facei;
787 facei += patchSizes[
patchi];
793 for (
label facei = 0; facei < nActiveFaces; facei++)
795 if (region_[facei] >= 0)
797 oldToNew[facei] = workPatchStarts[region_[facei]]++;
802 for (
label facei = nActiveFaces; facei < oldToNew.size(); facei++)
804 oldToNew[facei] = facei;
810 if (oldToNew[facei] == -1)
813 <<
"Did not determine new position"
814 <<
" for face " << facei
815 <<
" owner " << faceOwner_[facei]
816 <<
" neighbour " << faceNeighbour_[facei]
817 <<
" region " << region_[facei] <<
endl
818 <<
"This is usually caused by not specifying a patch for"
819 <<
" a boundary face." <<
nl
820 <<
"Switch on the polyTopoChange::debug flag to catch"
821 <<
" this error earlier." <<
nl;
822 if (hasValidPoints(faces_[facei]))
825 <<
"points (removed points marked with "
826 <<
vector::max <<
") " << facePoints(faces_[facei]);
834 void Foam::polyTopoChange::reorderCompactFaces
841 faces_.setCapacity(newSize);
844 region_.setCapacity(newSize);
847 faceOwner_.setCapacity(newSize);
849 reorder(oldToNew, faceNeighbour_);
850 faceNeighbour_.setCapacity(newSize);
854 faceMap_.setCapacity(newSize);
856 renumberReverseMap(oldToNew, reverseFaceMap_);
859 flipFaceFlux_.setCapacity(newSize);
863 void Foam::polyTopoChange::compact
865 const bool orderCells,
866 const bool orderPoints,
867 label& nInternalPoints,
874 reversePointMap_.shrink();
879 faceNeighbour_.shrink();
881 reverseFaceMap_.shrink();
884 reverseCellMap_.shrink();
888 label nActivePoints = 0;
890 labelList localPointMap(points_.size(), -1);
895 nInternalPoints = -1;
899 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
910 if (!pointRemoved(pointi) && !retiredPoints_.found(pointi))
922 && faceOwner_[facei] >= 0
923 && faceNeighbour_[facei] < 0
927 const face&
f = faces_[facei];
933 if (localPointMap[pointi] == -1)
938 || retiredPoints_.found(pointi)
942 <<
"Removed or retired point " << pointi
944 <<
" at position " << facei <<
endl
945 <<
"Probably face has not been adapted for"
955 nInternalPoints = nActivePoints - nBoundaryPoints;
958 forAll(localPointMap, pointi)
960 if (localPointMap[pointi] != -1)
962 localPointMap[pointi] += nInternalPoints;
974 && faceOwner_[facei] >= 0
975 && faceNeighbour_[facei] >= 0
979 const face&
f = faces_[facei];
985 if (localPointMap[pointi] == -1)
990 || retiredPoints_.found(pointi)
994 <<
"Removed or retired point " << pointi
996 <<
" at position " << facei <<
endl
997 <<
"Probably face has not been adapted for"
1016 localPointMap[iter.key()] =
newPointi++;
1022 Pout<<
"Points : active:" << nActivePoints
1026 reorder(localPointMap, points_);
1030 reorder(localPointMap, pointMap_);
1032 renumberReverseMap(localPointMap, reversePointMap_);
1034 renumberKey(localPointMap, oldPoints_);
1035 renumber(localPointMap, retiredPoints_);
1040 face&
f = faces_[facei];
1043 renumberCompact(localPointMap,
f);
1045 if (!faceRemoved(facei) &&
f.
size() < 3)
1048 <<
"Created illegal face " <<
f
1050 <<
" at position:" << facei
1051 <<
" when filtering removed points"
1060 labelList localFaceMap(faces_.size(), -1);
1065 if (!faceRemoved(facei) && faceOwner_[facei] >= 0)
1067 localFaceMap[facei] = newFacei++;
1070 nActiveFaces_ = newFacei;
1074 if (!faceRemoved(facei) && faceOwner_[facei] < 0)
1077 localFaceMap[facei] = newFacei++;
1083 Pout<<
"Faces : active:" << nActiveFaces_
1084 <<
" removed:" << faces_.size()-newFacei <<
endl;
1088 reorderCompactFaces(newFacei, localFaceMap);
1099 CompactListList<label> cellCells;
1100 makeCellCells(nActiveFaces_, cellCells);
1103 newCelli = getCellOrder(cellCells, localCellMap);
1108 localCellMap.setSize(cellMap_.size());
1114 if (!cellRemoved(celli))
1116 localCellMap[celli] = newCelli++;
1123 Pout<<
"Cells : active:" << newCelli
1124 <<
" removed:" << cellMap_.size()-newCelli <<
endl;
1128 if (orderCells || (newCelli != cellMap_.size()))
1130 reorder(localCellMap, cellMap_);
1131 cellMap_.setCapacity(newCelli);
1132 renumberReverseMap(localCellMap, reverseCellMap_);
1136 forAll(faceOwner_, facei)
1138 label own = faceOwner_[facei];
1139 label nei = faceNeighbour_[facei];
1144 faceOwner_[facei] = localCellMap[own];
1149 faceNeighbour_[facei] = localCellMap[nei];
1154 faceNeighbour_[facei] >= 0
1155 && faceNeighbour_[facei] < faceOwner_[facei]
1158 faces_[facei].flip();
1159 Swap(faceOwner_[facei], faceNeighbour_[facei]);
1160 flipFaceFlux_[facei] =
1162 flipFaceFlux_[facei]
1172 faceNeighbour_[facei] = localCellMap[nei];
1183 makeCells(nActiveFaces_, cellFaces, cellFaceOffsets);
1199 reorderCompactFaces(localFaceMap.size(), localFaceMap);
1206 const primitiveMesh&
mesh,
1208 const bool internalFacesOnly
1215 label facei = faceLabels[i];
1229 collectedFaces = faceLabels;
1233 collectedFaces.
setSize(nFaces);
1239 label facei = faceLabels[i];
1243 collectedFaces[nFaces++] = facei;
1248 return collectedFaces;
1252 void Foam::polyTopoChange::calcPatchPointMap
1254 const List<Map<label>>& oldPatchMeshPointMaps,
1265 const Map<label>& oldMeshPointMap = oldPatchMeshPointMaps[
patchi];
1269 curPatchPointRnb.
setSize(meshPoints.size());
1273 if (meshPoints[i] < pointMap_.size())
1278 pointMap_[meshPoints[i]]
1281 if (ozmpmIter != oldMeshPointMap.end())
1283 curPatchPointRnb[i] = ozmpmIter();
1287 curPatchPointRnb[i] = -1;
1292 curPatchPointRnb[i] = -1;
1299 void Foam::polyTopoChange::reorderCoupledFaces
1301 const bool syncParallel,
1341 pBufs.finishedSends();
1346 bool anyChanged =
false;
1377 forAll(patchFaceMap, patchFacei)
1379 oldToNew[patchFacei + start] =
1380 start + patchFaceMap[patchFacei];
1383 forAll(patchFaceRotation, patchFacei)
1385 rotation[patchFacei + start] =
1386 patchFaceRotation[patchFacei];
1396 reduce(anyChanged, orOp<bool>());
1402 reorderCompactFaces(oldToNew.size(), oldToNew);
1407 if (rotation[facei] != 0)
1409 inplaceRotateList<List, label>(faces_[facei], rotation[facei]);
1416 void Foam::polyTopoChange::compactAndReorder
1418 const polyMesh&
mesh,
1419 const bool syncParallel,
1420 const bool orderCells,
1421 const bool orderPoints,
1423 label& nInternalPoints,
1427 List<objectMap>& pointsFromPoints,
1428 List<objectMap>& facesFromFaces,
1429 List<objectMap>& cellsFromCells,
1430 List<Map<label>>& oldPatchMeshPointMaps,
1439 <<
"polyTopoChange was constructed with a mesh with "
1440 << nPatches_ <<
" patches." <<
endl
1441 <<
"The mesh now provided has a different number of patches "
1443 <<
" which is illegal" <<
endl
1449 compact(orderCells, orderPoints, nInternalPoints, patchSizes, patchStarts);
1453 newPoints.transfer(points_);
1524 reversePointMap_(0),
1547 nPatches_(
mesh.boundaryMesh().size()),
1550 reversePointMap_(0),
1569 points_.setCapacity(points_.size() +
points.size());
1593 for (
label celli = 0; celli < nAllCells; celli++)
1609 faces_.setCapacity(faces_.size() + nAllFaces);
1615 flipFaceFlux_.
setCapacity(faces_.size() + nAllFaces);
1640 patchStartOrder.
sort();
1643 forAll(patchStartOrder, i)
1671 points_.clearStorage();
1672 pointMap_.clearStorage();
1673 reversePointMap_.clearStorage();
1674 retiredPoints_.clearStorage();
1675 oldPoints_.clearStorage();
1677 faces_.clearStorage();
1678 region_.clearStorage();
1679 faceOwner_.clearStorage();
1680 faceNeighbour_.clearStorage();
1681 faceMap_.clearStorage();
1682 reverseFaceMap_.clearStorage();
1683 flipFaceFlux_.clearStorage();
1686 cellMap_.clearStorage();
1687 reverseCellMap_.clearStorage();
1699 pointMap_.setCapacity(
nPoints);
1700 reversePointMap_.setCapacity(
nPoints);
1702 faces_.setCapacity(nFaces);
1703 region_.setCapacity(nFaces);
1704 faceOwner_.setCapacity(nFaces);
1705 faceNeighbour_.setCapacity(nFaces);
1706 faceMap_.setCapacity(nFaces);
1707 reverseFaceMap_.setCapacity(nFaces);
1708 flipFaceFlux_.setCapacity(nFaces);
1710 cellMap_.setCapacity(nCells);
1711 reverseCellMap_.setCapacity(nCells);
1718 const label masterPointID,
1722 label pointi = points_.size();
1725 pointMap_.append(masterPointID);
1726 reversePointMap_.append(pointi);
1730 retiredPoints_.insert(pointi);
1744 if (pointi < 0 || pointi >= points_.size())
1747 <<
"illegal point label " << pointi <<
endl
1748 <<
"Valid point labels are 0 .. " << points_.size()-1
1751 if (pointRemoved(pointi) || pointMap_[pointi] == -1)
1754 <<
"point " << pointi <<
" already marked for removal"
1757 points_[pointi] = pt;
1761 retiredPoints_.erase(pointi);
1765 retiredPoints_.insert(pointi);
1768 oldPoints_.erase(pointi);
1775 const label mergePointi
1778 if (pointi < 0 || pointi >= points_.size())
1781 <<
"illegal point label " << pointi <<
endl
1782 <<
"Valid point labels are 0 .. " << points_.size()-1
1789 && (pointRemoved(pointi) || pointMap_[pointi] == -1)
1793 <<
"point " << pointi <<
" already marked for removal" <<
nl
1794 <<
"Point:" << points_[pointi] <<
" pointMap:" << pointMap_[pointi]
1798 if (pointi == mergePointi)
1801 <<
"Cannot remove/merge point " << pointi <<
" onto itself."
1806 pointMap_[pointi] = -1;
1807 if (mergePointi >= 0)
1809 reversePointMap_[pointi] = -mergePointi-2;
1813 reversePointMap_[pointi] = -1;
1815 retiredPoints_.erase(pointi);
1816 oldPoints_.erase(pointi);
1825 const label masterFaceID,
1826 const bool flipFaceFlux,
1833 checkFace(
f, -1, own, nei, patchID);
1836 label facei = faces_.size();
1839 region_.append(patchID);
1840 faceOwner_.append(own);
1841 faceNeighbour_.append(nei);
1843 if (masterFaceID >= 0)
1845 faceMap_.append(masterFaceID);
1854 faceMap_.append(-1);
1856 reverseFaceMap_.append(facei);
1858 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
1870 const bool flipFaceFlux,
1877 checkFace(
f, facei, own, nei, patchID);
1881 faceOwner_[facei] = own;
1882 faceNeighbour_[facei] = nei;
1883 region_[facei] = patchID;
1885 flipFaceFlux_[facei] = (flipFaceFlux ? 1 : 0);
1891 if (facei < 0 || facei >= faces_.size())
1894 <<
"illegal face label " << facei <<
endl
1895 <<
"Valid face labels are 0 .. " << faces_.size()-1
1902 && (faceRemoved(facei) || faceMap_[facei] == -1)
1907 <<
" already marked for removal"
1911 faces_[facei].setSize(0);
1912 region_[facei] = -1;
1913 faceOwner_[facei] = -1;
1914 faceNeighbour_[facei] = -1;
1915 faceMap_[facei] = -1;
1916 if (mergeFacei >= 0)
1918 reverseFaceMap_[facei] = -mergeFacei-2;
1922 reverseFaceMap_[facei] = -1;
1924 flipFaceFlux_[facei] = 0;
1930 const label celli = cellMap_.size();
1931 cellMap_.append(masterCellID);
1932 reverseCellMap_.append(celli);
1940 if (celli < 0 || celli >= cellMap_.size())
1943 <<
"illegal cell label " << celli <<
endl
1944 <<
"Valid cell labels are 0 .. " << cellMap_.size()-1
1948 if (strict_ && cellMap_[celli] == -2)
1952 <<
" already marked for removal"
1956 cellMap_[celli] = -2;
1957 if (mergeCelli >= 0)
1959 reverseCellMap_[celli] = -mergeCelli-2;
1963 reverseCellMap_[celli] = -1;
1971 const bool syncParallel,
1972 const bool orderCells,
1973 const bool orderPoints
1978 Pout<<
"polyTopoChange::changeMesh"
1979 <<
"(polyMesh&, const bool, const bool, const bool, const bool)"
1985 Pout<<
"Old mesh:" <<
nl;
1993 label nInternalPoints;
2025 oldPatchMeshPointMaps,
2026 oldPatchNMeshPoints,
2048 move(faceNeighbour_),
2056 retiredPoints_.clearStorage();
2057 oldPoints_.clearStorage();
2058 region_.clearStorage();
2065 label nSplit, nInserted, nMerge, nRemove;
2076 <<
" added(from point):" << nSplit
2077 <<
" added(from nothing):" << nInserted
2078 <<
" merged(into other point):" << nMerge
2079 <<
" removed:" << nRemove
2082 countMap(faceMap_, reverseFaceMap_, nSplit, nInserted, nMerge, nRemove);
2084 <<
" added(from face):" << nSplit
2085 <<
" added(from nothing):" << nInserted
2086 <<
" merged(into other face):" << nMerge
2087 <<
" removed:" << nRemove
2090 countMap(cellMap_, reverseCellMap_, nSplit, nInserted, nMerge, nRemove);
2092 <<
" added(from cell):" << nSplit
2093 <<
" added(from nothing):" << nInserted
2094 <<
" merged(into other cell):" << nMerge
2095 <<
" removed:" << nRemove
2102 Pout<<
"New mesh:" <<
nl;
2113 oldPatchMeshPointMaps,
2118 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
2130 move(pointsFromPoints),
2133 move(facesFromFaces),
2136 move(cellsFromCells),
2138 move(reversePointMap_),
2139 move(reverseFaceMap_),
2140 move(reverseCellMap_),
2142 move(flipFaceFluxSet),
2144 move(patchPointMap),
2146 move(oldPatchSizes),
2147 move(oldPatchStarts),
2148 move(oldPatchNMeshPoints),
2150 move(oldCellVolumes)
2164 const bool syncParallel,
2165 const bool orderCells,
2166 const bool orderPoints
2171 Pout<<
"polyTopoChange::makeMesh"
2172 <<
"(autoPtr<fvMesh>&, const IOobject&, const fvMesh&"
2173 <<
", const bool, const bool, const bool)"
2179 Pout<<
"Old mesh:" <<
nl;
2186 label nInternalPoints;
2216 oldPatchMeshPointMaps,
2217 oldPatchNMeshPoints,
2241 move(faceNeighbour_)
2244 fvMesh& newMesh = newMeshPtr();
2248 retiredPoints_.clearStorage();
2249 oldPoints_.clearStorage();
2250 region_.clearStorage();
2257 label nSplit, nInserted, nMerge, nRemove;
2269 <<
" added(from point):" << nSplit
2270 <<
" added(from nothing):" << nInserted
2271 <<
" merged(into other point):" << nMerge
2272 <<
" removed:" << nRemove
2275 countMap(faceMap_, reverseFaceMap_, nSplit, nInserted, nMerge, nRemove);
2277 <<
" added(from face):" << nSplit
2278 <<
" added(from nothing):" << nInserted
2279 <<
" merged(into other face):" << nMerge
2280 <<
" removed:" << nRemove
2283 countMap(cellMap_, reverseCellMap_, nSplit, nInserted, nMerge, nRemove);
2285 <<
" added(from cell):" << nSplit
2286 <<
" added(from nothing):" << nInserted
2287 <<
" merged(into other cell):" << nMerge
2288 <<
" removed:" << nRemove
2346 newMesh.
addZones(pZonePtrs, fZonePtrs, cZonePtrs);
2354 oldPatchMeshPointMaps,
2361 Pout<<
"New mesh:" <<
nl;
2365 labelHashSet flipFaceFluxSet(getSetIndices(flipFaceFlux_));
2377 move(pointsFromPoints),
2380 move(facesFromFaces),
2383 move(cellsFromCells),
2385 move(reversePointMap_),
2386 move(reverseFaceMap_),
2387 move(reverseCellMap_),
2389 move(flipFaceFluxSet),
2391 move(patchPointMap),
2393 move(oldPatchSizes),
2394 move(oldPatchStarts),
2395 move(oldPatchNMeshPoints),
2397 move(oldCellVolumes)
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
void setCapacity(const label)
Alter the size of the underlying storage.
friend class const_iterator
Declare friendship with the const_iterator.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
readOption readOpt() const
autoPtr< IOobject > clone() const
Clone.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
void setCapacity(const label)
Alter the size of the underlying storage.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
void sort()
(stable) sort the list (if changed after construction time)
label size() const
Return the number of elements in the UPtrList.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
void reset(T *=nullptr)
If object pointer already set, delete object and set to given.
A face is a list of labels corresponding to mesh vertices.
Mesh data needed to do the Finite Volume discretisation.
void addFvPatches(const List< polyPatch * > &, const bool validBoundary=true)
Add boundary patches. Constructor helper.
Mesh consisting of general polyhedral cells.
const pointZoneList & pointZones() const
Return point zones.
const cellZoneList & cellZones() const
Return cell zones.
virtual const faceList & faces() const
Return raw faces.
void resetPrimitives(pointField &&points, faceList &&faces, labelList &&owner, labelList &&neighbour, const labelList &patchSizes, const labelList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
virtual const labelList & faceOwner() const
Return face owner.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
label start() const
Return start label of this patch in the polyMesh face list.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Direct mesh changes based on v1.3 polyTopoChange syntax.
void modifyPoint(const label, const point &, const bool inCell)
Modify coordinate.
void removePoint(const label, const label)
Remove point / merge points.
autoPtr< polyTopoChangeMap > makeMesh(autoPtr< fvMesh > &newMesh, const IOobject &io, const polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Create new mesh with old mesh patches.
polyTopoChange(const label nPatches, const bool strict=true)
Construct without mesh. Either specify nPatches or use.
const DynamicList< face > & faces() const
const DynamicList< point > & points() const
Points. Shrunk after constructing mesh (or calling of compact())
void removeFace(const label, const label)
Remove face / merge faces.
void setCapacity(const label nPoints, const label nFaces, const label nCells)
Explicitly pre-size the dynamic storage for expected mesh.
label addCell(const label masterCellID)
Add cell and return new cell index.
const DynamicList< label > & faceOwner() const
autoPtr< polyTopoChangeMap > changeMesh(polyMesh &mesh, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Inplace changes mesh without change of patches.
const DynamicList< label > & faceNeighbour() const
label addPoint(const point &, const label masterPointID, const bool inCell)
Add point and return new point index.
void clear()
Clear all storage.
void removeCell(const label, const label)
Remove cell / merge cells.
void modifyFace(const face &f, const label facei, const label own, const label nei, const bool flipFaceFlux, const label patchID)
Modify vertices or cell of face.
label addFace(const face &f, const label own, const label nei, const label masterFaceID, const bool flipFaceFlux, const label patchID)
Add face to cells and return new face index.
const scalarField & cellVolumes() const
label nInternalFaces() const
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const fvPatchList & patches
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
int order(const scalar s)
errorManip< error > abort(error &err)
ListType renumber(const labelUList &oldToNew, const ListType &)
Renumber the values (not the indices) of a list.
vectorField pointField
pointField is a vectorField.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
Addressing for a faceList slice.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
ListType reorder(const label size, const typename ListType::value_type &defaultValue, const labelUList &oldToNew, const ListType &lst)
List< labelList > labelListList
A List of labelList.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static const label labelMax
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
UList< label > labelUList
void inplaceReorder(const labelUList &oldToNew, ListType &)
Inplace reorder the elements of a list.
faceListList boundary(nPatches)