mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
committed by
Andrew Heather
parent
aafbca93b2
commit
5d445f4ed6
@ -121,14 +121,20 @@ Description
|
|||||||
{
|
{
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
{
|
{
|
||||||
|
// Optionally with patchID, procID, neighID fields
|
||||||
|
// - use Pstream::parRun() not writer.parallel() !!
|
||||||
writer.beginCellData
|
writer.beginCellData
|
||||||
(
|
(
|
||||||
1 + (Pstream::parRun() ? 2 : 0)
|
(withMeshIds ? 1 + (Pstream::parRun() ? 2 : 0) : 0)
|
||||||
+ nVolFields
|
+ nVolFields
|
||||||
);
|
);
|
||||||
writer.writePatchIDs();
|
|
||||||
writer.writeProcIDs();
|
if (withMeshIds)
|
||||||
writer.writeNeighIDs();
|
{
|
||||||
|
writer.writePatchIDs();
|
||||||
|
writer.writeProcIDs(); // parallel only
|
||||||
|
writer.writeNeighIDs(); // parallel only
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeAllVolFields
|
writeAllVolFields
|
||||||
|
|||||||
@ -262,22 +262,35 @@ Description
|
|||||||
// Begin CellData
|
// Begin CellData
|
||||||
if (internalWriter.valid())
|
if (internalWriter.valid())
|
||||||
{
|
{
|
||||||
// cellIds + procIds (parallel)
|
// Optionally with cellID and procID fields
|
||||||
internalWriter->beginCellData
|
internalWriter->beginCellData
|
||||||
(
|
(
|
||||||
1 + (internalWriter->parallel() ? 1 : 0)
|
(withMeshIds ? 1 + (internalWriter->parallel() ? 1 : 0) : 0)
|
||||||
+ nVolFields + nDimFields
|
+ nVolFields + nDimFields
|
||||||
);
|
);
|
||||||
internalWriter->writeCellIDs();
|
|
||||||
internalWriter->writeProcIDs(); // parallel only
|
if (withMeshIds)
|
||||||
|
{
|
||||||
|
internalWriter->writeCellIDs();
|
||||||
|
internalWriter->writeProcIDs(); // parallel only
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nVolFields)
|
if (nVolFields)
|
||||||
{
|
{
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
{
|
{
|
||||||
writer.beginCellData(1 + nVolFields);
|
// Optionally with patchID field
|
||||||
writer.writePatchIDs();
|
writer.beginCellData
|
||||||
|
(
|
||||||
|
(withMeshIds ? 1 : 0)
|
||||||
|
+ nVolFields
|
||||||
|
);
|
||||||
|
|
||||||
|
if (withMeshIds)
|
||||||
|
{
|
||||||
|
writer.writePatchIDs();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,6 +91,9 @@ Usage
|
|||||||
- \par -no-point-data
|
- \par -no-point-data
|
||||||
Suppress conversion of pointFields. No interpolated PointData.
|
Suppress conversion of pointFields. No interpolated PointData.
|
||||||
|
|
||||||
|
- \par -with-ids
|
||||||
|
Additional mesh id fields (cellID, procID, patchID)
|
||||||
|
|
||||||
- \par -with-point-ids
|
- \par -with-point-ids
|
||||||
Additional pointID field for internal mesh
|
Additional pointID field for internal mesh
|
||||||
|
|
||||||
@ -271,7 +274,8 @@ int main(int argc, char *argv[])
|
|||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"legacy",
|
"legacy",
|
||||||
"Write legacy format instead of xml"
|
"Write legacy format instead of xml",
|
||||||
|
true // mark as an advanced option
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
@ -323,7 +327,8 @@ int main(int argc, char *argv[])
|
|||||||
"faceZones",
|
"faceZones",
|
||||||
"wordRes",
|
"wordRes",
|
||||||
"Specify single or multiple faceZones to write\n"
|
"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
|
argList::addOption
|
||||||
@ -382,10 +387,18 @@ int main(int argc, char *argv[])
|
|||||||
);
|
);
|
||||||
argList::addOptionCompat("no-point-data", {"noPointValues", 1806});
|
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
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"with-point-ids",
|
"with-point-ids",
|
||||||
"Additional pointID field for internal mesh"
|
"Additional pointID field for internal mesh",
|
||||||
|
true // mark as an advanced option
|
||||||
);
|
);
|
||||||
|
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
@ -517,6 +530,12 @@ int main(int argc, char *argv[])
|
|||||||
Info<< nl;
|
Info<< nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool withMeshIds = args.found("with-ids");
|
||||||
|
if (withMeshIds)
|
||||||
|
{
|
||||||
|
Info<< "Writing mesh ids (cell, patch, proc) requested" << nl;
|
||||||
|
}
|
||||||
|
|
||||||
wordRes includePatches, excludePatches;
|
wordRes includePatches, excludePatches;
|
||||||
if (doBoundary)
|
if (doBoundary)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -528,15 +528,13 @@ bool Foam::functionObjects::vtkWrite::write()
|
|||||||
{
|
{
|
||||||
if (internalWriter.valid())
|
if (internalWriter.valid())
|
||||||
{
|
{
|
||||||
// cellIds + procIds (parallel)
|
// Optionally with cellID and procID fields
|
||||||
internalWriter->beginCellData
|
internalWriter->beginCellData
|
||||||
(
|
(
|
||||||
(writeIds_ ? 1 + (internalWriter->parallel() ? 1 : 0) : 0)
|
(writeIds_ ? 1 + (internalWriter->parallel() ? 1 : 0) : 0)
|
||||||
+ (internalWriter->parallel() ? 1 : 0)
|
|
||||||
+ nVolFields + nDimFields
|
+ nVolFields + nDimFields
|
||||||
);
|
);
|
||||||
|
|
||||||
// Write cellID field + procID (parallel only)
|
|
||||||
if (writeIds_)
|
if (writeIds_)
|
||||||
{
|
{
|
||||||
internalWriter->writeCellIDs();
|
internalWriter->writeCellIDs();
|
||||||
@ -548,11 +546,13 @@ bool Foam::functionObjects::vtkWrite::write()
|
|||||||
{
|
{
|
||||||
for (vtk::patchWriter& writer : patchWriters)
|
for (vtk::patchWriter& writer : patchWriters)
|
||||||
{
|
{
|
||||||
|
// Optionally with patchID field
|
||||||
writer.beginCellData
|
writer.beginCellData
|
||||||
(
|
(
|
||||||
(writeIds_ ? 1 : 0)
|
(writeIds_ ? 1 : 0)
|
||||||
+ nVolFields
|
+ nVolFields
|
||||||
);
|
);
|
||||||
|
|
||||||
if (writeIds_)
|
if (writeIds_)
|
||||||
{
|
{
|
||||||
writer.writePatchIDs();
|
writer.writePatchIDs();
|
||||||
|
|||||||
@ -98,7 +98,7 @@ Description
|
|||||||
directory | The output directory name | no | postProcessing/NAME
|
directory | The output directory name | no | postProcessing/NAME
|
||||||
width | Padding width for file name | no | 8
|
width | Padding width for file name | no | 8
|
||||||
decompose | Decompose polyhedral cells | no | false
|
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
|
\endtable
|
||||||
|
|
||||||
\heading Output Selection
|
\heading Output Selection
|
||||||
|
|||||||
Reference in New Issue
Block a user