diff --git a/src/mesh/conformalVoronoiMesh/Make/files b/src/mesh/conformalVoronoiMesh/Make/files index a47fb2126b..c013d4685b 100644 --- a/src/mesh/conformalVoronoiMesh/Make/files +++ b/src/mesh/conformalVoronoiMesh/Make/files @@ -4,6 +4,7 @@ conformalVoronoiMesh/conformalVoronoiMesh.C conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C conformalVoronoiMesh/conformalVoronoiMeshConformToSurface.C conformalVoronoiMesh/conformalVoronoiMeshIO.C +conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C cvControls/cvControls.C diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 06246b405e..42d5c1ae81 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -175,7 +175,7 @@ Foam::tensor Foam::conformalVoronoiMesh::requiredAlignment if (mag(ns) < SMALL) { FatalErrorIn("conformalVoronoiMesh::requiredAlignment") - << "Parallel normals detected in spoke search." << nl + << "Parallel normals detected in spoke search." << nl << "point: " << pt << nl << "closest surface point: " << surfHit.hitPoint() << nl << "closest spoke hit: " << closestSpokeHit.hitPoint() << nl @@ -294,25 +294,37 @@ void Foam::conformalVoronoiMesh::insertEdgePointGroup featureEdgeMesh::edgeStatus edStatus = feMesh.getEdgeStatus(edgeI); - if (edStatus == featureEdgeMesh::EXTERNAL) + switch (edStatus) { - insertExternalEdgePointGroup(feMesh, edHit); - } - else if (edStatus == featureEdgeMesh::INTERNAL) - { - insertInternalEdgePointGroup(feMesh, edHit); - } - else if (edStatus == featureEdgeMesh::FLAT) - { - insertFlatEdgePointGroup(feMesh, edHit); - } - else if (edStatus == featureEdgeMesh::OPEN) - { - insertOpenEdgePointGroup(feMesh, edHit); - } - else if (edStatus == featureEdgeMesh::MULTIPLE) - { - insertMultipleEdgePointGroup(feMesh, edHit); + case featureEdgeMesh::EXTERNAL: + { + insertExternalEdgePointGroup(feMesh, edHit); + break; + } + case featureEdgeMesh::INTERNAL: + { + insertInternalEdgePointGroup(feMesh, edHit); + break; + } + case featureEdgeMesh::FLAT: + { + insertFlatEdgePointGroup(feMesh, edHit); + break; + } + case featureEdgeMesh::OPEN: + { + insertOpenEdgePointGroup(feMesh, edHit); + break; + } + case featureEdgeMesh::MULTIPLE: + { + insertMultipleEdgePointGroup(feMesh, edHit); + break; + } + case featureEdgeMesh::NONE: + { + break; + } } } @@ -633,58 +645,62 @@ void Foam::conformalVoronoiMesh::insertMixedFeaturePoints() ptI++ ) { - labelList pEds(feMesh.pointEdges()[ptI]); - - // Skipping unsupported mixed feature point types - - bool skipEdge = false; - - forAll(pEds, e) + if (!insertSpecialisedFeaturePoint(feMesh, ptI)) { - label edgeI = pEds[e]; + // Specialisations available for some mixed feature points. For + // non-specialised feature points, inserting mixed internal and + // external edge groups at feature point. - featureEdgeMesh::edgeStatus edStatus = - feMesh.getEdgeStatus(edgeI); + labelList pEds(feMesh.pointEdges()[ptI]); - if - ( - edStatus == featureEdgeMesh::OPEN - || edStatus == featureEdgeMesh::MULTIPLE - ) + // Skipping unsupported mixed feature point types + + bool skipEdge = false; + + forAll(pEds, e) { - Info<< "Edge type " << edStatus - << " found for mixed feature point " << ptI - << ". Not supported." - << endl; + label edgeI = pEds[e]; - skipEdge = true; + featureEdgeMesh::edgeStatus edStatus = + feMesh.getEdgeStatus(edgeI); + + if + ( + edStatus == featureEdgeMesh::OPEN + || edStatus == featureEdgeMesh::MULTIPLE + ) + { + Info<< "Edge type " << edStatus + << " found for mixed feature point " << ptI + << ". Not supported." + << endl; + + skipEdge = true; + } } - } + if(skipEdge) + { + Info<< "Skipping point " << ptI << nl << endl; - if(skipEdge) - { - Info<< "Skipping point " << ptI << nl << endl; + continue; + } - continue; - } + const point& pt(feMesh.points()[ptI]); - // Inserting mixed internal and external feature points + scalar edgeGroupDistance = mixedFeaturePointDistance(pt); - const point& pt(feMesh.points()[ptI]); + forAll(pEds, e) + { + label edgeI = pEds[e]; - scalar edgeGroupDistance = mixedFeaturePointDistance(pt); - - forAll(pEds, e) - { - label edgeI = pEds[e]; - - point edgePt = + point edgePt = pt + edgeGroupDistance*feMesh.edgeDirection(edgeI, ptI); - pointIndexHit edgeHit(true, edgePt, edgeI); + pointIndexHit edgeHit(true, edgePt, edgeI); - insertEdgePointGroup(feMesh, edgeHit); + insertEdgePointGroup(feMesh, edgeHit); + } } } } diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index 388b238ad5..f14a5e67bb 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -325,6 +325,14 @@ private: //- Insert point groups at mixed feature points void insertMixedFeaturePoints(); + //- Insert feature point groups if a specialisation exists for the + // structure + bool insertSpecialisedFeaturePoint + ( + const featureEdgeMesh& feMesh, + label ptI + ); + //- Store the locations of all of the features to be conformed to void constructFeaturePointLocations(); diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C new file mode 100644 index 0000000000..a57cf65431 --- /dev/null +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshFeaturePointSpecialisations.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "conformalVoronoiMesh.H" + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +bool Foam::conformalVoronoiMesh::insertSpecialisedFeaturePoint +( + const featureEdgeMesh& feMesh, + label ptI +) +{ + labelList pEds(feMesh.pointEdges()[ptI]); + + if (pEds.size() != 3) + { + // Only three edge specialisations available + + return false; + } + + label nExternal = 0; + label nInternal = 0; + label nFlat = 0; + label nOpen = 0; + label nMultiple = 0; + + forAll(pEds, e) + { + label edgeI = pEds[e]; + + featureEdgeMesh::edgeStatus edStatus = feMesh.getEdgeStatus(edgeI); + + switch (edStatus) + { + case featureEdgeMesh::EXTERNAL: + { + nExternal++; + break; + } + case featureEdgeMesh::INTERNAL: + { + nInternal++; + break; + } + case featureEdgeMesh::FLAT: + { + nFlat++; + break; + } + case featureEdgeMesh::OPEN: + { + nOpen++; + break; + } + case featureEdgeMesh::MULTIPLE: + { + nMultiple++; + break; + } + case featureEdgeMesh::NONE: + { + break; + } + } + } + + if (nExternal == 2 && nInternal == 1) + { + Info<< "nExternal == 2 && nInternal == 1" << endl; + + return false; + } + else if (nExternal == 1 && nInternal == 2) + { + Info<< "nExternal == 1 && nInternal == 2" << endl; + + return false; + } + + return false; +} + + +// ************************************************************************* //