ENH: add foamToVTK -name option

- as per foamToEnsight, foamToEnsightParts.
  Allows the user to specify different output directories.
This commit is contained in:
Mark Olesen
2017-06-14 08:14:24 +02:00
parent 98cc0fc004
commit 2d530401fd
4 changed files with 21 additions and 16 deletions

View File

@ -173,8 +173,7 @@ int main(int argc, char *argv[])
( (
"name", "name",
"subdir", "subdir",
"define sub-directory name to use for ensight data " "sub-directory name for ensight output (default: 'EnSight')"
"(default: 'EnSight')"
); );
argList::addOption argList::addOption
( (

View File

@ -128,8 +128,7 @@ int main(int argc, char *argv[])
( (
"name", "name",
"subdir", "subdir",
"define sub-directory name to use for Ensight data " "sub-directory name for ensight output (default: 'Ensight')"
"(default: \"Ensight\")"
); );
argList::addOption argList::addOption
( (

View File

@ -302,10 +302,7 @@ fileName relativeName(const Time& runTime, const fileName& file)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addNote argList::addNote("VTK file format writer");
(
"legacy VTK file format writer"
);
timeSelector::addOptions(); timeSelector::addOptions();
#include "addRegionOption.H" #include "addRegionOption.H"
@ -398,7 +395,13 @@ int main(int argc, char *argv[])
argList::addBoolOption argList::addBoolOption
( (
"useTimeName", "useTimeName",
"use the time name instead of the time index when naming the files" "use time name instead of the time index when naming files"
);
argList::addOption
(
"name",
"subdir",
"sub-directory name for VTK output (default: 'VTK')"
); );
#include "setRootCase.H" #include "setRootCase.H"
@ -470,10 +473,13 @@ int main(int argc, char *argv[])
word pointSetName; word pointSetName;
args.optionReadIfPresent("pointSet", pointSetName); args.optionReadIfPresent("pointSet", pointSetName);
// Define sub-directory name to use for VTK data.
const word vtkDirName = args.optionLookupOrDefault<word>("name", "VTK");
#include "createNamedMesh.H" #include "createNamedMesh.H"
// VTK/ directory in the case // VTK/ directory in the case
fileName fvPath(runTime.path()/"VTK"); fileName fvPath(runTime.path()/vtkDirName);
// Directory of mesh (region0 gets filtered out) // Directory of mesh (region0 gets filtered out)
fileName regionPrefix; fileName regionPrefix;
@ -1340,10 +1346,11 @@ int main(int argc, char *argv[])
if (Pstream::parRun() && doLinks) if (Pstream::parRun() && doLinks)
{ {
mkDir(runTime.path()/".."/"VTK"); mkDir(runTime.path()/".."/vtkDirName);
chDir(runTime.path()/".."/"VTK"); chDir(runTime.path()/".."/vtkDirName);
Info<< "Linking all processor files to " << runTime.path()/".."/"VTK" Info<< "Linking all processor files to "
<< runTime.path()/".."/vtkDirName
<< endl; << endl;
// Get list of vtk files // Get list of vtk files
@ -1351,7 +1358,7 @@ int main(int argc, char *argv[])
( (
fileName("..") fileName("..")
/ "processor" + Foam::name(Pstream::myProcNo()) / "processor" + Foam::name(Pstream::myProcNo())
/ "VTK" / vtkDirName
); );
fileNameList dirs(readDir(procVTK, fileName::DIRECTORY)); fileNameList dirs(readDir(procVTK, fileName::DIRECTORY));

View File

@ -2563,8 +2563,8 @@ _of_foamToVTK()
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD-1]}" local prev="${COMP_WORDS[COMP_CWORD-1]}"
local opts="-allPatches -ascii -constant -latestTime -nearCellValue -newTimes -noFaceZones -noFunctionObjects -noInternal -noLagrangian -noLinks -noPointValues -noZero -parallel -poly -surfaceFields -useTimeName -srcDoc -doc -help " local opts="-allPatches -ascii -constant -latestTime -nearCellValue -newTimes -noFaceZones -noFunctionObjects -noInternal -noLagrangian -noLinks -noPointValues -noZero -parallel -poly -surfaceFields -useTimeName -xml -srcDoc -doc -help "
local optsWithArgs="-case -cellSet -decomposeParDict -excludePatches -faceSet -fields -pointSet -region -roots -time " local optsWithArgs="-case -cellSet -decomposeParDict -excludePatches -faceSet -fields -name -pointSet -region -roots -time "
case ${prev} in case ${prev} in
-case) -case)