From 603b513b20207ca974208273021c7df6ee57ca98 Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Mon, 15 Feb 2016 16:36:58 +0000
Subject: [PATCH] foamRunTutorials: Removed redundant code and simplified

---
 bin/foamRunTutorials | 62 ++++++++------------------------------------
 1 file changed, 11 insertions(+), 51 deletions(-)

diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials
index 8f2325808f..7aabb6c480 100755
--- a/bin/foamRunTutorials
+++ b/bin/foamRunTutorials
@@ -26,47 +26,15 @@
 #     foamRunTutorials
 #
 # Description
-#       Run either Allrun or blockMesh/application in current directory
-#       and all its subdirectories.
+#     Run either Allrun or blockMesh/application in current directory
+#     and all its subdirectories.
 #
 #------------------------------------------------------------------------------
 
-#------------------------------------------------------------------------------
-# Select the version of make to be used
-#------------------------------------------------------------------------------
-
-# normally use "make"
+# Normally use standard "make"
 make="make"
-runTests=false
-skipFirst=false
-
-## set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set
-#if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
-#then
-#    WM_NCOMPPROCS=$(wmakeScheduler -count)
-#    [ $? -eq 0 ] || unset WM_NCOMPPROCS
-#fi
-#
-#if [ "$WM_NCOMPPROCS" ]
-#then
-#    if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
-#    then
-#        lockDir=$HOME/.$WM_PROJECT/.wmake
-#
-#        if [ -d $lockDir ]
-#        then
-#            rm -f $lockDir/*
-#        else
-#            mkdir -p $lockDir
-#        fi
-#
-#        make="make --no-print-directory -j "$WM_NCOMPPROCS
-#    fi
-#fi
-
 
-
-# Source tutorial functions
+# Source tutorial run functions
 . $WM_PROJECT_DIR/bin/tools/RunFunctions
 
 thisScript=$0
@@ -75,13 +43,14 @@ then
     thisScript="$PWD/$thisScript"
 fi
 
+skipFirst=false
 
-# parse options
+# Parse options
 while [ "$#" -gt 0 ]
 do
     case "$1" in
     -t | -test)
-        runTests=true
+        passArgs="-test"
         shift
         ;;
     -s | -skipFirst)
@@ -94,20 +63,14 @@ do
     esac
 done
 
-passArgs=$(if $runTests; then echo "-test"; fi)
-
 # If an argument is supplied do not execute ./Allrun to avoid recursion
-if ! $skipFirst && $runTests && [ -f "./Alltest" ]
-then
-    # Run a special test script.
-    ./Alltest $passArgs
-elif ! $skipFirst && [ -f "./Allrun" ]
+if ! $skipFirst && [ -f "./Allrun" ]
 then
-    # Specialised script.
+    # Run specialised Allrun script.
     ./Allrun $passArgs
 elif [ -d system ]
 then
-    # Normal case.
+    # Run normal case.
     parentDir=`dirname $PWD`
     application=`getApplication`
     runApplication blockMesh
@@ -123,10 +86,7 @@ else
     done
     FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
 
-    #$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs \
-    #      FOAM_TARGETS="$FOAM_TARGETS" \
-    #      FOAM_APP="$WM_SCHEDULER $thisScript" FOAM_ARGS="$passArgs"
-
+    # Run all cases which have not already been run
     $make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs \
           FOAM_TARGETS="$FOAM_TARGETS" \
           FOAM_APP="$thisScript" FOAM_ARGS="$passArgs"
-- 
GitLab