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
#
# Description
# execute operation $1 on all C,H,L files
#
#------------------------------------------------------------------------------
if [ "$#" -gt 0 ]
then
find . -name "*.[HCL]" -exec $1 {} \; -print
find . -name "*.[CHL]" -exec $1 {} \; -print
fi
#------------------------------------------------------------------------------

View File

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

View File

@ -42,26 +42,23 @@ then
fi
# If an argument is supplied do not execute ./Allclean to avoid recursion
if [ $# = 0 -a -f "./Allclean" ]
if [ $# = 0 -a -f Allclean ]
then
# Specialised script.
./Allclean
elif [ -d "./system" ]
elif [ -d system ]
then
# Normal case.
cleanCase
elif [ -d "./Make" ]
elif [ -d Make ]
then
# Normal application.
cleanApplication
else
# Recurse to subdirectories
for case in *
for caseDir in *
do
if [ -d $case ]
then
(cd $case && $thisScript)
fi
( cd $caseDir 2>/dev/null && $thisScript )
done
fi

View File

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

View File

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

View File

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

View File

@ -1,14 +1,39 @@
#!/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
# windows or to separate log files.
# Requires bash on all processors.
#------------------------------------------------------------------------------
PROGNAME=`basename $0`
PROGDIR=`dirname $0`
if [ `uname -s` = 'Linux' ]; then
if [ `uname -s` = Linux ]
then
ECHO='echo -e'
else
ECHO='echo'
@ -17,7 +42,7 @@ fi
printUsage() {
echo ""
echo "Usage: $PROGNAME -np <dd> <executable> <args>"
echo "Usage: ${0##*/} -np <dd> <executable> <args>"
echo ""
echo "This will run like mpirun but with each process in an xterm"
}
@ -30,7 +55,8 @@ while [ "$1" != "" ]; do
echo "$1"
case $1 in
-np)
nProcs=$2;shift
nProcs=$2
shift
;;
*)
if [ ! "$exec" ]; then
@ -195,3 +221,5 @@ echo ""
$ECHO "Press return to execute.\c"
read dummy
exec $cmd
#------------------------------------------------------------------------------

View File

@ -1,4 +1,34 @@
#!/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
if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1
fi
for i
do
if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/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
if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1
fi
for i
do
if [ -d "$i" ]

View File

@ -1,18 +1,68 @@
#!/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 ]
then
echo "Usage: ${0##*/} : remove all .dep files"
echo " ${0##*/} <file> : remove all .dep files referring to <file>"
Remove all .dep files or remove .dep files referring to <file>
USAGE
exit 1
fi
}
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
if [ "$#" -eq 0 ]
then
echo "removing all .dep files"
echo "removing all .dep files ..."
find . -name '*.dep' -print | xargs -t rm 2>/dev/null
else
echo "removing all .dep files containing $1..."
echo "removing .dep files referring to $1 ..."
find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \;
fi

View File

@ -1,4 +1,34 @@
#!/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
if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1
fi
for i
do
if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/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
if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1
fi
for i
do
if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/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 ]
then
@ -7,6 +37,7 @@ then
exit 1
fi
if [ -d "$FOAM_APPBIN" ]
then
echo "touching FOAM_APPBIN: $FOAM_APPBIN"

View File

@ -1,4 +1,34 @@
#!/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
if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1
fi
for i
do
if [ -d "$i" ]

View File

@ -1,4 +1,34 @@
#!/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 ]
then
@ -7,6 +37,7 @@ then
exit 1
fi
if [ -d "$FOAM_LIBBIN" ]
then
echo "touching FOAM_LIBBIN: $FOAM_LIBBIN"

View File

@ -1,4 +1,34 @@
#!/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
if [ "$#" -eq 0 ]
@ -11,6 +41,7 @@ then
exit 1
fi
for i
do
if [ -d "$i" ]