From 1d6650bf3926b14230981cd31850e9e5da2bc259 Mon Sep 17 00:00:00 2001 From: graham Date: Thu, 16 Jul 2009 16:39:25 +0100 Subject: [PATCH] Moving test for surface hit near to an edge hit, so snap control to the edge, inside the test for whether the edge point is too close to a feature point. --- .../conformalVoronoiMesh.C | 75 ++++++++++++++----- 1 file changed, 55 insertions(+), 20 deletions(-) diff --git a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index a96a461285..2735a8f404 100644 --- a/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -1138,6 +1138,13 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits autoPtr >& edgeLocationTree ) const { + bool keepSurfacePoint = true; + + if (nearFeaturePt(surfHit.hitPoint())) + { + keepSurfacePoint = false; + } + List edHits; labelList featuresHit; @@ -1152,13 +1159,6 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits featuresHit ); - bool keepSurfacePoint = true; - - if (nearFeaturePt(surfHit.hitPoint())) - { - keepSurfacePoint = false; - } - // Gather edge locations but do not add them to newEdgeLocations inside the // loop as they will prevent nearby edge locations of different types being // conformed to. @@ -1173,21 +1173,21 @@ void Foam::conformalVoronoiMesh::addSurfaceAndEdgeHits if (edHit.hit()) { - if - ( - magSqr(edHit.hitPoint() - surfHit.hitPoint()) - < surfacePtReplaceDistCoeffSqr*targetCellSizeSqr - ) - { - // If the point is within a given distance of a feature edge, - // give control to edge control points instead, this will - // prevent "pits" forming. - - keepSurfacePoint = false; - } - if (!nearFeaturePt(edHit.hitPoint())) { + if + ( + magSqr(edHit.hitPoint() - surfHit.hitPoint()) + < surfacePtReplaceDistCoeffSqr*targetCellSizeSqr + ) + { + // If the point is within a given distance of a feature + // edge, give control to edge control points instead, this + // will prevent "pits" forming. + + keepSurfacePoint = false; + } + if ( !nearFeatureEdgeLocation @@ -2030,6 +2030,39 @@ void Foam::conformalVoronoiMesh::conformToSurface() << maxIterations << ") reached." << endl; } } + + // Info<< nl << " After iterations, check penetrations" << endl; + + // for + // ( + // Triangulation::Finite_vertices_iterator vit = + // finite_vertices_begin(); + // vit != finite_vertices_end(); + // vit++ + // ) + // { + // if (vit->internalOrBoundaryPoint()) + // { + // point vert(topoint(vit->point())); + // pointIndexHit surfHit; + // label hitSurface; + + // dualCellLargestSurfaceProtrusion(vit, surfHit, hitSurface); + + // if (surfHit.hit()) + // { + // Info<< nl << "Residual penetration: " << nl + // << vit->index() << nl + // << vit->type() << nl + // << vit->ppMaster() << nl + // << "nearFeaturePt " + // << nearFeaturePt(surfHit.hitPoint()) << nl + // << vert << nl + // << surfHit.hitPoint() + // << endl; + // } + // } + // } } @@ -2381,3 +2414,5 @@ void Foam::conformalVoronoiMesh::move() // ************************************************************************* // + +// LocalWords: edHit