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 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. # \\ / A nd | Copyright held by original author
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -39,26 +39,26 @@
if [ "$#" -gt 0 ] if [ "$#" -gt 0 ]
then then
filePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@../../..@ ) filePath=$(echo $1 | sed -e s@^$WM_PROJECT_DIR@../../..@ )
# dirName=$(echo "$filePath" | sed -e 's@/[^/]*$@@' ) # dirName=$(echo "$filePath" | sed -e 's@/[^/]*$@@' )
dirName=${filePath%/[^/]*} dirName=${filePath%/[^/]*}
fileName=${filePath##*/} fileName=${filePath##*/}
awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt.awk awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt.awk
case "$1" in case "$1" in
*/applications/solvers/*.C | */applications/utilities/*.C ) */applications/solvers/*.C | */applications/utilities/*.C )
awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-top.awk awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-top.awk
;; ;;
# */applications/solvers/*.H | */applications/utilities/*.H ) # */applications/solvers/*.H | */applications/utilities/*.H )
# awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-ignore.awk # awkScript=$WM_PROJECT_DIR/bin/tools/doxyFilt-ignore.awk
# ;; # ;;
esac esac
awk -f $awkScript $1 | \ awk -f $awkScript $1 | \
sed -f $WM_PROJECT_DIR/bin/tools/doxyFilt.sed \ sed -f $WM_PROJECT_DIR/bin/tools/doxyFilt.sed \
-e s@%filePath%@$filePath@g \ -e s@%filePath%@$filePath@g \
-e s@%fileName%@$fileName@g \ -e s@%fileName%@$fileName@g \
-e s@%dirName%@$dirName@g -e s@%dirName%@$dirName@g
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -24,47 +24,43 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# buildParaView # engridFoam
# #
# Description # Description
# Build and install ParaView # start engrid using the paraview libraries from OpenFOAM
# - run from folder above ParaView source folder or place the
# ParaView source under $WM_PROJECT_INST_DIR
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
. $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" * start engrid using the paraview-$ParaView_VERSION libraries
PARAVIEW_MAJOR_VERSION="3.3" passes through engrid options unmodified
VERBOSE=OFF USAGE
INCLUDE_MPI=OFF exit 1
MPI_MAX_PROCS=32 }
#INCLUDE_PYTHON=OFF
INCLUDE_PYTHON=ON
PYTHON_LIBRARY="/usr/lib64/libpython2.5.so.1.0"
PYTHON_LIBRARY=""
INCLUDE_MESA=OFF
set +x # report usage
[ "$1" = "-h" -o "$1" = "-help" ] && usage
# provide a shortcut for repeated builds - use with caution # set the major version "<digits>.<digits>"
if [ "$#" -gt 0 ] ParaView_MAJOR_VERSION=$(echo $ParaView_VERSION | \
then sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/')
CMAKE_SKIP=YES
fi
initialiseVariables
addMpiSupport # set MPI specific options bindir=$WM_THIRD_PARTY_DIR/engrid/platforms/$WM_ARCH
addPythonSupport # set python specific options libdir="$ParaView_DIR/lib/paraview-$ParaView_MAJOR_VERSION"
addMesaSupport # set MESA specific options
buildParaView [ -x $bindir/engrid ] || usage "engrid executable not found in $bindir"
installParaView [ -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 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# mksquashfs dir file # finddep
# #
# Description # 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 usage: ${0##*/} <file1> ... <fileN>
mksquashfs $1 $2 -b 256K -lzmadic 256K
# -force-uid 0 -force-gid 0 * find all .dep files referring to any of <file1> ... <fileN>
# -root-owned
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 # foamAllHC
# #
# Description # 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 DEFSTATEFILE=$HOME/.OpenFOAM/foamCheckJobs.out
if [ `uname -s` = 'Linux' ]; then if [ `uname -s` = Linux ]
ECHO='echo -e' then
ECHO='echo -e'
else else
ECHO='echo' ECHO='echo'
fi 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 fi
# If an argument is supplied do not execute ./Allclean to avoid recursion # If an argument is supplied do not execute ./Allclean to avoid recursion
if [ $# = 0 -a -f "./Allclean" ] if [ $# = 0 -a -f Allclean ]
then then
# Specialised script. # Specialised script.
./Allclean ./Allclean
elif [ -d "./system" ] elif [ -d system ]
then then
# Normal case. # Normal case.
cleanCase cleanCase
elif [ -d "./Make" ] elif [ -d Make ]
then then
# Normal application. # Normal application.
cleanApplication cleanApplication
else else
# Recurse to subdirectories # Recurse to subdirectories
for case in * for caseDir in *
do do
if [ -d $case ] ( cd $caseDir 2>/dev/null && $thisScript )
then
(cd $case && $thisScript)
fi
done done
fi fi

View file

@ -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 # foamClearPolyMesh
# #
# Description # 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 usage: ${0##*/} [-case dir] [-region name]
echo "there is constant/polyMesh";
cd constant/polyMesh
elif [ -d polyMesh ]; then Remove the contents of the constant/polyMesh directory
echo "there is polyMesh"; as per the Foam::polyMesh::removeFiles() method.
cd polyMesh
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 else
echo "in polyMesh directory"; meshDir=polyMesh
fi 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 # foamEbrowse
# #
# Description # 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.$$ sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then
echo "Usage : ${0##*/}" echo "Usage : ${0##*/}"
echo "" 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 "" echo ""
exit 1 exit 1
fi 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 # 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##*/} Script=${0##*/}
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [OPTION] <application> ... usage: ${0##*/} [OPTION] <application> ...
options: options:
-v ver specify OpenFOAM version -v ver specify OpenFOAM version
@ -52,16 +52,17 @@ options:
* run a particular OpenFOAM version of <application> * run a particular OpenFOAM version of <application>
USAGE USAGE
exit 1 exit 1
} }
# This script should exist in <foamInstall>/OpenFOAM-<VERSION>/bin/ # This script should exist in <foamInstall>/OpenFOAM-<VERSION>/bin/
# extract the <foamInstall> and <version> elements # extract the <foamInstall> and <version> elements
# using a function preserves the command args # using a function preserves the command args
getDefaults() { getDefaults() {
set -- $(echo $0 | sed -e 's@/OpenFOAM-\([^/]*\)/bin/[^/]*$@ \1@') set -- $(echo $0 | sed -e 's@/OpenFOAM-\([^/]*\)/bin/[^/]*$@ \1@')
foamInstall=$1 foamInstall=$1
version=$2 version=$2
} }
getDefaults getDefaults
@ -69,72 +70,60 @@ getDefaults
# parse options # parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help) -h | -help)
usage usage
;; ;;
-v) -v)
shift shift
version=$1 version=$1
shift shift
;; ;;
--) --)
shift shift
break break
;; ;;
-*) -*)
usage "invalid option '$1'" usage "invalid option '$1'"
;; ;;
*) *)
break break
;; ;;
esac esac
done done
if [ "$#" -lt 1 ]; then if [ "$#" -lt 1 ]
usage "no application specified" then
usage "no application specified"
fi fi
unset foamDotFile unset foamDotFile
# Check user-specific OpenFOAM bashrc file # Check user-specific OpenFOAM bashrc file
for subDir in \ foamDotFile="$HOME/.OpenFOAM/$version/bashrc"
$HOME/.OpenFOAM-$version \ if [ -f $foamDotFile ]
$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 ]
then then
for FOAM_INST_DIR in $foamInstall $WM_PROJECT_INST_DIR . $foamDotFile
do foamDotFile=okay
for subDir in \ else
OpenFOAM-$version/etc \ # Use the FOAM_INST_DIR variable for locating the installed version
OpenFOAM-$version/.OpenFOAM-$version \ for FOAM_INST_DIR in $foamInstall $WM_PROJECT_INST_DIR
; do
do foamDotFile="$FOAM_INST_DIR/OpenFOAM-$version/etc/bashrc"
foamDotFile="$FOAM_INST_DIR/$subDir/bashrc" if [ -f $foamDotFile ]
if [ -f $foamDotFile ]; then then
. $foamDotFile . $foamDotFile
foamDotFile=okay foamDotFile=okay
break 2 break
fi fi
done done
done
fi fi
if [ "$foamDotFile" != okay ];
if [ "$foamDotFile" != okay ]
then then
echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2 echo "Error : bashrc file could not be found for OpenFOAM-$version" 1>&2
exit 1 exit 1
fi fi
# Pass on the rest of the arguments # Pass on the rest of the arguments

View file

@ -33,9 +33,9 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Base settings # Base settings
FOAM_VERSION=1.5-dev FOAM_VERSION=1.6-ext
SUPPLIED_VERSION_GCC=4.3.1 SUPPLIED_VERSION_GCC=4.3.3
MIN_VERSION_GCC=4.2.0 MIN_VERSION_GCC=4.3.1
# General # General
WIDTH=20 WIDTH=20
@ -46,10 +46,8 @@ CRITICALERROR=0
SSHRSHOK=0 SSHRSHOK=0
# System variables # System variables
USER_SHELL=`basename $SHELL`
HOST_NAME=`uname -n` HOST_NAME=`uname -n`
OS=`uname -s` OS=`uname -s`
OS_VERSION=`uname -r`
USER_NAME=$LOGNAME USER_NAME=$LOGNAME
if [ ! -n $USER_NAME ]; then if [ ! -n $USER_NAME ]; then
USER_NAME=$USER USER_NAME=$USER
@ -92,7 +90,7 @@ length () {
stringLength () { stringLength () {
echo $1 | wc -m | tr -d " " echo $1 | wc -m | tr -d " "
} }
@ -125,7 +123,7 @@ reportEnv () {
SunOS) SunOS)
if /usr/bin/test -e $EXP_ENV ; then if /usr/bin/test -e $EXP_ENV ; then
EXISTS=" yes " EXISTS=" yes "
if [ "$2" != "noPath" ]; then if [ "$2" != noPath ]; then
ON_PATH=" no " ON_PATH=" no "
OLD_IFS=$IFS OLD_IFS=$IFS
IFS=':' IFS=':'
@ -152,7 +150,7 @@ reportEnv () {
*) *)
if [ -e "$EXP_ENV" ] ; then if [ -e "$EXP_ENV" ] ; then
EXISTS=" yes " EXISTS=" yes "
if [ "$2" != "noPath" ]; then if [ "$2" != noPath ]; then
ON_PATH=" no " ON_PATH=" no "
OLD_IFS=$IFS OLD_IFS=$IFS
IFS=':' IFS=':'
@ -182,10 +180,10 @@ reportEnv () {
fi fi
ERROR="false" ERROR="false"
if [ "$EXISTS" = "no" ] || [ "$ON_PATH" = "no" ]; then if [ "$EXISTS" = no ] || [ "$ON_PATH" = no ]; then
ERROR="true" ERROR="true"
fi fi
if [ "$3" = "yes" ] && [ "$ERROR" = "true" ]; then if [ "$3" = yes ] && [ "$ERROR" = true ]; then
CRITICALERROR=`expr $CRITICALERROR + 1` CRITICALERROR=`expr $CRITICALERROR + 1`
echo "WARNING: CRITICAL ERROR" echo "WARNING: CRITICAL ERROR"
echo echo
@ -254,7 +252,7 @@ reportExecutable () {
;; ;;
gcc) gcc)
VERSION=`$1 -v 2>&1 \ VERSION=`$1 -v 2>&1 \
| grep 'version' \ | grep 'gcc version' \
| cut -d" " -f3` | cut -d" " -f3`
if [ ! "$VERSION" = "$SUPPLIED_VERSION_GCC" ]; then if [ ! "$VERSION" = "$SUPPLIED_VERSION_GCC" ]; then
echo "WARNING: gcc version does not match gcc supplied" \ echo "WARNING: gcc version does not match gcc supplied" \
@ -312,9 +310,9 @@ pingTest () {
case $OS in case $OS in
SunOS) SunOS)
PINGTEST=`/usr/sbin/ping $1 2>&1` PINGTEST=`/usr/sbin/ping $1 2>&1`
if [ "`echo $PINGTEST | grep "alive"`" != "" ] ; then if [ "`echo $PINGTEST | grep alive`" != "" ] ; then
RESULT="Successful" RESULT="Successful"
elif [ "`echo $PINGTEST | grep "unknown host"`" != "" ] ; then elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then
RESULT="No_entry_for_\"$1\"_in_/etc/hosts" RESULT="No_entry_for_\"$1\"_in_/etc/hosts"
else else
RESULT="Networking_cannot_reach_$1" RESULT="Networking_cannot_reach_$1"
@ -322,9 +320,9 @@ pingTest () {
;; ;;
*) *)
PINGTEST=`/bin/ping -w 3 -c 1 $1 2>&1` 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" RESULT="Successful"
elif [ "`echo $PINGTEST | grep "unknown host"`" != "" ] ; then elif [ "`echo $PINGTEST | grep 'unknown host'`" != "" ] ; then
RESULT="No_entry_for_\"$1\"_in_/etc/hosts" RESULT="No_entry_for_\"$1\"_in_/etc/hosts"
else else
RESULT="Networking_cannot_reach_$1" RESULT="Networking_cannot_reach_$1"
@ -334,7 +332,7 @@ pingTest () {
echo "`fixlen "Pinging_$1" 25` `fixlen "$RESULT" 45` `fixlen "$2" 5`" 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` CRITICALERROR=`expr $CRITICALERROR + 1`
echo "WARNING: CRITICAL ERROR" echo "WARNING: CRITICAL ERROR"
echo echo
@ -351,7 +349,7 @@ EOF
checkTelnetPort () { 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]"` RESULT=`telnetPortTest $1 $2 2>&1 | egrep "onnect.* [t|r]"`
if [ "`echo $RESULT | grep 'Connected to'`" ] ; then if [ "`echo $RESULT | grep 'Connected to'`" ] ; then
RESULT='Successful' RESULT='Successful'
@ -361,7 +359,7 @@ checkTelnetPort () {
RESULT="Not_active*" RESULT="Not_active*"
fi fi
else else
RESULT='No_telnet_running:_cannot_check*' RESULT='No_telnet_installed:_cannot_check*'
fi fi
} }
@ -369,7 +367,7 @@ checkTelnetPort () {
checkRsh () { checkRsh () {
checkTelnetPort $HOST_NAME 222 checkTelnetPort $HOST_NAME 222
echo "`fixlen "Test_rsh:" 25` `fixlen "$RESULT" 45` "yes"" echo "`fixlen "Test_rsh:" 25` `fixlen "$RESULT" 45` "yes""
if [ "$RESULT" != 'Successful' ]; then if [ "$RESULT" != Successful ]; then
SSHRSHOK=`expr $SSHRSHOK + 1` SSHRSHOK=`expr $SSHRSHOK + 1`
fi fi
} }
@ -378,14 +376,14 @@ checkRsh () {
checkSsh () { checkSsh () {
checkTelnetPort $HOST_NAME 22 checkTelnetPort $HOST_NAME 22
echo "`fixlen "Test_ssh:" 25` `fixlen "$RESULT" 45` "yes"" echo "`fixlen "Test_ssh:" 25` `fixlen "$RESULT" 45` "yes""
if [ "$RESULT" != 'Successful' ]; then if [ "$RESULT" != Successful ]; then
SSHRSHOK=`expr $SSHRSHOK + 1` SSHRSHOK=`expr $SSHRSHOK + 1`
fi fi
} }
checkOpenFOAMEnvironment() { 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 ""
echo "FATAL ERROR: OpenFOAM environment not configured." echo "FATAL ERROR: OpenFOAM environment not configured."
echo "" echo ""
@ -394,22 +392,23 @@ checkOpenFOAMEnvironment() {
echo " to source the OpenFOAM environment." echo " to source the OpenFOAM environment."
echo "" echo ""
exit 1 exit 1
fi }
} }
checkUserShell() { checkUserShell() {
case $USER_SHELL in case $SHELL in
csh | tcsh) */csh | */tcsh)
USER_CONFIG_TYPE="cshrc" # USER_CONFIG_TYPE="cshrc"
echo "`fixlen "Shell:" $WIDTH` ${USER_SHELL}" echo "`fixlen "Shell:" $WIDTH` ${SHELL##*/}"
;; ;;
bash | ksh) */bash | */ksh)
USER_CONFIG_TYPE="bashrc" # USER_CONFIG_TYPE="bashrc"
echo "`fixlen "Shell:" $WIDTH` ${USER_SHELL}" 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 "FATAL ERROR: Cannot identify the shell you are running."
echo " OpenFOAM ${FOAM_VERSION} is compatible with " echo " OpenFOAM ${FOAM_VERSION} is compatible with "
echo " csh, tcsh, ksh and bash." echo " csh, tcsh, ksh and bash."
@ -435,15 +434,18 @@ checkHostName() {
checkOS () { checkOS () {
if [ "$OS" = "Linux" ] || [ "$OS" = "LinuxAMD64" ] || [ "$OS" = "SunOS" ]; then case "$OS" in
echo "`fixlen "OS:" $WIDTH` ${OS} version ${OS_VERSION}" Linux | LinuxAMD64 | SunOS )
else echo "`fixlen "OS:" $WIDTH` ${OS} version $(uname -r)"
;;
*)
echo "FATAL ERROR: Incompatible operating system \"$OS\"." echo "FATAL ERROR: Incompatible operating system \"$OS\"."
echo " OpenFOAM ${FOAM_VERSION} is currently " echo " OpenFOAM ${FOAM_VERSION} is currently "
echo " available for Linux and SunOS only." echo " available for Linux and SunOS only."
echo echo
FATALERROR=`expr $FATALERROR + 1` FATALERROR=`expr $FATALERROR + 1`
fi ;;
esac
} }
@ -485,6 +487,7 @@ hline
reportEnv '$WM_PROJECT_DIR' '$PATH' "yes" reportEnv '$WM_PROJECT_DIR' '$PATH' "yes"
echo "" echo ""
reportEnv '$FOAM_APPBIN' '$PATH' "yes" reportEnv '$FOAM_APPBIN' '$PATH' "yes"
reportEnv '$FOAM_SITE_APPBIN' '$PATH' "no"
reportEnv '$FOAM_USER_APPBIN' '$PATH' "no" reportEnv '$FOAM_USER_APPBIN' '$PATH' "no"
reportEnv '$WM_DIR' '$PATH' "yes" reportEnv '$WM_DIR' '$PATH' "yes"
hline hline
@ -495,6 +498,7 @@ hline
echo "$COL1 $COL2 $COL3 $COL4 $COL5" echo "$COL1 $COL2 $COL3 $COL4 $COL5"
hline hline
reportEnv '$FOAM_LIBBIN' '$LD_LIBRARY_PATH' "yes" reportEnv '$FOAM_LIBBIN' '$LD_LIBRARY_PATH' "yes"
reportEnv '$FOAM_SITE_LIBBIN' '$LD_LIBRARY_PATH' "no"
reportEnv '$FOAM_USER_LIBBIN' '$LD_LIBRARY_PATH' "no" reportEnv '$FOAM_USER_LIBBIN' '$LD_LIBRARY_PATH' "no"
reportEnv '$MPI_ARCH_PATH' '$LD_LIBRARY_PATH' "yes" reportEnv '$MPI_ARCH_PATH' '$LD_LIBRARY_PATH' "yes"
hline hline
@ -509,7 +513,7 @@ echo "$COL1 $COL2 $COL3"
hline hline
reportExecutable gcc "${WM_COMPILER_DIR}/bin/gcc" reportExecutable gcc "${WM_COMPILER_DIR}/bin/gcc"
reportExecutable gzip reportExecutable gzip
if [ "$OS" = "Linux" ] ; then if [ "$OS" = Linux ] ; then
reportExecutable tar reportExecutable tar
else else
reportExecutable gtar reportExecutable gtar
@ -519,32 +523,9 @@ reportExecutable icoFoam "${FOAM_APPBIN}/icoFoam"
hline hline
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
heading "Checking networking..." heading "Summary"
COL1=`fixlen "Action" 25`
COL2=`fixlen "Result" 45`
COL3=`fixlen "Crit" 5`
hline
echo "$COL1 $COL2 $COL3"
hline 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 if [ $FATALERROR -gt 0 ] ; then
echo "The system test has evoked $FATALERROR fatal error(s)." echo "The system test has evoked $FATALERROR fatal error(s)."
else else

View file

@ -29,13 +29,11 @@
# Description # Description
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/}
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [OPTION] <application> ... usage: ${0##*/} [OPTION] <application> ...
options: options:
-case dir specify case directory -case dir specify case directory
@ -108,9 +106,9 @@ do
usage usage
;; ;;
-case) -case)
shift [ "$#" -ge 2 ] || usage "'-case' option requires an argument"
caseDir=$1 caseDir=$2
[ "$#" -ge 1 ] || usage "'-case' option requires an argument" shift 2
cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'"
;; ;;
-s) -s)
@ -206,24 +204,6 @@ else
# #
echo "Parallel processing using $WM_MPLIB with $NPROCS processors" echo "Parallel processing using $WM_MPLIB with $NPROCS processors"
case "$WM_MPLIB" in 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) OPENMPI)
# add hostfile info # add hostfile info
for hostfile in \ for hostfile in \

View file

@ -30,15 +30,13 @@
# Create a new standard OpenFOAM source file # Create a new standard OpenFOAM source file
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/}
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script <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) type: (source|template)
@ -46,23 +44,26 @@ USAGE
exit 1 exit 1
} }
if [ "$#" -lt 1 ]; then if [ "$#" -lt 2 ]
usage "wrong number of arguments, expected 2 (or more)" then
usage "wrong number of arguments, expected 2 (or more)"
fi fi
case "$1" in case "$1" in
source) -h | -help)
shift usage
$WM_PROJECT_DIR/bin/foamTemplates/source/newSource $* ;;
;; source)
template) shift
shift $WM_PROJECT_DIR/bin/foamTemplates/source/newSource $*
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $* ;;
;; template)
shift
$WM_PROJECT_DIR/bin/foamTemplates/sourceTemplate/newSourceTemplate $*
;;
*) *)
usage "unknown type" usage "unknown type"
;; ;;
esac esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -38,19 +38,20 @@ packFile=${packDir}_${timeStamp}.tgz
if [ ! -d $packDir ] if [ ! -d $packDir ]
then then
echo "Error: directory $packDir does not exist" echo "Error: directory $packDir does not exist" 1>&2
exit 1 exit 1
fi fi
# add optional output directory # add optional output directory
if [ -d "$1" ]; then if [ -d "$1" ]
packFile="$1/$packFile" then
packFile="$1/$packFile"
fi fi
if [ -f $packFile ] if [ -f $packFile ]
then then
echo "Error: $packFile already exists" echo "Error: $packFile already exists" 1>&2
exit 1 exit 1
fi fi
# Create time stamp file # Create time stamp file
@ -88,8 +89,10 @@ find -H $packDir \
-e "\@$packDir/.git/@d" \ -e "\@$packDir/.git/@d" \
-e "\@.svn/@d" \ -e "\@.svn/@d" \
-e "\@$packDir/lib/@d" \ -e "\@$packDir/lib/@d" \
-e '\@applications/bin/@d' \ -e '\@/\.git/@d' \
-e '\@/t/@d' \ -e '\@applications/bin/@d' \
-e '\@wmake/bin/@d' \
-e '\@/t/@d' \
-e '\@Make[.A-Za-z]*/[^/]*/@d' \ -e '\@Make[.A-Za-z]*/[^/]*/@d' \
-e '\@doc/[Dd]oxygen/html@d' \ -e '\@doc/[Dd]oxygen/html@d' \
-e '\@doc/[Dd]oxygen/latex@d' \ -e '\@doc/[Dd]oxygen/latex@d' \
@ -100,12 +103,12 @@ find -H $packDir \
tar czpf $packFile --files-from $tmpFile tar czpf $packFile --files-from $tmpFile
if [ $? = 0 ] if [ $? -eq 0 ]
then then
echo "Finished packing and compressing $packDir into file $packFile" echo "Finished packing and compressing $packDir into file $packFile"
else else
echo "Error: failure packing $packDir into file $packFile" echo "Error: failure packing $packDir into file $packFile" 1>&2
rm -f $packFile 2>/dev/null rm -f $packFile 2>/dev/null
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -30,113 +30,71 @@
# Packs and compresses binary version of OpenFOAM for release # Packs and compresses binary version of OpenFOAM for release
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$
# if [ $# -eq 0 ]
# FUNCTIONS then
# echo "Error: architecture type expected, exiting"
printUsage () { echo
cat <<EOF echo "Usage : ${0##*/} <arch> [outputDir]"
Usage : ${0##*/} [-l] <arch> [outputDir]" echo
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
exit 1 exit 1
fi 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 arch=$1
if [ $LZM ]; then # base arch (w/o precision, optimization, etc)
packFile=${packDir}.${arch}_${timeStamp}.lzm baseArch=$(echo "$arch" | sed -e 's@[DS]P.*$@@')
else
packFile=${packDir}.${arch}_${timeStamp}.tgz timeStamp=$(date +%Y-%m-%d)
fi packDir=$WM_PROJECT-$WM_PROJECT_VERSION
packFile=${packDir}.${arch}_${timeStamp}.gtgz
# add optional output directory # add optional output directory
if [ -d "$2" ]; then if [ -d "$2" ]
packFile="$2/$packFile" then
packFile="$2/$packFile"
fi fi
if [ -f $packFile ]; then if [ -f $packFile ]
echo "Error: $packFile already exists" then
exit 1 echo "Error: $packFile already exists"
exit 1
fi fi
# check for essential directories # check for essential directories
for dir in $packDir $packDir/lib/$arch $packDir/applications/bin/$arch for dir in $packDir $packDir/lib/$arch $packDir/applications/bin/$arch
do do
if [ ! -d $dir ]; then if [ ! -d $dir ]
echo "Error: directory $dir does not exist" then
exit 1 echo "Error: directory $dir does not exist"
fi exit 1
fi
done done
# get list of directories # get list of directories
dirList=$( dirList=$(
for dir in \ for dir in \
$packDir/lib/$arch \ $packDir/lib/$arch \
$packDir/applications/bin/$arch \ $packDir/applications/bin/$arch \
$packDir/wmake/rules \ $packDir/wmake/rules \
; $packDir/wmake/bin/$baseArch \
do ;
[ -d $dir ] && echo $dir do
done [ -d $dir ] && echo $dir
done
) )
echo echo
echo "Packing $arch port of $packDir into $packFile" echo "Packing $arch ($baseArch) port of $packDir into $packFile"
echo echo
if [ $LZM ]; then tar czpf $packFile $dirList
# Clean up on termination and on Ctrl-C if [ $? -eq 0 ]
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 ]
then then
echo "Finished packing and compressing file $packFile" echo "Finished packing and compressing file $packFile"
else else
echo "Error: failure packing $packFile" echo "Error: failure packing $packFile"
rm -f $packFile 2>/dev/null rm -f $packFile 2>/dev/null
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -27,20 +27,21 @@
# foamPackBinAll [outputDir] # foamPackBinAll [outputDir]
# #
# Description # 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 packDir=$WM_PROJECT-$WM_PROJECT_VERSION
if [ ! -d $packDir ] if [ ! -d $packDir ]
then then
echo "Error: directory $packDir does not exist" echo "Error: directory $packDir does not exist"
exit 1 exit 1
fi fi
# obtain arch types from lib/
for bin in $packDir/lib/* for bin in $packDir/lib/*
do do
foamPackBin ${bin##*/} $@ foamPackBin ${bin##*/} $@
done 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) timeStamp=$(date +%Y-%m-%d)
packDir=$WM_PROJECT-$WM_PROJECT_VERSION packDir=$WM_PROJECT-$WM_PROJECT_VERSION
packFile=${packDir}.General_${timeStamp}.tgz packFile=${packDir}.General_${timeStamp}.tgz
LZMOPT=""
# if [ ! -d $packDir ]
# OPTIONS then
# echo "Error: directory $packDir does not exist"
OPTS=`getopt hl $*`
if [ $? -ne 0 ] ; then
echo "Error: Aborting due to invalid option"
printUsage;
exit 1 exit 1
fi 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 # add optional output directory
if [ -d "$1" ]; then if [ -d "$1" ]
packFile="$1/$packFile" then
packFile="$1/$packFile"
fi fi
if [ -f $packFile ]; then if [ -f $packFile ]
echo "Error: $packFile already exists" then
exit 1 echo "Error: $packFile already exists"
exit 1
fi fi
# Create time stamp file # Create time stamp file
@ -86,9 +62,9 @@ echo $timeStamp 2>/dev/null > $packDir/.timeStamp
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo echo
echo "Packing $packDir into $packFile" echo "Packing $packDir source files into $packFile"
echo echo
foamPackSource $LZMOPT $packDir $packFile foamPackSource $packDir $packFile
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -32,56 +32,31 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$ tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$
tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$
# if [ $# -ne 2 ]
# FUNCTIONS then
# echo "Usage : ${0##*/} directory tarFile"
printUsage () { echo ""
cat <<EOF echo "Packs all .C and .H files and Make/options and Make/files into"
Usage : ${0##*/} directory tarFile echo "<tarFile>"
echo ""
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;
exit 1 exit 1
fi 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) # canonical form (no double and no trailing dashes)
packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@') packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@')
packFile=$2 packFile=$2
if [ ! -d $packDir ]; then if [ ! -d $packDir ]
echo "Error: directory $packDir does not exist" then
exit 1 echo "Error: directory $packDir does not exist"
exit 1
fi fi
if [ -f $packFile ]; then if [ -f $packFile ]
echo "Error: $packFile already exists" then
exit 1 echo "Error: $packFile already exists"
exit 1
fi fi
# Clean up on termination and on Ctrl-C # Clean up on termination and on Ctrl-C
@ -107,36 +82,29 @@ find -H $packDir \
-e "\@$packDir/.git/@d" \ -e "\@$packDir/.git/@d" \
-e "\@.svn/@d" \ -e "\@.svn/@d" \
-e "\@$packDir/lib/@d" \ -e "\@$packDir/lib/@d" \
-e '\@/\.git/@d' \
-e '\@/\.tags/@d' \
-e '\@applications/bin/@d' \ -e '\@applications/bin/@d' \
-e '\@wmake/bin/@d' \
-e '\@/t/@d' \ -e '\@/t/@d' \
-e '\@/Make[.A-Za-z]*/[^/]*/@d'\ -e '\@/Make[.A-Za-z]*/[^/]*/@d'\
-e '\@/platforms/@d' \ -e '\@/platforms/@d' \
-e '\@libccmio.*/@d' \
-e '\@/.svn/@d' \ -e '\@/.svn/@d' \
> $tmpFile > $tmpFile
if [ $LZM ]; then
# Clean up on termination and on Ctrl-C # provide some feedback
trap 'rm -f $tmpFile 2>/dev/null; rm -rf $tmpDir 2>/dev/null; exit 0' EXIT TERM INT wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}'
mkdir $tmpDir $tmpDir/OpenFOAM tar czpf $packFile --files-from $tmpFile
xargs -i -a $tmpFile cp -al --parents {} $tmpDir/OpenFOAM
chmod -R a+rX $tmpDir/OpenFOAM if [ $? -eq 0 ]
foamDir2lzm $tmpDir $packFile then
echo; echo
else
tar czpf $packFile --files-from $tmpFile
fi
if [ $? = 0 ]; then
echo "Finished packing and compressing $packDir into file $packFile" echo "Finished packing and compressing $packDir into file $packFile"
else else
echo "Error: failure packing $packDir into file $packFile" echo "Error: failure packing $packDir into file $packFile"
rm -f $packFile 2>/dev/null rm -f $packFile 2>/dev/null
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

@ -30,72 +30,44 @@
# Packs and compresses binary version of OpenFOAM ThirdParty for release # Packs and compresses binary version of OpenFOAM ThirdParty for release
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
tmpDir=${TMPDIR:-/tmp}/foamPackDir.$$
# if [ $# -eq 0 ]
# FUNCTIONS then
# echo "Error: archOptions type expected, exiting"
printUsage () { echo
cat <<EOF echo "Usage : ${0##*/} <archOptions> [outputDir]"
Usage : ${0##*/} [-l] <archOptions> [outputDir]" echo
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
exit 1 exit 1
fi 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 archOptions=$1
arch=${archOptions%%G*} arch=${archOptions%%G*} # TODO: works for Gcc only
arch3264=$(echo "$arch" | sed 's@64@-64@') arch3264=$(echo "$arch" | sed -e 's@64@-64@')
echo "archOptions=$archOptions" echo "archOptions=$archOptions"
echo "arch=$arch" echo "arch=$arch"
echo "arch3264=$arch3264" echo "arch3264=$arch3264"
timeStamp=$(date +%Y-%m-%d) timeStamp=$(date +%Y-%m-%d)
packDir=ThirdParty packDir=${WM_THIRD_PARTY_DIR:-ThirdParty}
packDir=${packDir##*/}
packFile=${packDir}.${archOptions}_${timeStamp}.tgz
if [ $LZM ]; then if [ ! -d $packDir ]
packFile=${packDir}.${arch}_${timeStamp}.lzm then
else echo "Error: directory $packDir does not exist"
packFile=${packDir}.${arch}_${timeStamp}.tgz exit 1
fi fi
# add optional output directory # add optional output directory
if [ -d "$2" ] if [ -d "$2" ]
then then
packFile="$2/$packFile" packFile="$2/$packFile"
fi fi
if [ -f $packFile ] if [ -f $packFile ]
then then
echo "Error: $packFile already exists" echo "Error: $packFile already exists"
exit 1 exit 1
fi fi
# get list of directories # get list of directories
@ -104,28 +76,14 @@ echo
echo "Packing $archOptions port of $packDir into $packFile" echo "Packing $archOptions port of $packDir into $packFile"
echo echo
if [ $LZM ]; then tar czpf $packFile $dirList
# Clean up on termination and on Ctrl-C if [ $? -eq 0 ]
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 ]
then then
echo "Finished packing and compressing file $packFile" echo "Finished packing and compressing file $packFile"
else else
echo "Error: failure packing $packFile" echo "Error: failure packing $packFile"
rm -f $packFile 2>/dev/null rm -f $packFile 2>/dev/null
fi 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) timeStamp=$(date +%Y-%m-%d)
packDir=ThirdParty packDir=${WM_THIRD_PARTY_DIR:-ThirdParty}
packDir=${packDir##*/}
packFile=${packDir}.General_${timeStamp}.tgz packFile=${packDir}.General_${timeStamp}.tgz
LZMOPT=""
# if [ ! -d $packDir ]
# OPTIONS then
# echo "Error: directory $packDir does not exist"
OPTS=`getopt hl $*`
if [ $? -ne 0 ] ; then
echo "Error: Aborting due to invalid option"
printUsage;
exit 1 exit 1
fi 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 # add optional output directory
if [ -d "$1" ]; then if [ -d "$1" ]
packFile="$1/$packFile" then
packFile="$1/$packFile"
fi fi
if [ -f $packFile ]; then if [ -f $packFile ]
echo "Error: $packFile already exists" then
exit 1 echo "Error: $packFile already exists"
exit 1
fi fi
# Create time stamp file # Create time stamp file
@ -86,9 +63,9 @@ echo $timeStamp 2>/dev/null > $packDir/.timeStamp
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo echo
echo "Packing $packDir into $packFile" echo "Packing $packDir source files into $packFile"
echo echo
foamPackSource $LZMOPT $packDir $packFile foamPackSource $packDir $packFile
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View file

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

View file

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

View file

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

View file

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

View file

@ -24,48 +24,42 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
# Script # Script
# buildParaView # foamTags
# #
# Description # Description
# Build and install ParaView # Build the tags files for all the .C and .H files
# - 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 if [ $# -ne 0 ]; then
echo "Usage : ${0##*/}"
PARAVIEW_SRC="paraview-2.4.4" echo ""
PARAVIEW_MAJOR_VERSION="2.4" echo "Build the tags files for all the .C and .H files"
echo ""
VERBOSE=OFF exit 1
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
fi fi
# set paraview environment cd $WM_PROJECT_DIR
PARAVIEW_SRC_DIR=$PWD/$PARAVIEW_SRC mkdir .tags 2>/dev/null
#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 etagsCmd="etags --declarations -l c++ -o .tags/etags -"
addPythonSupport # set python specific options #etagsDefCmd="etags -l c++ -o .tags/etagsDef -"
addMesaSupport # set MESA specific options #etagsDecCmd="etags --declarations -l c++ -o .tags/etagsDec -"
buildParaView etagsCmd="ectags -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -"
installParaView 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[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H"
#include "createTime.H"
# include "setRootCase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "createTime.H"
Info << "End\n" << endl; Info << "End\n" << endl;

View file

@ -31,9 +31,15 @@ License
const dataType Foam::className::staticData(); const dataType Foam::className::staticData();
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::className::className() 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) 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 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
className Foam::className
Description Description
Author
SourceFiles SourceFiles
classNameI.H classNameI.H
className.C className.C
@ -57,7 +55,7 @@ Ostream& operator<<(Ostream&, const className&);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class className Declaration Class className Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class className class className
@ -66,6 +64,7 @@ class className
{ {
// Private data // Private data
//- Description of data_
dataType data_; dataType data_;
@ -82,7 +81,7 @@ public:
// Static data members // Static data members
//- Static data someStaticData //- Static data staticData
static const dataType staticData; static const dataType staticData;
@ -107,9 +106,8 @@ public:
static autoPtr<className> New(); static autoPtr<className> New();
// Destructor //- Destructor
~className();
~className();
// Member Functions // 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 * create a new standard OpenFOAM source file
type: (C|H|I|IO|App|cfg) type: (C|H|I|IO|App)
USAGE USAGE
exit 1 exit 1
@ -74,10 +74,6 @@ app|App)
wmakeFilesAndOptions wmakeFilesAndOptions
fi fi
;; ;;
cfg)
template=foamUtilTemplate
fileType=$1
;;
*) *)
usage "unknown type" usage "unknown type"
;; ;;

View file

@ -32,6 +32,9 @@ template<TemplateClassArgument>
const dataType Foam::ClassName<TemplateArgument>::staticData(); const dataType Foam::ClassName<TemplateArgument>::staticData();
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private 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> template<TemplateClassArgument>
void Foam::ClassName<TemplateArgument>::operator= 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 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
ClassName Foam::ClassName
Description Description
@ -114,8 +114,7 @@ public:
static autoPtr<ClassName<TemplateArgument> > New(); static autoPtr<ClassName<TemplateArgument> > New();
// Destructor //- Destructor
~ClassName(); ~ClassName();
@ -132,16 +131,10 @@ public:
// IOstream Operators // IOstream Operators
friend Istream& operator>> friend Istream& operator>> <TemplateArgument>
#ifndef __CINT__
<TemplateArgument>
#endif
(Istream&, ClassName<TemplateArgument>&); (Istream&, ClassName<TemplateArgument>&);
friend Ostream& operator<< friend Ostream& operator<< <TemplateArgument>
#ifndef __CINT__
<TemplateArgument>
#endif
(Ostream&, const ClassName<TemplateArgument>&); (Ostream&, const ClassName<TemplateArgument>&);
}; };

View file

@ -33,85 +33,111 @@
# Also removes consecutive blank lines from file. # Also removes consecutive blank lines from file.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
foamVersion=$WM_PROJECT_VERSION
# usage() {
# FUNCTIONS cat<<USAGE
#
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
Options are: Usage: ${0##*/} [OPTION] <file1> ... <fileN>
-v "<version>" specifies the version to be written in the header
-h help options:
EOF -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++ -*----------------------------------*\\ /*--------------------------------*- C++ -*----------------------------------*\\
| ========= | | | ========= | |
| \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\\\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\\\ / O peration | Version: ${1} | | \\\\ / O peration | Version: ${foamVersion} |
| \\\\ / A nd | Web: http://www.OpenFOAM.org | | \\\\ / A nd | Web: www.OpenFOAM.org |
| \\\\/ M anipulation | | | \\\\/ M anipulation | |
\\*---------------------------------------------------------------------------*/ \\*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ${2}; format ${1};
class ${3}; class ${2};
object ${4}; 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 # OPTIONS
# #
OPTS=`getopt hv: $*` opts=$(getopt hv: $*)
if [ $? -ne 0 ] ; then if [ $? -ne 0 ]
then
echo "Aborting due to invalid option" echo "Aborting due to invalid option"
printUsage usage
exit 1
fi fi
eval set -- '$OPTS' eval set -- '$opts'
while [ "$1" != "--" ]; do while [ "$1" != "--" ]
do
case $1 in case $1 in
-v) VERSION=$2; shift;; -v)
-h) printUsage; exit 1;; foamVersion=$2
shift
;;
-h)
usage
;;
esac esac
shift shift
done done
shift shift
[ $# -ge 1 ] || usage
# constant width for version
foamVersion=$(printf %-36s $foamVersion)
# #
# MAIN # MAIN
# #
CASE_FILE=$1 unset NOTE
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
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 # Upgrade the turbulenceProperties dictionary to the new format employed
# in OpenFOAM version 1.5-dev # in OpenFOAM version 1.5-dev
# - RAS turbulence models now defined by the RASProperties dictionary, # - 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, # - LES turbulence models now defined by the LESProperties dictionary,
# and LESModel keyword. # and LESModel keyword.
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
printUsage() usage() {
{ cat<<USAGE
echo "Usage: `basename $0` <turbulenceProperties>"
echo " Where <turbulenceProperties> is the full path to the" usage: ${0##*/} <turbulenceProperties>
echo " turbulenceProperties dictionary"
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() convertDict()
{ {
echo " Identified $1 turbulence model" echo "Identified $1 turbulence model in '$3'"
outputPath=`dirname $3`
sed -e "s/turbulenceProperties/$1Properties/" \ if [ -e "$outputPath/$1Properties" ]
-e "s/$2/$1Model/" \ then
-e "s/[a-zA-Z0-9]* [ ]*\[[0-9 ]*\]//" \ echo "Error: file already exists $outputPath/$1Properties'" 1>&2
$3 > "$outputPath/$1Properties" 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` [ $# -ge 1 ] || usage
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
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 # OpenFOAM is free software; you can redistribute it and/or modify it
# windows or to separate log files. # under the terms of the GNU General Public License as published by the
# Requires bash on all processors. # 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.
#------------------------------------------------------------------------------
if [ `uname -s` = Linux ]
PROGNAME=`basename $0` then
PROGDIR=`dirname $0` ECHO='echo -e'
if [ `uname -s` = 'Linux' ]; then
ECHO='echo -e'
else else
ECHO='echo' ECHO='echo'
fi fi
printUsage() { printUsage() {
echo "" echo ""
echo "Usage: $PROGNAME -np <dd> <executable> <args>" echo "Usage: ${0##*/} -np <dd> <executable> <args>"
echo "" echo ""
echo "This will run like mpirun but with each process in an xterm" echo "This will run like mpirun but with each process in an xterm"
} }
nProcs='' nProcs=''
@ -30,7 +55,8 @@ while [ "$1" != "" ]; do
echo "$1" echo "$1"
case $1 in case $1 in
-np) -np)
nProcs=$2;shift nProcs=$2
shift
;; ;;
*) *)
if [ ! "$exec" ]; then if [ ! "$exec" ]; then
@ -70,15 +96,17 @@ if [ ! -x "$exec" ]; then
exit 1 exit 1
fi 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 "Choose running method: 0)normal 1)gdb+xterm 2)gdb 3)log 4)log+xterm 5)xterm+valgrind: \c"
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"
read method 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 printUsage
exit 1 exit 1
fi fi
@ -119,41 +147,43 @@ fi
echo "**sourceFoam:$sourceFoam" echo "**sourceFoam:$sourceFoam"
rm -f $HOME/mpirun.schema rm -f $PWD/mpirun.schema
touch $HOME/mpirun.schema touch $PWD/mpirun.schema
proc=0 proc=0
xpos=0 xpos=0
ypos=0 ypos=0
for ((proc=0; proc<$nProcs; proc++)) for ((proc=0; proc<$nProcs; proc++))
do do
procCmdFile="$HOME/processor${proc}.sh" procCmdFile="$PWD/processor${proc}.sh"
procLog="processor${proc}.log" procLog="processor${proc}.log"
geom="-geometry 120x20+$xpos+$ypos" geom="-geometry 120x20+$xpos+$ypos"
node="" node=""
if [ .$WM_MPLIB = .OPENMPI ]; then if [ .$WM_MPLIB = .OPENMPI ]; then
node="-np 1 " node="-np 1 "
elif [ .$WM_MPLIB = .LAM ]; then
if [ "$spawn" -eq 2 ]; then
node="c${proc} "
fi
fi fi
echo "#!/bin/sh" > $procCmdFile echo "#!/bin/sh" > $procCmdFile
if [ "$method" -eq 1 ]; then if [ "$method" -eq 0 ]; then
echo "$sourceFoam; cd $PWD; gdb -command $HOME/gdbCommands $exec 2>&1 | tee $procLog; read dummy" >> $procCmdFile 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 "$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 elif [ "$method" -eq 2 ]; then
echo "$sourceFoam; cd $PWD; gdb -command $HOME/gdbCommands >& $procLog" >> $procCmdFile echo "$sourceFoam; cd $PWD; gdb -command $PWD/gdbCommands >& $procLog" >> $procCmdFile
echo "${node}$procCmdFile" >> $HOME/mpirun.schema echo "${node}$procCmdFile" >> $PWD/mpirun.schema
elif [ "$method" -eq 3 ]; then elif [ "$method" -eq 3 ]; then
echo "$sourceFoam; cd $PWD; $exec $args >& $procLog" >> $procCmdFile 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 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 "$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 fi
chmod +x $procCmdFile chmod +x $procCmdFile
@ -173,10 +203,32 @@ do
echo " tail -f $procLog" echo " tail -f $procLog"
done done
$ECHO "Constructed $HOME/mpirun.schema file. Press return to execute.\c" cmd=""
read dummy
if [ .$WM_MPLIB = .OPENMPI ]; then if [ .$WM_MPLIB = .OPENMPI ]; then
mpirun -app $HOME/mpirun.schema </dev/null cmd="mpirun -app $PWD/mpirun.schema </dev/null"
elif [ .$WM_MPLIB = .LAM ]; then elif [ .$WM_MPLIB = .MPICH ]; then
mpirun $HOME/mpirun.schema </dev/null 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 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 # start paraview with the OpenFOAM libraries
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
Script=${0##*/}
usage() { usage() {
while [ "$#" -ge 1 ]; do echo "$1"; shift; done while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
usage: $Script [-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 * start paraview $ParaView_VERSION with the OpenFOAM libraries
USAGE USAGE
exit 1 exit 1
} }
unset regionName touchOnly
# parse options # parse options
if [ "$#" -gt 0 ]; then while [ "$#" -gt 0 ]
case "$1" in do
-h | -help) case "$1" in
usage -h | -help)
;; usage
-case) ;;
shift -case)
caseDir=$1 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
[ "$#" -ge 1 ] || usage "'-case' option requires an argument" cd "$2" 2>/dev/null || usage "directory does not exist: '$2'"
cd "$caseDir" 2>/dev/null || usage "directory does not exist: '$caseDir'" shift 2
;; ;;
*) -region)
usage "unknown option/argument: '$*'" [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
;; regionName=$2
esac shift 2
fi ;;
-touch)
touchOnly=true
shift
;;
*)
usage "unknown option/argument: '$*'"
;;
esac
done
# get a sensible caseName # get a sensible caseName
caseName=${PWD##*/} 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 # parent directory for normal or parallel results
case "$caseName" in case "$caseName" in
processor*) parentDir=".." ;; processor*) parentDir=".." ;;
*) parentDir="." ;; *) parentDir="." ;;
esac esac
# check existence of essential files # check existence of essential files
for check in system/controlDict system/fvSchemes system/fvSolution for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution
do do
[ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'"
done done
#caseFile="$caseName.foam"
caseFile="$caseName.OpenFOAM"
case "$ParaView_VERSION" in case "$ParaView_VERSION" in
2*) 2*)
# Clean up on termination and on Ctrl-C trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT
trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT touch "$caseFile"
touch $caseFile
# since we are now in the cwd, %CASE% is '$PWD/$caseFile' # since we are now in the cwd, %CASE% is '$PWD/$caseFile'
sed -e s%CASE%$PWD/$caseFile%g \ sed -e s@%CASE%@$PWD/$caseFile@g \
$WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs $WM_PROJECT_DIR/bin/tools/paraFoam.pvs > paraFoam.pvs
paraview paraFoam.pvs paraview paraFoam.pvs
;; ;;
*) *)
# Clean up on termination and on Ctrl-C # only create/remove caseFile if it didn't already exist
trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT [ -e $caseFile ] || {
touch $caseFile trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT
paraview --data=$caseFile touch "$caseFile"
;; echo "created temporary '$caseFile'"
}
paraview --data="$caseFile"
;;
esac 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 #!/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 #!/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 #!/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 Remove all .dep files or remove .dep files referring to <file>
find . \( -name '*.dep' \) -print | xargs -t rm
elif [ $# -eq 1 ]; then USAGE
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>"
exit 1 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 fi
#------------------------------------------------------------------------------

View file

@ -1,2 +1,56 @@
#!/bin/sh #!/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 #!/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 # rm -rf ${T} > /dev/null 2>&1
# fi # fi
# done # 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 () cleanTimeDirectories ()
@ -55,15 +55,23 @@ cleanTimeDirectories ()
zeros=`printf %0${nZeros}d 0` zeros=`printf %0${nZeros}d 0`
nZeros=$(($nZeros + 1)) nZeros=$(($nZeros + 1))
done 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 () cleanCase ()
{ {
cleanTimeDirectories 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/{owner*,neighbour*,point*,edge*} \
constant/polyMesh/{cellLevel*,pointLevel*,refinementHistory*,surfaceIndex*} \
constant/{cellToRegion,cellLevel*,pointLevel*} \
constant/polyMesh/sets/ \
VTK \
> /dev/null 2>&1 > /dev/null 2>&1
for f in `find . -name "*Dict"` for f in `find . -name "*Dict"`
@ -73,13 +81,6 @@ cleanCase ()
done done
} }
cleanParallelCase ()
{
cleanCase
rm -rf processor* > /dev/null 2>&1
}
removeCase () removeCase ()
{ {
echo "Removing $case case" echo "Removing $case case"

View file

@ -1,2 +1,2 @@
Misc. tools for building applications, etc that are useful to have Misc. tools, scripts, templates that are useful (eg, for building applications)
but which don't really need to be in the PATH. 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 () runApplication ()
{ {
APP_RUN=$1; shift APP_RUN=$1; shift
APP_NAME=${APP_RUN##*/}
if [ -f log.$APP_RUN ] ; then if [ -f log.$APP_NAME ] ; then
echo "$APP_RUN already run on $PWD: remove log file to run" echo "$APP_NAME already run on $PWD: remove log file to run"
else else
echo "Running $APP_RUN on $PWD" echo "Running $APP_RUN on $PWD"
$APP_RUN $* > log.$APP_RUN 2>&1 $APP_RUN $* > log.$APP_NAME 2>&1
fi fi
} }
@ -48,18 +54,8 @@ runParallel ()
if [ -f $log.$APP_RUN ] ; then if [ -f $log.$APP_RUN ] ; then
echo "$APP_RUN already run on $PWD: remove log file to run" echo "$APP_RUN already run on $PWD: remove log file to run"
else 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" echo "Running $APP_RUN in parallel on $PWD using $1 processes"
( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 ) ( mpirun -np $1 $APP_RUN -parallel < /dev/null > log.$APP_RUN 2>&1 )
if [ "$WM_MPLIB" = LAM ]
then
echo "Stopping LAM"
lamclean
fi
fi fi
} }
@ -69,12 +65,6 @@ compileApplication ()
wmake $1 wmake $1
} }
compileLibrary ()
{
echo "Compiling $1 application"
wmake libso $1
}
cloneCase () cloneCase ()
{ {
if [ -d $2 ] ; then 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 #!/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 #!/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 #!/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 #!/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
#------------------------------------------------------------------------------