mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: checkMesh -writeChecks : support multi-region - see EP10:599
This commit is contained in:
@ -13,28 +13,34 @@ const Enum<writeChecksFormatType> writeChecksFormatTypeNames
|
|||||||
|
|
||||||
writeChecksFormatType writeChecksFormat(writeChecksFormatType::none);
|
writeChecksFormatType writeChecksFormat(writeChecksFormatType::none);
|
||||||
|
|
||||||
auto writeMeshChecks = [](const fvMesh& mesh, const writeChecksFormatType fmt)
|
auto writeMeshChecks = [&](const fvMesh& mesh, const writeChecksFormatType fmt)
|
||||||
{
|
{
|
||||||
if (UPstream::master())
|
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)
|
switch (fmt)
|
||||||
{
|
{
|
||||||
case writeChecksFormatType::dictionary:
|
case writeChecksFormatType::dictionary:
|
||||||
{
|
{
|
||||||
OFstream os(mesh.time().globalPath()/"checkMesh.dict");
|
|
||||||
|
|
||||||
IOdictionary data
|
IOdictionary data
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
mesh.time().globalPath()/"checkMesh.dict",
|
os.name(),
|
||||||
mesh,
|
mesh,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Writing mesh data to " << os.name() << nl << endl;
|
|
||||||
|
|
||||||
data.writeHeader(os);
|
data.writeHeader(os);
|
||||||
|
|
||||||
mesh.data().meshDict().write(os, false);
|
mesh.data().meshDict().write(os, false);
|
||||||
@ -45,13 +51,9 @@ auto writeMeshChecks = [](const fvMesh& mesh, const writeChecksFormatType fmt)
|
|||||||
}
|
}
|
||||||
case writeChecksFormatType::JSON:
|
case writeChecksFormatType::JSON:
|
||||||
{
|
{
|
||||||
OFstream os(mesh.time().globalPath()/"checkMesh.json");
|
|
||||||
|
|
||||||
Info<< "Writing mesh data to " << os.name() << nl << endl;
|
|
||||||
|
|
||||||
JSONformatter json(os);
|
JSONformatter json(os);
|
||||||
|
|
||||||
json.writeDict(mesh.data().meshDict());
|
json.writeDict(mesh.data().meshDict());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user