Commit 5d445f4e authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

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)
parent aafbca93
......@@ -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
......
......@@ -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();
}
}
}
......
......@@ -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)
{
......
......@@ -528,15 +528,13 @@ bool Foam::functionObjects::vtkWrite::write()
{
if (internalWriter.valid())
{
// cellIds + procIds (parallel)
// Optionally with cellID and procID fields
internalWriter->beginCellData
(
(writeIds_ ? 1 + (internalWriter->parallel() ? 1 : 0) : 0)
+ (internalWriter->parallel() ? 1 : 0)
+ nVolFields + nDimFields
);
// Write cellID field + procID (parallel only)
if (writeIds_)
{
internalWriter->writeCellIDs();
......@@ -548,11 +546,13 @@ bool Foam::functionObjects::vtkWrite::write()
{
for (vtk::patchWriter& writer : patchWriters)
{
// Optionally with patchID field
writer.beginCellData
(
(writeIds_ ? 1 : 0)
+ nVolFields
);
if (writeIds_)
{
writer.writePatchIDs();
......
......@@ -98,7 +98,7 @@ Description
directory | The output directory name | no | postProcessing/NAME
width | Padding width for file name | no | 8
decompose | Decompose polyhedral cells | no | false
writeIds | Write cell/patch ids as field | no | false
writeIds | Write cell,patch,proc id fields | no | false
\endtable
\heading Output Selection
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment