From 2d530401fdabbf47c3c0dda0074d388d38d3f2fe Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Wed, 14 Jun 2017 08:14:24 +0200 Subject: [PATCH] ENH: add foamToVTK -name option - as per foamToEnsight, foamToEnsightParts. Allows the user to specify different output directories. --- .../foamToEnsight/foamToEnsight.C | 3 +-- .../foamToEnsightParts/foamToEnsightParts.C | 3 +-- .../dataConversion/foamToVTK/foamToVTK.C | 27 ++++++++++++------- etc/config.sh/bashcompletion | 4 +-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C index 705c8e66504..bf15ffef0aa 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/foamToEnsight.C @@ -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 ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index ab2e67e855e..f6fdfae977f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -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 ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 4ea7887a59e..a012136f013 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -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)); diff --git a/etc/config.sh/bashcompletion b/etc/config.sh/bashcompletion index b7b919e15d5..464fb2f1ef7 100644 --- a/etc/config.sh/bashcompletion +++ b/etc/config.sh/bashcompletion @@ -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) -- GitLab