From 8024b53c971c848715c7c2bfec76067c9307063b Mon Sep 17 00:00:00 2001 From: laurence <laurence> Date: Thu, 26 Sep 2013 15:46:04 +0100 Subject: [PATCH] ENH: foamyHexMesh: Split boundary point priority into separate function --- .../conformalVoronoiMesh.H | 2 + .../conformalVoronoiMeshCalcDualMesh.C | 59 +++++++++++-------- .../indexedCell/indexedCell.H | 4 +- .../indexedCell/indexedCellI.H | 39 +++++++++--- .../indexedVertex/indexedVertex.H | 6 +- .../indexedVertex/indexedVertexI.H | 27 +++++---- 6 files changed, 90 insertions(+), 47 deletions(-) diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index 61b669882a8..2996493dbec 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -728,6 +728,8 @@ private: // elements damage the mesh quality, allowing backtracking. labelHashSet checkPolyMeshQuality(const pointField& pts) const; + label classifyBoundaryPoint(Cell_handle cit) const; + //- Index all of the the Delaunay cells and calculate their //- dual points void indexDualVertices diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index e220556fa59..7a2476df3e7 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -1199,6 +1199,41 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::checkPolyMeshQuality } +Foam::label Foam::conformalVoronoiMesh::classifyBoundaryPoint +( + Cell_handle cit +) const +{ + if (cit->boundaryDualVertex()) + { + if (cit->featurePointDualVertex()) + { + return featurePoint; + } + else if (cit->featureEdgeDualVertex()) + { + return featureEdge; + } + else + { + return surface; + } + } + else if (cit->baffleSurfaceDualVertex()) + { + return surface; + } + else if (cit->baffleEdgeDualVertex()) + { + return featureEdge; + } + else + { + return internal; + } +} + + void Foam::conformalVoronoiMesh::indexDualVertices ( pointField& pts, @@ -1448,29 +1483,7 @@ void Foam::conformalVoronoiMesh::indexDualVertices // } // } - if (cit->boundaryDualVertex()) - { - if (cit->featurePointDualVertex()) - { - boundaryPts[cit->cellIndex()] = featurePoint; - } - else if (cit->featureEdgeDualVertex()) - { - boundaryPts[cit->cellIndex()] = featureEdge; - } - else - { - boundaryPts[cit->cellIndex()] = surface; - } - } - else if (cit->baffleBoundaryDualVertex()) - { - boundaryPts[cit->cellIndex()] = surface; - } - else - { - boundaryPts[cit->cellIndex()] = internal; - } + boundaryPts[cit->cellIndex()] = classifyBoundaryPoint(cit); } else { diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H index 977f6fd7ffe..f4397070c9a 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCell.H @@ -221,7 +221,9 @@ public: // least one Delaunay vertex outside and at least one inside inline bool boundaryDualVertex() const; - inline bool baffleBoundaryDualVertex() const; + inline bool baffleSurfaceDualVertex() const; + + inline bool baffleEdgeDualVertex() const; //- A dual vertex on a feature edge will result from this Delaunay cell inline bool featureEdgeDualVertex() const; diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H index f4890b50fb3..d0ae6137a5d 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedCell/indexedCellI.H @@ -443,21 +443,42 @@ inline bool CGAL::indexedCell<Gt, Cb>::boundaryDualVertex() const template<class Gt, class Cb> -inline bool CGAL::indexedCell<Gt, Cb>::baffleBoundaryDualVertex() const +inline bool CGAL::indexedCell<Gt, Cb>::baffleSurfaceDualVertex() const { return ( ( - this->vertex(0)->internalBafflePoint() - || this->vertex(1)->internalBafflePoint() - || this->vertex(2)->internalBafflePoint() - || this->vertex(3)->internalBafflePoint() + this->vertex(0)->internalBaffleSurfacePoint() + || this->vertex(1)->internalBaffleSurfacePoint() + || this->vertex(2)->internalBaffleSurfacePoint() + || this->vertex(3)->internalBaffleSurfacePoint() ) && ( - this->vertex(0)->externalBafflePoint() - || this->vertex(1)->externalBafflePoint() - || this->vertex(2)->externalBafflePoint() - || this->vertex(3)->externalBafflePoint() + this->vertex(0)->externalBaffleSurfacePoint() + || this->vertex(1)->externalBaffleSurfacePoint() + || this->vertex(2)->externalBaffleSurfacePoint() + || this->vertex(3)->externalBaffleSurfacePoint() + ) + ); +} + + +template<class Gt, class Cb> +inline bool CGAL::indexedCell<Gt, Cb>::baffleEdgeDualVertex() const +{ + return + ( + ( + this->vertex(0)->internalBaffleEdgePoint() + || this->vertex(1)->internalBaffleEdgePoint() + || this->vertex(2)->internalBaffleEdgePoint() + || this->vertex(3)->internalBaffleEdgePoint() + ) + && ( + this->vertex(0)->externalBaffleEdgePoint() + || this->vertex(1)->externalBaffleEdgePoint() + || this->vertex(2)->externalBaffleEdgePoint() + || this->vertex(3)->externalBaffleEdgePoint() ) ); } diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H index 362e457d748..311329da0a9 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H @@ -243,10 +243,12 @@ public: inline bool surfacePoint() const; inline bool internalBoundaryPoint() const; - inline bool internalBafflePoint() const; + inline bool internalBaffleSurfacePoint() const; + inline bool internalBaffleEdgePoint() const; inline bool externalBoundaryPoint() const; - inline bool externalBafflePoint() const; + inline bool externalBaffleSurfacePoint() const; + inline bool externalBaffleEdgePoint() const; inline bool constrained() const; diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H index c5930395c3d..688e9f28e1e 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertexI.H @@ -308,15 +308,16 @@ inline bool CGAL::indexedVertex<Gt, Vb>::internalBoundaryPoint() const } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::internalBafflePoint() const +inline bool CGAL::indexedVertex<Gt, Vb>::internalBaffleSurfacePoint() const { - return - ( - type_ == vtInternalSurfaceBaffle - || type_ == vtInternalFeatureEdgeBaffle - ); + return (type_ == vtInternalSurfaceBaffle); } +template<class Gt, class Vb> +inline bool CGAL::indexedVertex<Gt, Vb>::internalBaffleEdgePoint() const +{ + return (type_ == vtInternalFeatureEdgeBaffle); +} template<class Gt, class Vb> inline bool CGAL::indexedVertex<Gt, Vb>::externalBoundaryPoint() const @@ -325,13 +326,15 @@ inline bool CGAL::indexedVertex<Gt, Vb>::externalBoundaryPoint() const } template<class Gt, class Vb> -inline bool CGAL::indexedVertex<Gt, Vb>::externalBafflePoint() const +inline bool CGAL::indexedVertex<Gt, Vb>::externalBaffleSurfacePoint() const +{ + return (type_ == vtExternalSurfaceBaffle); +} + +template<class Gt, class Vb> +inline bool CGAL::indexedVertex<Gt, Vb>::externalBaffleEdgePoint() const { - return - ( - type_ == vtExternalSurfaceBaffle - || type_ == vtExternalFeatureEdgeBaffle - ); + return (type_ == vtExternalFeatureEdgeBaffle); } -- GitLab