50 PackedBoolList& boundaryFacesToRemove
57 timeCheck(
"After setVertexSizeAndAlignment");
62 Info<<
nl <<
"Merging identical points" <<
endl;
70 timeCheck(
"Before createFacesOwnerNeighbourAndPatches");
80 patchToDelaunayVertex,
81 boundaryFacesToRemove,
91 cellCentres =
pointField(cellCentres, cellToDelaunayVertex);
110 labelList vertexMap(number_of_vertices());
114 points.setSize(number_of_vertices());
115 pointToDelaunayVertex.setSize(number_of_vertices());
119 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
120 vit != finite_vertices_end();
124 if (vit->internalPoint() || vit->boundaryPoint())
126 vertexMap[vit->index()] = vertI;
128 pointToDelaunayVertex[vertI] = vit->index();
134 pointToDelaunayVertex.setSize(vertI);
140 Delaunay::Finite_cells_iterator cit = finite_cells_begin();
141 cit != finite_cells_end();
145 if (cit->internalOrBoundaryDualVertex())
147 cit->cellIndex() = cellI++;
151 cit->cellIndex() = Cb::ctFar;
155 patchNames = geometryToConformTo_.patchNames();
167 faces.setSize(number_of_finite_facets());
169 owner.setSize(number_of_finite_facets());
171 neighbour.setSize(number_of_finite_facets());
177 face newFace(verticesOnTriFace);
181 Delaunay::Finite_facets_iterator fit = finite_facets_begin();
182 fit != finite_facets_end();
186 const Cell_handle
c1(fit->first);
187 const label oppositeVertex = fit->second;
188 const Cell_handle
c2(
c1->neighbor(oppositeVertex));
190 if (
c1->hasFarPoint() &&
c2->hasFarPoint())
199 label ownerCell = -1;
200 label neighbourCell = -1;
202 for (
label i = 0; i < 3; i++)
204 verticesOnTriFace[i] = vertexMap
206 c1->vertex(vertex_triple_index(oppositeVertex, i))->index()
210 newFace = face(verticesOnTriFace);
212 if (
c1->hasFarPoint() ||
c2->hasFarPoint())
215 if (
c1->hasFarPoint())
228 label patchIndex = geometryToConformTo_.findPatch
233 if (patchIndex == -1)
239 <<
"did not find a surface patch. Adding to "
245 patchOwners[patchIndex].append(ownerCell);
265 faces[faceI] = newFace;
266 owner[faceI] = ownerCell;
267 neighbour[faceI] = neighbourCell;
272 label nInternalFaces = faceI;
274 faces.setSize(nInternalFaces);
275 owner.setSize(nInternalFaces);
276 neighbour.setSize(nInternalFaces);
278 sortFaces(faces, owner, neighbour);
305 label nPtsMerged = 0;
306 label nPtsMergedSum = 0;
310 Map<label> dualPtIndexMap;
312 nPtsMerged = mergeIdenticalDualVertices
318 reindexDualVertices(dualPtIndexMap, boundaryPts);
320 reduce(nPtsMerged, sumOp<label>());
322 nPtsMergedSum += nPtsMerged;
324 }
while (nPtsMerged > 0);
326 if (nPtsMergedSum > 0)
328 Info<<
" Merged " << nPtsMergedSum <<
" points " <<
endl;
336 Map<label>& dualPtIndexMap
339 label nPtsMerged = 0;
343 Delaunay::Finite_facets_iterator fit = finite_facets_begin();
344 fit != finite_facets_end();
348 const Cell_handle
c1(fit->first);
349 const label oppositeVertex = fit->second;
350 const Cell_handle
c2(
c1->neighbor(oppositeVertex));
352 if (is_infinite(
c1) || is_infinite(
c2))
360 if ((c1I != c2I) && !
c1->hasFarPoint() && !
c2->hasFarPoint())
382 dualPtIndexMap.insert(c1I, c1I);
383 dualPtIndexMap.insert(c2I, c1I);
387 dualPtIndexMap.insert(c1I, c2I);
388 dualPtIndexMap.insert(c2I, c2I);
398 Info<<
"mergeIdenticalDualVertices:" <<
endl
399 <<
" zero-length edges : "
676 const HashSet<
labelPair, labelPair::Hash<> >& deferredCollapseFaces
679 DynamicList<label> faceLabels;
683 if (deferredCollapseFaces.found(Pair<label>(owner[nI], neighbour[nI])))
685 faceLabels.append(nI);
689 Pout<<
"facesToCollapse" <<
nl << faceLabels <<
endl;
706 PackedBoolList boundaryFacesToRemove;
708 timeCheck(
"Start of checkPolyMeshQuality");
710 Info<<
nl <<
"Creating polyMesh to assess quality" <<
endl;
712 createFacesOwnerNeighbourAndPatches
720 patchToDelaunayVertex,
721 boundaryFacesToRemove,
727 labelList cellToDelaunayVertex(removeUnusedCells(owner, neighbour));
728 cellCentres =
pointField(cellCentres, cellToDelaunayVertex);
736 "foamyHexMesh_temporary",
753 label nValidPatches = 0;
766 if (totalPatchSize > 0)
768 patchDicts[
p].set(
"transform",
"coincidentFullMatch");
770 patches[nValidPatches] =
new processorPolyPatch
775 pMesh.boundaryMesh(),
776 processorPolyPatch::typeName
785 reduce(totalPatchSize, sumOp<label>());
787 if (totalPatchSize > 0)
802 patches.setSize(nValidPatches);
812 Info<<
"Checking cell sizes..."<<
endl;
814 timeCheck(
"Start of Cell Sizing");
816 labelList boundaryPts(number_of_finite_cells(),
internal);
819 indexDualVertices(ptsField, boundaryPts);
822 mergeIdenticalDualVertices(ptsField, boundaryPts);
824 autoPtr<polyMesh>
meshPtr = createPolyMeshFromPoints(ptsField);
825 const polyMesh& pMesh =
meshPtr();
830 DynamicList<label> checkFaces(
identity(pMesh.nFaces()));
833 Info<<
"Running checkMesh on mesh with " << pMesh.nCells()
836 const dictionary&
dict
837 = foamyHexMeshControls().foamyHexMeshDict();
839 const dictionary& meshQualityDict
842 const scalar maxNonOrtho =
843 readScalar(meshQualityDict.lookup(
"maxNonOrtho",
true));
845 label nWrongFaces = 0;
847 if (maxNonOrtho < 180.0 - SMALL)
863 Info<<
" non-orthogonality > " << maxNonOrtho
864 <<
" degrees : " << nNonOrthogonal <<
endl;
866 nWrongFaces += nNonOrthogonal;
869 labelHashSet protrudingCells = findOffsetPatchFaces(pMesh, 0.25);
871 label nProtrudingCells = protrudingCells.size();
873 Info<<
" protruding/intruding cells : " << nProtrudingCells <<
endl;
875 nWrongFaces += nProtrudingCells;
886 Info<<
" Found total of " << nWrongFaces <<
" bad faces" <<
endl;
894 const label faceOwner = pMesh.faceOwner()[iter.key()];
895 const label faceNeighbour = pMesh.faceNeighbour()[iter.key()];
897 if (!cellsToResizeMap.found(faceOwner))
899 cellsToResizeMap.insert(faceOwner);
902 if (!cellsToResizeMap.found(faceNeighbour))
904 cellsToResizeMap.insert(faceNeighbour);
908 cellsToResizeMap += protrudingCells;
910 pointField cellsToResize(cellsToResizeMap.size());
913 for (
label cellI = 0; cellI < pMesh.nCells(); ++cellI)
915 if (cellsToResizeMap.found(cellI))
917 cellsToResize[count++] = pMesh.cellCentres()[cellI];
921 Info<<
" DISABLED: Automatically re-sizing " << cellsToResize.size()
922 <<
" cells that are attached to the bad faces: " <<
endl;
927 timeCheck(
"End of Cell Sizing");
929 Info<<
"Finished checking cell sizes"<<
endl;
935 const polyMesh&
mesh,
936 const scalar allowedOffset
939 timeCheck(
"Start findRemainingProtrusionSet");
943 cellSet offsetBoundaryCells
946 "foamyHexMesh_protrudingCells",
952 const polyPatch& patch =
patches[patchI];
954 const faceList& localFaces = patch.localFaces();
955 const pointField& localPoints = patch.localPoints();
957 const labelList& fCell = patch.faceCells();
961 const face&
f = localFaces[pLFI];
965 const scalar targetSize = targetCellSize(faceCentre);
970 geometryToConformTo_.findSurfaceNearest
981 && (
mag(pHit.hitPoint() - faceCentre) > allowedOffset*targetSize)
984 offsetBoundaryCells.insert(fCell[pLFI]);
989 if (foamyHexMeshControls().objOutput())
991 offsetBoundaryCells.write();
994 return offsetBoundaryCells;
1003 autoPtr<polyMesh>
meshPtr = createPolyMeshFromPoints(pts);
1006 timeCheck(
"polyMesh created, checking quality");
1010 DynamicList<label> checkFaces(pMesh.nFaces());
1014 scalar faceAreaLimit = SMALL;
1018 if (
mag(fAreas[fI]) > faceAreaLimit)
1020 checkFaces.append(fI);
1024 Info<<
nl <<
"Excluding "
1025 <<
returnReduce(fAreas.size() - checkFaces.size(), sumOp<label>())
1026 <<
" faces from check, < " << faceAreaLimit <<
" area" <<
endl;
1028 const dictionary&
dict
1029 = foamyHexMeshControls().foamyHexMeshDict();
1031 const dictionary& meshQualityDict
1045 label nInvalidPolyhedra = 0;
1051 if (
cells[cI].size() < 4 &&
cells[cI].size() > 0)
1057 nInvalidPolyhedra++;
1061 wrongFaces.insert(
cells[cI][cFI]);
1066 Info<<
" cells with more than 1 but fewer than 4 faces : "
1074 for (
label fI = 0; fI < pMesh.nInternalFaces(); fI++)
1076 nInternalFaces[pMesh.faceOwner()[fI]]++;
1077 nInternalFaces[pMesh.faceNeighbour()[fI]]++;
1080 const polyBoundaryMesh&
patches = pMesh.boundaryMesh();
1084 if (
patches[patchI].coupled())
1090 nInternalFaces[owners[i]]++;
1095 label oneInternalFaceCells = 0;
1097 forAll(nInternalFaces, cI)
1099 if (nInternalFaces[cI] <= 1)
1101 oneInternalFaceCells++;
1105 wrongFaces.insert(
cells[cI][cFI]);
1110 Info<<
" cells with with zero or one non-boundary face : "
1116 PackedBoolList ptToBeLimited(pts.size(),
false);
1120 const face
f = pMesh.faces()[iter.key()];
1124 ptToBeLimited[
f[fPtI]] =
true;
1169 label maxFilterCount = 0;
1173 Delaunay::Finite_cells_iterator cit = finite_cells_begin();
1174 cit != finite_cells_end();
1178 label cI = cit->cellIndex();
1182 if (ptToBeLimited[cI] ==
true)
1184 cit->filterCount()++;
1187 if (cit->filterCount() > maxFilterCount)
1189 maxFilterCount = cit->filterCount();
1194 Info<<
nl <<
"Maximum number of filter limits applied: "
1206 if (cit->boundaryDualVertex())
1208 if (cit->featurePointDualVertex())
1210 return featurePoint;
1212 else if (cit->featureEdgeDualVertex())
1221 else if (cit->baffleSurfaceDualVertex())
1225 else if (cit->baffleEdgeDualVertex())
1244 this->resetCellCount();
1246 label nConstrainedVertices = 0;
1247 if (foamyHexMeshControls().guardFeaturePoints())
1251 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
1252 vit != finite_vertices_end();
1256 if (vit->constrained())
1258 vit->index() = number_of_finite_cells() + nConstrainedVertices;
1259 nConstrainedVertices++;
1264 pts.setSize(number_of_finite_cells() + nConstrainedVertices);
1267 number_of_finite_cells() + nConstrainedVertices,
1271 if (foamyHexMeshControls().guardFeaturePoints())
1273 nConstrainedVertices = 0;
1276 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
1277 vit != finite_vertices_end();
1281 if (vit->constrained())
1283 pts[number_of_finite_cells() + nConstrainedVertices] =
1286 boundaryPts[number_of_finite_cells() + nConstrainedVertices] =
1289 nConstrainedVertices++;
1300 Delaunay::Finite_cells_iterator cit = finite_cells_begin();
1301 cit != finite_cells_end();
1312 if (!cit->hasFarPoint())
1314 cit->cellIndex() = getNewCellIndex();
1322 typedef CGAL::Exact_predicates_exact_constructions_kernel Exact;
1323 typedef CGAL::Point_3<Exact> ExactPoint;
1328 for (
label vI = 0; vI < 4; ++vI)
1332 cit->vertex(vI)->procIndex(),
1333 cit->vertex(vI)->index()
1336 cellVertices[vI] = ExactPoint
1338 cit->vertex(vI)->point().x(),
1339 cit->vertex(vI)->point().y(),
1340 cit->vertex(vI)->point().z()
1348 oldToNew =
invert(oldToNew.size(), oldToNew);
1351 ExactPoint synchronisedDual = CGAL::circumcenter
1361 CGAL::to_double(synchronisedDual.x()),
1362 CGAL::to_double(synchronisedDual.y()),
1363 CGAL::to_double(synchronisedDual.z())
1368 pts[cit->cellIndex()] = cit->dual();
1372 if (foamyHexMeshControls().snapFeaturePoints())
1374 if (cit->featurePointDualVertex())
1382 geometryToConformTo_.findFeaturePointNearest
1385 sqr(targetCellSize(dual)),
1394 Info<<
"Dual = " << dual <<
nl
1395 <<
" Nearest = " << fpHit.hitPoint() <<
endl;
1398 pts[cit->cellIndex()] = fpHit.hitPoint();
1485 boundaryPts[cit->cellIndex()] = classifyBoundaryPoint(cit);
1489 cit->cellIndex() = Cb::ctFar;
1501 const Map<label>& dualPtIndexMap,
1507 Delaunay::Finite_cells_iterator cit = finite_cells_begin();
1508 cit != finite_cells_end();
1512 if (dualPtIndexMap.found(cit->cellIndex()))
1514 cit->cellIndex() = dualPtIndexMap[cit->cellIndex()];
1515 boundaryPts[cit->cellIndex()] =
1518 boundaryPts[cit->cellIndex()],
1519 boundaryPts[dualPtIndexMap[cit->cellIndex()]]
1532 patchNames = geometryToConformTo_.patchNames();
1536 const PtrList<dictionary>& patchInfo = geometryToConformTo_.patchInfo();
1540 if (patchInfo.set(patchI))
1542 patchDicts.set(patchI,
new dictionary(patchInfo[patchI]));
1550 wallPolyPatch::typeName
1557 patchNames[defaultPatchIndex] =
"foamyHexMesh_defaultPatch";
1558 patchDicts.set(defaultPatchIndex,
new dictionary());
1562 wallPolyPatch::typeName
1565 label nProcPatches = 0;
1580 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
1581 vit != finite_vertices_end();
1588 if (vit->referred())
1590 procUsed[vit->procIndex()] =
true;
1598 forAll(procUsedList, procI)
1604 procUsed[procI] =
true;
1618 label nTotalPatches = nNonProcPatches + nProcPatches;
1622 for (
label pI = nNonProcPatches; pI < nTotalPatches; ++pI)
1642 processorPolyPatch::typeName
1651 patchDicts[nNonProcPatches + procAddI].set(
"neighbProcNo", pUI);
1658 return defaultPatchIndex;
1671 for (
label cI = 0; cI < 4; ++cI)
1673 if (
c1->neighbor(cI) !=
c2 && !
c1->vertex(cI)->constrained())
1675 if (
c1->vertex(cI)->internalBoundaryPoint())
1677 patchEdge[0] =
topoint(
c1->vertex(cI)->point());
1681 patchEdge[1] =
topoint(
c1->vertex(cI)->point());
1688 return vector(patchEdge[1] - patchEdge[0]);
1698 label nInternal = 0;
1699 label nExternal = 0;
1701 for (
label cI = 0; cI < 4; ++cI)
1703 if (
c1->neighbor(cI) !=
c2 && !
c1->vertex(cI)->constrained())
1705 if (
c1->vertex(cI)->internalBoundaryPoint())
1709 else if (
c1->vertex(cI)->externalBoundaryPoint())
1716 Info<<
"in = " << nInternal <<
" out = " << nExternal <<
endl;
1718 return (nInternal == 1 && nExternal == 1);
1731 PackedBoolList& boundaryFacesToRemove,
1732 bool includeEmptyPatches
1761 faces.setSize(number_of_finite_edges());
1762 owner.setSize(number_of_finite_edges());
1763 neighbour.setSize(number_of_finite_edges());
1764 boundaryFacesToRemove.setSize(number_of_finite_edges(),
false);
1766 labelPairPairDynListList procPatchSortingIndex(
nPatches);
1768 label dualFaceI = 0;
1770 if (foamyHexMeshControls().guardFeaturePoints())
1772 OBJstream startCellStr(
"startingCell.obj");
1773 OBJstream featurePointFacesStr(
"ftPtFaces.obj");
1774 OBJstream featurePointDualsStr(
"ftPtDuals.obj");
1775 OFstream cellStr(
"vertexCells.obj");
1781 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
1782 vit != finite_vertices_end();
1786 if (vit->constrained())
1789 std::list<Cell_handle> vertexCells;
1790 finite_incident_cells(vit, std::back_inserter(vertexCells));
1792 Cell_handle startCell;
1796 std::list<Cell_handle>::iterator vcit = vertexCells.begin();
1797 vcit != vertexCells.end();
1801 if ((*vcit)->featurePointExternalCell())
1806 if ((*vcit)->real())
1808 featurePointDualsStr.write
1816 if (startCell == NULL)
1818 Pout<<
"Start cell is null!" <<
endl;
1822 Cell_handle vc1 = startCell;
1825 Info<<
"c1 index = " << vc1->cellIndex() <<
" "
1826 << vc1->dual() <<
endl;
1828 for (
label cI = 0; cI < 4; ++cI)
1830 Info<<
"c1 = " << cI <<
" "
1831 << vc1->neighbor(cI)->cellIndex() <<
" v = "
1832 << vc1->neighbor(cI)->dual() <<
endl;
1834 Info<< vc1->vertex(cI)->info();
1837 Cell_handle nextCell;
1839 for (
label cI = 0; cI < 4; ++cI)
1841 if (vc1->vertex(cI)->externalBoundaryPoint())
1843 vc2 = vc1->neighbor(cI);
1845 Info<<
" c2 is neighbor "
1847 <<
" of c1" <<
endl;
1849 for (
label cI = 0; cI < 4; ++cI)
1851 Info<<
" c2 = " << cI <<
" "
1852 << vc2->neighbor(cI)->cellIndex() <<
" v = "
1853 << vc2->vertex(cI)->index() <<
endl;
1857 f[0] = vit->index();
1858 f[1] = vc1->cellIndex();
1859 f[2] = vc2->cellIndex();
1867 vector correctNormal = calcSharedPatchNormal(vc1, vc2);
1868 correctNormal /=
mag(correctNormal);
1870 Info<<
" cN " << correctNormal <<
endl;
1874 if (
mag(fN) < SMALL)
1883 if ((fN & correctNormal) > 0)
1893 label own = vit->index();
1897 Info<<
"Start walk from " << vc1->cellIndex()
1898 <<
" to " << vc2->cellIndex() <<
endl;
1905 Info<<
" Walk from " << vc1->cellIndex()
1906 <<
" " << vc1->dual()
1907 <<
" to " << vc2->cellIndex()
1908 <<
" " << vc2->dual()
1916 geometryToConformTo_.findPatch
1921 f[1] = vc1->cellIndex();
1922 f[2] = vc2->cellIndex();
1925 patchOwners[patchIndex].append(own);
1926 patchPPSlaves[patchIndex].append(own);
1929 Cell_handle nextCell;
1931 Info<<
" c1 vertices " << vc2->dual() <<
endl;
1932 for (
label cI = 0; cI < 4; ++cI)
1934 Info<<
" " << vc2->vertex(cI)->info();
1936 Info<<
" c1 neighbour vertices " <<
endl;
1937 for (
label cI = 0; cI < 4; ++cI)
1941 !vc2->vertex(cI)->constrained()
1942 && vc2->neighbor(cI) != vc1
1943 && !is_infinite(vc2->neighbor(cI))
1946 vc2->neighbor(cI)->featurePointExternalCell()
1947 || vc2->neighbor(cI)->featurePointInternalCell()
1949 && vc2->neighbor(cI)->hasConstrainedPoint()
1959 Info<<
" neighbour " << cI <<
" "
1960 << vc2->neighbor(cI)->dual() <<
endl;
1964 << vc2->neighbor(cI)->vertex(
I)->info();
1969 for (
label cI = 0; cI < 4; ++cI)
1973 !vc2->vertex(cI)->constrained()
1974 && vc2->neighbor(cI) != vc1
1975 && !is_infinite(vc2->neighbor(cI))
1978 vc2->neighbor(cI)->featurePointExternalCell()
1979 || vc2->neighbor(cI)->featurePointInternalCell()
1981 && vc2->neighbor(cI)->hasConstrainedPoint()
1985 if (boundaryDualFace(vc2, vc2->neighbor(cI)))
1987 nextCell = vc2->neighbor(cI);
1997 }
while (vc1 != startCell && iter < 100);
2004 Delaunay::Finite_edges_iterator eit = finite_edges_begin();
2005 eit != finite_edges_end();
2009 Cell_handle
c = eit->first;
2010 Vertex_handle vA =
c->vertex(eit->second);
2011 Vertex_handle vB =
c->vertex(eit->third);
2013 if (vA->constrained() && vB->constrained())
2020 (vA->constrained() && vB->internalOrBoundaryPoint())
2021 || (vB->constrained() && vA->internalOrBoundaryPoint())
2024 face newDualFace = buildDualFace(eit);
2029 if (ownerAndNeighbour(vA, vB, own, nei))
2035 faces[dualFaceI] = newDualFace;
2036 owner[dualFaceI] = own;
2037 neighbour[dualFaceI] = nei;
2043 (vA->internalOrBoundaryPoint() && !vA->referred())
2044 || (vB->internalOrBoundaryPoint() && !vB->referred())
2049 (vA->internalPoint() && vB->externalBoundaryPoint())
2050 || (vB->internalPoint() && vA->externalBoundaryPoint())
2053 Cell_circulator ccStart = incident_cells(*eit);
2054 Cell_circulator cc1 = ccStart;
2055 Cell_circulator cc2 = cc1;
2059 bool skipEdge =
false;
2065 cc1->hasFarPoint() || cc2->hasFarPoint()
2066 || is_infinite(cc1) || is_infinite(cc2)
2069 Pout<<
"Ignoring edge between internal and external: "
2080 }
while (cc1 != ccStart);
2095 face newDualFace = buildDualFace(eit);
2097 if (newDualFace.size() >= 3)
2102 if (ownerAndNeighbour(vA, vB, own, nei))
2107 label patchIndex = -1;
2116 if (isProcBoundaryEdge(eit))
2121 label procIndex =
max(vA->procIndex(), vB->procIndex());
2137 DynamicList<Pair<labelPair> >& sortingIndex =
2138 procPatchSortingIndex[patchIndex];
2140 if (vB->internalOrBoundaryPoint() && vB->referred())
2146 labelPair(vA->index(), vA->procIndex()),
2157 labelPair(vB->index(), vB->procIndex()),
2168 DynamicList<Pair<labelPair> >& sortingIndex =
2169 procPatchSortingIndex[patchIndex];
2171 if (vA->internalOrBoundaryPoint() && vA->referred())
2177 labelPair(vA->index(), vA->procIndex()),
2188 labelPair(vB->index(), vB->procIndex()),
2207 patchIndex = geometryToConformTo_.findPatch(ptA, ptB);
2210 if (patchIndex == -1)
2219 patchIndex = geometryToConformTo_.findPatch
2226 patchOwners[patchIndex].append(own);
2232 vA->boundaryPoint() && vB->boundaryPoint()
2233 && !ptPairs_.isPointPair(vA, vB)
2234 && !ftPtConformer_.featurePointPairs().isPointPair(vA, vB)
2237 indirectPatchFace[patchIndex].append(
true);
2241 indirectPatchFace[patchIndex].append(
false);
2245 if (vA->internalOrBoundaryPoint())
2247 patchPPSlaves[patchIndex].append(vB->index());
2251 patchPPSlaves[patchIndex].append(vA->index());
2262 patchIndex = geometryToConformTo_.findPatch(ptA, ptB);
2265 if (patchIndex != -1)
2299 faces[dualFaceI] = newDualFace;
2300 owner[dualFaceI] = own;
2301 neighbour[dualFaceI] = nei;
2313 <<
" faces were not able to have their patch determined from "
2315 <<
nl <<
"Adding to patch " <<
patchNames[defaultPatchIndex]
2319 label nInternalFaces = dualFaceI;
2321 faces.setSize(nInternalFaces);
2322 owner.setSize(nInternalFaces);
2323 neighbour.setSize(nInternalFaces);
2325 timeCheck(
"polyMesh quality checked");
2327 sortFaces(faces, owner, neighbour);
2334 procPatchSortingIndex
2337 timeCheck(
"faces, owner, neighbour sorted");
2345 boundaryFacesToRemove,
2352 patchPointPairSlaves.setSize(
nPatches);
2353 forAll(patchPPSlaves, patchI)
2355 patchPointPairSlaves[patchI].transfer(patchPPSlaves[patchI]);
2358 if (foamyHexMeshControls().objOutput())
2360 Info<<
"Writing processor interfaces" <<
endl;
2366 const label neighbour =
2379 forAll(procPatchFaces, fI)
2381 procPatchFaces[fI] = procPatchFaces[fI].reverseFace();
2385 if (neighbour != -1)
2396 time().
path()/fName,
2430 forAll(ownerNeighbourPair, oNI)
2432 ownerNeighbourPair[oNI] =
labelPair(owner[oNI], neighbour[oNI]);
2436 <<
"Sorting faces, owner and neighbour into upper triangular order"
2443 oldToNew =
invert(oldToNew.size(), oldToNew);
2454 List<DynamicList<label> >& patchOwners,
2455 List<DynamicList<label> >& patchPointPairSlaves,
2456 labelPairPairDynListList& patchSortingIndices
2464 forAll(patchSortingIndices, patchI)
2468 DynamicList<label>& slaves = patchPointPairSlaves[patchI];
2469 DynamicList<Pair<labelPair> >& sortingIndices
2470 = patchSortingIndices[patchI];
2472 if (!sortingIndices.empty())
2476 faces.size() != sortingIndices.size()
2477 || owner.size() != sortingIndices.size()
2478 || slaves.size() != sortingIndices.size()
2482 <<
"patch size and size of sorting indices is inconsistent "
2483 <<
" for patch " << patchI <<
nl
2484 <<
" faces.size() " << faces.size() <<
nl
2485 <<
" owner.size() " << owner.size() <<
nl
2486 <<
" slaves.size() " << slaves.size() <<
nl
2487 <<
" sortingIndices.size() "
2488 << sortingIndices.size()
2496 oldToNew =
invert(oldToNew.size(), oldToNew);
2509 const label nInternalFaces,
2513 PackedBoolList& boundaryFacesToRemove,
2515 const List<DynamicList<label> >& patchOwners,
2516 const List<DynamicList<bool> >& indirectPatchFace
2519 label nBoundaryFaces = 0;
2524 patchDicts[
p].set(
"startFace", nInternalFaces + nBoundaryFaces);
2529 faces.setSize(nInternalFaces + nBoundaryFaces);
2530 owner.setSize(nInternalFaces + nBoundaryFaces);
2531 boundaryFacesToRemove.setSize(nInternalFaces + nBoundaryFaces);
2533 label faceI = nInternalFaces;
2540 owner[faceI] = patchOwners[
p][
f];
2541 boundaryFacesToRemove[faceI] = indirectPatchFace[
p][
f];
2556 Info<<
nl <<
"Removing unused points" <<
endl;
2558 PackedBoolList ptUsed(pts.size(),
false);
2564 const face&
f = faces[fI];
2568 ptUsed[
f[fPtI]] =
true;
2581 if (ptUsed[ptUI] ==
true)
2583 oldToNew[ptUI] = pointI++;
2595 pts.setSize(pointI);
2596 boundaryPts.setSize(pointI);
2613 Info<<
nl <<
"Removing unused cells" <<
endl;
2615 PackedBoolList cellUsed(vertexCount(),
false);
2621 cellUsed[owner[oI]] =
true;
2626 cellUsed[neighbour[nI]] =
true;
2638 if (cellUsed[cellUI] ==
true)
2640 oldToNew[cellUI] = cellI++;
2650 DynamicList<label> unusedCells;
2654 if (cellUsed[cUI] ==
false)
2656 unusedCells.append(cUI);
2660 if (unusedCells.size() > 0)
2664 <<
" unused cell labels" <<
endl;
2668 label& o = owner[oI];
2675 label&
n = neighbour[nI];