bin merge

This commit is contained in:
Hrvoje Jasak 2010-05-27 11:48:11 +01:00
parent fdce75c58e
commit 288efa21ab
56 changed files with 1337 additions and 1847 deletions

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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<<USAGE
# set -x
usage: ${0##*/} [OPTION]
options:
-help
PARAVIEW_SRC="ParaView3.3-cvs"
PARAVIEW_MAJOR_VERSION="3.3"
* start engrid using the paraview-$ParaView_VERSION libraries
passes through engrid options unmodified
VERBOSE=OFF
INCLUDE_MPI=OFF
MPI_MAX_PROCS=32
#INCLUDE_PYTHON=OFF
INCLUDE_PYTHON=ON
PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
PYTHON_LIBRARY=""
INCLUDE_MESA=OFF
USAGE
exit 1
}
set +x
# report usage
[ "$1" = "-h" -o "$1" = "-help" ] && usage
# provide a shortcut for repeated builds - use with caution
if [ "$#" -gt 0 ]
then
CMAKE_SKIP=YES
fi
# set the major version "<digits>.<digits>"
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 $@ &"
#------------------------------------------------------------------------------

View file

@ -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 <file1> ... <fileN>
#
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
rm -f $2
mksquashfs $1 $2 -b 256K -lzmadic 256K
# -force-uid 0 -force-gid 0
# -root-owned
usage: ${0##*/} <file1> ... <fileN>
* find all .dep files referring to any of <file1> ... <fileN>
USAGE
exit 1
}
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-*)
usage "unknown option: '$*'"
;;
*)
break
;;
esac
done
[ "$#" -gt 0 ] || usage
find . -name '*.dep' -print | \
while read src
do
for file in $@
do
grep -l "$file" $src && break
done
done
#------------------------------------------------------------------------------

View file

@ -27,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
#------------------------------------------------------------------------------

View file

@ -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

View file

@ -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 <<USAGE 1>&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
# -----------------------------------------------------------------------------

View file

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

View file

@ -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 {} \; \) \)

View file

@ -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 <<USAGE 1>&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
#------------------------------------------------------------------------------

View file

@ -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 <oldDir> <newDir> <tarFile>
#
# 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 <oldDir> and <newDir>"
echo "and pack them into <tarFile>"
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 "----------------------------------------------------------------------"
# ----------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -40,10 +40,10 @@
Script=${0##*/}
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [OPTION] <application> ...
usage: ${0##*/} [OPTION] <application> ...
options:
-v ver specify OpenFOAM version
@ -52,16 +52,17 @@ options:
* run a particular OpenFOAM version of <application>
USAGE
exit 1
exit 1
}
# This script should exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
# extract the <foamInstall> and <version> 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

View file

@ -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

View file

@ -29,13 +29,11 @@
# Description
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [OPTION] <application> ...
usage: ${0##*/} [OPTION] <application> ...
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 \

View file

@ -30,15 +30,13 @@
# Create a new standard OpenFOAM source file
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script <type> {args}
usage: ${0##*/} <type> {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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -30,113 +30,71 @@
# Packs and compresses binary version of OpenFOAM for release
#
#------------------------------------------------------------------------------
tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage : ${0##*/} [-l] <arch> [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##*/} <arch> [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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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 <directory> <tarFile>
#
# 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 "----------------------------------------------------------------------"
# ----------------------------------------------------------------------------

View file

@ -31,50 +31,26 @@
#
#------------------------------------------------------------------------------
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage : ${0##*/} " [-l] [outputDir]
Packs and compresses the OpenFOAM directory for release
EOF
}
timeStamp=$(date +%Y-%m-%d)
packDir=$WM_PROJECT-$WM_PROJECT_VERSION
packFile=${packDir}.General_${timeStamp}.tgz
LZMOPT=""
#
# OPTIONS
#
OPTS=`getopt hl $*`
if [ $? -ne 0 ] ; then
echo "Error: Aborting due to invalid option"
printUsage;
if [ ! -d $packDir ]
then
echo "Error: directory $packDir does not exist"
exit 1
fi
eval set -- '$OPTS'
while [ "$1" != "--" ]; do
case $1 in
-l) LZMOPT="-l"; packFile=${packDir}.General_${timeStamp}.lzm;;
-h) printUsage; exit 1;;
esac
shift
done
shift
# 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
if [ -f $packFile ]
then
echo "Error: $packFile already exists"
exit 1
fi
# Create time stamp file
@ -86,9 +62,9 @@ echo $timeStamp 2>/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
#------------------------------------------------------------------------------

View file

@ -32,56 +32,31 @@
#
#------------------------------------------------------------------------------
tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$
tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage : ${0##*/} directory tarFile
Packs all .C and .H files and Make/options and Make/files into <tarFile>
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 "<tarFile>"
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
#------------------------------------------------------------------------------

View file

@ -30,72 +30,44 @@
# Packs and compresses binary version of OpenFOAM ThirdParty for release
#
#------------------------------------------------------------------------------
tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage : ${0##*/} [-l] <archOptions> [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##*/} <archOptions> [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
#------------------------------------------------------------------------------

View file

@ -31,50 +31,27 @@
#
#------------------------------------------------------------------------------
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage : ${0##*/} " [-l] [outputDir]
Packs and compresses the OpenFOAM directory for release
EOF
}
timeStamp=$(date +%Y-%m-%d)
packDir=ThirdParty
packDir=${WM_THIRD_PARTY_DIR:-ThirdParty}
packDir=${packDir##*/}
packFile=${packDir}.General_${timeStamp}.tgz
LZMOPT=""
#
# OPTIONS
#
OPTS=`getopt hl $*`
if [ $? -ne 0 ] ; then
echo "Error: Aborting due to invalid option"
printUsage;
if [ ! -d $packDir ]
then
echo "Error: directory $packDir does not exist"
exit 1
fi
eval set -- '$OPTS'
while [ "$1" != "--" ]; do
case $1 in
-l) LZMOPT="-l"; packFile=${packDir}.General_${timeStamp}.lzm;;
-h) printUsage; exit 1;;
esac
shift
done
shift
# 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
if [ -f $packFile ]
then
echo "Error: $packFile already exists"
exit 1
fi
# Create time stamp file
@ -86,9 +63,9 @@ echo $timeStamp 2>/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
#------------------------------------------------------------------------------

View file

@ -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

View file

@ -50,7 +50,7 @@ elif [ -d "./system" ]
then
# Normal case.
parentDir=`dirname $PWD`
application=`basename $parentDir`
application=`getApplication`
runApplication blockMesh
runApplication $application
else

View file

@ -27,7 +27,7 @@
# foamSolverSweeps
#
# Description
#
#
#------------------------------------------------------------------------------
#-- settings

View file

@ -34,7 +34,7 @@
# STATIC VARIABLES
# ~~~~~~~~~~~~~~~~
FOAM_VERSION=1.5
FOAM_VERSION=1.6-ext
HLINE="-----------------------------------------------------------------------"
WIDTH=16

View file

@ -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"
#------------------------------------------------------------------------------

View file

@ -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;

View file

@ -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 * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -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<className> New();
// Destructor
~className();
//- Destructor
~className();
// Member Functions

View file

@ -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;
}
}
}
// ************************************************************************* //

View file

@ -40,7 +40,7 @@ usage: $Script <type> <class name>
* 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"
;;

View file

@ -32,6 +32,9 @@ template<TemplateClassArgument>
const dataType Foam::ClassName<TemplateArgument>::staticData();
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -84,10 +87,13 @@ Foam::ClassName<TemplateArgument>::~ClassName()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
template<TemplateClassArgument>
void Foam::ClassName<TemplateArgument>::operator=
@ -108,10 +114,10 @@ void Foam::ClassName<TemplateArgument>::operator=
}
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
// ************************************************************************* //

View file

@ -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<ClassName<TemplateArgument> > New();
// Destructor
//- Destructor
~ClassName();
@ -132,16 +131,10 @@ public:
// IOstream Operators
friend Istream& operator>>
#ifndef __CINT__
<TemplateArgument>
#endif
friend Istream& operator>> <TemplateArgument>
(Istream&, ClassName<TemplateArgument>&);
friend Ostream& operator<<
#ifndef __CINT__
<TemplateArgument>
#endif
friend Ostream& operator<< <TemplateArgument>
(Ostream&, const ClassName<TemplateArgument>&);
};

View file

@ -33,85 +33,111 @@
# Also removes consecutive blank lines from file.
#
#------------------------------------------------------------------------------
foamVersion=$WM_PROJECT_VERSION
#
# FUNCTIONS
#
printUsage () {
cat <<EOF
Usage: $0 <file>
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<<USAGE
Options are:
-v "<version>" specifies the version to be written in the header
-h help
EOF
Usage: ${0##*/} [OPTION] <file1> ... <fileN>
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<<EOF
printHeader() {
cat<<HEADER
/*--------------------------------*- C++ -*----------------------------------*\\
| ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: ${1} |
| \\\\ / A nd | Web: http://www.OpenFOAM.org |
| \\\\ / O peration | Version: ${foamVersion} |
| \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ${2};
class ${3};
object ${4};
format ${1};
class ${2};
object ${3};
}
EOF
HEADER
}
FoamFileAttribute () {
grep $1 $2 | tr -s " " | cut -d" " -f3 | cut -d\; -f1
#
# extract attribute '$1' from file '$2'
#
FoamFileAttribute() {
sed -n -e 's/[ ;]*$//' -e "s/^ *$1 *//p" $2
}
VERSION=$WM_PROJECT_VERSION
#
# OPTIONS
#
OPTS=`getopt hv: $*`
if [ $? -ne 0 ] ; then
opts=$(getopt hv: $*)
if [ $? -ne 0 ]
then
echo "Aborting due to invalid option"
printUsage
exit 1
usage
fi
eval set -- '$OPTS'
while [ "$1" != "--" ]; do
eval set -- '$opts'
while [ "$1" != "--" ]
do
case $1 in
-v) VERSION=$2; shift;;
-h) printUsage; exit 1;;
-v)
foamVersion=$2
shift
;;
-h)
usage
;;
esac
shift
done
shift
[ $# -ge 1 ] || usage
# constant width for version
foamVersion=$(printf %-36s $foamVersion)
#
# MAIN
#
CASE_FILE=$1
if [ "`grep FoamFile $CASE_FILE`" ] ; then
echo "Updating case file:" $CASE_FILE
sed -n '/FoamFile/,/}/p' $CASE_FILE > 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
#------------------------------------------------------------------------------

View file

@ -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` <turbulenceProperties>"
echo " Where <turbulenceProperties> is the full path to the"
echo " turbulenceProperties dictionary"
usage() {
cat<<USAGE
usage: ${0##*/} <turbulenceProperties>
Where <turbulenceProperties> 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
#------------------------------------------------------------------------------

View file

@ -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 <dd> <executable> <args>"
echo ""
echo "This will run like mpirun but with each process in an xterm"
echo ""
echo "Usage: ${0##*/} -np <dd> <executable> <args>"
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 </dev/null
elif [ .$WM_MPLIB = .LAM ]; then
mpirun $HOME/mpirun.schema </dev/null
cmd="mpirun -app $PWD/mpirun.schema </dev/null"
elif [ .$WM_MPLIB = .MPICH ]; then
cmd="mpiexec"
for ((proc=0; proc<$nProcs; proc++))
do
read procCmd
procXtermCmdFile="$PWD/processor${proc}Xterm.sh"
echo "#!/bin/sh" > $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
#------------------------------------------------------------------------------

View file

@ -30,75 +30,104 @@
# start paraview with the OpenFOAM libraries
#
#------------------------------------------------------------------------------
Script=${0##*/}
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: $Script [-case dir]
usage: ${0##*/} [OPTION]
options:
-case dir specify alternative case directory
-region name specify mesh region name
-touch only create the .OpenFOAM file
* start paraview $ParaView_VERSION with the OpenFOAM libraries
USAGE
exit 1
exit 1
}
unset regionName touchOnly
# parse options
if [ "$#" -gt 0 ]; then
case "$1" in
-h | -help)
usage
;;
-case)
shift
caseDir=$1
[ "$#" -ge 1 ] || usage "'-case' option requires an argument"
cd "$caseDir" 2>/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
#------------------------------------------------------------------------------

View file

@ -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"

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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 <file>
#------------------------------------------------------------------------------
usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE 1>&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` <file> to remove all .dep files referring to <file>"
Remove all .dep files or remove .dep files referring to <file>
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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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"

View file

@ -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.

View file

@ -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

View file

@ -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"
#------------------------------------------------------------------------------

View file

@ -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<<USAGE
usage: ${0##*/} [OPTION]
options:
-fast for repeated builds (-make -install) *use with caution*
-mpi with mpi (if not already enabled)
-python with python (if not already enabled)
-mesa with mesa (if not already enabled)
-verbose verbose output in Makefiles
-help
For finer control, the build stages can be also selected individually
(mutually exclusive)
-config
-make
-makedoc
-install
[-envpath] alter absolute paths in CMake files to use env variables
Build and install $PARAVIEW_SRC
- run from folder above the ParaView source folder or place the
ParaView source under \$WM_THIRD_PARTY_DIR
USAGE
exit 1
}
# add options based on script name:
case "$Script" in *-mpi*) WITH_MPI=ON;; esac
case "$Script" in *-python*) WITH_PYTHON=ON;; esac
case "$Script" in *-mesa*) WITH_MESA=ON;; esac
runCONFIG=true
runMAKE=true
runMAKEDOC=true
runINSTALL=true
runENVPATH=false
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-config) # stage 1: config only
runCONFIG=true
runMAKE=false
runMAKEDOC=false
runINSTALL=false
shift
;;
-make) # stage 2: make only
runCONFIG=false
runMAKE=true
runMAKEDOC=false
runINSTALL=false
shift
;;
-makedoc) # stage 3: generate html documentation
runCONFIG=false
runMAKE=false
runMAKEDOC=true
runINSTALL=false
shift
;;
-install) # stage 4: install only
runCONFIG=false
runMAKE=false
runMAKEDOC=false
runINSTALL=true
shift
;;
-envpath) # optional: change cmake files to use env variables
runCONFIG=false
runMAKE=false
runMAKEDOC=false
runINSTALL=false
runENVPATH=true
shift
;;
-fast) # shortcut for rebuild
runCONFIG=false
runMAKE=true
runMAKEDOC=false
runINSTALL=true
shift
;;
-mpi)
WITH_MPI=ON
shift
;;
-python)
WITH_PYTHON=ON
shift
;;
-mesa)
WITH_MESA=ON
shift
;;
-verbose)
VERBOSE=ON
shift
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
# Set configure options
#~~~~~~~~~~~~~~~~~~~~~~
addVerbosity # verbose makefiles
addMpiSupport # set MPI-specific options
addPythonSupport # set Python-specific options
addMesaSupport # set MESA-specific options
getPaths # discover where things are or should be put
# Build and install
# ~~~~~~~~~~~~~~~~~
[ $runCONFIG = true ] && configParaView
[ $runMAKE = true ] && makeParaView
[ $runENVPATH = true ] && fixCMakeFiles
[ $runMAKEDOC = true ] && makeDocs
[ $runINSTALL = true ] && installParaView
echo "done"
#------------------------------------------------------------------------------

View file

@ -1,397 +0,0 @@
#---------------------------------*- 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
# buildParaViewFunctions
#
# Description
# ParaView build/install helper functions
#
#------------------------------------------------------------------------------
# ParaView_INST_DIR : location of the original sources
# ParaView_DIR : location of the build (for the ParaViewConfig.cmake)
# and the installed program
#
# set CMake cache variables
#
addCMakeVariable()
{
while [ -n "$1" ]
do
CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
shift
done
}
#
# verbose makefiles
#
addVerbosity()
{
[ "$VERBOSE" = ON ] && addCMakeVariable CMAKE_VERBOSE_MAKEFILE=TRUE
}
#
# define options for mpi support
#
addMpiSupport()
{
[ "$WITH_MPI" = ON ] || return
OBJ_ADD="$OBJ_ADD-mpi"
addCMakeVariable PARAVIEW_USE_MPI=ON VTK_USE_MPI=ON
addCMakeVariable MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
addCMakeVariable MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
addCMakeVariable VTK_MPIRUN_EXE=$MPI_ARCH_PATH/bin/mpirun
addCMakeVariable VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS
}
#
# define options for python support
#
addPythonSupport()
{
[ "$WITH_PYTHON" = ON ] || return
OBJ_ADD="$OBJ_ADD-py"
if pythonBin=$(which python 2>/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

View file

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------

View file

@ -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
#------------------------------------------------------------------------------