From 45ce8ab68dade441aaa3f14479c72c81a3d982b9 Mon Sep 17 00:00:00 2001 From: laurence Date: Fri, 4 Jan 2013 14:30:07 +0000 Subject: [PATCH] ENH: Update cellShapeControl to work with 2D mesher and remove dependency on the Triangulation --- .../cellSizeAndAlignmentGrid.C | 183 +++++++++--------- .../cellShapeControl/cellShapeControl.C | 166 +++++++++------- .../cellShapeControl/cellShapeControl.H | 5 +- .../cellSizeAndAlignmentControl.C | 5 +- .../cellSizeAndAlignmentControl.H | 14 +- .../cellSizeAndAlignmentControls.C | 105 +++++++++- .../cellSizeAndAlignmentControls.H | 17 +- .../fileControl/fileControl.C | 8 +- .../fileControl/fileControl.H | 10 +- .../searchableSurfaceControl.C | 11 +- .../searchableSurfaceControl.H | 22 ++- .../cellSizeFunction/cellSizeFunction.C | 5 +- .../cellSizeFunction/cellSizeFunction.H | 9 +- .../conformalVoronoiMesh.C | 29 ++- .../conformalVoronoiMesh.H | 8 +- .../conformalVoronoiMeshCalcDualMesh.C | 4 +- .../conformalVoronoiMeshI.H | 92 ++++++++- .../cvControls/cvControls.C | 6 +- .../cvControls/cvControls.H | 18 +- .../cvControls/cvControlsI.H | 14 +- .../mesh/generation/cvMesh/cvMeshDict | 3 + .../extrude2DMesh/extrude2DMeshApp.C | 14 +- .../mesh/cvMesh/blob/system/collapseDict | 2 +- tutorials/mesh/cvMesh/blob/system/controlDict | 2 +- .../mesh/cvMesh/flange/system/collapseDict | 2 +- .../mesh/cvMesh/flange/system/controlDict | 2 +- .../mesh/cvMesh/flange/system/cvMeshDict | 4 +- 27 files changed, 524 insertions(+), 236 deletions(-) diff --git a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C index 18109761a5..454416299d 100644 --- a/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C +++ b/applications/utilities/mesh/generation/cvMesh/cellSizeAndAlignmentGrid/cellSizeAndAlignmentGrid.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -174,12 +174,7 @@ Foam::tmp buildAlignmentField(const T& mesh) continue; } - alignments[vit->index()] = triad - ( - vit->alignment().x(), - vit->alignment().y(), - vit->alignment().z() - ); + alignments[vit->index()] = vit->alignment(); } return tAlignments; @@ -214,6 +209,61 @@ Foam::tmp buildPointField(const T& mesh) } +void refine +( + cellShapeControlMesh& mesh, + const conformationSurfaces& geometryToConformTo, + const label maxRefinementIterations, + const scalar defaultCellSize +) +{ + for (label iter = 0; iter < maxRefinementIterations; ++iter) + { + DynamicList ptsToInsert; + + for + ( + CellSizeDelaunay::Finite_cells_iterator cit = + mesh.finite_cells_begin(); + cit != mesh.finite_cells_end(); + ++cit + ) + { + const point newPoint = + topoint + ( + CGAL::centroid + ( + cit->vertex(0)->point(), + cit->vertex(1)->point(), + cit->vertex(2)->point(), + cit->vertex(3)->point() + ) + ); + + if (geometryToConformTo.inside(newPoint)) + { + ptsToInsert.append(newPoint); + } + } + + Info<< " Adding " << returnReduce(ptsToInsert.size(), sumOp