Scripts in bin: added -help to scripts
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -30,15 +30,34 @@
|
|||||||
# and all its subdirectories.
|
# and all its subdirectories.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
Script=$PWD/${0##*/}
|
||||||
|
|
||||||
# Source tutorial clean functions
|
# Source tutorial clean functions
|
||||||
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
. "$WM_PROJECT_DIR/bin/tools/CleanFunctions"
|
||||||
|
|
||||||
thisScript=$0
|
usage() {
|
||||||
if [ "/${thisScript#/}" != "$thisScript" ]
|
cat<<USAGE
|
||||||
then
|
|
||||||
thisScript="$PWD/$thisScript"
|
Usage: ${0##*/} [OPTIONS]
|
||||||
fi
|
options:
|
||||||
|
-help | -h help
|
||||||
|
|
||||||
|
Helper script used by the Allclean scripts in the OpenFOAM tutorials
|
||||||
|
USAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage && exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# If an argument is supplied do not execute ./Allwclean or ./Allclean
|
# If an argument is supplied do not execute ./Allwclean or ./Allclean
|
||||||
# (to avoid recursion)
|
# (to avoid recursion)
|
||||||
@ -62,7 +81,7 @@ else
|
|||||||
# Recurse into subdirectories
|
# Recurse into subdirectories
|
||||||
for caseName in *
|
for caseName in *
|
||||||
do
|
do
|
||||||
( cd $caseName 2>/dev/null && $thisScript )
|
( cd "$caseName" 2>/dev/null && $Script )
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
# ========= |
|
# ========= |
|
||||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
# \\ / O peration |
|
# \\ / O peration |
|
||||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
@ -30,18 +30,26 @@
|
|||||||
# and all its subdirectories.
|
# and all its subdirectories.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
Script=$PWD/${0##*/}
|
||||||
|
|
||||||
# Normally use standard "make"
|
# Normally use standard "make"
|
||||||
make="make"
|
make="make"
|
||||||
|
|
||||||
# Source tutorial run functions
|
# Source tutorial run functions
|
||||||
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
. "$WM_PROJECT_DIR/bin/tools/RunFunctions"
|
||||||
|
|
||||||
thisScript=$0
|
usage() {
|
||||||
if [ "/${thisScript#/}" != "$thisScript" ]
|
cat<<USAGE
|
||||||
then
|
|
||||||
thisScript="$PWD/$thisScript"
|
Usage: ${0##*/} [OPTIONS]
|
||||||
fi
|
options:
|
||||||
|
-help | -h help
|
||||||
|
-skipFirst | -s do not execute the first Allrun script
|
||||||
|
-test | -t run test loop
|
||||||
|
|
||||||
|
Helper script used by the Allrun scripts in the OpenFOAM tutorials
|
||||||
|
USAGE
|
||||||
|
}
|
||||||
|
|
||||||
skipFirst=false
|
skipFirst=false
|
||||||
|
|
||||||
@ -49,14 +57,17 @@ skipFirst=false
|
|||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-t | -test)
|
-h | -help)
|
||||||
passArgs="-test"
|
usage && exit 0
|
||||||
shift
|
|
||||||
;;
|
;;
|
||||||
-s | -skipFirst)
|
-s | -skipFirst)
|
||||||
skipFirst=true
|
skipFirst=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-t | -test)
|
||||||
|
passArgs="-test"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@ -71,25 +82,24 @@ then
|
|||||||
elif [ -d system ]
|
elif [ -d system ]
|
||||||
then
|
then
|
||||||
# Run normal case.
|
# Run normal case.
|
||||||
parentDir=`dirname $PWD`
|
application=$(getApplication)
|
||||||
application=`getApplication`
|
|
||||||
runApplication blockMesh
|
runApplication blockMesh
|
||||||
runApplication $application
|
runApplication "$application"
|
||||||
else
|
else
|
||||||
# Loop over sub-directories and compile any applications
|
# Loop over sub-directories and compile any applications
|
||||||
for caseName in *
|
for caseName in *
|
||||||
do
|
do
|
||||||
if [ -d $caseName -a -d "$caseName/Make" ]
|
if [ -d "$caseName" -a -d "$caseName/Make" ]
|
||||||
then
|
then
|
||||||
( compileApplication $caseName )
|
( compileApplication "$caseName" )
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
|
FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
|
||||||
|
|
||||||
# Run all cases which have not already been run
|
# Run all cases which have not already been run
|
||||||
$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs \
|
$make -k -f "$WM_PROJECT_DIR/bin/tools/MakefileDirs" \
|
||||||
FOAM_TARGETS="$FOAM_TARGETS" \
|
FOAM_TARGETS="$FOAM_TARGETS" \
|
||||||
FOAM_APP="$thisScript" FOAM_ARGS="$passArgs"
|
FOAM_APP="$Script" FOAM_ARGS="$passArgs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user