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",
"subdir",
"define sub-directory name to use for ensight data "
"(default: 'EnSight')"
"sub-directory name for ensight output (default: 'EnSight')"
);
argList::addOption
(

View File

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

View File

@ -302,10 +302,7 @@ fileName relativeName(const Time& runTime, const fileName& file)
int main(int argc, char *argv[])
{
argList::addNote
(
"legacy VTK file format writer"
);
argList::addNote("VTK file format writer");
timeSelector::addOptions();
#include "addRegionOption.H"
@ -398,7 +395,13 @@ int main(int argc, char *argv[])
argList::addBoolOption
(
"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"
@ -470,10 +473,13 @@ int main(int argc, char *argv[])
word 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"
// VTK/ directory in the case
fileName fvPath(runTime.path()/"VTK");
fileName fvPath(runTime.path()/vtkDirName);
// Directory of mesh (region0 gets filtered out)
fileName regionPrefix;
@ -1340,10 +1346,11 @@ int main(int argc, char *argv[])
if (Pstream::parRun() && doLinks)
{
mkDir(runTime.path()/".."/"VTK");
chDir(runTime.path()/".."/"VTK");
mkDir(runTime.path()/".."/vtkDirName);
chDir(runTime.path()/".."/vtkDirName);
Info<< "Linking all processor files to " << runTime.path()/".."/"VTK"
Info<< "Linking all processor files to "
<< runTime.path()/".."/vtkDirName
<< endl;
// Get list of vtk files
@ -1351,7 +1358,7 @@ int main(int argc, char *argv[])
(
fileName("..")
/ "processor" + Foam::name(Pstream::myProcNo())
/ "VTK"
/ vtkDirName
);
fileNameList dirs(readDir(procVTK, fileName::DIRECTORY));

View File

@ -2563,8 +2563,8 @@ _of_foamToVTK()
local cur="${COMP_WORDS[COMP_CWORD]}"
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 optsWithArgs="-case -cellSet -decomposeParDict -excludePatches -faceSet -fields -pointSet -region -roots -time "
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 -name -pointSet -region -roots -time "
case ${prev} in
-case)