ENH: 'wclean all' now uses either Allwclean or Allclean files if

present.
This commit is contained in:
Mark Olesen
2010-03-09 17:16:23 +01:00
parent d4054f6b1f
commit 2068c67a33
7 changed files with 55 additions and 80 deletions

View File

@ -27,8 +27,8 @@
# foamCleanTutorials # foamCleanTutorials
# #
# Description # Description
# Run either Allclean or default cleanCase in current directory # Run either Allwclean, Allclean or default cleanCase in current directory
# and all its subdirectories. # and all its subdirectories.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -41,24 +41,29 @@ then
thisScript="$PWD/$thisScript" thisScript="$PWD/$thisScript"
fi fi
# If an argument is supplied do not execute ./Allclean to avoid recursion # If an argument is supplied do not execute ./Allwclean or ./Allclean
if [ $# = 0 -a -f Allclean ] # (to avoid recursion)
if [ $# -eq 0 -a -f Allwclean ]
then then
# Specialised script. # Specialized script
./Allwclean
elif [ $# -eq 0 -a -f Allclean ]
then
# Specialized script
./Allclean ./Allclean
elif [ -d system ] elif [ -d system ]
then then
# Normal case. # Normal case
cleanCase cleanCase
elif [ -d Make ] elif [ -d Make ]
then then
# Normal application. # Normal application
cleanApplication cleanApplication
else else
# Recurse to subdirectories # Recurse into subdirectories
for caseDir in * for caseName in *
do do
( cd $caseDir 2>/dev/null && $thisScript ) ( cd $caseName 2>/dev/null && $thisScript )
done done
fi fi

View File

@ -1,35 +1,4 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Script
# Allclean
#
# Description
#
#------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
echo "--------" echo "--------"
@ -43,4 +12,5 @@ rm logs testLoopReport > /dev/null 2>&1
foamCleanTutorials cases foamCleanTutorials cases
echo "--------" echo "--------"
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -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) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -29,7 +29,6 @@
# Description # Description
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
# Source tutorial run functions # Source tutorial run functions
@ -38,9 +37,9 @@ cd ${0%/*} || exit 1 # run from this directory
# logReport <logfile> # logReport <logfile>
# Extracts useful info from log file. # Extracts useful info from log file.
logReport () { logReport () {
case=`dirname $1 | sed s/"\(.*\)\.\/"/""/g` caseName=`dirname $1 | sed s/"\(.*\)\.\/"/""/g`
app=`echo $1 | sed s/"\(.*\)\."/""/g` app=`echo $1 | sed s/"\(.*\)\."/""/g`
appAndCase="Application $app - case $case" appAndCase="Application $app - case $caseName"
fatalError=`grep "FOAM FATAL" $1` fatalError=`grep "FOAM FATAL" $1`
UxSS=`grep -E "Ux[:| ]*solution singularity" $1` UxSS=`grep -E "Ux[:| ]*solution singularity" $1`
@ -51,11 +50,9 @@ logReport () {
if [ "$fatalError" ] if [ "$fatalError" ]
then then
echo "$appAndCase: ** FOAM FATAL ERROR **" echo "$appAndCase: ** FOAM FATAL ERROR **"
return
elif [ "$UxSS" -a "$UySS" -a "$UzSS" ] elif [ "$UxSS" -a "$UySS" -a "$UzSS" ]
then then
echo "$appAndCase: ** Solution singularity **" echo "$appAndCase: ** Solution singularity **"
return
elif [ "$completed" ] elif [ "$completed" ]
then then
completionTime=`tail -10 $log | grep Execution | cut -d= -f2 | sed 's/^[ \t]*//'` completionTime=`tail -10 $log | grep Execution | cut -d= -f2 | sed 's/^[ \t]*//'`
@ -64,7 +61,6 @@ logReport () {
completionTime="in $completionTime" completionTime="in $completionTime"
fi fi
echo "$appAndCase: completed $completionTime" echo "$appAndCase: completed $completionTime"
return
else else
echo "$appAndCase: unconfirmed completion" echo "$appAndCase: unconfirmed completion"
fi fi
@ -78,17 +74,18 @@ foamRunTutorials cases
# Analyse all log files # Analyse all log files
rm testLoopReport > /dev/null 2>&1 & rm testLoopReport > /dev/null 2>&1 &
touch testLoopReport touch testLoopReport
for application in * for appDir in *
do do
if [ -d $application ] if [ -d $appDir ]
then then
cd $application (
cd $appDir
for log in `find . -name "log.*" | xargs ls -rt` for log in `find . -name "log.*" | xargs ls -rt`
do do
logReport $log >> ../testLoopReport logReport $log >> ../testLoopReport
done done
echo "" >> ../testLoopReport echo "" >> ../testLoopReport
cd .. )
fi fi
done done

View File

@ -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) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -30,7 +30,6 @@
# quickly tests the tutorials and writes out the scheme/solver information # quickly tests the tutorials and writes out the scheme/solver information
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
usage() { usage() {
@ -225,5 +224,4 @@ do
echo "" >> $SOLVERS_FILE echo "" >> $SOLVERS_FILE
done done
# ----------------------------------------------------------------- end-of-file # ----------------------------------------------------------------- end-of-file

View File

@ -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) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -27,8 +27,8 @@
# wclean # wclean
# #
# Description # Description
# Clean up the wmake control directory Make and remove the include # Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
# directories generated for libraries. # lnInclude directories generated for libraries.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/} Script=${0##*/}
@ -36,18 +36,23 @@ Script=${0##*/}
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [dir]
$Script target [dir [MakeDir]]
Clean up the wmake control directory Make and remove the include Usage: $Script [OPTION] [dir]
directories generated for libraries. $Script [OPTION] target [dir [MakeDir]]
options:
-help print the usage
Clean up the wmake control directory Make/\$WM_OPTIONS and remove the
lnInclude directories generated for libraries.
The targets correspond to a subset of the 'wmake' special targets: The targets correspond to a subset of the 'wmake' special targets:
all all subdirectories all all subdirectories
exe cleans dir/Make (NB: any Allwclean or Allclean files will be used if they exist)
lib cleans dir/Make and dir/lnInclude exe clean dir/Make
libso cleans dir/Make and dir/lnInclude lib clean dir/Make and dir/lnInclude
libo cleans dir/Make and dir/lnInclude libo clean dir/Make and dir/lnInclude
libso clean dir/Make and dir/lnInclude
USAGE USAGE
exit 1 exit 1
@ -77,16 +82,11 @@ then
makeOption=$1 makeOption=$1
fi fi
if [ $# -ge 2 ] # specified directory name:
then [ $# -ge 2 ] && dir=$2
dir=$2
fi
# alternative name for the Make sub-directory # specified alternative name for the Make sub-directory:
if [ $# -ge 3 ] [ $# -ge 3 ] && MakeDir=$3
then
MakeDir=$3
fi
if [ "$dir" ] if [ "$dir" ]
then then
@ -106,7 +106,11 @@ fi
if [ "$makeOption" = all ] if [ "$makeOption" = all ]
then then
if [ -e Allclean ] if [ -e Allwclean ] # consistent with Allwmake
then
./Allwclean
exit $?
elif [ -e Allclean ] # often used for tutorial cases
then then
./Allclean ./Allclean
exit $? exit $?
@ -141,7 +145,7 @@ rm -rf $MakeDir/$WM_OPTIONS $MakeDir/classes 2>/dev/null
find . -name "*.dep" -exec rm {} \; find . -name "*.dep" -exec rm {} \;
case "$makeOption" in case "$makeOption" in
lib | libso | libo ) lib | libo | libso )
rm -rf lnInclude 2>/dev/null rm -rf lnInclude 2>/dev/null
;; ;;
esac esac

View File

@ -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) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -62,6 +62,6 @@ find . -depth -type d \( -name lnInclude -o -name ii_files -o -name Templates.DB
echo "Removing misc files" echo "Removing misc files"
find . \( -name exe -o -name log -o -name so_locations \) -exec rm {} \; find . \( -name exe -o -name log -o -name so_locations \) -exec rm {} \;
( cd tutorials && ./Allclean ) tutorials/Allclean
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -48,7 +48,8 @@ The 'target' is a Makefile target:
e.g., Make/linux64GccDPOpt/fvMesh.o e.g., Make/linux64GccDPOpt/fvMesh.o
or a special target: or a special target:
all all subdirectories (NB: any Allwmake files will be used if they exist) all all subdirectories
(NB: any Allwmake files will be used if they exist)
exe build statically linked executable exe build statically linked executable
lib build statically linked archive lib (.a) lib build statically linked archive lib (.a)
libo build statically linked lib (.o) libo build statically linked lib (.o)