ENH: improve option naming consistency in

- foamToVTK, foamToEnsight, foamToEnsightParts
This commit is contained in:
Mark Olesen
2018-11-25 10:47:00 +01:00
parent a139543e9c
commit b5432011fa
4 changed files with 110 additions and 85 deletions

View File

@ -42,24 +42,26 @@ Usage
- \par -noZero - \par -noZero
Exclude the often incomplete initial conditions. Exclude the often incomplete initial conditions.
- \par -noLagrangian - \par -no-boundary
Suppress writing lagrangian positions and fields.
- \par -noPatches
Suppress writing any patches. Suppress writing any patches.
- \par -patches patchList - \par -no-internal
Specify particular patches to write. Suppress writing the internal mesh.
Specifying an empty list suppresses writing the internalMesh.
- \par -faceZones zoneList - \par -no-lagrangian
Suppress writing lagrangian positions and fields.
- \par -patches patch or patch list
Specify particular patches to write.
- \par -faceZones patch or zone list
Specify faceZones to write, with wildcards Specify faceZones to write, with wildcards
- \par -cellZone zoneName - \par -cellZone zoneName
Specify single cellZone to write (not lagrangian) Specify single cellZone to write (not lagrangian)
- \par -width \<n\> - \par -width \<n\>
Width of EnSight data subdir (default: 8) Width of Ensight data subdir (default: 8)
Note Note
Writes to \a EnSight directory to avoid collisions with Writes to \a EnSight directory to avoid collisions with
@ -124,42 +126,47 @@ int main(int argc, char *argv[])
argList::addBoolOption argList::addBoolOption
( (
"nodeValues", "nodeValues",
"Write values in nodes" "Write values at nodes"
); );
argList::addBoolOption argList::addBoolOption
( (
"noLagrangian", "no-boundary", // noPatches
"Suppress writing lagrangian positions and fields"
);
argList::addBoolOption
(
"noInternal",
"Do not generate file for mesh, only for patches"
);
argList::addBoolOption
(
"noBoundary",
"Suppress writing any patches" "Suppress writing any patches"
); );
argList::addOptionCompat("noBoundary", {"noPatches", 1806}); argList::addOptionCompat("no-boundary", {"noPatches", 1806});
argList::addBoolOption
(
"no-internal",
"Suppress writing the internal mesh"
);
argList::addBoolOption
(
"no-lagrangian", // noLagrangian
"Suppress writing lagrangian positions and fields"
);
argList::addOptionCompat("no-lagrangian", {"noLagrangian", 1806});
argList::addOption argList::addOption
( (
"patches", "patches",
"wordRes", "wordRes",
"Specify particular patches to write - eg '(outlet \"inlet.*\")'." "Specify single patch or multiple patches to write\n"
"Eg, 'inlet' or '(outlet \"inlet.*\")'"
); );
argList::addOption argList::addOption
( (
"faceZones", "faceZones",
"wordRes", "wordRes",
"Specify faceZones to write - eg '( slice \"mfp-.*\" )'." "Specify single or multiple faceZones to write\n"
"Eg, 'cells' or '( slice \"mfp-.*\" )'."
); );
argList::addOption argList::addOption
( (
"fields", "fields",
"wordRes", "wordRes",
"Specify fields to export (all by default) - eg '( \"U.*\" )'." "Specify single or multiple fields to write (all by default)\n"
"Eg, 'T' or '( \"U.*\" )'"
); );
argList::addOption argList::addOption
( (
@ -171,13 +178,13 @@ int main(int argc, char *argv[])
( (
"name", "name",
"subdir", "subdir",
"Sub-directory name for ensight output (default: 'EnSight')" "Sub-directory name for Ensight output (default: 'EnSight')"
); );
argList::addOption argList::addOption
( (
"width", "width",
"n", "n",
"Width of ensight data subdir" "Width of Ensight data subdir"
); );
#include "setRootCase.H" #include "setRootCase.H"
@ -235,8 +242,9 @@ int main(int argc, char *argv[])
// Output configuration (geometry related) // Output configuration (geometry related)
// //
ensightMesh::options writeOpts(format); ensightMesh::options writeOpts(format);
writeOpts.useInternalMesh(!args.found("noInternal")); writeOpts.useBoundaryMesh(!args.found("no-boundary"));
writeOpts.useBoundaryMesh(!args.found("noBoundary")); writeOpts.useInternalMesh(!args.found("no-internal"));
const bool doLagrangian = !args.found("no-lagrangian");
if (args.found("patches")) if (args.found("patches"))
{ {
@ -248,9 +256,8 @@ int main(int argc, char *argv[])
} }
// //
// output configuration (field related) // Output configuration (field related)
// //
const bool doLagrangian = !args.found("noLagrangian");
wordRes fieldPatterns; wordRes fieldPatterns;
args.readListIfPresent<wordRe>("fields", fieldPatterns); args.readListIfPresent<wordRe>("fields", fieldPatterns);

View File

@ -31,7 +31,7 @@ if (timeDirs.size())
// Now check for lagrangian/<cloudName> // Now check for lagrangian/<cloudName>
// //
fileNameList cloudDirs; fileNameList cloudDirs;
if (!noLagrangian) if (doLagrangian)
{ {
cloudDirs = readDir cloudDirs = readDir
( (

View File

@ -48,10 +48,10 @@ Usage
Ignore the time index contained in the time file and use a Ignore the time index contained in the time file and use a
simple indexing when creating the \c Ensight/data/######## files. simple indexing when creating the \c Ensight/data/######## files.
- \par -noLagrangian - \par -no-lagrangian
Suppress writing lagrangian positions and fields. Suppress writing lagrangian positions and fields.
- \par -noMesh - \par -no-mesh
Suppress writing the geometry. Can be useful for converting partial Suppress writing the geometry. Can be useful for converting partial
results for a static geometry. results for a static geometry.
@ -104,25 +104,29 @@ int main(int argc, char *argv[])
( (
"index", "index",
"start", "start",
"Ignore the time index contained in the uniform/time file " "Ignore the time index contained in the uniform/time file"
"and use simple indexing when creating the files" " and use simple indexing when creating files"
); );
argList::addBoolOption argList::addBoolOption
( (
"noLagrangian", "no-lagrangian", // noLagrangian
"Suppress writing lagrangian positions and fields" "Suppress writing lagrangian positions and fields"
); );
argList::addOptionCompat("no-lagrangian", {"noLagrangian", 1806});
argList::addBoolOption argList::addBoolOption
( (
"noMesh", "no-mesh", // noMesh
"Suppress writing the geometry. " "Suppress writing the geometry."
"Can be useful for converting partial results for a static geometry" " Can be useful for converting partial results for a static geometry"
); );
argList::addOptionCompat("no-mesh", {"noMesh", 1806});
argList::addOption argList::addOption
( (
"name", "name",
"subdir", "subdir",
"Sub-directory name for ensight output (default: 'Ensight')" "Sub-directory name for Ensight output (default: 'Ensight')"
); );
argList::addOption argList::addOption
( (
@ -213,10 +217,10 @@ int main(int argc, char *argv[])
// Control for renumbering iterations // Control for renumbering iterations
label indexingNumber = 0; label indexingNumber = 0;
const bool optIndex = args.readIfPresent("index", indexingNumber); const bool optIndex = args.readIfPresent("index", indexingNumber);
const bool noLagrangian = args.found("noLagrangian"); const bool doLagrangian = !args.found("no-lagrangian");
// Always write the geometry, unless the -noMesh option is specified // Write the geometry, unless otherwise specified
bool optNoMesh = args.found("noMesh"); bool doGeometry = !args.found("no-mesh");
// Construct the list of ensight parts for the entire mesh // Construct the list of ensight parts for the entire mesh
@ -237,10 +241,10 @@ int main(int argc, char *argv[])
#include "checkMeshMoving.H" #include "checkMeshMoving.H"
#include "findFields.H" #include "findFields.H"
if (meshMoving && optNoMesh) if (meshMoving && !doGeometry)
{ {
Info<< "mesh is moving: ignoring '-noMesh' option" << endl; Info<< "mesh is moving: ignoring '-no-mesh' option" << endl;
optNoMesh = false; doGeometry = true;
} }
@ -264,7 +268,7 @@ int main(int argc, char *argv[])
partsList.recalculate(mesh); partsList.recalculate(mesh);
} }
if (!optNoMesh) if (doGeometry)
{ {
autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving); autoPtr<ensightGeoFile> os = ensCase.newGeometry(meshMoving);
partsList.write(os.ref()); partsList.write(os.ref());

View File

@ -34,7 +34,7 @@ Description
- Handles volFields, pointFields, surfaceScalarField, surfaceVectorField - Handles volFields, pointFields, surfaceScalarField, surfaceVectorField
fields. fields.
- Mesh topo changes. - Mesh topo changes.
- Both ascii and binary. - Output legacy or xml VTK format in ascii or binary.
- Single time step writing. - Single time step writing.
- Write subset only. - Write subset only.
- Optional decomposition of cells. - Optional decomposition of cells.
@ -50,9 +50,11 @@ Usage
Write VTK data in legacy format instead of XML format Write VTK data in legacy format instead of XML format
- \par -fields \<fields\> - \par -fields \<fields\>
Convert selected fields only. For example, Specify single or multiple fields to write (all by default)
For example,
\verbatim \verbatim
-fields '( p T U )' -fields T
-fields '(p T U \"alpha.*\")'
\endverbatim \endverbatim
The quoting is required to avoid shell expansions and to pass the The quoting is required to avoid shell expansions and to pass the
information as a single argument. information as a single argument.
@ -71,32 +73,37 @@ Usage
- \par -nearCellValue - \par -nearCellValue
Output cell value on patches instead of patch value itself Output cell value on patches instead of patch value itself
- \par -noBoundary - \par -no-boundary
Suppress output for all boundary patches Suppress output for all boundary patches
- \par -noInternal - \par -no-internal
Suppress output for internal (volume) mesh Suppress output for internal (volume) mesh
- \par -noLagrangian - \par -no-lagrangian
Suppress writing Lagrangian positions and fields. Suppress writing Lagrangian positions and fields.
- \par -noPointValues - \par -no-point-data
No pointFields Suppress conversion of pointFields. No interpolated PointData.
- \par -noFaceZones - \par -noFaceZones
No faceZones Suppress conversion of surface fields on faceZones
- \par -poly-decomp - \par -poly-decomp
Decompose polyhedral cells into tets/pyramids Decompose polyhedral cells into tets/pyramids
- \par -allPatches - \par -one-boundary
Combine all patches into a single boundary file Combine all patches into a single boundary file
- \par -patch \<patchNames\> - \par -patches NAME | LIST
Specify which patch or patches (name or regex) to convert. Specify single patch or multiple patches (name or regex) to write
For example,
\verbatim
-patches top
-patches '( front \".*back\" )'
\endverbatim
- \par -excludePatches \<patchNames\> - \par -excludePatches NAME | LIST
Specify which patch or patches (name or regex) not to convert. Specify single or multiple patches (name or regex) not to convert.
For example, For example,
\verbatim \verbatim
-excludePatches '( inlet_1 inlet_2 "proc.*")' -excludePatches '( inlet_1 inlet_2 "proc.*")'
@ -306,8 +313,8 @@ int main(int argc, char *argv[])
( (
"fields", "fields",
"wordRes", "wordRes",
"Only convert specified fields\n" "Specify single or multiple fields to write (all by default)\n"
"Eg, '(p T U \"alpha.*\")'" "Eg, 'T' or '(p T U \"alpha.*\")'"
); );
argList::addBoolOption argList::addBoolOption
@ -330,30 +337,35 @@ int main(int argc, char *argv[])
); );
argList::addBoolOption argList::addBoolOption
( (
"noBoundary", // no-boundary "no-boundary",
"Suppress output for boundary patches" "Suppress output for boundary patches"
); );
argList::addBoolOption argList::addBoolOption
( (
"noInternal", // no-internal "no-internal",
"Suppress output for internal volume mesh" "Suppress output for internal volume mesh"
); );
argList::addBoolOption argList::addBoolOption
( (
"noLagrangian", // no-lagrangian "no-lagrangian", // noLagrangian
"Suppress writing lagrangian positions and fields" "Suppress writing lagrangian positions and fields"
); );
argList::addOptionCompat("no-lagrangian", {"noLagrangian", 1806});
argList::addBoolOption argList::addBoolOption
( (
"noPointValues", // no-point-data "no-point-data", // noPointValues
"No pointFields and no interpolated PointData" "Suppress conversion of pointFields. No interpolated PointData."
); );
argList::addOptionCompat("no-point-data", {"noPointValues", 1806});
argList::addBoolOption argList::addBoolOption
( (
"allPatches", // one-boundary "one-boundary", // allPatches
"Combine all patches into a single file", "Combine all patches into a single file",
true // mark as an advanced option true // mark as an advanced option
); );
argList::addOptionCompat("one-boundary", {"allPatches", 1806});
#include "addRegionOption.H" #include "addRegionOption.H"
@ -374,21 +386,22 @@ int main(int argc, char *argv[])
( (
"patches", "patches",
"wordRes", "wordRes",
"A list of patches to include.\n" "Specify single patch or multiple patches to write\n"
"Eg, '( front \".*back\" )'" "Eg, 'top' or '( front \".*back\" )'"
); );
argList::addOption argList::addOption
( (
"excludePatches", "excludePatches",
"wordRes", "wordRes",
"A list of patches to exclude\n" "Specify single patch or multiple patches to exclude from writing."
"Eg, '( inlet \".*Wall\" )'" " Eg, 'outlet' or '( inlet \".*Wall\" )'",
true // mark as an advanced option
); );
argList::addBoolOption argList::addBoolOption
( (
"noFaceZones", "noFaceZones",
"No faceZones", "Suppress conversion of surface fields on faceZones",
true // mark as an advanced option true // mark as an advanced option
); );
argList::ignoreOptionCompat argList::ignoreOptionCompat
@ -416,14 +429,14 @@ int main(int argc, char *argv[])
#include "setRootCase.H" #include "setRootCase.H"
const bool decomposePoly = args.found("poly-decomp"); const bool decomposePoly = args.found("poly-decomp");
const bool doBoundary = !args.found("noBoundary"); const bool doBoundary = !args.found("no-boundary");
const bool doInternal = !args.found("noInternal"); const bool doInternal = !args.found("no-internal");
const bool doLagrangian = !args.found("noLagrangian"); const bool doLagrangian = !args.found("no-lagrangian");
const bool doFiniteArea = args.found("finiteAreaFields"); const bool doFiniteArea = args.found("finiteAreaFields");
const bool doSurfaceFields = args.found("surfaceFields"); const bool doSurfaceFields = args.found("surfaceFields");
const bool doFaceZones = !args.found("noFaceZones") && doInternal; const bool doFaceZones = !args.found("noFaceZones") && doInternal;
const bool oneBoundary = args.found("allPatches") && doBoundary; const bool oneBoundary = args.found("one-boundary") && doBoundary;
const bool nearCellValue = args.found("nearCellValue") && doBoundary; const bool nearCellValue = args.found("nearCellValue") && doBoundary;
const bool allRegions = args.found("allRegions"); const bool allRegions = args.found("allRegions");
@ -435,11 +448,11 @@ int main(int argc, char *argv[])
<< nl << endl; << nl << endl;
} }
const bool noPointValues = args.found("noPointValues"); const bool noPointValues = args.found("no-point-data");
if (noPointValues) if (noPointValues)
{ {
Info<< "Outputting cell values only." Info<< "Point fields and interpolated point data"
<< " Point fields disabled by '-noPointValues' option" << " disabled with the '-no-point-data' option"
<< nl; << nl;
} }
@ -478,7 +491,7 @@ int main(int argc, char *argv[])
if (regionNames.empty()) if (regionNames.empty())
{ {
Info<<"Warning: " Info<< "Warning: "
<< "No regionProperties - assuming default region" << "No regionProperties - assuming default region"
<< nl << endl; << nl << endl;
@ -500,9 +513,10 @@ int main(int argc, char *argv[])
} }
else if else if
( (
selectRegions.size() == 1 && !selectRegions.first().isPattern() selectRegions.size() == 1 && selectRegions.first().isLiteral()
) )
{ {
// Identical to -region NAME
regionNames.resize(1); regionNames.resize(1);
regionNames.first() = selectRegions.first(); regionNames.first() = selectRegions.first();
} }
@ -513,7 +527,7 @@ int main(int argc, char *argv[])
if (regionNames.empty()) if (regionNames.empty())
{ {
Info<<"Warning: " Info<< "Warning: "
<< "No regionProperties - assuming default region" << "No regionProperties - assuming default region"
<< nl << endl; << nl << endl;