diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index 19b461e51a..bf68fccf84 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -257,6 +257,21 @@ void Foam::mergeAndWrite } +Foam::fileName Foam::checkMeshOutputDir(const polyMesh& mesh) +{ + return + mesh.time().globalPath() + /functionObjects::writeFile::outputPrefix + /( + (mesh.name() != polyMesh::defaultRegion) + ? mesh.name() + : word::null + ) + /"checkMesh" + /mesh.pointsInstance(); +} + + void Foam::mergeAndWrite ( const surfaceWriter& writer, @@ -271,15 +286,7 @@ void Foam::mergeAndWrite mesh.points() ); - fileName outputDir - ( - set.time().globalPath() - /functionObjects::writeFile::outputPrefix - /mesh.pointsInstance() - /set.name() - ); - - mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir); + mergeAndWrite(mesh, writer, set.name(), setPatch, checkMeshOutputDir(mesh)); } @@ -363,13 +370,7 @@ void Foam::mergeAndWrite mesh.points() ); - fileName outputDir - ( - set.time().globalPath() - /functionObjects::writeFile::outputPrefix - /mesh.pointsInstance() - /set.name() - ); + const fileName outputDir(checkMeshOutputDir(mesh)); outputDir.clean(); mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir); @@ -453,9 +454,7 @@ void Foam::mergeAndWrite { writer.write ( - set.time().globalPath() - /functionObjects::writeFile::outputPrefix - /mesh.pointsInstance(), + checkMeshOutputDir(mesh), set.name(), coordSet(false, word::null, mergedPts), "pointID", diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.H b/applications/utilities/mesh/manipulation/checkMesh/checkTools.H index 2b83d746a0..a24e7950d1 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.H +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,6 +48,9 @@ namespace Foam class fileName; class polyMesh; + //- Output directory for sets and surfaces + fileName checkMeshOutputDir(const polyMesh& mesh); + //- Print mesh statistics void printMeshStats(const polyMesh& mesh, const bool allTopology); @@ -62,15 +65,15 @@ namespace Foam const fileName& outputDir ); - //- Write vtk representation of (assembled) faceSet to surface file in + //- Write representation of (assembled) faceSet to surface file in // postProcessing/ directory void mergeAndWrite(const surfaceWriter&, const faceSet&); - //- Write vtk representation of (assembled) cellSet to surface file in + //- Write representation of (assembled) cellSet to surface file in // postProcessing/ directory void mergeAndWrite(const surfaceWriter&, const cellSet&); - //- Write vtk representation of (assembled) pointSet to 'set' file in + //- Write representation of (assembled) pointSet to 'set' file in // postProcessing/ directory void mergeAndWrite(const setWriter&, const pointSet&); }