From 0a421c99abf15c91b539a0b55ad5b0ba1f56b948 Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 24 Jul 2025 14:51:45 +0100 Subject: [PATCH] ENH: checkMesh -writeChecks : support multi-region - see EP10:599 --- .../manipulation/checkMesh/writeMeshChecks.H | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/writeMeshChecks.H b/applications/utilities/mesh/manipulation/checkMesh/writeMeshChecks.H index f4c8051fc6..e3d80bb154 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/writeMeshChecks.H +++ b/applications/utilities/mesh/manipulation/checkMesh/writeMeshChecks.H @@ -13,28 +13,34 @@ const Enum writeChecksFormatTypeNames writeChecksFormatType writeChecksFormat(writeChecksFormatType::none); -auto writeMeshChecks = [](const fvMesh& mesh, const writeChecksFormatType fmt) +auto writeMeshChecks = [&](const fvMesh& mesh, const writeChecksFormatType fmt) { if (UPstream::master()) { + fileName path(mesh.time().globalPath()/"checkMesh"); + if (mesh.name() != polyMesh::defaultRegion) + { + path += "_" + mesh.name(); + } + + OFstream os(path.ext(writeChecksFormatTypeNames[fmt])); + + Info<< "Writing mesh data to " << os.name() << nl << endl; + switch (fmt) { case writeChecksFormatType::dictionary: { - OFstream os(mesh.time().globalPath()/"checkMesh.dict"); - IOdictionary data ( IOobject ( - mesh.time().globalPath()/"checkMesh.dict", + os.name(), mesh, IOobject::NO_READ ) ); - Info<< "Writing mesh data to " << os.name() << nl << endl; - data.writeHeader(os); mesh.data().meshDict().write(os, false); @@ -45,13 +51,9 @@ auto writeMeshChecks = [](const fvMesh& mesh, const writeChecksFormatType fmt) } case writeChecksFormatType::JSON: { - OFstream os(mesh.time().globalPath()/"checkMesh.json"); - - Info<< "Writing mesh data to " << os.name() << nl << endl; - JSONformatter json(os); - json.writeDict(mesh.data().meshDict()); + break; } default: