From 0ec0facff6de955af304037a6ad441a45d689ff1 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 6 May 2020 16:42:16 +0200 Subject: [PATCH] ENH: add paraFoam -plugin-path=DIR option - convenient way to use alternative plugin installations - provide separate -help-build information and reduce the noisy output when a reader module cannot be located. --- bin/paraFoam | 105 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 80 insertions(+), 25 deletions(-) diff --git a/bin/paraFoam b/bin/paraFoam index f36df1a8d1..33c5216071 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -21,21 +21,43 @@ # Note # Combining -block, -vtk, -builtin options with -region option yields # undefined behaviour +# #------------------------------------------------------------------------------ +printBuildHelp() { +cat< Specify alternative case directory, default is the cwd -region Specify alternative mesh region -touch Create the file (eg, .blockMesh, .OpenFOAM, .foam, ...) -touch-all Create .blockMesh, .foam, .OpenFOAM files (for all regions) +HELP_HEAD + +if [ -n "$1" ] +then +cat<&2 + unset pluginPath + fi + ;; + + -block*) # Silently accepts -blockMesh extension=blockMesh plugin=blockReader ;; @@ -136,16 +193,14 @@ do shift done + +pluginError="No supplementary ParaView/OpenFOAM reader modules" + if [ -n "$plugin" ] then - pluginError="Cannot use ParaView/OpenFOAM reader modules" - - # Check if requested reader module exists - if [ -z "$PV_PLUGIN_PATH" ] + if [ -d "$PV_PLUGIN_PATH" ] then - echo "The PV_PLUGIN_PATH environment variable is unset" 1>&2 - echo "$pluginError" 1>&2 - else + # Check if requested reader module exists # Check for different names. For example, # - ParaFoamReader = (paraview >= 5.7) @@ -186,30 +241,30 @@ then if [ -n "$pluginError" ] then cat<< NO_PLUGIN 1>&2 -========================= -$pluginError - need to build? +$pluginError + See '${0##*/} -help-build' for more information - cd \$WM_PROJECT_DIR/modules/visualization/src/paraview-plugins -OR cd \$WM_PROJECT_DIR/applications/utilities/postProcessing/graphics/PVReaders - - ./Allwclean && ./Allwmake -========================= NO_PLUGIN fi + else + echo "Invalid \$PV_PLUGIN_PATH and -plugin-path= not defined" 1>&2 + echo "$pluginError" 1>&2 fi if [ -n "$pluginError" ] then # Fallback to native reader, if possible - if [ "$plugin" = foamReader ] - then - echo "Continuing with builtin reader: paraFoam -vtk" 1>&2 + case "$plugin" in + (foamReader) + echo "Using builtin reader: ${0##*/} -vtk" 1>&2 echo 1>&2 extension=foam - else + ;; + (*) echo 1>&2 exit 1 - fi + ;; + esac unset plugin fi fi