From 09a44ad6064fc910132d1485426a20a50cc0371c Mon Sep 17 00:00:00 2001 From: laurence Date: Tue, 30 Jul 2013 12:12:18 +0100 Subject: [PATCH] ENH: foamyHexMesh: Check moved internal points are inside the geometry before inserting them --- .../conformalVoronoiMesh.C | 114 ++++++------------ .../conformalVoronoiMesh.H | 3 + .../conformalVoronoiMeshI.H | 18 +++ .../conformalVoronoiMeshIO.C | 4 + 4 files changed, 60 insertions(+), 79 deletions(-) diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 14d1042778..d87d1ed97b 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -562,7 +562,7 @@ void Foam::conformalVoronoiMesh::setVertexSizeAndAlignment() { if (vit->internalOrBoundaryPoint()) { - pointFromPoint pt = topoint(vit->point()); + const pointFromPoint pt = topoint(vit->point()); cellShapeControls().cellSizeAndAlignment ( @@ -1135,10 +1135,12 @@ void Foam::conformalVoronoiMesh::move() && pointToBeRetained[vB->index()] == true ) { - pointsToInsert.append - ( - toPoint(0.5*(dVA + dVB)) - ); + Foam::point pt(0.5*(dVA + dVB)); + + if (internalPointIsInside(pt)) + { + pointsToInsert.append(toPoint(pt)); + } } } @@ -1274,7 +1276,10 @@ void Foam::conformalVoronoiMesh::move() if (positionOnThisProc(newPt)) { // Prevent insertions spanning surfaces - pointsToInsert.append(toPoint(newPt)); + if (internalPointIsInside(newPt)) + { + pointsToInsert.append(toPoint(newPt)); + } } } } @@ -1310,10 +1315,12 @@ void Foam::conformalVoronoiMesh::move() && pointToBeRetained[vB->index()] == true ) { - pointsToInsert.append - ( - toPoint(0.5*(dVA + dVB)) - ); + Foam::point pt(0.5*(dVA + dVB)); + + if (internalPointIsInside(pt)) + { + pointsToInsert.append(toPoint(pt)); + } } } @@ -1428,21 +1435,31 @@ void Foam::conformalVoronoiMesh::move() // 14/1/2011. // Only necessary if using an exact constructions kernel // (extended precision) - - pointsToInsert.append + Foam::point pt ( - toPoint - ( - topoint(vit->point()) - + displacementAccumulator[vit->index()] - ) + topoint(vit->point()) + + displacementAccumulator[vit->index()] ); + + if (internalPointIsInside(pt)) + { + pointsToInsert.append(toPoint(pt)); + } } } } pointsToInsert.shrink(); + Info<< indent + << returnReduce + ( + pointToBeRetained.count() - pointsToInsert.size(), + sumOp