added command bin/finddep, added copyright headers to misc bin/ scripts

This commit is contained in:
Mark Olesen
2008-12-31 16:16:20 +01:00
parent 7f168dc93c
commit 172b862c47
20 changed files with 562 additions and 161 deletions

74
bin/finddep Executable file
View File

@ -0,0 +1,74 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# finddep
#
# Description
# find all .dep files referring to any of <file1> ... <fileN>
#
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} <file1> ... <fileN>
* find all .dep files referring to any of <file1> ... <fileN>
USAGE
exit 1
}
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
[ "$#" -gt 0 ] || usage
find . -name '*.dep' -print | \
while read src
do
for file in $@
do
grep -l "$file" $src && break
done
done
#------------------------------------------------------------------------------

View File

@ -27,12 +27,13 @@
# foamAllHC # foamAllHC
# #
# Description # Description
# execute operation $1 on all C,H,L files
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ "$#" -gt 0 ] if [ "$#" -gt 0 ]
then then
find . -name "*.[HCL]" -exec $1 {} \; -print find . -name "*.[CHL]" -exec $1 {} \; -print
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -54,7 +54,8 @@ MACHDIR=$HOME/.OpenFOAM/${PROGNAME}
DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out
if [ `uname -s` = 'Linux' ]; then if [ `uname -s` = Linux ]
then
ECHO='echo -e' ECHO='echo -e'
else else
ECHO='echo' ECHO='echo'

View File

@ -42,26 +42,23 @@ then
fi fi
# If an argument is supplied do not execute ./Allclean to avoid recursion # If an argument is supplied do not execute ./Allclean to avoid recursion
if [ $# = 0 -a -f "./Allclean" ] if [ $# = 0 -a -f Allclean ]
then then
# Specialised script. # Specialised 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 to subdirectories
for case in * for caseDir in *
do do
if [ -d $case ] ( cd $caseDir 2>/dev/null && $thisScript )
then
(cd $case && $thisScript)
fi
done done
fi fi

View File

@ -54,13 +54,13 @@ do
usage usage
;; ;;
-case) -case)
[ "$#" -ge 2 ] || usage "'-case' option requires an argument" [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
caseDir=$2 caseDir=$2
shift 2 shift 2
cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'"
;; ;;
-region) -region)
[ "$#" -ge 2 ] || usage "'-region' option requires an argument" [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
regionName=$2 regionName=$2
shift 2 shift 2
;; ;;

View File

@ -45,8 +45,8 @@ fi
trap 'rm -f $headersFile $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT trap 'rm -f $headersFile $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT
cd $WM_PROJECT_DIR cd $WM_PROJECT_DIR
find -H . -name "*.H" | fgrep -v "lnInclude" > $headersFile find -H . -name "*.H" | fgrep -v lnInclude > $headersFile
find -H . -name "*.C" | fgrep -v "lnInclude" > $sourcesFile find -H . -name "*.C" | fgrep -v lnInclude > $sourcesFile
ebrowse --files=$headersFile --files=$sourcesFile --output-file=.ebrowse ebrowse --files=$headersFile --files=$sourcesFile --output-file=.ebrowse
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -43,14 +43,16 @@ PROGNAME=`basename $0`
TMPFILE=/tmp/${PROGNAME}$$.tmp TMPFILE=/tmp/${PROGNAME}$$.tmp
AWKFILE=/tmp/${PROGNAME}$$.awk AWKFILE=/tmp/${PROGNAME}$$.awk
if [ `uname -s` = 'Linux' ]; then if [ `uname -s` = Linux ]
then
ECHO='echo -e' ECHO='echo -e'
else else
ECHO='echo' ECHO='echo'
fi fi
if [ $# -ne 1 ]; then if [ $# -ne 1 ]
then
echo "Error : $PROGNAME : insufficient arguments" 1>&2 echo "Error : $PROGNAME : insufficient arguments" 1>&2
exit 1 exit 1
fi fi

View File

@ -1,14 +1,39 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# mpirunDebug
#
# Description
# Driver script to run mpi jobs with the processes in separate # Driver script to run mpi jobs with the processes in separate
# windows or to separate log files. # windows or to separate log files.
# Requires bash on all processors. # Requires bash on all processors.
#------------------------------------------------------------------------------
if [ `uname -s` = Linux ]
PROGNAME=`basename $0` then
PROGDIR=`dirname $0`
if [ `uname -s` = 'Linux' ]; then
ECHO='echo -e' ECHO='echo -e'
else else
ECHO='echo' ECHO='echo'
@ -17,7 +42,7 @@ fi
printUsage() { printUsage() {
echo "" echo ""
echo "Usage: $PROGNAME -np <dd> <executable> <args>" echo "Usage: ${0##*/} -np <dd> <executable> <args>"
echo "" echo ""
echo "This will run like mpirun but with each process in an xterm" echo "This will run like mpirun but with each process in an xterm"
} }
@ -30,7 +55,8 @@ while [ "$1" != "" ]; do
echo "$1" echo "$1"
case $1 in case $1 in
-np) -np)
nProcs=$2;shift nProcs=$2
shift
;; ;;
*) *)
if [ ! "$exec" ]; then if [ ! "$exec" ]; then
@ -195,3 +221,5 @@ echo ""
$ECHO "Press return to execute.\c" $ECHO "Press return to execute.\c"
read dummy read dummy
exec $cmd exec $cmd
#------------------------------------------------------------------------------

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# rmclassall
#
# Description
# remove all .class files
#------------------------------------------------------------------------------
# default is pwd # default is pwd
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1 exit 1
fi fi
for i for i
do do
if [ -d "$i" ] if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# rmcore
#
# Description
# remove all core files
#------------------------------------------------------------------------------
# default is pwd # default is pwd
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1 exit 1
fi fi
for i for i
do do
if [ -d "$i" ] if [ -d "$i" ]

View File

@ -1,18 +1,68 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# rmdepall
#
# Description
# Remove all .dep files or remove .dep files referring to <file>
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE 1>&2
usage: ${0##*/} [file]
if [ "$1" = "-h" -o "$1" = "-help" -o "$#" -gt 1 ] Remove all .dep files or remove .dep files referring to <file>
then
echo "Usage: ${0##*/} : remove all .dep files" USAGE
echo " ${0##*/} <file> : remove all .dep files referring to <file>"
exit 1 exit 1
fi }
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
then then
echo "removing all .dep files" echo "removing all .dep files ..."
find . -name '*.dep' -print | xargs -t rm 2>/dev/null find . -name '*.dep' -print | xargs -t rm 2>/dev/null
else else
echo "removing all .dep files containing $1..." echo "removing .dep files referring to $1 ..."
find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \; find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \;
fi fi

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# rmoall
#
# Description
# remove all .o files
#------------------------------------------------------------------------------
# default is pwd # default is pwd
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1 exit 1
fi fi
for i for i
do do
if [ -d "$i" ] if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# rm~all
#
# Description
# remove all *~ files
#------------------------------------------------------------------------------
# default is pwd # default is pwd
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1 exit 1
fi fi
for i for i
do do
if [ -d "$i" ] if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# touchapp
#
# Description
# touch FOAM_APPBIN
#------------------------------------------------------------------------------
if [ "$#" -ne 0 ] if [ "$#" -ne 0 ]
then then
@ -7,6 +37,7 @@ then
exit 1 exit 1
fi fi
if [ -d "$FOAM_APPBIN" ] if [ -d "$FOAM_APPBIN" ]
then then
echo "touching FOAM_APPBIN: $FOAM_APPBIN" echo "touching FOAM_APPBIN: $FOAM_APPBIN"

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# touchdep
#
# Description
# touch all .dep files
#------------------------------------------------------------------------------
# default is pwd # default is pwd
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1 exit 1
fi fi
for i for i
do do
if [ -d "$i" ] if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# touchlib
#
# Description
# touch FOAM_LIBBIN
#------------------------------------------------------------------------------
if [ "$#" -ne 0 ] if [ "$#" -ne 0 ]
then then
@ -7,6 +37,7 @@ then
exit 1 exit 1
fi fi
if [ -d "$FOAM_LIBBIN" ] if [ -d "$FOAM_LIBBIN" ]
then then
echo "touching FOAM_LIBBIN: $FOAM_LIBBIN" echo "touching FOAM_LIBBIN: $FOAM_LIBBIN"

View File

@ -1,4 +1,34 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 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
# toucho
#
# Description
# touch all .o files
#------------------------------------------------------------------------------
# default is pwd # default is pwd
if [ "$#" -eq 0 ] if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1 exit 1
fi fi
for i for i
do do
if [ -d "$i" ] if [ -d "$i" ]