From 288efa21ab932fd8f83ff95828cdda89c42dba86 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 27 May 2010 11:48:11 +0100 Subject: [PATCH] bin merge --- bin/doxyFilt | 36 +- bin/{buildParaView3.3-cvs => engridFoam} | 54 ++- bin/{foamDir2lzm => finddep} | 49 ++- bin/foamAllHC | 8 +- bin/foamCheckJobs | 7 +- bin/foamCheckSourceDeps | 70 --- bin/foamCleanTutorials | 13 +- bin/foamClearOutRelease.sh | 4 - bin/foamClearPolyMesh | 126 +++++- bin/foamDiffSourceList | 135 ------ bin/foamEbrowse | 19 +- bin/foamExec | 111 +++-- bin/foamInstallationTest | 101 ++--- bin/foamJob | 28 +- bin/foamNew | 35 +- bin/foamPack | 27 +- bin/foamPackBin | 120 ++---- bin/foamPackBinAll | 9 +- bin/foamPackChanged | 105 ----- bin/foamPackGeneral | 48 +-- bin/foamPackSource | 84 ++-- bin/foamPackThirdPartyBin | 88 +--- bin/foamPackThirdPartyGeneral | 51 +-- bin/foamProcessInfo | 10 +- bin/foamRunTutorials | 2 +- bin/foamSolverSweeps | 2 +- bin/foamSystemCheck | 2 +- bin/{buildParaView2.4.4 => foamTags} | 60 ++- bin/foamTemplates/source/foamAppTemplate.C | 6 +- bin/foamTemplates/source/foamTemplate.C | 15 +- bin/foamTemplates/source/foamTemplate.H | 14 +- bin/foamTemplates/source/foamUtilTemplate.cfg | 27 -- bin/foamTemplates/source/newSource | 6 +- .../sourceTemplate/foamTemplateTemplate.C | 14 +- .../sourceTemplate/foamTemplateTemplate.H | 15 +- bin/foamUpdateCaseFileHeader | 122 +++--- bin/foamUpgradeTurbulenceProperties | 90 ++-- bin/mpirunDebug | 134 ++++-- bin/paraFoam | 111 +++-- bin/paraFoam.pvs | 12 - bin/rmclassall | 56 ++- bin/rmcore | 57 ++- bin/rmdepall | 73 +++- bin/rmoall | 56 ++- bin/rm~all | 57 ++- bin/tools/CleanFunctions | 21 +- bin/tools/README | 4 +- bin/tools/RunFunctions | 28 +- bin/tools/buildParaView3.2.1 | 71 ---- bin/tools/buildParaView3.3 | 192 --------- bin/tools/buildParaViewFunctions | 397 ------------------ bin/tools/temp.7077 | 0 bin/touchapp | 47 ++- bin/touchdep | 54 ++- bin/touchlib | 47 ++- bin/toucho | 54 ++- 56 files changed, 1337 insertions(+), 1847 deletions(-) rename bin/{buildParaView3.3-cvs => engridFoam} (60%) rename bin/{foamDir2lzm => finddep} (63%) delete mode 100755 bin/foamCheckSourceDeps delete mode 100755 bin/foamClearOutRelease.sh delete mode 100755 bin/foamDiffSourceList delete mode 100755 bin/foamPackChanged rename bin/{buildParaView2.4.4 => foamTags} (51%) delete mode 100644 bin/foamTemplates/source/foamUtilTemplate.cfg delete mode 100644 bin/paraFoam.pvs delete mode 100755 bin/tools/buildParaView3.2.1 delete mode 100755 bin/tools/buildParaView3.3 delete mode 100644 bin/tools/buildParaViewFunctions delete mode 100644 bin/tools/temp.7077 diff --git a/bin/doxyFilt b/bin/doxyFilt index c08851c53..327de5076 100755 --- a/bin/doxyFilt +++ b/bin/doxyFilt @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. +# \\ / A nd | Copyright held by original author # \\/ M anipulation | #------------------------------------------------------------------------------- # License @@ -39,26 +39,26 @@ if [ "$#" -gt 0 ] then - filePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@../../..@ ) - # dirName=$(echo "$filePath" | sed -e 's@/[^/]*$@@' ) - dirName=${filePath%/[^/]*} - fileName=${filePath##*/} + filePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@../../..@ ) + # dirName=$(echo "$filePath" | sed -e 's@/[^/]*$@@' ) + dirName=${filePath%/[^/]*} + fileName=${filePath##*/} - awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt.awk + awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt.awk - case "$1" in - */applications/solvers/*.C | */applications/utilities/*.C ) - awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-top.awk - ;; -# */applications/solvers/*.H | */applications/utilities/*.H ) -# awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-ignore.awk -# ;; + case "$1" in + */applications/solvers/*.C | */applications/utilities/*.C ) + awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-top.awk + ;; +# */applications/solvers/*.H | */applications/utilities/*.H ) +# awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-ignore.awk +# ;; esac - awk -f $awkScript $1 | \ - sed -f $WM_PROJECT_DIR/bin/tools/doxyFilt.sed \ - -e s@%filePath%@$filePath@g \ - -e s@%fileName%@$fileName@g \ - -e s@%dirName%@$dirName@g + awk -f $awkScript $1 | \ + sed -f $WM_PROJECT_DIR/bin/tools/doxyFilt.sed \ + -e s@%filePath%@$filePath@g \ + -e s@%fileName%@$fileName@g \ + -e s@%dirName%@$dirName@g fi #------------------------------------------------------------------------------ diff --git a/bin/buildParaView3.3-cvs b/bin/engridFoam similarity index 60% rename from bin/buildParaView3.3-cvs rename to bin/engridFoam index 22e919f59..2117d259f 100755 --- a/bin/buildParaView3.3-cvs +++ b/bin/engridFoam @@ -24,47 +24,43 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# buildParaView +# engridFoam # # Description -# Build and install ParaView -# - run from folder above ParaView source folder or place the -# ParaView source under $WM_PROJECT_INST_DIR +# start engrid using the paraview libraries from OpenFOAM # #------------------------------------------------------------------------------ -. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<." +ParaView_MAJOR_VERSION=$(echo $ParaView_VERSION | \ + sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/') -initialiseVariables -addMpiSupport # set MPI specific options -addPythonSupport # set python specific options -addMesaSupport # set MESA specific options +bindir=$WM_THIRD_PARTY_DIR/engrid/platforms/$WM_ARCH +libdir="$ParaView_DIR/lib/paraview-$ParaView_MAJOR_VERSION" -buildParaView -installParaView +[ -x $bindir/engrid ] || usage "engrid executable not found in $bindir" +[ -d $libdir ] || usage "paraview libraries not found" -echo "done" +export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH +echo "starting $bindir/engrid $@" +eval "exec $bindir/engrid $@ &" #------------------------------------------------------------------------------ diff --git a/bin/foamDir2lzm b/bin/finddep similarity index 63% rename from bin/foamDir2lzm rename to bin/finddep index e430ef6de..638fb3217 100755 --- a/bin/foamDir2lzm +++ b/bin/finddep @@ -24,14 +24,51 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# mksquashfs dir file +# finddep # # Description -# Creates an lzm module for SLAX +# find all .dep files referring to any of ... # #------------------------------------------------------------------------------ +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat< ... + +* find all .dep files referring to any of ... + +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 + +#------------------------------------------------------------------------------ diff --git a/bin/foamAllHC b/bin/foamAllHC index 8b9dd3c72..5f86ad718 100755 --- a/bin/foamAllHC +++ b/bin/foamAllHC @@ -27,9 +27,13 @@ # foamAllHC # # Description -# +# execute operation $1 on all C,H,L files +# #------------------------------------------------------------------------------ -find . -name "*.[HCL]" -exec $1 {} \; -print +if [ "$#" -gt 0 ] +then + find . -name "*.[CHL]" -exec $1 {} \; -print +fi #------------------------------------------------------------------------------ diff --git a/bin/foamCheckJobs b/bin/foamCheckJobs index 6d87af627..da73cf464 100755 --- a/bin/foamCheckJobs +++ b/bin/foamCheckJobs @@ -54,10 +54,11 @@ MACHDIR=$HOME/.OpenFOAM/${PROGNAME} DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out -if [ `uname -s` = 'Linux' ]; then - ECHO='echo -e' +if [ `uname -s` = Linux ] +then + ECHO='echo -e' else - ECHO='echo' + ECHO='echo' fi diff --git a/bin/foamCheckSourceDeps b/bin/foamCheckSourceDeps deleted file mode 100755 index c6bcf645d..000000000 --- a/bin/foamCheckSourceDeps +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | -# \\ / A nd | Copyright held by original author -# \\/ 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 -# foamCheckSourceDeps -# -# Description -# Usage: foamCheckSourceDeps [dir1 .. dirN] -# -# Search for *.dep files that are without a corresponding .C or .L file. -# These could indicate a directory that has been moved. -# - print questionable directory and dep file -#------------------------------------------------------------------------------ -if [ "$1" = "-h" -o "$1" = "-help" ] -then - cat <&2 -Usage: ${0##*/} [dir1 .. dirN] - - Search for .dep files that are without a corresponding .C or .L file. - This could indicate a directory that has been moved. - - print questionable directory and file -USAGE - exit 1 -fi - -if [ "$#" -eq 0 ] -then - set -- . -fi - -for checkDir -do - if [ -d $checkDir ] - then - find $checkDir -name '*.dep' -print | while read depFile; - do - Cfile=$(echo $depFile | sed -e 's/\.dep$/.C/') - # also check flex files - Lfile=$(echo $depFile | sed -e 's/\.C$/.L/') - if [ ! -f $Cfile -a ! -f $Lfile ] - then - echo "$(dirname $Cfile) ${depFile##*/}" - fi - done - fi -done - -# ----------------------------------------------------------------------------- diff --git a/bin/foamCleanTutorials b/bin/foamCleanTutorials index 63a40778c..1654c3d75 100755 --- a/bin/foamCleanTutorials +++ b/bin/foamCleanTutorials @@ -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 diff --git a/bin/foamClearOutRelease.sh b/bin/foamClearOutRelease.sh deleted file mode 100755 index 2ed76abf1..000000000 --- a/bin/foamClearOutRelease.sh +++ /dev/null @@ -1,4 +0,0 @@ -# Clears a release directory before untarring a Release-Tarball into it -# Leaves the directory structure and all .svn-directories intact - -find $1 \( \( -name .svn -prune \) -or \( -type f -print -exec rm -f {} \; \) \) diff --git a/bin/foamClearPolyMesh b/bin/foamClearPolyMesh index afaacf578..7fdb08961 100755 --- a/bin/foamClearPolyMesh +++ b/bin/foamClearPolyMesh @@ -27,20 +27,128 @@ # foamClearPolyMesh # # Description -# +# Remove the contents of the constant/polyMesh directory +# as per the Foam::polyMesh::removeFiles() method. +# #------------------------------------------------------------------------------ +usage() { + while [ "$#" -ge 1 ]; do echo "$1" 1>&2; shift; done + cat <&2 -if [ -d constant/polyMesh ]; then - echo "there is constant/polyMesh"; - cd constant/polyMesh +usage: ${0##*/} [-case dir] [-region name] -elif [ -d polyMesh ]; then - echo "there is polyMesh"; - cd polyMesh + Remove the contents of the constant/polyMesh directory + as per the Foam::polyMesh::removeFiles() method. + +USAGE + exit 1 +} + +unset caseDir regionName + +# parse a single option +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -case) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + cd "$2" 2>/dev/null || usage "directory does not exist: '$2'" + caseDir=$2 + shift 2 + ;; + -region) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + regionName=$2 + shift 2 + ;; + *) + usage "unknown option/argument: '$*'" + ;; + esac +done + +if [ -n "$regionName" ] +then + meshDir=$regionName/polyMesh else - echo "in polyMesh directory"; + meshDir=polyMesh fi -rm -f pointFaces pointEdges pointCells faceEdges edges edgeFaces edgeCells cellEdges cellCells owner neighbour losort faceCentres faceAreas cellVolumes cellCentres +# if -case was specified: insist upon 'constant/polyMesh' +if [ -n "$caseDir" ] +then + if [ -d constant/$meshDir ] + then + # use constant/polyMesh + meshDir=constant/$meshDir + else + echo "Error: no 'constant/$meshDir' in $caseDir" 1>&2 + exit 1 + fi +else + if [ -d constant/$meshDir ] + then + # use constant/polyMesh + meshDir=constant/$meshDir + elif [ -d $meshDir ] + then + # likely already in constant/ - do not adjust anything + : + elif [ "${PWD##*/}" = polyMesh -a -z "$regionName" ] + then + # apparently already within polyMesh/ + meshDir=. + else + echo "Error: no appropriate 'polyMesh/' directory found" 1>&2 + exit 1 + fi +fi + + +# +# remove files (mesh itself, modifiers, snappyHexMesh ones) and subdirectories +# +echo "Clearing ${caseDir:-.}/$meshDir" 1>&2 + +for i in \ + points \ + faces \ + owner \ + neighbour \ + cells \ + boundary \ + pointZones \ + faceZones \ + cellZones \ + meshModifiers \ + parallelData \ + sets \ + cellLevel \ + pointLevel \ + refinementHistory \ + surfaceIndex \ + points.gz \ + faces.gz \ + owner.gz \ + neighbour.gz \ + cells.gz \ + boundary.gz \ + pointZones.gz \ + faceZones.gz \ + cellZones.gz \ + meshModifiers.gz \ + parallelData.gz \ + sets.gz \ + cellLevel.gz \ + pointLevel.gz \ + refinementHistory.gz \ + surfaceIndex.gz \ +; +do + rm -rf $meshDir/$i +done #------------------------------------------------------------------------------ diff --git a/bin/foamDiffSourceList b/bin/foamDiffSourceList deleted file mode 100755 index 36a6e6a3f..000000000 --- a/bin/foamDiffSourceList +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | -# \\ / A nd | Copyright held by original author -# \\/ 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 -# foamDiffSourceList -# -# Description -# Packs and compresses files that have changed (diff -uw) between -# oldDir newDir -# -#------------------------------------------------------------------------------ -tmpFile=${TMPDIR:-/tmp}/foamDiffList.$$ - -if [ $# -ne 3 ]; then - echo "Usage : ${0##*/} oldDir newDir tarFile" - echo "" - echo "Find the files that changed (diff -uw) between and " - echo "and pack them into " - echo "" - exit 1 -fi - -# canonical form (no double and no trailing dashes) -oldDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@') -newDir=$(echo "$2" | sed -e 's@//*@/@g' -e 's@/$@@') -packFile=$3 - -if [ ! -d $oldDir ]; then - echo "Error: directory $oldDir does not exist" - exit 1 -fi - -if [ ! -d $newDir ]; then - echo "Error: directory $newDir does not exist" - exit 1 -fi - -if [ -f $packFile ]; then - echo "Error: $packFile already exists" - exit 1 -fi - -# Clean up on termination and on Ctrl-C -trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT - -fileCount=0 -cat /dev/null > $tmpFile - -find -H $newDir \ - ! -type d -type f \ - ! -name "*~" \ - -a ! -name ".*~" \ - -a ! -name ".#*" \ - -a ! -name "*.orig" \ - -a ! -name "*.dep" \ - -a ! -name "*.o" \ - -a ! -name "*.so" \ - -a ! -name "*.a" \ - -a ! -name "*.tgz" \ - -a ! -name "core" \ - -a ! -name "core.[1-9]*" \ - -a ! -name "log[0-9]*" \ -| sed \ - -e "\@$newDir/.git/@d" \ - -e "\@$newDir/lib/@d" \ - -e '\@applications/bin/@d' \ - -e '\@/t/@d' \ - -e '\@Make[.A-Za-z]*/[^/]*/@d' \ - -e '\@[Dd]oxygen/html@d' \ - -e '\@[Dd]oxygen/latex@d' \ - -e '\@[Dd]oxygen/man@d' \ - -e "s@$newDir/*@@" \ - | \ - ( - while read file - do - (( fileCount=$fileCount + 1)) - - if [ -f "$oldDir/$file" ] - then - diff -uw $oldDir/$file $newDir/$file >/dev/null 2>&1 - if [ $? = 1 ] - then - echo "[DIFF]" $file - echo $newDir/$file >> $tmpFile - continue - fi - else - echo "[NEW]" $file - echo $newDir/$file >> $tmpFile - continue - fi - echo $fileCount $file - done - ) - -# file fileCount -fileCount=$(cat $tmpFile | wc -l) -echo "----------------------------------------------------------------------" -echo "pack $fileCount changed/new files" - -tar -czpf $packFile --files-from $tmpFile - -if [ $? = 0 ] -then - echo "Finished packing changed files from $newDir into $packFile" -else - echo "Error: failure packing changed files from $newDir into $packFile" - rm -f $packFile 2>/dev/null -fi -echo "----------------------------------------------------------------------" - -# ---------------------------------------------------------------------------- diff --git a/bin/foamEbrowse b/bin/foamEbrowse index 6cdebe3de..7e2aaa2f7 100755 --- a/bin/foamEbrowse +++ b/bin/foamEbrowse @@ -27,26 +27,27 @@ # foamEbrowse # # Description -# Build the Ebrowse dadbase for all the .C and .H files +# Build the Ebrowse database for all the .H and .C files # #------------------------------------------------------------------------------ -headersFile=${TMPDIR:-/tmp}/headersFile.$$ sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$ if [ $# -ne 0 ]; then echo "Usage : ${0##*/}" echo "" - echo "Build the Ebrowse dadbase for all the .C and .H files" + echo "Build the Ebrowse dadbase for all the .H and .C files" echo "" exit 1 fi -cd $WM_PROJECT_DIR -find -H . -name "*.H" | fgrep -v "lnInclude" > $headersFile -find -H . -name "*.C" | fgrep -v "lnInclude" > $sourcesFile -ebrowse --files=$headersFile --files=$sourcesFile --output-file=.ebrowse - # Clean up on termination and on Ctrl-C -trap 'rm -f $headersFile $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT +trap 'rm -f $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT + +cd $WM_PROJECT_DIR +mkdir .tags 2>/dev/null +cd .tags + +find -H .. \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) -print > $sourcesFile +ebrowse --files=$sourcesFile --output-file=ebrowse #------------------------------------------------------------------------------ diff --git a/bin/foamExec b/bin/foamExec index 767ebb417..9fed6e2ff 100755 --- a/bin/foamExec +++ b/bin/foamExec @@ -40,10 +40,10 @@ Script=${0##*/} usage() { - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat< ... +usage: ${0##*/} [OPTION] ... options: -v ver specify OpenFOAM version @@ -52,16 +52,17 @@ options: * run a particular OpenFOAM version of USAGE - exit 1 + exit 1 } + # This script should exist in /OpenFOAM-/bin/ # extract the and elements # using a function preserves the command args getDefaults() { - set -- $(echo $0 | sed -e 's@/OpenFOAM-\([^/]*\)/bin/[^/]*$@ \1@') - foamInstall=$1 - version=$2 + set -- $(echo $0 | sed -e 's@/OpenFOAM-\([^/]*\)/bin/[^/]*$@ \1@') + foamInstall=$1 + version=$2 } getDefaults @@ -69,72 +70,60 @@ getDefaults # parse options while [ "$#" -gt 0 ] do - case "$1" in - -h | -help) - usage - ;; - -v) - shift - version=$1 - shift - ;; - --) - shift - break - ;; - -*) - usage "invalid option '$1'" - ;; - *) - break - ;; - esac + case "$1" in + -h | -help) + usage + ;; + -v) + shift + version=$1 + shift + ;; + --) + shift + break + ;; + -*) + usage "invalid option '$1'" + ;; + *) + break + ;; + esac done -if [ "$#" -lt 1 ]; then - usage "no application specified" +if [ "$#" -lt 1 ] +then + usage "no application specified" fi unset foamDotFile # Check user-specific OpenFOAM bashrc file -for subDir in \ - $HOME/.OpenFOAM-$version \ - $HOME/.OpenFOAM/$version \ -; -do - foamDotFile="$subDir/bashrc" - if [ -f $foamDotFile ]; then - . $foamDotFile - foamDotFile=okay - break - fi -done - -# Use the FOAM_INST_DIR variable for locating the installed version -if [ "$foamDotFile" != okay ] +foamDotFile="$HOME/.OpenFOAM/$version/bashrc" +if [ -f $foamDotFile ] then - for FOAM_INST_DIR in $foamInstall $WM_PROJECT_INST_DIR - do - for subDir in \ - OpenFOAM-$version/etc \ - OpenFOAM-$version/.OpenFOAM-$version \ - ; - do - foamDotFile="$FOAM_INST_DIR/$subDir/bashrc" - if [ -f $foamDotFile ]; then - . $foamDotFile - foamDotFile=okay - break 2 + . $foamDotFile + foamDotFile=okay +else + # Use the FOAM_INST_DIR variable for locating the installed version + for FOAM_INST_DIR in $foamInstall $WM_PROJECT_INST_DIR + do + foamDotFile="$FOAM_INST_DIR/OpenFOAM-$version/etc/bashrc" + if [ -f $foamDotFile ] + then + . $foamDotFile + foamDotFile=okay + break fi - done - done + done fi -if [ "$foamDotFile" != okay ]; + +if [ "$foamDotFile" != okay ] then - echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2 - exit 1 + echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2 + exit 1 fi # Pass on the rest of the arguments diff --git a/bin/foamInstallationTest b/bin/foamInstallationTest index ad1560cc3..c67961e88 100755 --- a/bin/foamInstallationTest +++ b/bin/foamInstallationTest @@ -33,9 +33,9 @@ #------------------------------------------------------------------------------ # Base settings -FOAM_VERSION=1.5-dev -SUPPLIED_VERSION_GCC=4.3.1 -MIN_VERSION_GCC=4.2.0 +FOAM_VERSION=1.6-ext +SUPPLIED_VERSION_GCC=4.3.3 +MIN_VERSION_GCC=4.3.1 # General WIDTH=20 @@ -46,10 +46,8 @@ CRITICALERROR=0 SSHRSHOK=0 # System variables -USER_SHELL=`basename $SHELL` HOST_NAME=`uname -n` OS=`uname -s` -OS_VERSION=`uname -r` USER_NAME=$LOGNAME if [ ! -n $USER_NAME ]; then USER_NAME=$USER @@ -92,7 +90,7 @@ length () { stringLength () { -echo $1 | wc -m | tr -d " " + echo $1 | wc -m | tr -d " " } @@ -125,7 +123,7 @@ reportEnv () { SunOS) if /usr/bin/test -e $EXP_ENV ; then EXISTS=" yes " - if [ "$2" != "noPath" ]; then + if [ "$2" != noPath ]; then ON_PATH=" no " OLD_IFS=$IFS IFS=':' @@ -152,7 +150,7 @@ reportEnv () { *) if [ -e "$EXP_ENV" ] ; then EXISTS=" yes " - if [ "$2" != "noPath" ]; then + if [ "$2" != noPath ]; then ON_PATH=" no " OLD_IFS=$IFS IFS=':' @@ -182,10 +180,10 @@ reportEnv () { fi ERROR="false" - if [ "$EXISTS" = "no" ] || [ "$ON_PATH" = "no" ]; then + if [ "$EXISTS" = no ] || [ "$ON_PATH" = no ]; then ERROR="true" fi - if [ "$3" = "yes" ] && [ "$ERROR" = "true" ]; then + if [ "$3" = yes ] && [ "$ERROR" = true ]; then CRITICALERROR=`expr $CRITICALERROR + 1` echo "WARNING: CRITICAL ERROR" echo @@ -254,7 +252,7 @@ reportExecutable () { ;; gcc) VERSION=`$1 -v 2>&1 \ - | grep 'version' \ + | grep 'gcc version' \ | cut -d" " -f3` if [ ! "$VERSION" = "$SUPPLIED_VERSION_GCC" ]; then echo "WARNING: gcc version does not match gcc supplied" \ @@ -312,9 +310,9 @@ pingTest () { case $OS in SunOS) PINGTEST=`/usr/sbin/ping $1 2>&1` - if [ "`echo $PINGTEST | grep "alive"`" != "" ] ; then + if [ "`echo $PINGTEST | grep alive`" != "" ] ; then RESULT="Successful" - elif [ "`echo $PINGTEST | grep "unknown host"`" != "" ] ; then + elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then RESULT="No_entry_for_\"$1\"_in_/etc/hosts" else RESULT="Networking_cannot_reach_$1" @@ -322,9 +320,9 @@ pingTest () { ;; *) PINGTEST=`/bin/ping -w 3 -c 1 $1 2>&1` - if [ "`echo $PINGTEST | grep "1 received"`" != "" ] ; then + if [ "`echo $PINGTEST | grep '1 received'`" != "" ] ; then RESULT="Successful" - elif [ "`echo $PINGTEST | grep "unknown host"`" != "" ] ; then + elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then RESULT="No_entry_for_\"$1\"_in_/etc/hosts" else RESULT="Networking_cannot_reach_$1" @@ -334,7 +332,7 @@ pingTest () { echo "`fixlen "Pinging_$1" 25` `fixlen "$RESULT" 45` `fixlen "$2" 5`" - if [ "$2" = "yes" ] && [ "$RESULT" != "Successful" ]; then + if [ "$2" = yes ] && [ "$RESULT" != Successful ]; then CRITICALERROR=`expr $CRITICALERROR + 1` echo "WARNING: CRITICAL ERROR" echo @@ -351,7 +349,7 @@ EOF checkTelnetPort () { - if [ -x "/usr/bin/telnet" ] || [ -x "/bin/telnet" ] ; then + if [ -x "/usr/bin/telnet" ] || [ -x "/bin/telnet" ] ; then RESULT=`telnetPortTest $1 $2 2>&1 | egrep "onnect.* [t|r]"` if [ "`echo $RESULT | grep 'Connected to'`" ] ; then RESULT='Successful' @@ -361,7 +359,7 @@ checkTelnetPort () { RESULT="Not_active*" fi else - RESULT='No_telnet_running:_cannot_check*' + RESULT='No_telnet_installed:_cannot_check*' fi } @@ -369,7 +367,7 @@ checkTelnetPort () { checkRsh () { checkTelnetPort $HOST_NAME 222 echo "`fixlen "Test_rsh:" 25` `fixlen "$RESULT" 45` "yes"" - if [ "$RESULT" != 'Successful' ]; then + if [ "$RESULT" != Successful ]; then SSHRSHOK=`expr $SSHRSHOK + 1` fi } @@ -378,14 +376,14 @@ checkRsh () { checkSsh () { checkTelnetPort $HOST_NAME 22 echo "`fixlen "Test_ssh:" 25` `fixlen "$RESULT" 45` "yes"" - if [ "$RESULT" != 'Successful' ]; then + if [ "$RESULT" != Successful ]; then SSHRSHOK=`expr $SSHRSHOK + 1` fi } checkOpenFOAMEnvironment() { - if [ ! -d "$WM_PROJECT_INST_DIR" -o ! -d "$WM_THIRD_PARTY_DIR" ]; then + [ -d "$WM_PROJECT_INST_DIR" ] && [ -d "$WM_THIRD_PARTY_DIR" ] || { echo "" echo "FATAL ERROR: OpenFOAM environment not configured." echo "" @@ -394,22 +392,23 @@ checkOpenFOAMEnvironment() { echo " to source the OpenFOAM environment." echo "" exit 1 - fi + } } checkUserShell() { - case $USER_SHELL in - csh | tcsh) - USER_CONFIG_TYPE="cshrc" - echo "`fixlen "Shell:" $WIDTH` ${USER_SHELL}" + case $SHELL in + */csh | */tcsh) + # USER_CONFIG_TYPE="cshrc" + echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" ;; - bash | ksh) - USER_CONFIG_TYPE="bashrc" - echo "`fixlen "Shell:" $WIDTH` ${USER_SHELL}" + */bash | */ksh) + # USER_CONFIG_TYPE="bashrc" + echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" ;; - *) USER_CONFIG_TYPE="" - echo "`fixlen "Shell:" $WIDTH` ${USER_SHELL}" + *) + # USER_CONFIG_TYPE="" + echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}" echo "FATAL ERROR: Cannot identify the shell you are running." echo " OpenFOAM ${FOAM_VERSION} is compatible with " echo " csh, tcsh, ksh and bash." @@ -435,15 +434,18 @@ checkHostName() { checkOS () { - if [ "$OS" = "Linux" ] || [ "$OS" = "LinuxAMD64" ] || [ "$OS" = "SunOS" ]; then - echo "`fixlen "OS:" $WIDTH` ${OS} version ${OS_VERSION}" - else + case "$OS" in + Linux | LinuxAMD64 | SunOS ) + echo "`fixlen "OS:" $WIDTH` ${OS} version $(uname -r)" + ;; + *) echo "FATAL ERROR: Incompatible operating system \"$OS\"." echo " OpenFOAM ${FOAM_VERSION} is currently " echo " available for Linux and SunOS only." echo FATALERROR=`expr $FATALERROR + 1` - fi + ;; + esac } @@ -485,6 +487,7 @@ hline reportEnv '$WM_PROJECT_DIR' '$PATH' "yes" echo "" reportEnv '$FOAM_APPBIN' '$PATH' "yes" +reportEnv '$FOAM_SITE_APPBIN' '$PATH' "no" reportEnv '$FOAM_USER_APPBIN' '$PATH' "no" reportEnv '$WM_DIR' '$PATH' "yes" hline @@ -495,6 +498,7 @@ hline echo "$COL1 $COL2 $COL3 $COL4 $COL5" hline reportEnv '$FOAM_LIBBIN' '$LD_LIBRARY_PATH' "yes" +reportEnv '$FOAM_SITE_LIBBIN' '$LD_LIBRARY_PATH' "no" reportEnv '$FOAM_USER_LIBBIN' '$LD_LIBRARY_PATH' "no" reportEnv '$MPI_ARCH_PATH' '$LD_LIBRARY_PATH' "yes" hline @@ -509,7 +513,7 @@ echo "$COL1 $COL2 $COL3" hline reportExecutable gcc "${WM_COMPILER_DIR}/bin/gcc" reportExecutable gzip -if [ "$OS" = "Linux" ] ; then +if [ "$OS" = Linux ] ; then reportExecutable tar else reportExecutable gtar @@ -519,32 +523,9 @@ reportExecutable icoFoam "${FOAM_APPBIN}/icoFoam" hline #------------------------------------------------------------------------------ -heading "Checking networking..." -COL1=`fixlen "Action" 25` -COL2=`fixlen "Result" 45` -COL3=`fixlen "Crit" 5` - -hline -echo "$COL1 $COL2 $COL3" +heading "Summary" hline -pingTest "$HOST_NAME" "yes" -pingTest "localHost" "yes" -checkRsh -checkSsh - -if [ $SSHRSHOK -eq 1 ]; then - echo "(*) Only one of rsh or ssh is required by the OpenFOAM enviroment." -elif [ $SSHRSHOK -gt 1 ]; then - echo "FATAL ERROR: No remote shell available." - echo " OpenFOAM ${FOAM_VERSION} enviroment requires either ssh and/or rsh." - echo " Contact your system administrator." - echo "" - FATALERROR=`expr $FATALERROR + 1` -fi -echo "" -hline -echo "" if [ $FATALERROR -gt 0 ] ; then echo "The system test has evoked $FATALERROR fatal error(s)." else diff --git a/bin/foamJob b/bin/foamJob index 0d801fa01..5e6f454e4 100755 --- a/bin/foamJob +++ b/bin/foamJob @@ -29,13 +29,11 @@ # Description # #------------------------------------------------------------------------------ -Script=${0##*/} - usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< ... +usage: ${0##*/} [OPTION] ... options: -case dir specify case directory @@ -108,9 +106,9 @@ do usage ;; -case) - shift - caseDir=$1 - [ "$#" -ge 1 ] || usage "'-case' option requires an argument" + [ "$#" -ge 2 ] || usage "'-case' option requires an argument" + caseDir=$2 + shift 2 cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" ;; -s) @@ -206,24 +204,6 @@ else # echo "Parallel processing using $WM_MPLIB with $NPROCS processors" case "$WM_MPLIB" in - LAM) - lamPid=`getPID lamd` - if [ ! "$lamPid" ] ; then - echo "No LAM daemon running." - if [ -r system/machines ] ; then - echo "system/machines file exists" - echo "Try starting the LAM multicomputer with \"lamboot -v system/machines\"" - exit 1 - else - echo "Cannot find a 'machines' file for LAM in system/" - echo "required to start a LAM multicomputer" - consultGuide - exit 1 - fi - else - echo "LAM daemon running (PID $lamPid). Proceeding with MPI run." - fi - ;; OPENMPI) # add hostfile info for hostfile in \ diff --git a/bin/foamNew b/bin/foamNew index 29751f63c..87ad6508d 100755 --- a/bin/foamNew +++ b/bin/foamNew @@ -30,15 +30,13 @@ # Create a new standard OpenFOAM source file # #------------------------------------------------------------------------------ -Script=${0##*/} - usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat< {args} +usage: ${0##*/} {args} -* create a new standard OpenFOAM source file +* create a new standard OpenFOAM source or template file type: (source|template) @@ -46,23 +44,26 @@ USAGE exit 1 } -if [ "$#" -lt 1 ]; then - usage "wrong number of arguments, expected 2 (or more)" +if [ "$#" -lt 2 ] +then + usage "wrong number of arguments, expected 2 (or more)" fi case "$1" in - source) - shift - $WM_PROJECT_DIR/bin/foamTemplates/source/newSource $* - ;; - template) - shift - $WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $* - ;; +-h | -help) + usage + ;; +source) + shift + $WM_PROJECT_DIR/bin/foamTemplates/source/newSource $* + ;; +template) + shift + $WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $* + ;; *) - usage "unknown type" - ;; + usage "unknown type" + ;; esac - #------------------------------------------------------------------------------ diff --git a/bin/foamPack b/bin/foamPack index 7a68d3141..a4f6e66f7 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -38,19 +38,20 @@ packFile=${packDir}_${timeStamp}.tgz if [ ! -d $packDir ] then - echo "Error: directory $packDir does not exist" - exit 1 + echo "Error: directory $packDir does not exist" 1>&2 + exit 1 fi # add optional output directory -if [ -d "$1" ]; then - packFile="$1/$packFile" +if [ -d "$1" ] +then + packFile="$1/$packFile" fi if [ -f $packFile ] then - echo "Error: $packFile already exists" - exit 1 + echo "Error: $packFile already exists" 1>&2 + exit 1 fi # Create time stamp file @@ -88,8 +89,10 @@ find -H $packDir \ -e "\@$packDir/.git/@d" \ -e "\@.svn/@d" \ -e "\@$packDir/lib/@d" \ - -e '\@applications/bin/@d' \ - -e '\@/t/@d' \ + -e '\@/\.git/@d' \ + -e '\@applications/bin/@d' \ + -e '\@wmake/bin/@d' \ + -e '\@/t/@d' \ -e '\@Make[.A-Za-z]*/[^/]*/@d' \ -e '\@doc/[Dd]oxygen/html@d' \ -e '\@doc/[Dd]oxygen/latex@d' \ @@ -100,12 +103,12 @@ find -H $packDir \ tar czpf $packFile --files-from $tmpFile -if [ $? = 0 ] +if [ $? -eq 0 ] then - echo "Finished packing and compressing $packDir into file $packFile" + echo "Finished packing and compressing $packDir into file $packFile" else - echo "Error: failure packing $packDir into file $packFile" - rm -f $packFile 2>/dev/null + echo "Error: failure packing $packDir into file $packFile" 1>&2 + rm -f $packFile 2>/dev/null fi #------------------------------------------------------------------------------ diff --git a/bin/foamPackBin b/bin/foamPackBin index a2c861854..71e9e002b 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -30,113 +30,71 @@ # Packs and compresses binary version of OpenFOAM for release # #------------------------------------------------------------------------------ -tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$ -# -# FUNCTIONS -# -printUsage () { -cat < [outputDir]" -EOF -} - -timeStamp=$(date +%Y-%m-%d) -packDir=$WM_PROJECT-$WM_PROJECT_VERSION -packFile=${packDir}.${arch}_${timeStamp}.tgz - -# -# OPTIONS -# -OPTS=`getopt hl $*` -if [ $? -ne 0 ] ; then - echo "Aborting due to invalid option" - printUsage +if [ $# -eq 0 ] +then + echo "Error: architecture type expected, exiting" + echo + echo "Usage : ${0##*/} [outputDir]" + echo exit 1 fi - -eval set -- '$OPTS' -while [ "$1" != "--" ]; do - case $1 in - -l) LZM=1;; - -h) printUsage; exit 1;; - esac - shift -done -shift - -if [ $# = 0 ]; then - printUsage; - exit 1 -fi arch=$1 -if [ $LZM ]; then - packFile=${packDir}.${arch}_${timeStamp}.lzm -else - packFile=${packDir}.${arch}_${timeStamp}.tgz -fi +# base arch (w/o precision, optimization, etc) +baseArch=$(echo "$arch" | sed -e 's@[DS]P.*$@@') + +timeStamp=$(date +%Y-%m-%d) +packDir=$WM_PROJECT-$WM_PROJECT_VERSION +packFile=${packDir}.${arch}_${timeStamp}.gtgz # add optional output directory -if [ -d "$2" ]; then - packFile="$2/$packFile" +if [ -d "$2" ] +then + packFile="$2/$packFile" fi -if [ -f $packFile ]; then - echo "Error: $packFile already exists" - exit 1 +if [ -f $packFile ] +then + echo "Error: $packFile already exists" + exit 1 fi # check for essential directories for dir in $packDir $packDir/lib/$arch $packDir/applications/bin/$arch do - if [ ! -d $dir ]; then - echo "Error: directory $dir does not exist" - exit 1 - fi + if [ ! -d $dir ] + then + echo "Error: directory $dir does not exist" + exit 1 + fi done # get list of directories dirList=$( - for dir in \ - $packDir/lib/$arch \ - $packDir/applications/bin/$arch \ - $packDir/wmake/rules \ - ; - do - [ -d $dir ] && echo $dir - done + for dir in \ + $packDir/lib/$arch \ + $packDir/applications/bin/$arch \ + $packDir/wmake/rules \ + $packDir/wmake/bin/$baseArch \ + ; + do + [ -d $dir ] && echo $dir + done ) echo -echo "Packing $arch port of $packDir into $packFile" +echo "Packing $arch ($baseArch) port of $packDir into $packFile" echo -if [ $LZM ]; then +tar czpf $packFile $dirList - # Clean up on termination and on Ctrl-C - trap 'rm -rf $tmpDir 2>/dev/null; exit 0' EXIT TERM INT - - mkdir $tmpDir $tmpDir/OpenFOAM - cp -arl --parents $dirList $tmpDir/OpenFOAM - find $tmpDir -name .svn | xargs rm -rf - - chmod -R a+rX $tmpDir/OpenFOAM - foamDir2lzm $tmpDir $packFile - echo; echo - -else - - tar --exclude-vcs czpf $packFile $dirList - -fi - -if [ $? = 0 ] +if [ $? -eq 0 ] then - echo "Finished packing and compressing file $packFile" + echo "Finished packing and compressing file $packFile" else - echo "Error: failure packing $packFile" - rm -f $packFile 2>/dev/null + echo "Error: failure packing $packFile" + rm -f $packFile 2>/dev/null fi #------------------------------------------------------------------------------ diff --git a/bin/foamPackBinAll b/bin/foamPackBinAll index 931462a15..bc5658009 100755 --- a/bin/foamPackBinAll +++ b/bin/foamPackBinAll @@ -27,20 +27,21 @@ # foamPackBinAll [outputDir] # # Description -# Packs and compresses all binary version of foam for release +# Packs and compresses all binary versions of foam for release # #------------------------------------------------------------------------------ packDir=$WM_PROJECT-$WM_PROJECT_VERSION if [ ! -d $packDir ] then - echo "Error: directory $packDir does not exist" - exit 1 + echo "Error: directory $packDir does not exist" + exit 1 fi +# obtain arch types from lib/ for bin in $packDir/lib/* do - foamPackBin ${bin##*/} $@ + foamPackBin ${bin##*/} $@ done #------------------------------------------------------------------------------ diff --git a/bin/foamPackChanged b/bin/foamPackChanged deleted file mode 100755 index 8e215e9da..000000000 --- a/bin/foamPackChanged +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | -# \\ / A nd | Copyright held by original author -# \\/ 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 -# foamPackChanged -# -# Description -# Packs and compresses files that have a corresponding .orig file -# -#------------------------------------------------------------------------------ -tmpFile=${TMPDIR:-/tmp}/foamPackChanged.$$ - -if [ $# -ne 2 ]; then - echo "Usage : ${0##*/} directory tarFile" - echo "" - echo "Packs and compresses files that have a corresponding .orig file" - echo "" - exit 1 -fi - -# canonical form (no double and no trailing dashes) -packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@') -packFile=$2 - -if [ ! -d $packDir ]; then - echo "Error: directory $packDir does not exist" - exit 1 -fi - -# Clean up on termination and on Ctrl-C -trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT - -fileCount=0 -cat /dev/null > $tmpFile - -find -H $packDir \ - ! -type d \ - -type f \ - -name "*.orig" \ -| sed \ - -e "\@$packDir/lib/@d" \ - -e '\@applications/bin/@d' \ - -e '\@/t/@d' \ - -e '\@Make[.A-Za-z]*/[^/]*/@d' \ - -e '\@[Dd]oxygen/html@d' \ - -e '\@[Dd]oxygen/latex@d' \ - -e '\@[Dd]oxygen/man@d' \ - -e "s@$packDir/*@@" \ - | \ - ( - while read file - do - (( fileCount=$fileCount + 1 )) - - file=${file%%.orig} - - if [ -f "$packDir/$file" ] - then - echo $fileCount $file - echo $packDir/$file >> $tmpFile - else - echo "[MISSING]" $file - fi - done - ) - -# file fileCount -fileCount=$(cat $tmpFile | wc -l) -echo "----------------------------------------------------------------------" -echo "pack $fileCount updated (non-.orig) files" - -tar -czpf $packFile --files-from $tmpFile - -if [ $? = 0 ] -then - echo "Finished packing changed files from $packDir into $packFile" -else - echo "Error: failure packing changed files from $packDir into $packFile" - rm -f $packFile 2>/dev/null -fi -echo "----------------------------------------------------------------------" - -# ---------------------------------------------------------------------------- diff --git a/bin/foamPackGeneral b/bin/foamPackGeneral index e98f670b8..fa90a764b 100755 --- a/bin/foamPackGeneral +++ b/bin/foamPackGeneral @@ -31,50 +31,26 @@ # #------------------------------------------------------------------------------ -# -# FUNCTIONS -# -printUsage () { -cat </dev/null > $packDir/.timeStamp # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo -echo "Packing $packDir into $packFile" +echo "Packing $packDir source files into $packFile" echo -foamPackSource $LZMOPT $packDir $packFile +foamPackSource $packDir $packFile #------------------------------------------------------------------------------ diff --git a/bin/foamPackSource b/bin/foamPackSource index d1affb63e..7efadaca4 100755 --- a/bin/foamPackSource +++ b/bin/foamPackSource @@ -32,56 +32,31 @@ # #------------------------------------------------------------------------------ tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$ -tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$ -# -# FUNCTIONS -# -printUsage () { -cat < -EOF -} - -# -# OPTIONS -# -OPTS=`getopt hl $*` -if [ $? -ne 0 ] ; then - echo "Error: Aborting due to invalid option" - printUsage; +if [ $# -ne 2 ] +then + echo "Usage : ${0##*/} directory tarFile" + echo "" + echo "Packs all .C and .H files and Make/options and Make/files into" + echo "" + echo "" exit 1 fi -eval set -- '$OPTS' -while [ "$1" != "--" ]; do - case $1 in - -l) LZM=1;; - -h) printUsage; exit 1;; - esac - shift -done -shift - -if [ $# -ne 2 ]; then - printUsage; - exit 1 -fi - # canonical form (no double and no trailing dashes) packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@') packFile=$2 -if [ ! -d $packDir ]; then - echo "Error: directory $packDir does not exist" - exit 1 +if [ ! -d $packDir ] +then + echo "Error: directory $packDir does not exist" + exit 1 fi -if [ -f $packFile ]; then - echo "Error: $packFile already exists" - exit 1 +if [ -f $packFile ] +then + echo "Error: $packFile already exists" + exit 1 fi # Clean up on termination and on Ctrl-C @@ -107,36 +82,29 @@ find -H $packDir \ -e "\@$packDir/.git/@d" \ -e "\@.svn/@d" \ -e "\@$packDir/lib/@d" \ + -e '\@/\.git/@d' \ + -e '\@/\.tags/@d' \ -e '\@applications/bin/@d' \ + -e '\@wmake/bin/@d' \ -e '\@/t/@d' \ -e '\@/Make[.A-Za-z]*/[^/]*/@d'\ -e '\@/platforms/@d' \ + -e '\@libccmio.*/@d' \ -e '\@/.svn/@d' \ > $tmpFile -if [ $LZM ]; then - # Clean up on termination and on Ctrl-C - trap 'rm -f $tmpFile 2>/dev/null; rm -rf $tmpDir 2>/dev/null; exit 0' EXIT TERM INT +# provide some feedback +wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}' - mkdir $tmpDir $tmpDir/OpenFOAM - xargs -i -a $tmpFile cp -al --parents {} $tmpDir/OpenFOAM +tar czpf $packFile --files-from $tmpFile - chmod -R a+rX $tmpDir/OpenFOAM - foamDir2lzm $tmpDir $packFile - echo; echo - -else - - tar czpf $packFile --files-from $tmpFile - -fi - -if [ $? = 0 ]; then +if [ $? -eq 0 ] +then echo "Finished packing and compressing $packDir into file $packFile" else - echo "Error: failure packing $packDir into file $packFile" - rm -f $packFile 2>/dev/null + echo "Error: failure packing $packDir into file $packFile" + rm -f $packFile 2>/dev/null fi #------------------------------------------------------------------------------ diff --git a/bin/foamPackThirdPartyBin b/bin/foamPackThirdPartyBin index d76625a34..00f8b93f6 100755 --- a/bin/foamPackThirdPartyBin +++ b/bin/foamPackThirdPartyBin @@ -30,72 +30,44 @@ # Packs and compresses binary version of OpenFOAM ThirdParty for release # #------------------------------------------------------------------------------ -tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$ -# -# FUNCTIONS -# -printUsage () { -cat < [outputDir]" -EOF -} - -timeStamp=$(date +%Y-%m-%d) -packDir=$WM_PROJECT-$WM_PROJECT_VERSION -packFile=${packDir}.${arch}_${timeStamp}.tgz - -# -# OPTIONS -# -OPTS=`getopt hl $*` -if [ $? -ne 0 ] ; then - echo "Aborting due to invalid option" - printUsage +if [ $# -eq 0 ] +then + echo "Error: archOptions type expected, exiting" + echo + echo "Usage : ${0##*/} [outputDir]" + echo exit 1 fi - -eval set -- '$OPTS' -while [ "$1" != "--" ]; do - case $1 in - -l) LZM=1;; - -h) printUsage; exit 1;; - esac - shift -done -shift - -if [ $# = 0 ]; then - printUsage; - exit 1 -fi archOptions=$1 -arch=${archOptions%%G*} -arch3264=$(echo "$arch" | sed 's@64@-64@') +arch=${archOptions%%G*} # TODO: works for Gcc only +arch3264=$(echo "$arch" | sed -e 's@64@-64@') echo "archOptions=$archOptions" echo "arch=$arch" echo "arch3264=$arch3264" timeStamp=$(date +%Y-%m-%d) -packDir=ThirdParty +packDir=${WM_THIRD_PARTY_DIR:-ThirdParty} +packDir=${packDir##*/} +packFile=${packDir}.${archOptions}_${timeStamp}.tgz -if [ $LZM ]; then - packFile=${packDir}.${arch}_${timeStamp}.lzm -else - packFile=${packDir}.${arch}_${timeStamp}.tgz +if [ ! -d $packDir ] +then + echo "Error: directory $packDir does not exist" + exit 1 fi # add optional output directory if [ -d "$2" ] then - packFile="$2/$packFile" + packFile="$2/$packFile" fi if [ -f $packFile ] then - echo "Error: $packFile already exists" - exit 1 + echo "Error: $packFile already exists" + exit 1 fi # get list of directories @@ -104,28 +76,14 @@ echo echo "Packing $archOptions port of $packDir into $packFile" echo -if [ $LZM ]; then +tar czpf $packFile $dirList - # Clean up on termination and on Ctrl-C - trap 'rm -rf $tmpDir 2>/dev/null; exit 0' EXIT TERM INT - - mkdir $tmpDir $tmpDir/OpenFOAM - cp -arl --parents $dirList $tmpDir/OpenFOAM - foamDir2lzm $tmpDir $packFile - echo; echo - -else - - tar czpf $packFile $dirList - -fi - -if [ $? = 0 ] +if [ $? -eq 0 ] then - echo "Finished packing and compressing file $packFile" + echo "Finished packing and compressing file $packFile" else - echo "Error: failure packing $packFile" - rm -f $packFile 2>/dev/null + echo "Error: failure packing $packFile" + rm -f $packFile 2>/dev/null fi #------------------------------------------------------------------------------ diff --git a/bin/foamPackThirdPartyGeneral b/bin/foamPackThirdPartyGeneral index 4c287e3cc..87493b240 100755 --- a/bin/foamPackThirdPartyGeneral +++ b/bin/foamPackThirdPartyGeneral @@ -31,50 +31,27 @@ # #------------------------------------------------------------------------------ -# -# FUNCTIONS -# -printUsage () { -cat </dev/null > $packDir/.timeStamp # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo -echo "Packing $packDir into $packFile" +echo "Packing $packDir source files into $packFile" echo -foamPackSource $LZMOPT $packDir $packFile +foamPackSource $packDir $packFile #------------------------------------------------------------------------------ diff --git a/bin/foamProcessInfo b/bin/foamProcessInfo index 63f7e1788..1bc3a7a2f 100755 --- a/bin/foamProcessInfo +++ b/bin/foamProcessInfo @@ -43,14 +43,16 @@ PROGNAME=`basename $0` TMPFILE=/tmp/${PROGNAME}$$.tmp AWKFILE=/tmp/${PROGNAME}$$.awk -if [ `uname -s` = 'Linux' ]; then - ECHO='echo -e' +if [ `uname -s` = Linux ] +then + ECHO='echo -e' else - ECHO='echo' + ECHO='echo' fi -if [ $# -ne 1 ]; then +if [ $# -ne 1 ] +then echo "Error : $PROGNAME : insufficient arguments" 1>&2 exit 1 fi diff --git a/bin/foamRunTutorials b/bin/foamRunTutorials index 1787dff99..b0cf363ef 100755 --- a/bin/foamRunTutorials +++ b/bin/foamRunTutorials @@ -50,7 +50,7 @@ elif [ -d "./system" ] then # Normal case. parentDir=`dirname $PWD` - application=`basename $parentDir` + application=`getApplication` runApplication blockMesh runApplication $application else diff --git a/bin/foamSolverSweeps b/bin/foamSolverSweeps index e86f19526..e8c25788a 100755 --- a/bin/foamSolverSweeps +++ b/bin/foamSolverSweeps @@ -27,7 +27,7 @@ # foamSolverSweeps # # Description -# +# #------------------------------------------------------------------------------ #-- settings diff --git a/bin/foamSystemCheck b/bin/foamSystemCheck index 0b9d0e258..5a4d892b9 100755 --- a/bin/foamSystemCheck +++ b/bin/foamSystemCheck @@ -34,7 +34,7 @@ # STATIC VARIABLES # ~~~~~~~~~~~~~~~~ -FOAM_VERSION=1.5 +FOAM_VERSION=1.6-ext HLINE="-----------------------------------------------------------------------" WIDTH=16 diff --git a/bin/buildParaView2.4.4 b/bin/foamTags similarity index 51% rename from bin/buildParaView2.4.4 rename to bin/foamTags index 9c36f9ab6..ffe8fd178 100755 --- a/bin/buildParaView2.4.4 +++ b/bin/foamTags @@ -24,48 +24,42 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# buildParaView +# foamTags # # Description -# Build and install ParaView -# - run from folder above ParaView source folder or place the -# ParaView source under $WM_PROJECT_INST_DIR +# Build the tags files for all the .C and .H files # #------------------------------------------------------------------------------ -. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions -# set -x - -PARAVIEW_SRC="paraview-2.4.4" -PARAVIEW_MAJOR_VERSION="2.4" - -VERBOSE=OFF -INCLUDE_MPI=OFF -MPI_MAX_PROCS=32 -INCLUDE_PYTHON=OFF -PYTHON_LIBRARY="" -INCLUDE_MESA=OFF - -set +x - -# provide a shortcut for repeated builds - use with caution -if [ "$#" -gt 0 ] -then - CMAKE_SKIP=YES +if [ $# -ne 0 ]; then + echo "Usage : ${0##*/}" + echo "" + echo "Build the tags files for all the .C and .H files" + echo "" + exit 1 fi -# set paraview environment -PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC -#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD -PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_ARCH$WM_COMPILER +cd $WM_PROJECT_DIR +mkdir .tags 2>/dev/null -addMpiSupport # set MPI specific options -addPythonSupport # set python specific options -addMesaSupport # set MESA specific options +etagsCmd="etags --declarations -l c++ -o .tags/etags -" +#etagsDefCmd="etags -l c++ -o .tags/etagsDef -" +#etagsDecCmd="etags --declarations -l c++ -o .tags/etagsDec -" -buildParaView -installParaView +etagsCmd="ectags -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -" +etagsDefCmd="ectags -e --extra=+fq --file-scope=no -o .tags/etagsDef -L -" +etagsDecCmd="ectags -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etagsDec -L -" + +ectagsDecCmd="ectags -o .tags/ectagsDec --file-scope=no --c-kinds=+p --excmd=n --extra=+fq --fields=+afiKmnsSzt -L -" + +find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsCmd +find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsDefCmd +find -H $WM_PROJECT_DIR \( -name "*.H" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsDecCmd +find -H $WM_PROJECT_DIR \( -name "*.H" -o -name lnInclude -prune -o -name Doxygen -prune \) | $ectagsDecCmd + +gtags -i --gtagsconf bin/tools/gtagsrc .tags + +foamEbrowse -echo "done" #------------------------------------------------------------------------------ diff --git a/bin/foamTemplates/source/foamAppTemplate.C b/bin/foamTemplates/source/foamAppTemplate.C index 8fed188f2..29de07b09 100644 --- a/bin/foamTemplates/source/foamAppTemplate.C +++ b/bin/foamTemplates/source/foamAppTemplate.C @@ -36,10 +36,10 @@ Description int main(int argc, char *argv[]) { + #include "setRootCase.H" + #include "createTime.H" -# include "setRootCase.H" -# include "createTime.H" - + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Info << "End\n" << endl; diff --git a/bin/foamTemplates/source/foamTemplate.C b/bin/foamTemplates/source/foamTemplate.C index bd9792b20..acd99cb3f 100644 --- a/bin/foamTemplates/source/foamTemplate.C +++ b/bin/foamTemplates/source/foamTemplate.C @@ -31,9 +31,15 @@ License const dataType Foam::className::staticData(); +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::className::className() @@ -71,10 +77,10 @@ Foam::className::~className() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // void Foam::className::operator=(const className& rhs) { @@ -87,11 +93,10 @@ void Foam::className::operator=(const className& rhs) } } - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/bin/foamTemplates/source/foamTemplate.H b/bin/foamTemplates/source/foamTemplate.H index e9f229180..a668af847 100644 --- a/bin/foamTemplates/source/foamTemplate.H +++ b/bin/foamTemplates/source/foamTemplate.H @@ -23,12 +23,10 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - className + Foam::className Description -Author - SourceFiles classNameI.H className.C @@ -57,7 +55,7 @@ Ostream& operator<<(Ostream&, const className&); /*---------------------------------------------------------------------------*\ - Class className Declaration + Class className Declaration \*---------------------------------------------------------------------------*/ class className @@ -66,6 +64,7 @@ class className { // Private data + //- Description of data_ dataType data_; @@ -82,7 +81,7 @@ public: // Static data members - //- Static data someStaticData + //- Static data staticData static const dataType staticData; @@ -107,9 +106,8 @@ public: static autoPtr New(); - // Destructor - - ~className(); + //- Destructor + ~className(); // Member Functions diff --git a/bin/foamTemplates/source/foamUtilTemplate.cfg b/bin/foamTemplates/source/foamUtilTemplate.cfg deleted file mode 100644 index 159b04a92..000000000 --- a/bin/foamTemplates/source/foamUtilTemplate.cfg +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | -| \\ / A nd | Web: http://www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -// className tool definition - -description ""; - -classNameDict -{ - type dictionary; - description "className control dictionary"; - dictionaryPath "system"; - - entries - { - arguments - { - type rootCaseTimeArguments; - } - } -} - -// ************************************************************************* // diff --git a/bin/foamTemplates/source/newSource b/bin/foamTemplates/source/newSource index 6d4253733..72557fa42 100755 --- a/bin/foamTemplates/source/newSource +++ b/bin/foamTemplates/source/newSource @@ -40,7 +40,7 @@ usage: $Script * create a new standard OpenFOAM source file -type: (C|H|I|IO|App|cfg) +type: (C|H|I|IO|App) USAGE exit 1 @@ -74,10 +74,6 @@ app|App) wmakeFilesAndOptions fi ;; -cfg) - template=foamUtilTemplate - fileType=$1 - ;; *) usage "unknown type" ;; diff --git a/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.C b/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.C index 5d54a71fe..cc725c820 100644 --- a/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.C +++ b/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.C @@ -32,6 +32,9 @@ template const dataType Foam::ClassName::staticData(); +// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -84,10 +87,13 @@ Foam::ClassName::~ClassName() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // template void Foam::ClassName::operator= @@ -108,10 +114,10 @@ void Foam::ClassName::operator= } -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * // // ************************************************************************* // diff --git a/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.H b/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.H index 5ec6938cc..1fcaf8c05 100644 --- a/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.H +++ b/bin/foamTemplates/sourceTemplate/foamTemplateTemplate.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - ClassName + Foam::ClassName Description @@ -114,8 +114,7 @@ public: static autoPtr > New(); - // Destructor - + //- Destructor ~ClassName(); @@ -132,16 +131,10 @@ public: // IOstream Operators - friend Istream& operator>> - #ifndef __CINT__ - - #endif + friend Istream& operator>> (Istream&, ClassName&); - friend Ostream& operator<< - #ifndef __CINT__ - - #endif + friend Ostream& operator<< (Ostream&, const ClassName&); }; diff --git a/bin/foamUpdateCaseFileHeader b/bin/foamUpdateCaseFileHeader index 766bc21dd..7b3c97789 100755 --- a/bin/foamUpdateCaseFileHeader +++ b/bin/foamUpdateCaseFileHeader @@ -33,85 +33,111 @@ # Also removes consecutive blank lines from file. # #------------------------------------------------------------------------------ +foamVersion=$WM_PROJECT_VERSION -# -# FUNCTIONS -# -printUsage () { -cat < - Updates the header of application files - By default, writes current version in the header - Alternatively version can be specified with -v option - Also removes consecutive blank lines from file +usage() { + cat<" specifies the version to be written in the header --h help -EOF +Usage: ${0##*/} [OPTION] ... + +options: + -v VER specifies the version to be written in the header + -h help + + Updates the header of application files and removes consecutive blank lines. + By default, writes current OpenFOAM version in the header. + An alternative version can be specified with the -v option. + +USAGE + exit 1 } -printOpenFOAMheader () { -cat< FoamFile - CLASS=`FoamFileAttribute class FoamFile` - OBJECT=`FoamFileAttribute object FoamFile` - FORMAT=`FoamFileAttribute format FoamFile` - printOpenFOAMheader $VERSION $FORMAT $CLASS $OBJECT > temp - sed '1,/}/d' $CASE_FILE | sed '/./,/^$/!d' >> temp - mv temp $1 - rm FoamFile -else - echo "The following file does not appear to be a case file:" - echo " " $CASE_FILE -fi +unset NOTE +for caseFile +do + if grep FoamFile $caseFile >/dev/null 2>&1 + then + echo "Updating case file: $caseFile" + sed -n '/FoamFile/,/}/p' $caseFile > FoamFile.tmp + + FORMAT=$(FoamFileAttribute format FoamFile.tmp) + CLASS=$(FoamFileAttribute class FoamFile.tmp) + OBJECT=$(FoamFileAttribute object FoamFile.tmp) + # extract NOTE? + + printHeader $FORMAT $CLASS $OBJECT $NOTE > FoamFile.tmp + sed '1,/}/d' $caseFile | sed '/./,/^$/!d' >> FoamFile.tmp + + # use cat to avoid removing/replace soft-links + [ -s FoamFile.tmp ] && cat FoamFile.tmp >| $caseFile + rm -f FoamFile.tmp 2>/dev/null + else + echo " Invalid case file: $caseFile" 1>&2 + fi +done #------------------------------------------------------------------------------ diff --git a/bin/foamUpgradeTurbulenceProperties b/bin/foamUpgradeTurbulenceProperties index 1c8687553..3c6054167 100755 --- a/bin/foamUpgradeTurbulenceProperties +++ b/bin/foamUpgradeTurbulenceProperties @@ -30,59 +30,69 @@ # Upgrade the turbulenceProperties dictionary to the new format employed # in OpenFOAM version 1.5-dev # - RAS turbulence models now defined by the RASProperties dictionary, -# and RASModel keyword, and +# and RASModel keyword. # - LES turbulence models now defined by the LESProperties dictionary, # and LESModel keyword. # #------------------------------------------------------------------------------ -printUsage() -{ - echo "Usage: `basename $0` " - echo " Where is the full path to the" - echo " turbulenceProperties dictionary" +usage() { + cat< + + Where is the full path to the + turbulenceProperties dictionary + + Note: can upgrade several files at once + +USAGE + exit 1 } +# +# $1: turbulence model +# $2: new properties type +# $3: original dictionary +# convertDict() { - echo " Identified $1 turbulence model" + echo "Identified $1 turbulence model in '$3'" + outputPath=`dirname $3` - sed -e "s/turbulenceProperties/$1Properties/" \ - -e "s/$2/$1Model/" \ - -e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \ - $3 > "$outputPath/$1Properties" + if [ -e "$outputPath/$1Properties" ] + then + echo "Error: file already exists $outputPath/$1Properties'" 1>&2 + else + sed -e "s/turbulenceProperties/$1Properties/" \ + -e "s/$2/$1Model/" \ + -e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \ + $3 > "$outputPath/$1Properties" - echo " written $1Properties to $outputPath/" + echo " wrote $outputPath/$1Properties" + fi } -outputPath=`dirname $1` - -if [ $# -ne 1 ]; then - printUsage - exit 1 -elif [ ! -e $1 ]; then - echo " Error: file $1 does not exist" - echo "" - printUsage - exit 1 -fi - -# Identify type of turbulence model -RAS=`grep turbulenceModel $1` -LES=`grep LESmodel $1` - -if [ -n "$RAS" ]; then - convertDict "RAS" "turbulenceModel" $1 -elif [ -n "$LES" ]; then - convertDict "LES" "LESmodel" $1 -else - echo "Unable to determine turbulence model type - nothing changed" - exit 1 -fi - -echo "done." - -exit 0 +[ $# -ge 1 ] || usage +for turbDict +do + # Identify type of turbulence model and convert + if [ -f $turbDict ] + then + if grep turbulenceModel $turbDict >/dev/null 2>&1 + then + convertDict RAS turbulenceModel $turbDict + elif grep LESmodel $turbDict >/dev/null 2>&1 + then + convertDict LES LESmodel $turbDict + else + echo "Unable to determine turbulence model type in '$turbDict'" 1>&2 + echo " - nothing changed" 1>&2 + fi + else + echo "Error: file '$turbDict' does not exist" 1>&2 + fi +done #------------------------------------------------------------------------------ diff --git a/bin/mpirunDebug b/bin/mpirunDebug index eec151343..d92a3a51e 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -1,25 +1,50 @@ -#!/bin/sh +#!/bin/bash +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ M anipulation | +#------------------------------------------------------------------------------- +# License +# This file is part of OpenFOAM. # -# Driver script to run mpi jobs with the processes in separate -# windows or to separate log files. -# Requires bash on all processors. +# 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 - ECHO='echo -e' +if [ `uname -s` = Linux ] +then + ECHO='echo -e' else - ECHO='echo' + ECHO='echo' fi printUsage() { - echo "" - echo "Usage: $PROGNAME -np
" - echo "" - echo "This will run like mpirun but with each process in an xterm" + echo "" + echo "Usage: ${0##*/} -np
" + echo "" + echo "This will run like mpirun but with each process in an xterm" } nProcs='' @@ -30,7 +55,8 @@ while [ "$1" != "" ]; do echo "$1" case $1 in -np) - nProcs=$2;shift + nProcs=$2 + shift ;; *) if [ ! "$exec" ]; then @@ -70,15 +96,17 @@ if [ ! -x "$exec" ]; then exit 1 fi +if [ ! "$PWD" ]; then + PWD=`pwd` +fi +echo "run $args" > $PWD/gdbCommands +echo "where" >> $PWD/gdbCommands +echo "Constructed gdb initialization file $PWD/gdbCommands" -echo "run $args" > $HOME/gdbCommands -echo "where" >> $HOME/gdbCommands -echo "Constructed gdb initialization file $HOME/gdbCommands" - -$ECHO "Choose running method: 1)gdb+xterm 2)gdb 3)log 4)xterm+valgrind: \c" +$ECHO "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c" read method -if [ "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 ]; then +if [ "$method" -ne 0 -a "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 -a "$method" -ne 5 ]; then printUsage exit 1 fi @@ -119,41 +147,43 @@ fi echo "**sourceFoam:$sourceFoam" -rm -f $HOME/mpirun.schema -touch $HOME/mpirun.schema +rm -f $PWD/mpirun.schema +touch $PWD/mpirun.schema proc=0 xpos=0 ypos=0 for ((proc=0; proc<$nProcs; proc++)) do - procCmdFile="$HOME/processor${proc}.sh" + procCmdFile="$PWD/processor${proc}.sh" procLog="processor${proc}.log" geom="-geometry 120x20+$xpos+$ypos" node="" if [ .$WM_MPLIB = .OPENMPI ]; then node="-np 1 " - elif [ .$WM_MPLIB = .LAM ]; then - if [ "$spawn" -eq 2 ]; then - node="c${proc} " - fi fi echo "#!/bin/sh" > $procCmdFile - if [ "$method" -eq 1 ]; then - echo "$sourceFoam; cd $PWD; gdb -command $HOME/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile + if [ "$method" -eq 0 ]; then + echo "$sourceFoam; cd $PWD; $exec $args | tee $procLog" >> $procCmdFile + echo "${node}$procCmdFile" >> $PWD/mpirun.schema + elif [ "$method" -eq 1 ]; then + echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile #echo "$sourceFoam; cd $PWD; $exec $args; read dummy" >> $procCmdFile - echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $HOME/mpirun.schema + echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 2 ]; then - echo "$sourceFoam; cd $PWD; gdb -command $HOME/gdbCommands >& $procLog" >> $procCmdFile - echo "${node}$procCmdFile" >> $HOME/mpirun.schema + echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands >& $procLog" >> $procCmdFile + echo "${node}$procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 3 ]; then echo "$sourceFoam; cd $PWD; $exec $args >& $procLog" >> $procCmdFile - echo "${node}$procCmdFile" >> $HOME/mpirun.schema + echo "${node}$procCmdFile" >> $PWD/mpirun.schema elif [ "$method" -eq 4 ]; then + echo "$sourceFoam; cd $PWD; $exec $args 2>&1 | tee $procLog; read dummy" >> $procCmdFile + echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema + elif [ "$method" -eq 5 ]; then echo "$sourceFoam; cd $PWD; valgrind $exec $args; read dummy" >> $procCmdFile - echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $HOME/mpirun.schema + echo "${node}xterm -font fixed -title 'processor'$proc $geom -e $procCmdFile" >> $PWD/mpirun.schema fi chmod +x $procCmdFile @@ -173,10 +203,32 @@ do echo " tail -f $procLog" done -$ECHO "Constructed $HOME/mpirun.schema file. Press return to execute.\c" -read dummy +cmd="" if [ .$WM_MPLIB = .OPENMPI ]; then - mpirun -app $HOME/mpirun.schema $procXtermCmdFile + echo "$procCmd" >> $procXtermCmdFile + chmod +x $procXtermCmdFile + if [ $proc -ne 0 ]; then + cmd="${cmd} :" + fi + cmd="${cmd} -n 1 ${procXtermCmdFile}" + done < $PWD/mpirun.schema fi + +echo "Constructed $PWD/mpirun.schema file." +echo "" +echo " $cmd" +echo "" +$ECHO "Press return to execute.\c" +read dummy +exec $cmd + +#------------------------------------------------------------------------------ diff --git a/bin/paraFoam b/bin/paraFoam index dade5ce93..877ec4591 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -30,75 +30,104 @@ # start paraview with the OpenFOAM libraries # #------------------------------------------------------------------------------ -Script=${0##*/} - usage() { - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat</dev/null || usage "directory does not exist: '$caseDir'" - ;; - *) - usage "unknown option/argument: '$*'" - ;; - esac -fi +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -case) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + cd "$2" 2>/dev/null || usage "directory does not exist: '$2'" + shift 2 + ;; + -region) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + regionName=$2 + shift 2 + ;; + -touch) + touchOnly=true + shift + ;; + *) + usage "unknown option/argument: '$*'" + ;; + esac +done # get a sensible caseName caseName=${PWD##*/} +caseFile="$caseName.OpenFOAM" +fvControls="system" + +if [ -n "$regionName" ] +then + caseFile="$caseName{$regionName}.OpenFOAM" + fvControls="$fvControls/$regionName" +fi + +if [ -n "$touchOnly" ] +then + touch "$caseFile" + echo "created '$caseFile'" + exit 0 +fi # parent directory for normal or parallel results case "$caseName" in - processor*) parentDir=".." ;; - *) parentDir="." ;; + processor*) parentDir=".." ;; + *) parentDir="." ;; esac # check existence of essential files -for check in system/controlDict system/fvSchemes system/fvSolution +for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution do - [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" + [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" done -#caseFile="$caseName.foam" -caseFile="$caseName.OpenFOAM" case "$ParaView_VERSION" in 2*) - # Clean up on termination and on Ctrl-C - trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT - touch $caseFile + trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" - # since we are now in the cwd, %CASE% is '$PWD/$caseFile' - sed -e s%CASE%$PWD/$caseFile%g \ - $WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs + # since we are now in the cwd, %CASE% is '$PWD/$caseFile' + sed -e s@%CASE%@$PWD/$caseFile@g \ + $WM_PROJECT_DIR/bin/tools/paraFoam.pvs > paraFoam.pvs - paraview paraFoam.pvs - ;; + paraview paraFoam.pvs + ;; *) - # Clean up on termination and on Ctrl-C - trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT - touch $caseFile - paraview --data=$caseFile - ;; + # only create/remove caseFile if it didn't already exist + [ -e $caseFile ] || { + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" + echo "created temporary '$caseFile'" + } + + paraview --data="$caseFile" + ;; esac #------------------------------------------------------------------------------ diff --git a/bin/paraFoam.pvs b/bin/paraFoam.pvs deleted file mode 100644 index e98fa6ee4..000000000 --- a/bin/paraFoam.pvs +++ /dev/null @@ -1,12 +0,0 @@ -# ParaView State Version 2.2 - -set kw(vtkTemp2) [$Application GetMainWindow] -set kw(vtkTemp29) [$kw(vtkTemp2) GetMainView] -set kw(vtkTemp980) [$kw(vtkTemp2) GetAnimationManager] -[$kw(vtkTemp2) GetRotateCameraButton] SetState 1 -$kw(vtkTemp2) ChangeInteractorStyle 1 -set kw(vtkTemp840) [$kw(vtkTemp2) InitializeReadCustom "FoamReader" "CASE"] -$kw(vtkTemp2) ReadFileInformation $kw(vtkTemp840) "CASE" -$kw(vtkTemp2) FinalizeRead $kw(vtkTemp840) "CASE" -set kw(vtkTemp868) [$kw(vtkTemp840) GetPVWidget {Filename}] -$kw(vtkTemp868) SetValue "CASE" diff --git a/bin/rmclassall b/bin/rmclassall index 5ee1c7362..41190c994 100755 --- a/bin/rmclassall +++ b/bin/rmclassall @@ -1,2 +1,56 @@ #!/bin/sh -find . \( -name '*.class' \) -print | xargs -t rm +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all .class files" + exit 1 +fi + + +for i +do + if [ -d "$i" ] + then + echo "removing all .class files: $i" + find $i -name '*.class' -print | xargs -t rm 2>/dev/null + else + echo "no directory: $i" 1>&2 + fi +done + +#------------------------------------------------------------------------------ diff --git a/bin/rmcore b/bin/rmcore index 6014adc41..d1e3b997a 100755 --- a/bin/rmcore +++ b/bin/rmcore @@ -1,3 +1,56 @@ #!/bin/sh -#find . \( -name 'core' \) -exec ls -l {} \; -exec rm {} \; -find . \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all core files" + exit 1 +fi + + +for i +do + if [ -d "$i" ] + then + echo "removing all core files: $i" + find $i \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm 2>/dev/null + else + echo "no directory: $i" 1>&2 + fi +done + +#------------------------------------------------------------------------------ diff --git a/bin/rmdepall b/bin/rmdepall index 89e6e4c56..df3e80437 100755 --- a/bin/rmdepall +++ b/bin/rmdepall @@ -1,12 +1,69 @@ #!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 +#------------------------------------------------------------------------------ +usage() { + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + cat<&2 +usage: ${0##*/} [file] -if [ $# -eq 0 ]; then - find . \( -name '*.dep' \) -print | xargs -t rm -elif [ $# -eq 1 ]; then - echo "Removing all dep files containing $1..." - find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \; -else - echo "Usage: `basename $0` to remove all .dep files" - echo " `basename $0` to remove all .dep files referring to " +Remove all .dep files or remove .dep files referring to + +USAGE exit 1 +} + +# 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 ..." + find . -name '*.dep' -print | xargs -t rm 2>/dev/null +else + echo "removing .dep files referring to $1 ..." + find . -name '*.dep' -exec grep "$1" '{}' \; -exec rm '{}' \; fi + +#------------------------------------------------------------------------------ diff --git a/bin/rmoall b/bin/rmoall index 636e055e5..75e934ad3 100755 --- a/bin/rmoall +++ b/bin/rmoall @@ -1,2 +1,56 @@ #!/bin/sh -find . \( -name '*.o' \) -print | xargs -t rm +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all .o files" + exit 1 +fi + + +for i +do + if [ -d "$i" ] + then + echo "removing all .o files: $i" + find $i -name '*.o' -print | xargs -t rm 2>/dev/null + else + echo "no directory: $i" 1>&2 + fi +done + +#------------------------------------------------------------------------------ diff --git a/bin/rm~all b/bin/rm~all index 73ea1d556..bd1b15bf6 100755 --- a/bin/rm~all +++ b/bin/rm~all @@ -1,3 +1,56 @@ #!/bin/sh -#find . \( -name '*~' -o -name '.*~' \) -exec ls -l {} \; -exec rm {} \; -find . \( -name '*~' -o -name '.*~' \) -print | xargs -t rm +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " remove all *~ files" + exit 1 +fi + + +for i +do + if [ -d "$i" ] + then + echo "removing all *~ files: $i" + find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm 2>/dev/null + else + echo "no directory: $i" 1>&2 + fi +done + +#------------------------------------------------------------------------------ diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index ab277ce31..9f85a0f6b 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -40,7 +40,7 @@ # rm -rf ${T} > /dev/null 2>&1 # fi # done -# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1 +# rm -rf {log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 #} cleanTimeDirectories () @@ -55,15 +55,23 @@ cleanTimeDirectories () zeros=`printf %0${nZeros}d 0` nZeros=$(($nZeros + 1)) done - rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.foam} > /dev/null 2>&1 + rm -rf ./{[1-9]*,-[1-9]*,log,log.*,log-*,logSummary.*,.fxLock,*.xml,ParaView*,paraFoam*,*.OpenFOAM} > /dev/null 2>&1 } cleanCase () { cleanTimeDirectories + rm -rf processor* > /dev/null 2>&1 + rm -rf probes* > /dev/null 2>&1 + rm -rf forces* > /dev/null 2>&1 - rm -rf constant/polyMesh/{allOwner*,cell*,face*,meshModifiers*} \ + rm -rf system/machines \ + constant/polyMesh/{allOwner*,cell*,face*,meshModifiers*} \ constant/polyMesh/{owner*,neighbour*,point*,edge*} \ + constant/polyMesh/{cellLevel*,pointLevel*,refinementHistory*,surfaceIndex*} \ + constant/{cellToRegion,cellLevel*,pointLevel*} \ + constant/polyMesh/sets/ \ + VTK \ > /dev/null 2>&1 for f in `find . -name "*Dict"` @@ -73,13 +81,6 @@ cleanCase () done } -cleanParallelCase () -{ - cleanCase - - rm -rf processor* > /dev/null 2>&1 -} - removeCase () { echo "Removing $case case" diff --git a/bin/tools/README b/bin/tools/README index c99723b20..2b98a9702 100644 --- a/bin/tools/README +++ b/bin/tools/README @@ -1,2 +1,2 @@ -Misc. tools for building applications, etc that are useful to have -but which don't really need to be in the PATH. +Misc. tools, scripts, templates that are useful (eg, for building applications) +but don't need to be in the PATH. diff --git a/bin/tools/RunFunctions b/bin/tools/RunFunctions index 8f1b8efb0..592ef6c4e 100644 --- a/bin/tools/RunFunctions +++ b/bin/tools/RunFunctions @@ -29,15 +29,21 @@ # #------------------------------------------------------------------------------ +getApplication () +{ + grep application system/controlDict | sed "s/application *\([a-zA-Z]*\);/\1/" +} + runApplication () { APP_RUN=$1; shift + APP_NAME=${APP_RUN##*/} - if [ -f log.$APP_RUN ] ; then - echo "$APP_RUN already run on $PWD: remove log file to run" + if [ -f log.$APP_NAME ] ; then + echo "$APP_NAME already run on $PWD: remove log file to run" else echo "Running $APP_RUN on $PWD" - $APP_RUN $* > log.$APP_RUN 2>&1 + $APP_RUN $* > log.$APP_NAME 2>&1 fi } @@ -48,18 +54,8 @@ runParallel () if [ -f $log.$APP_RUN ] ; then echo "$APP_RUN already run on $PWD: remove log file to run" else - if [ "$WM_MPLIB" = LAM ] - then - echo "Starting LAM using $2 machines file" - lamboot -v $2 - fi echo "Running $APP_RUN in parallel on $PWD using $1 processes" ( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 ) - if [ "$WM_MPLIB" = LAM ] - then - echo "Stopping LAM" - lamclean - fi fi } @@ -69,12 +65,6 @@ compileApplication () wmake $1 } -compileLibrary () -{ - echo "Compiling $1 application" - wmake libso $1 -} - cloneCase () { if [ -d $2 ] ; then diff --git a/bin/tools/buildParaView3.2.1 b/bin/tools/buildParaView3.2.1 deleted file mode 100755 index 58b2236ad..000000000 --- a/bin/tools/buildParaView3.2.1 +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -#------------------------------------------------------------------------------ -# ========= | -# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox -# \\ / O peration | -# \\ / A nd | Copyright held by original author -# \\/ 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 -# buildParaView -# -# Description -# Build and install ParaView -# - run from folder above ParaView source folder or place the -# ParaView source under $WM_PROJECT_INST_DIR -# -#------------------------------------------------------------------------------ -. $WM_PROJECT_DIR/bin/tools/buildParaViewFunctions - -# set -x - -PARAVIEW_SRC="ParaView3.2.1" -PARAVIEW_MAJOR_VERSION="3.2" - -VERBOSE=OFF -INCLUDE_MPI=ON -MPI_MAX_PROCS=32 -INCLUDE_PYTHON=ON -PYTHON_LIBRARY="" -INCLUDE_MESA=OFF - -set +x - -# provide a shortcut for repeated builds - use with caution -if [ "$#" -gt 0 ] -then - CMAKE_SKIP=YES -fi - -# set paraview environment -PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC -#PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD -PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_ARCH$WM_COMPILER - -addMpiSupport # set MPI specific options -addPythonSupport # set python specific options -addMesaSupport # set MESA specific options - -buildParaView -installParaView - -echo "done" - -#------------------------------------------------------------------------------ diff --git a/bin/tools/buildParaView3.3 b/bin/tools/buildParaView3.3 deleted file mode 100755 index 88b86a91a..000000000 --- a/bin/tools/buildParaView3.3 +++ /dev/null @@ -1,192 +0,0 @@ -#!/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 -# buildParaView3.3-cvs -# -# Description -# Build and install ParaView -# - run from folder above ParaView source folder or place the -# ParaView source under $WM_THIRD_PARTY_DIR -# -#------------------------------------------------------------------------------ -. ./buildParaViewFunctions - -PARAVIEW_SRC=ParaView3.3-cvs -PARAVIEW_MAJOR_VERSION=3.3 - -# User options: -# ~~~~~~~~~~~~~ - -# MPI support: -WITH_MPI=OFF -MPI_MAX_PROCS=32 - -# Python support: -# note: script will try to determine the appropriate python library. -# If it fails, specify the path using the PYTHON_LIBRARY variable -WITH_PYTHON=OFF -PYTHON_LIBRARY="" -# PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0" - -# MESA graphics support: -WITH_MESA=OFF - -# -# No further editing below this line -#------------------------------------------------------------------------------ -Script=${0##*/} - -usage() { - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat</dev/null) - then - if [ -n "$PYTHON_LIBRARY" ] - then - # check $PYTHON_LIBRARY if it has been set - if [ ! -e "$PYTHON_LIBRARY" ] - then - echo "*** Error: libpython not found at location specified " \ - "by PYTHON_LIBRARY=$PYTHON_LIBRARY" - fi - else - # Try to get $PYTHON_LIBRARY from dynamically linked binary - PYTHON_LIBRARY=$(ldd $pythonBin | \ - sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p') - - if [ ! -e "$PYTHON_LIBRARY" ] - then - echo "*** Error: Unable to determine path to python library." - fi - fi - - [ -e "$PYTHON_LIBRARY" ] || { - echo " Please set the variable PYTHON_LIBRARY to the full" - echo " path to (and including) libpython, or deactivate" - echo " python support by setting WITH_PYTHON=OFF" - exit 1 - } - - pythonMajor=$(echo $PYTHON_LIBRARY | sed 's/.*libpython\(.*\)\.so.*/\1/') - pythonInclude=/usr/include/python$pythonMajor - - [ -e "$PYTHON_LIBRARY" ] || { - echo " Please set the variable PYTHON_LIBRARY to the full" - echo " path to (and including) libpython, or deactivate" - echo " python support by setting WITH_PYTHON=OFF" - exit 1 - } - - # note - we could also allow for a PYTHON_INCLUDE variable ... - [ -e "$pythonInclude" ] || { - echo " No python include headers found" - echo " Please install python headers or deactivate " - echo " python support by setting WITH_PYTHON=OFF" - exit 1 - } - - addCMakeVariable PARAVIEW_ENABLE_PYTHON=ON - addCMakeVariable PYTHON_INCLUDE_PATH=$pythonInclude - addCMakeVariable PYTHON_LIBRARY=$PYTHON_LIBRARY - - echo "----" - echo "Python information:" - echo " executable : $pythonBin" - echo " version : $pythonMajor" - echo " include path : $pythonInclude" - echo " library : $PYTHON_LIBRARY" - - unset pythonBin pythonInclude pythonMajor - else - echo "*** Error: python not installed" - echo "*** Deactivate python support by setting WITH_PYTHON=OFF" - exit 1 - fi -} - - -# -# define options for mesa support -# -addMesaSupport() -{ - [ "$WITH_MESA" = ON ] || return - - if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ] - then - OBJ_ADD="$OBJ_ADD-mesa" - - addCMakeVariable VTK_OPENGL_HAS_OSMESA=ON - addCMakeVariable OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR - addCMakeVariable OSMESA_LIBRARY=$MESA_LIBRARY - - else - echo "*** Error: no MESA information found" - echo "*** Deactivate MESA support by setting WITH_MESA=OFF, or" - echo "*** correct paths given by:" - echo "*** - MESA_INCLUDE_DIR ($MESA_INCLUDE_DIR)" - echo "*** - MESA_LIBRARY ($MESA_LIBRARY)" - exit 1 - fi -} - - -# -# discover where things are or should be put -# -getPaths() -{ - # set paraview environment - for i in $PWD $WM_THIRD_PARTY_DIR - do - ParaView_INST_DIR=$i/$PARAVIEW_SRC - [ -d $ParaView_INST_DIR ] && break - done - - if [ ! -d "$ParaView_INST_DIR" ] - then - # last chance: maybe already in the paraview directory - [ "${PWD##*/}" = $PARAVIEW_SRC ] && ParaView_INST_DIR=$PWD - - [ -d "$ParaView_INST_DIR" ] || { - echo "did not find $PARAVIEW_SRC in these directories:" - echo " PWD=$PWD" - echo " WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR" - echo "abort build" - exit 1 - } - fi - - # ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER$OBJ_ADD - ParaView_DIR=$ParaView_INST_DIR/platforms/$WM_ARCH$WM_COMPILER - echo "ParaView_DIR=$ParaView_DIR" -} - - -# -# configure via cmake, but don't actually build anything -# -configParaView() -{ - # remove any existing build folder and recreate - if [ -d $ParaView_DIR ] - then - echo "removing old build/install directory" - rm -rf $ParaView_DIR - fi - mkdir -p $ParaView_DIR - - cd $ParaView_DIR - - echo "----" - echo "Configuring $PARAVIEW_SRC" - echo " MPI support : $WITH_MPI" - echo " Python support : $WITH_PYTHON" - echo " MESA support : $WITH_MESA" - echo " Source : $ParaView_INST_DIR" - echo " Target : $ParaView_DIR" - echo "----" - echo - echo cmake \ - -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \ - $CMAKE_VARIABLES \ - ../.. - echo - echo "----" - echo - - # run cmake to create Makefiles - cmake \ - -DCMAKE_INSTALL_PREFIX:PATH=$ParaView_DIR \ - $CMAKE_VARIABLES \ - ../.. - -} - - -# -# invoke make -# also link bin/ to lib/paraview-* for development without installation -# -makeParaView() -{ - cd $ParaView_DIR || exit 1 # change to build folder - echo " Starting make" - - if [ -r /proc/cpuinfo ] - then - WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l) - [ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8 - - time make -j $WM_NCOMPPROCS - else - time make - fi - echo " Done make" - - echo " For quicker development, linking lib/paraview-$PARAVIEW_MAJOR_VERSION/ -> bin/" - rm -rf lib/paraview-$PARAVIEW_MAJOR_VERSION - mkdir lib 2>/dev/null - ( cd lib && ln -s ../bin paraview-$PARAVIEW_MAJOR_VERSION ) -} - - -# -# adjust hard-links (internal function) -# Note: use loop with grep to avoid touching too many files -# -fixHardLinks() -{ - envName=$1 - string=$2 - shift 2 - - echo "-- Replacing path hard links for \$$envName" - - for fileSpec - do - echo -n " $fileSpec: " - for i in $(find . -type f -iname "$fileSpec") - do - if grep -q "$string" $i - then - echo -n "#" - sed -i "s,$string,\$ENV{$envName},g" $i - fi - done - echo - done -} - - -# -# replace absolute paths with environment variables -# This triggers a partial (or even a full) rebuild, but might let us -# find our files later if we relocate the build -# -fixCMakeFiles() -{ - cd $ParaView_DIR || exit 1 # change to build folder - - # Replace path with env variable: ParaView_DIR - fixHardLinks ParaView_DIR "$ParaView_DIR" '*.cmake' - - # Replace path with env variable: ParaView_INST_DIR - fixHardLinks ParaView_INST_DIR "$ParaView_INST_DIR" '*.cmake' - - # Replace path with env variable: MPI_ARCH_PATH - if [ "$WITH_MPI" = ON ] - then - fixHardLinks MPI_ARCH_PATH "$MPI_ARCH_PATH" '*.cmake' - fi - - # Replace path with env variable: CMAKE_HOME - if [ -r "$CMAKE_HOME" ] - then - fixHardLinks CMAKE_HOME "$CMAKE_HOME" '*cmake*' - fi - - # Replace path with env variable: WM_COMPILER_DIR - # (include cmake.check_cache) - # This triggers a complete rebuild (with cmake-2.6.2), but is likely - # needed when redistributing files - fixHardLinks WM_COMPILER_DIR "$WM_COMPILER_DIR" '*cmake*' -} - - -# -# make html documentation (mostly just for the readers/writers) -# -makeDocs() -{ - cd $ParaView_DIR || exit 1 # change to build folder - echo " Creating html documentation" - - make HTMLDocumentation -} - - -# -# actually install the program -# -installParaView() -{ - cd $ParaView_DIR || exit 1 # change to build folder - echo " Installing ParaView to $ParaView_DIR" - - echo "disabled 'make install' for now, just use links" - - # about.txt may be missing - paraviewLibDir="$ParaView_DIR/lib/paraview-$PARAVIEW_MAJOR_VERSION" - if [ -d "$paraviewLibDir" -a ! -e "$paraviewLibDir/about.txt" ] - then - echo "paraview-$PARAVIEW_MAJOR_VERSION installed - $(date)" > $paraviewLibDir/about.txt - fi - -cat<< INFO - --- - Installation complete - Set environment variables: - - export ParaView_INST_DIR=$ParaView_INST_DIR - export ParaView_DIR=$ParaView_DIR - export PV_PLUGIN_PATH=$FOAM_LIBBIN - export PATH=\$ParaView_DIR/bin:\$PATH - --- -INFO -} - - -# clear all the variables used before using any of the functions -unset VERBOSE -unset WITH_MPI WITH_MESA -unset WITH_PYTHON PYTHON_LIBRARY -unset CMAKE_VARIABLES -unset OBJ_ADD - -# start with these general settings -addCMakeVariable VTK_USE_TK=FALSE -addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF -addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release - -# include development files in "make install" -addCMakeVariable PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON - -# ----------------------------------------------------------------- end-of-file diff --git a/bin/tools/temp.7077 b/bin/tools/temp.7077 deleted file mode 100644 index e69de29bb..000000000 diff --git a/bin/touchapp b/bin/touchapp index 38325105e..10163f297 100755 --- a/bin/touchapp +++ b/bin/touchapp @@ -1,3 +1,48 @@ #!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 +#------------------------------------------------------------------------------ -touch $FOAM_APPBIN/* +if [ "$#" -ne 0 ] +then + echo "Usage: ${0##*/}" + echo " touch FOAM_APPBIN" + exit 1 +fi + + +if [ -d "$FOAM_APPBIN" ] +then + echo "touching FOAM_APPBIN: $FOAM_APPBIN" + touch $FOAM_APPBIN/* +else + echo "no FOAM_APPBIN: $FOAM_APPBIN" +fi +#------------------------------------------------------------------------------ diff --git a/bin/touchdep b/bin/touchdep index 25d4b75fa..abdc8c57b 100755 --- a/bin/touchdep +++ b/bin/touchdep @@ -1,3 +1,55 @@ #!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 +#------------------------------------------------------------------------------ -find . \( -name '*.dep' \) -print | xargs -t touch +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " touch all .dep files" + exit 1 +fi + + +for i +do + if [ -d "$i" ] + then + echo "touching all .dep files: $i" + find $i -name '*.dep' -print | xargs -t touch + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------ diff --git a/bin/touchlib b/bin/touchlib index bda6880c9..fd36002dd 100755 --- a/bin/touchlib +++ b/bin/touchlib @@ -1,3 +1,48 @@ #!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 +#------------------------------------------------------------------------------ -touch $FOAM_LIBBIN/* +if [ "$#" -ne 0 ] +then + echo "Usage: ${0##*/}" + echo " touch FOAM_LIBBIN" + exit 1 +fi + + +if [ -d "$FOAM_LIBBIN" ] +then + echo "touching FOAM_LIBBIN: $FOAM_LIBBIN" + touch $FOAM_LIBBIN/* $FOAM_LIBBIN/*/* +else + echo "no FOAM_LIBBIN: $FOAM_LIBBIN" +fi +#------------------------------------------------------------------------------ diff --git a/bin/toucho b/bin/toucho index bf3a69f6d..f93af41cc 100755 --- a/bin/toucho +++ b/bin/toucho @@ -1,3 +1,55 @@ #!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | +# \\ / A nd | Copyright held by original author +# \\/ 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 +#------------------------------------------------------------------------------ -find . \( -name '*.o' \) -print | xargs -t touch +# default is pwd +if [ "$#" -eq 0 ] +then + set -- . +elif [ "$1" = "-h" -o "$1" = "-help" ] +then + echo "Usage: ${0##*/} [dir1] .. [dirN]" + echo " touch all .o files" + exit 1 +fi + + +for i +do + if [ -d "$i" ] + then + echo "touching all .o files: $i" + find $i -name '*.o' -print | xargs -t touch + else + echo "no directory: $i" + fi +done +#------------------------------------------------------------------------------