diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index 7a07b63d8f..0515205c78 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -95,24 +95,56 @@ int main(int argc, char *argv[]) const bool collapseFaces = args.optionFound("collapseFaces"); const bool collapseFaceZone = args.optionFound("collapseFaceZone"); + if (collapseFaces && collapseFaceZone) + { + FatalErrorIn("main(int, char*[])") + << "Both face zone collapsing and face collapsing have been" + << "selected. Choose only one of:" << nl + << " -collapseFaces" << nl + << " -collapseFaceZone " + << abort(FatalError); + } + + labelIOList pointPriority + ( + IOobject + ( + "pointPriority", + runTime.timeName(), + runTime, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + labelList(mesh.nPoints(), labelMin) + ); + forAll(timeDirs, timeI) { runTime.setTime(timeDirs[timeI], timeI); Info<< "Time = " << runTime.timeName() << endl; - polyMeshFilter meshFilter(mesh); + autoPtr meshFilterPtr; - // newMesh will be empty until it is filtered - const autoPtr& newMesh = meshFilter.filteredMesh(); + label nBadFaces = 0; - // Filter small edges only. This reduces the number of faces so that - // the face filtering is sped up. - label nBadFaces = meshFilter.filterEdges(0); { - polyTopoChange meshMod(newMesh); + meshFilterPtr.set(new polyMeshFilter(mesh, pointPriority)); + polyMeshFilter& meshFilter = meshFilterPtr(); - meshMod.changeMesh(mesh, false); + // newMesh will be empty until it is filtered + const autoPtr& newMesh = meshFilter.filteredMesh(); + + // Filter small edges only. This reduces the number of faces so that + // the face filtering is sped up. + nBadFaces = meshFilter.filterEdges(0); + { + polyTopoChange meshMod(newMesh); + + meshMod.changeMesh(mesh, false); + } + + pointPriority = meshFilter.pointPriority(); } if (collapseFaceZone) @@ -121,18 +153,30 @@ int main(int argc, char *argv[]) const faceZone& fZone = mesh.faceZones()[faceZoneName]; + meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority)); + polyMeshFilter& meshFilter = meshFilterPtr(); + + const autoPtr& newMesh = meshFilter.filteredMesh(); + // Filter faces. Pass in the number of bad faces that are present // from the previous edge filtering to use as a stopping criterion. - meshFilter.filterFaceZone(fZone); + meshFilter.filter(fZone); { polyTopoChange meshMod(newMesh); meshMod.changeMesh(mesh, false); } + + pointPriority = meshFilter.pointPriority(); } if (collapseFaces) { + meshFilterPtr.reset(new polyMeshFilter(mesh, pointPriority)); + polyMeshFilter& meshFilter = meshFilterPtr(); + + const autoPtr& newMesh = meshFilter.filteredMesh(); + // Filter faces. Pass in the number of bad faces that are present // from the previous edge filtering to use as a stopping criterion. meshFilter.filter(nBadFaces); @@ -141,6 +185,8 @@ int main(int argc, char *argv[]) meshMod.changeMesh(mesh, false); } + + pointPriority = meshFilter.pointPriority(); } // Write resulting mesh @@ -157,6 +203,7 @@ int main(int argc, char *argv[]) << runTime.timeName() << nl << endl; mesh.write(); + pointPriority.write(); } Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C index 8224492921..e5a5d9e1bf 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C @@ -41,9 +41,26 @@ License namespace Foam { -defineTypeNameAndDebug(conformalVoronoiMesh, 0); + defineTypeNameAndDebug(conformalVoronoiMesh, 0); + + template<> + const char* Foam::NamedEnum + < + Foam::conformalVoronoiMesh::dualMeshPointType, + 5 + >::names[] = + { + "internal", + "surface", + "featureEdge", + "featurePoint", + "constrained" + }; } +const Foam::NamedEnum + Foam::conformalVoronoiMesh::dualMeshPointTypeNames_; + // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // @@ -1600,7 +1617,6 @@ void Foam::conformalVoronoiMesh::move() printVertexInfo(Info); } - // Write the intermediate mesh, do not filter the dual faces. if (time().outputTime()) { writeMesh(time().timeName()); diff --git a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H index eb75909d1c..1daffd4c74 100644 --- a/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H +++ b/applications/utilities/mesh/generation/foamyHexMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.H @@ -120,6 +120,17 @@ private: // Static data + enum dualMeshPointType + { + internal = 0, + surface = 1, + featureEdge = 2, + featurePoint = 3, + constrained = 4 + }; + + static const NamedEnum dualMeshPointTypeNames_; + static const scalar searchConeAngle; static const scalar searchAngleOppositeSurface; @@ -682,14 +693,12 @@ private: //- Merge vertices that are identical void mergeIdenticalDualVertices ( - const pointField& pts, - const labelList& boundaryPts + const pointField& pts ); label mergeIdenticalDualVertices ( const pointField& pts, - const labelList& boundaryPts, Map