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.
This commit is contained in:
laurence
2012-02-09 10:52:18 +00:00
parent 693c537190
commit 779d1548d1
2 changed files with 41 additions and 8 deletions

View File

@ -426,8 +426,6 @@ void Foam::conformalVoronoiMesh::insertPoints
indices,
types
);
Pout<< pts.size() << " " << indices.size() << " " << types.size() << endl;
}

View File

@ -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;