ENH: checkMesh -writeChecks : support multi-region - see EP10:599

This commit is contained in:
Andrew Heather
2025-07-24 14:51:45 +01:00
parent 20e04a88f7
commit 0a421c99ab

View File

@ -13,28 +13,34 @@ const Enum<writeChecksFormatType> 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: