ENH: suppress cell/patch/proc ids for foamToVTK (#1230)

- reduces output size, consistent with vtkWrite function object

STYLE: mark some foamToVTK options as advanced (ie, visible with -help-full)
This commit is contained in:
Mark Olesen
2019-03-11 11:02:58 +01:00
parent ed181431d9
commit 7c4f455b96
5 changed files with 55 additions and 17 deletions

View File

@ -121,14 +121,20 @@ Description
{
for (vtk::patchWriter& writer : patchWriters)
{
// Optionally with patchID, procID, neighID fields
// - use Pstream::parRun() not writer.parallel() !!
writer.beginCellData
(
1 + (Pstream::parRun() ? 2 : 0)
(withMeshIds ? 1 + (Pstream::parRun() ? 2 : 0) : 0)
+ nVolFields
);
writer.writePatchIDs();
writer.writeProcIDs();
writer.writeNeighIDs();
if (withMeshIds)
{
writer.writePatchIDs();
writer.writeProcIDs(); // parallel only
writer.writeNeighIDs(); // parallel only
}
}
writeAllVolFields

View File

@ -262,22 +262,35 @@ Description
// Begin CellData
if (internalWriter.valid())
{
// cellIds + procIds (parallel)
// Optionally with cellID and procID fields
internalWriter->beginCellData
(
1 + (internalWriter->parallel() ? 1 : 0)
(withMeshIds ? 1 + (internalWriter->parallel() ? 1 : 0) : 0)
+ nVolFields + nDimFields
);
internalWriter->writeCellIDs();
internalWriter->writeProcIDs(); // parallel only
if (withMeshIds)
{
internalWriter->writeCellIDs();
internalWriter->writeProcIDs(); // parallel only
}
}
if (nVolFields)
{
for (vtk::patchWriter& writer : patchWriters)
{
writer.beginCellData(1 + nVolFields);
writer.writePatchIDs();
// Optionally with patchID field
writer.beginCellData
(
(withMeshIds ? 1 : 0)
+ nVolFields
);
if (withMeshIds)
{
writer.writePatchIDs();
}
}
}

View File

@ -91,6 +91,9 @@ Usage
- \par -no-point-data
Suppress conversion of pointFields. No interpolated PointData.
- \par -with-ids
Additional mesh id fields (cellID, procID, patchID)
- \par -with-point-ids
Additional pointID field for internal mesh
@ -271,7 +274,8 @@ int main(int argc, char *argv[])
argList::addBoolOption
(
"legacy",
"Write legacy format instead of xml"
"Write legacy format instead of xml",
true // mark as an advanced option
);
argList::addBoolOption
(
@ -323,7 +327,8 @@ int main(int argc, char *argv[])
"faceZones",
"wordRes",
"Specify single or multiple faceZones to write\n"
"Eg, 'cells' or '( slice \"mfp-.*\" )'."
"Eg, 'cells' or '( slice \"mfp-.*\" )'.",
true // mark as an advanced option
);
argList::addOption
@ -382,10 +387,18 @@ int main(int argc, char *argv[])
);
argList::addOptionCompat("no-point-data", {"noPointValues", 1806});
argList::addBoolOption
(
"with-ids",
"Additional mesh id fields (cellID, procID, patchID)",
true // mark as an advanced option
);
argList::addBoolOption
(
"with-point-ids",
"Additional pointID field for internal mesh"
"Additional pointID field for internal mesh",
true // mark as an advanced option
);
argList::addBoolOption
@ -517,6 +530,12 @@ int main(int argc, char *argv[])
Info<< nl;
}
const bool withMeshIds = args.found("with-ids");
if (withMeshIds)
{
Info<< "Writing mesh ids (cell, patch, proc) requested" << nl;
}
wordRes includePatches, excludePatches;
if (doBoundary)
{