38const Foam::scalar Foam::conformalVoronoiMesh::searchConeAngle
41const Foam::scalar Foam::conformalVoronoiMesh::searchAngleOppositeSurface
47void Foam::conformalVoronoiMesh::conformToSurface()
53 Delaunay::Finite_cells_iterator cit = finite_cells_begin();
54 cit != finite_cells_end();
61 if (!reconformToSurface())
64 reinsertSurfaceConformation();
76 buildSurfaceConformation();
78 if (distributeBackground(*
this))
88 storeSurfaceConformation();
95bool Foam::conformalVoronoiMesh::reconformToSurface()
const
100 % foamyHexMeshControls().surfaceConformationRebuildFrequency() == 0
111Foam::label Foam::conformalVoronoiMesh::findVerticesNearBoundaries()
113 label countNearBoundaryVertices = 0;
117 Delaunay::Finite_facets_iterator fit = finite_facets_begin();
118 fit != finite_facets_end();
122 Cell_handle
c1 = fit->first;
123 Cell_handle
c2 = fit->first->neighbor(fit->second);
125 if (is_infinite(c1) || is_infinite(c2))
133 if (!geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1))
138 for (label celli = 0; celli < 4; ++celli)
140 Vertex_handle v =
c1->vertex(celli);
145 && v->internalPoint()
146 && fit->second != celli
149 v->setNearBoundary();
153 for (label celli = 0; celli < 4; ++celli)
155 Vertex_handle v =
c2->vertex(celli);
160 && v->internalPoint()
161 && fit->second != celli
164 v->setNearBoundary();
171 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
172 vit != finite_vertices_end();
176 if (vit->nearBoundary())
178 countNearBoundaryVertices++;
219 return countNearBoundaryVertices;
223void Foam::conformalVoronoiMesh::buildSurfaceConformation()
225 timeCheck(
"Start buildSurfaceConformation");
228 <<
"Rebuilding surface conformation for more iterations"
231 existingEdgeLocations_.clearStorage();
232 existingSurfacePtLocations_.clearStorage();
234 buildEdgeLocationTree(existingEdgeLocations_);
235 buildSurfacePtLocationTree(existingSurfacePtLocations_);
237 label initialTotalHits = 0;
268 label countNearBoundaryVertices = findVerticesNearBoundaries();
270 Info<<
" Vertices marked as being near a boundary: "
272 <<
" (estimated)" <<
endl;
274 timeCheck(
"After set near boundary");
276 const scalar edgeSearchDistCoeffSqr =
277 foamyHexMeshControls().edgeSearchDistCoeffSqr();
279 const scalar surfacePtReplaceDistCoeffSqr =
280 foamyHexMeshControls().surfacePtReplaceDistCoeffSqr();
282 const label AtoV = label(6/
Foam::pow(scalar(number_of_vertices()), 3));
286 pointIndexHitAndFeatureDynList featureEdgeHits(AtoV/4);
287 pointIndexHitAndFeatureDynList surfaceHits(AtoV);
295 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
296 vit != finite_vertices_end();
300 if (vit->nearBoundary())
302 pointIndexHitAndFeatureDynList surfaceIntersections(AtoV);
306 dualCellSurfaceAllIntersections
317 addSurfaceAndEdgeHits
320 surfaceIntersections,
321 surfacePtReplaceDistCoeffSqr,
322 edgeSearchDistCoeffSqr,
327 surfacePtToEdgePtDist,
334 countNearBoundaryVertices--;
339 Info<<
" Vertices marked as being near a boundary: "
341 <<
" (after dual surface intersection)" <<
endl;
343 label nVerts = number_of_vertices();
344 label nSurfHits = surfaceHits.size();
345 label nFeatEdHits = featureEdgeHits.size();
354 Info<<
nl <<
"Initial conformation" <<
nl
355 <<
" Number of vertices " << nVerts <<
nl
356 <<
" Number of surface hits " << nSurfHits <<
nl
357 <<
" Number of edge hits " << nFeatEdHits
363 synchroniseSurfaceTrees(surfaceToTreeShape, surfaceHits);
368 insertSurfacePointPairs
371 "surfaceConformationLocations_initial.obj",
378 synchroniseEdgeTrees(edgeToTreeShape, featureEdgeHits);
381 insertEdgePointGroups
384 "edgeConformationLocations_initial.obj",
390 Map<label> oldToNewIndices = insertPointPairs(pts,
true,
true);
393 ptPairs_.reIndex(oldToNewIndices);
399 timeCheck(
"After initial conformation");
401 initialTotalHits = nSurfHits + nFeatEdHits;
414 forAll(referralVertices, proci)
426 receivedVertices.
reset
434 decomposition_().procBounds(),
440 label iterationNo = 0;
442 label maxIterations = foamyHexMeshControls().maxConformationIterations();
444 scalar iterationToInitialHitRatioLimit =
445 foamyHexMeshControls().iterationToInitialHitRatioLimit();
447 label hitLimit = label(iterationToInitialHitRatioLimit*initialTotalHits);
449 Info<<
nl <<
"Stopping iterations when: " <<
nl
450 <<
" total number of hits drops below "
451 << iterationToInitialHitRatioLimit
452 <<
" of initial hits (" << hitLimit <<
")" <<
nl
454 <<
" maximum number of iterations (" << maxIterations
460 label totalHits = initialTotalHits;
465 && totalHits >= hitLimit
466 && iterationNo < maxIterations
469 pointIndexHitAndFeatureDynList surfaceHits(0.5*AtoV);
470 pointIndexHitAndFeatureDynList featureEdgeHits(0.25*AtoV);
478 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
479 vit != finite_vertices_end();
490 || vit->internalBoundaryPoint()
491 || (vit->internalOrBoundaryPoint() && vit->referred())
494 pointIndexHitAndFeatureDynList surfaceIntersections(0.5*AtoV);
501 dualCellLargestSurfaceProtrusion(vit, surfHit, hitSurface);
505 surfaceIntersections.append
507 pointIndexHitAndFeature(surfHit, hitSurface)
510 addSurfaceAndEdgeHits
513 surfaceIntersections,
514 surfacePtReplaceDistCoeffSqr,
515 edgeSearchDistCoeffSqr,
520 surfacePtToEdgePtDist,
528 if (vit->nearBoundary())
536 vit->externalBoundaryPoint()
537 || (vit->externalBoundaryPoint() && vit->referred())
540 pointIndexHitAndFeatureDynList surfaceIntersections(0.5*AtoV);
547 dualCellLargestSurfaceIncursion(vit, surfHit, hitSurface);
551 surfaceIntersections.append
553 pointIndexHitAndFeature(surfHit, hitSurface)
556 addSurfaceAndEdgeHits
559 surfaceIntersections,
560 surfacePtReplaceDistCoeffSqr,
561 edgeSearchDistCoeffSqr,
566 surfacePtToEdgePtDist,
573 label nVerts = number_of_vertices();
574 label nSurfHits = surfaceHits.size();
575 label nFeatEdHits = featureEdgeHits.size();
584 Info<<
nl <<
"Conformation iteration " << iterationNo <<
nl
585 <<
" Number of vertices " << nVerts <<
nl
586 <<
" Number of surface hits " << nSurfHits <<
nl
587 <<
" Number of edge hits " << nFeatEdHits
590 totalHits = nSurfHits + nFeatEdHits;
592 label nNotInserted = 0;
600 synchroniseSurfaceTrees(surfaceToTreeShape, surfaceHits);
605 2*surfaceHits.size() + 3*featureEdgeHits.size()
608 insertSurfacePointPairs
611 "surfaceConformationLocations_" +
name(iterationNo) +
".obj",
619 synchroniseEdgeTrees(edgeToTreeShape, featureEdgeHits);
622 insertEdgePointGroups
625 "edgeConformationLocations_" +
name(iterationNo) +
".obj",
631 Map<label> oldToNewIndices = insertPointPairs(pts,
true,
true);
634 ptPairs_.reIndex(oldToNewIndices);
642 decomposition_().procBounds(),
649 timeCheck(
"Conformation iteration " +
name(iterationNo));
653 if (iterationNo == maxIterations)
656 <<
"Maximum surface conformation iterations ("
657 << maxIterations <<
") reached." <<
endl;
660 if (totalHits <= nNotInserted)
662 Info<<
nl <<
"Total hits (" << totalHits
663 <<
") less than number of failed insertions (" << nNotInserted
664 <<
"), stopping iterations" <<
endl;
668 if (totalHits < hitLimit)
670 Info<<
nl <<
"Total hits (" << totalHits
671 <<
") less than limit (" << hitLimit
672 <<
"), stopping iterations" <<
endl;
676 edgeLocationTreePtr_.clear();
677 surfacePtLocationTreePtr_.clear();
681Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
684 pointIndexHitAndFeatureList& surfaceHits
687 Info<<
" Surface tree synchronisation" <<
endl;
689 pointIndexHitAndFeatureDynList synchronisedSurfLocations
700 label nStoppedInsertion = 0;
711 const pointIndexHitAndFeatureList& otherSurfEdges =
712 procSurfLocations[proci];
714 forAll(otherSurfEdges, peI)
716 const Foam::point& pt = otherSurfEdges[peI].first().hitPoint();
719 pointIsNearSurfaceLocation(pt, nearest);
722 pointIsNearFeatureEdgeLocation(pt, nearestEdge);
724 if (nearest.
hit() || nearestEdge.
hit())
727 hits[proci].insert(peI);
738 synchronisedSurfLocations.append(surfaceHits[eI]);
742 surfacePtLocationTreePtr_().remove(surfaceToTreeShape[eI]);
756 Info<<
" Not inserting total of " << nNotInserted <<
" locations"
759 surfaceHits = synchronisedSurfLocations;
765Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
768 pointIndexHitAndFeatureList& featureEdgeHits
771 Info<<
" Edge tree synchronisation" <<
endl;
773 pointIndexHitAndFeatureDynList synchronisedEdgeLocations
775 featureEdgeHits.size()
784 label nStoppedInsertion = 0;
795 pointIndexHitAndFeatureList& otherProcEdges = procEdgeLocations[proci];
797 forAll(otherProcEdges, peI)
799 const Foam::point& pt = otherProcEdges[peI].first().hitPoint();
802 pointIsNearFeatureEdgeLocation(pt, nearest);
814 hits[proci].insert(peI);
821 forAll(featureEdgeHits, eI)
825 synchronisedEdgeLocations.append(featureEdgeHits[eI]);
829 edgeLocationTreePtr_().remove(edgeToTreeShape[eI]);
843 Info<<
" Not inserting total of " << nNotInserted <<
" locations"
846 featureEdgeHits = synchronisedEdgeLocations;
852bool Foam::conformalVoronoiMesh::surfaceLocationConformsToInside
854 const pointIndexHitAndFeature& info
857 if (info.first().hit())
861 geometryToConformTo_.getNormal
870 const scalar ppDist = pointPairDistance(info.first().hitPoint());
872 const Foam::point innerPoint = info.first().hitPoint() - ppDist*
n;
874 if (!geometryToConformTo_.inside(innerPoint))
886bool Foam::conformalVoronoiMesh::dualCellSurfaceAnyIntersection
888 const Delaunay::Finite_vertices_iterator& vit
891 std::list<Facet> facets;
892 incident_facets(vit, std::back_inserter(facets));
896 std::list<Facet>::iterator fit=facets.begin();
903 is_infinite(fit->first)
904 || is_infinite(fit->first->neighbor(fit->second))
905 || !fit->first->hasInternalPoint()
906 || !fit->first->neighbor(fit->second)->hasInternalPoint()
913 Foam::point dE1 = fit->first->neighbor(fit->second)->dual();
920 bool inProc = clipLineToProc(
topoint(vit->point()), a,
b);
926 && geometryToConformTo_.findSurfaceAnyIntersection(a,
b)
934 if (geometryToConformTo_.findSurfaceAnyIntersection(dE0, dE1))
945bool Foam::conformalVoronoiMesh::dualCellSurfaceAllIntersections
947 const Delaunay::Finite_vertices_iterator& vit,
948 pointIndexHitAndFeatureDynList& infoList
951 bool flagIntersection =
false;
953 std::list<Facet> facets;
954 incident_facets(vit, std::back_inserter(facets));
958 std::list<Facet>::iterator fit = facets.begin();
965 is_infinite(fit->first)
966 || is_infinite(fit->first->neighbor(fit->second))
967 || !fit->first->hasInternalPoint()
968 || !fit->first->neighbor(fit->second)->hasInternalPoint()
977 Foam::point dE1 = fit->first->neighbor(fit->second)->dual();
980 label hitSurfaceIntersection = -1;
984 bool inProc = clipLineToProc(
topoint(vit->point()), dE0, dE1);
992 geometryToConformTo_.findSurfaceNearestIntersection
997 hitSurfaceIntersection
1000 if (infoIntersection.
hit())
1004 geometryToConformTo_.getNormal
1006 hitSurfaceIntersection,
1019 const scalar d =
p.normalIntersect(r);
1023 pointIndexHitAndFeature info;
1024 geometryToConformTo_.findSurfaceNearest
1027 4.0*
magSqr(newPoint - vertex),
1032 bool rejectPoint =
false;
1034 if (!surfaceLocationConformsToInside(info))
1039 if (!rejectPoint && info.first().hit())
1041 if (!infoList.empty())
1048 infoList[hitI].first().index()
1049 == info.first().index()
1057 = infoList[hitI].
first().hitPoint();
1059 const scalar separationDistance =
1062 const scalar minSepDist =
1065 foamyHexMeshControls().removalDistCoeff()
1072 if (separationDistance < minSepDist)
1083 if (!rejectPoint && info.first().hit())
1085 flagIntersection =
true;
1086 infoList.append(info);
1091 return flagIntersection;
1095bool Foam::conformalVoronoiMesh::clipLineToProc
1102 bool inProc =
false;
1104 pointIndexHit findAnyIntersection = decomposition_().findLine(a,
b);
1106 if (!findAnyIntersection.
hit())
1131 a = findAnyIntersection.
hitPoint();
1139void Foam::conformalVoronoiMesh::dualCellLargestSurfaceProtrusion
1141 const Delaunay::Finite_vertices_iterator& vit,
1143 label& hitSurfaceLargest
1148 hitSurfaceLargest = -1;
1150 std::list<Facet> facets;
1151 finite_incident_facets(vit, std::back_inserter(facets));
1155 scalar maxProtrusionDistance = maxSurfaceProtrusion(vert);
1159 std::list<Facet>::iterator fit = facets.begin();
1160 fit != facets.end();
1164 Cell_handle
c1 = fit->first;
1165 Cell_handle
c2 = fit->first->neighbor(fit->second);
1169 is_infinite(c1) || is_infinite(c2)
1171 !
c1->internalOrBoundaryDualVertex()
1172 || !
c2->internalOrBoundaryDualVertex()
1174 || !
c1->real() || !
c2->real()
1191 >
magSqr(geometryToConformTo().globalBounds().
mag())
1200 geometryToConformTo_.findSurfaceNearestIntersection
1212 allGeometry_[hitSurface].getNormal
1220 const scalar normalProtrusionDistance
1225 if (normalProtrusionDistance > maxProtrusionDistance)
1231 const scalar d =
p.normalIntersect(r);
1235 pointIndexHitAndFeature info;
1236 geometryToConformTo_.findSurfaceNearest
1239 4.0*
magSqr(newPoint - endPt),
1244 if (info.first().hit())
1248 surfaceLocationConformsToInside
1250 pointIndexHitAndFeature(info.first(), info.second())
1254 surfHitLargest = info.first();
1255 hitSurfaceLargest = info.second();
1257 maxProtrusionDistance = normalProtrusionDistance;
1268 surfHitLargest.
hit()
1271 && !decomposition().positionOnThisProcessor(surfHitLargest.
hitPoint())
1279 hitSurfaceLargest = -1;
1284void Foam::conformalVoronoiMesh::dualCellLargestSurfaceIncursion
1286 const Delaunay::Finite_vertices_iterator& vit,
1288 label& hitSurfaceLargest
1293 hitSurfaceLargest = -1;
1295 std::list<Facet> facets;
1296 finite_incident_facets(vit, std::back_inserter(facets));
1300 scalar minIncursionDistance = -maxSurfaceProtrusion(vert);
1304 std::list<Facet>::iterator fit = facets.begin();
1305 fit != facets.end();
1309 Cell_handle
c1 = fit->first;
1310 Cell_handle
c2 = fit->first->neighbor(fit->second);
1314 is_infinite(c1) || is_infinite(c2)
1316 !
c1->internalOrBoundaryDualVertex()
1317 || !
c2->internalOrBoundaryDualVertex()
1319 || !
c1->real() || !
c2->real()
1336 >
magSqr(geometryToConformTo().globalBounds().
mag())
1345 geometryToConformTo_.findSurfaceNearestIntersection
1357 allGeometry_[hitSurface].getNormal
1365 scalar normalIncursionDistance
1370 if (normalIncursionDistance < minIncursionDistance)
1376 const scalar d =
p.normalIntersect(r);
1380 pointIndexHitAndFeature info;
1381 geometryToConformTo_.findSurfaceNearest
1384 4.0*
magSqr(newPoint - endPt),
1389 if (info.first().hit())
1393 surfaceLocationConformsToInside
1395 pointIndexHitAndFeature(info.first(), info.second())
1399 surfHitLargest = info.first();
1400 hitSurfaceLargest = info.second();
1402 minIncursionDistance = normalIncursionDistance;
1413 surfHitLargest.
hit()
1416 && !decomposition().positionOnThisProcessor(surfHitLargest.
hitPoint())
1424 hitSurfaceLargest = -1;
1429void Foam::conformalVoronoiMesh::reportProcessorOccupancy()
1433 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
1434 vit != finite_vertices_end();
1443 && !decomposition().positionOnThisProcessor(
topoint(vit->point()))
1446 Pout<<
topoint(vit->point()) <<
" is not on this processor "
1559void Foam::conformalVoronoiMesh::limitDisplacement
1561 const Delaunay::Finite_vertices_iterator& vit,
1571 displacement =
Zero;
1583 if (!geometryToConformTo_.globalBounds().contains(dispPt))
1588 else if (geometryToConformTo_.findSurfaceAnyIntersection(pt, dispPt))
1599 scalar searchDistanceSqr =
sqr
1601 2*vit->targetCellSize()
1602 *foamyHexMeshControls().pointPairDistanceCoeff()
1605 geometryToConformTo_.findSurfaceNearest
1620 displacement =
Zero;
1631 displacement *= 0.5;
1633 limitDisplacement(vit, displacement, callCount);
1638Foam::scalar Foam::conformalVoronoiMesh::angleBetweenSurfacePoints
1645 label pAsurfaceHit = -1;
1647 const scalar searchDist = 5.0*targetCellSize(pA);
1649 geometryToConformTo_.findSurfaceNearest
1664 allGeometry_[pAsurfaceHit].getNormal
1670 const vector nA = norm[0];
1673 label pBsurfaceHit = -1;
1675 geometryToConformTo_.findSurfaceNearest
1688 allGeometry_[pBsurfaceHit].getNormal
1694 const vector nB = norm[0];
1700bool Foam::conformalVoronoiMesh::nearSurfacePoint
1702 pointIndexHitAndFeature& pHit
1708 const bool closeToSurfacePt = pointIsNearSurfaceLocation(pt, closePoint);
1715 >
sqr(pointPairDistance(pt))
1719 const scalar cosAngle =
1720 angleBetweenSurfacePoints(pt, closePoint.
hitPoint());
1723 if (cosAngle < searchAngleOppositeSurface)
1726 label pCloseSurfaceHit = -1;
1728 const scalar searchDist = targetCellSize(closePoint.
hitPoint());
1730 geometryToConformTo_.findSurfaceNearest
1740 allGeometry_[pCloseSurfaceHit].getNormal
1746 const vector& nA = norm[0];
1749 label oppositeSurfaceHit = -1;
1751 geometryToConformTo_.findSurfaceNearestIntersection
1753 closePoint.
hitPoint() + 0.5*pointPairDistance(pt)*nA,
1754 closePoint.
hitPoint() + 5*targetCellSize(pt)*nA,
1759 if (oppositeHit.
hit())
1762 pHit.first() = oppositeHit;
1763 pHit.second() = oppositeSurfaceHit;
1765 return !closeToSurfacePt;
1770 return closeToSurfacePt;
1774bool Foam::conformalVoronoiMesh::appendToSurfacePtTree
1779 label startIndex = existingSurfacePtLocations_.size();
1781 existingSurfacePtLocations_.append(pt);
1783 label endIndex = existingSurfacePtLocations_.size();
1785 return surfacePtLocationTreePtr_().insert(startIndex, endIndex);
1789bool Foam::conformalVoronoiMesh::appendToEdgeLocationTree
1794 label startIndex = existingEdgeLocations_.size();
1796 existingEdgeLocations_.append(pt);
1798 label endIndex = existingEdgeLocations_.size();
1800 return edgeLocationTreePtr_().insert(startIndex, endIndex);
1805Foam::conformalVoronoiMesh::nearestFeatureEdgeLocations
1810 const scalar exclusionRangeSqr = featureEdgeExclusionDistanceSqr(pt);
1813 = edgeLocationTreePtr_().findSphere(pt, exclusionRangeSqr);
1819 label index = elems[elemI];
1822 = edgeLocationTreePtr_().shapes().shapePoints()[index];
1826 dynPointHit.
append(nearHit);
1833bool Foam::conformalVoronoiMesh::pointIsNearFeatureEdgeLocation
1838 const scalar exclusionRangeSqr = featureEdgeExclusionDistanceSqr(pt);
1841 = edgeLocationTreePtr_().findNearest(pt, exclusionRangeSqr);
1847bool Foam::conformalVoronoiMesh::pointIsNearFeatureEdgeLocation
1853 const scalar exclusionRangeSqr = featureEdgeExclusionDistanceSqr(pt);
1855 info = edgeLocationTreePtr_().findNearest(pt, exclusionRangeSqr);
1861bool Foam::conformalVoronoiMesh::pointIsNearSurfaceLocation
1868 pointIsNearSurfaceLocation(pt, info);
1874bool Foam::conformalVoronoiMesh::pointIsNearSurfaceLocation
1880 const scalar exclusionRangeSqr = surfacePtExclusionDistanceSqr(pt);
1882 info = surfacePtLocationTreePtr_().findNearest(pt, exclusionRangeSqr);
1888bool Foam::conformalVoronoiMesh::nearFeatureEdgeLocation
1896 const scalar exclusionRangeSqr = featureEdgeExclusionDistanceSqr(pt);
1898 bool closeToFeatureEdge =
1899 pointIsNearFeatureEdgeLocation(pt, nearestEdgeHit);
1901 if (closeToFeatureEdge)
1912 label featureHit = -1;
1914 geometryToConformTo_.findEdgeNearest
1923 = geometryToConformTo_.features()[featureHit];
1929 const scalar cosAngle
1941 mag(cosAngle) < searchConeAngle
1942 && (
mag(lineBetweenPoints) > pointPairDistance(pt))
1947 closeToFeatureEdge =
false;
1951 closeToFeatureEdge =
true;
1957 return closeToFeatureEdge;
1961void Foam::conformalVoronoiMesh::buildEdgeLocationTree
1968 geometryToConformTo_.globalBounds().extend(rndGen_, 1
e-4)
1974 edgeLocationTreePtr_.reset
1988void Foam::conformalVoronoiMesh::buildSurfacePtLocationTree
1995 geometryToConformTo_.globalBounds().extend(rndGen_, 1
e-4)
2001 surfacePtLocationTreePtr_.reset
2015void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits
2018 const pointIndexHitAndFeatureDynList& surfaceIntersections,
2019 scalar surfacePtReplaceDistCoeffSqr,
2020 scalar edgeSearchDistCoeffSqr,
2021 pointIndexHitAndFeatureDynList& surfaceHits,
2022 pointIndexHitAndFeatureDynList& featureEdgeHits,
2029 const scalar cellSize = targetCellSize(vit);
2030 const scalar cellSizeSqr =
sqr(cellSize);
2032 forAll(surfaceIntersections, sI)
2034 pointIndexHitAndFeature surfHitI = surfaceIntersections[sI];
2036 bool keepSurfacePoint =
true;
2038 if (!surfHitI.first().hit())
2043 const Foam::point& surfPt = surfHitI.first().hitPoint();
2045 bool isNearFeaturePt = nearFeaturePt(surfPt);
2047 bool isNearFeatureEdge = surfacePtNearFeatureEdge(surfPt);
2049 bool isNearSurfacePt = nearSurfacePoint(surfHitI);
2051 if (isNearFeaturePt || isNearSurfacePt || isNearFeatureEdge)
2053 keepSurfacePoint =
false;
2060 const scalar searchRadiusSqr = edgeSearchDistCoeffSqr*cellSizeSqr;
2062 geometryToConformTo_.findAllNearestEdges
2070 forAll(edHitsByFeature, i)
2072 const label featureHit = featuresHit[i];
2087 && !decomposition().positionOnThisProcessor(edPt)
2094 if (!nearFeaturePt(edPt))
2099 < surfacePtReplaceDistCoeffSqr*cellSizeSqr
2109 keepSurfacePoint =
false;
2121 !nearFeatureEdgeLocation(edHit, nearestEdgeHit)
2124 appendToEdgeLocationTree(edPt);
2128 existingEdgeLocations_.size() - 1
2133 featureEdgeHits.append
2135 pointIndexHitAndFeature(edHit, featureHit)
2141 surfacePtToEdgePtDist.
insert
2143 existingEdgeLocations_.size() - 1,
2149 label hitIndex = nearestEdgeHit.
index();
2156 < surfacePtToEdgePtDist[hitIndex]
2159 featureEdgeHits[hitIndex] =
2160 pointIndexHitAndFeature(edHit, featureHit);
2162 existingEdgeLocations_[hitIndex] =
2164 surfacePtToEdgePtDist[hitIndex] =
2170 edgeLocationTreePtr_().remove(hitIndex);
2171 edgeLocationTreePtr_().insert
2183 if (keepSurfacePoint)
2185 surfaceHits.append(surfHitI);
2186 appendToSurfacePtTree(surfPt);
2187 surfaceToTreeShape.
append(existingSurfacePtLocations_.size() - 1);
2199void Foam::conformalVoronoiMesh::storeSurfaceConformation()
2201 Info<<
nl <<
"Storing surface conformation" <<
endl;
2203 surfaceConformationVertices_.clear();
2210 Delaunay::Finite_vertices_iterator vit = finite_vertices_begin();
2211 vit != finite_vertices_end();
2220 && vit->boundaryPoint()
2221 && !vit->featurePoint()
2222 && !vit->constrained()
2225 tempSurfaceVertices.append
2238 tempSurfaceVertices.shrink();
2240 surfaceConformationVertices_.transfer(tempSurfaceVertices);
2245 label(surfaceConformationVertices_.size()),
2248 <<
" vertices" <<
nl <<
endl;
2252void Foam::conformalVoronoiMesh::reinsertSurfaceConformation()
2254 Info<<
nl <<
"Reinserting stored surface conformation" <<
endl;
2257 insertPointPairs(surfaceConformationVertices_,
true,
true);
2259 ptPairs_.reIndex(oldToNewIndices);
2261 bitSet selectedElems(surfaceConformationVertices_.size(),
true);
2263 forAll(surfaceConformationVertices_, vI)
2265 Vb& v = surfaceConformationVertices_[vI];
2266 label& vIndex = v.
index();
2268 const auto iter = oldToNewIndices.
cfind(vIndex);
2272 const label newIndex = *iter;
2280 selectedElems.unset(vI);
2285 inplaceSubset<bitSet, List<Vb>>
2288 surfaceConformationVertices_
Istream and Ostream manipulators taking arguments.
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
void resetCellCount()
Set the cell count to zero.
void sync(const boundBox &bb)
Refer vertices so that the processor interfaces are consistent.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
void clear()
Clear all entries from table.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A HashTable to objects of type <T> with a label key.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label index() const noexcept
Return the hit index.
bool hit() const noexcept
Is there a hit?
const point_type & hitPoint() const
Return hit point. Fatal if not hit.
UPstream::rangeType allProcs() const noexcept
Range of ranks indices associated with PstreamBuffers.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void allGatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void listCombineAllGather(const List< commsStruct > &comms, List< T > &values, const CombineOp &cop, const int tag, const label comm)
After completion all processors have the same data.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
T & first()
Return the first element of the list.
static bool & parRun() noexcept
Test if this a parallel run.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reset(autoPtr< T > &&other) noexcept
Delete managed object and set to new given pointer.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted.
Holds (reference to) pointField. Encapsulation of data needed for octree searches....
const vectorField & edgeDirections() const
Return the edgeDirection vectors.
A reference point and direction.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
int myProcNo() const noexcept
Return processor number.
Standard boundBox with extra functionality for use in octree.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr scalar pi(M_PI)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
const dimensionedScalar c1
First radiation constant: default SI units: [W/m2].
dimensionedSymmTensor sqr(const dimensionedVector &dv)
PointIndexHit< point > pointIndexHit
A PointIndexHit for 3D points.
pointFromPoint topoint(const Point &P)
messageStream Info
Information stream (stdout output on master, null elsewhere)
complex limit(const complex &, const complex &)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
constexpr scalar degToRad(const scalar deg) noexcept
Conversion from degrees to radians.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
static constexpr const zero Zero
Global zero (0)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce (copy) and return value.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedScalar cos(const dimensionedScalar &ds)
HashSet< labelPair, Foam::Hash< labelPair > > labelPairHashSet
A HashSet for a labelPair. The hashing is based on labelPair (FixedList) and is thus non-commutative.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.