From 779d1548d1ec5c36dd36b7daed901d5e03fda937 Mon Sep 17 00:00:00 2001 From: laurence <laurence> Date: Thu, 9 Feb 2012 10:52:18 +0000 Subject: [PATCH] ENH: cvMesh surf conformance: Add quick prefilter for vertices near boundary dualCellSurfaceAllIntersections is expensive, so do a faster prefilter to label vertices as being near a boundary before calling that function. May need more tuning on the distance from a surface that constitutes being near a boundary. --- .../conformalVoronoiMesh.C | 2 - .../conformalVoronoiMeshConformToSurface.C | 47 ++++++++++++++++--- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 7ca688a113a..8abdd02833d 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -426,8 +426,6 @@ void Foam::conformalVoronoiMesh::insertPoints indices, types ); - - Pout<< pts.size() << " " << indices.size() << " " << types.size() << endl; } diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C index cf77b5e14a5..79ca95a03ac 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C @@ -175,7 +175,34 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation // \ . / // ---x---- + label countNearBoundaryVertices = 0; + for + ( + Delaunay::Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); + vit++ + ) + { + if (vit->internalPoint()) + { + const Foam::point& pt = topoint(vit->point()); + const scalar range = sqr(2.0*targetCellSize(pt)); + + bool closeToBoundary = geometryToConformTo_.wellInside(pt, range); + + if (!closeToBoundary) + { + vit->setNearBoundary(); + countNearBoundaryVertices++; + } + } + } + + Info<< " Vertices marked as being near a boundary: " + << countNearBoundaryVertices << " (estimated)" << endl; + + timeCheck("After set near boundary"); // Initial surface protrusion conformation - nearest surface point { @@ -198,7 +225,7 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation vit++ ) { - if (vit->internalPoint()) + if (vit->internalPoint() && vit->nearBoundary()) { const Foam::point vert = topoint(vit->point()); @@ -220,11 +247,6 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation ) ) { - // This used to be just before this if statement. - // Moved because a point is only near the boundary if - // the dual cell intersects the surface. - vit->setNearBoundary(); - // meshTools::writeOBJ(Pout, vert); // meshTools::writeOBJ(Pout, surfHit.hitPoint()); // Pout<< "l cr0 cr1" << endl; @@ -246,9 +268,18 @@ void Foam::conformalVoronoiMesh::buildSurfaceConformation existingSurfacePtLocations ); } + else + { + vit->setInternal(); + countNearBoundaryVertices--; + } } } + Info<< " Vertices marked as being near a boundary: " + << countNearBoundaryVertices + << " (after dual surface intersection)" << endl; + label nVerts = number_of_vertices(); label nSurfHits = surfaceHits.size(); label nFeatEdHits = featureEdgeHits.size(); @@ -1179,6 +1210,8 @@ void Foam::conformalVoronoiMesh::buildParallelInterfaceInfluence cIOuter++; } + timeCheck("End of testing cell influence"); + // Increasing the circumspheres to increase the overlaps and compensate for // floating point errors missing some referrals labelListList circumsphereOverlaps @@ -1186,6 +1219,8 @@ void Foam::conformalVoronoiMesh::buildParallelInterfaceInfluence overlapsProc(circumcentre, sqr(1.01)*circumradiusSqr) ); + timeCheck("End of increasing overlaps"); + // Reset counters cIOuter = 0; -- GitLab