Commit 658b7700 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

Conflicts:
	etc/settings.csh
	etc/settings.sh
	src/parallel/decompose/Allwmake
parents 9f5c39af fe083ad9
......@@ -2,7 +2,7 @@
#
#+TITLE: OpenFOAM README for version 1.6
#+AUTHOR: OpenCFD Ltd.
#+DATE: November 2009
#+DATE: March 2010
#+LINK: http://www.opencfd.co.uk
#+OPTIONS: author:nil ^:{}
......@@ -23,10 +23,10 @@
section "Running OpenFOAM in 32-bit mode".
*** Qt (from http://trolltech.com/products/qt)
The ParaView 3.6.1 visualisation package requires Qt to be installed on the
The ParaView 3.7.0 visualisation package requires Qt to be installed on the
system. ParaView's producers state that ParaView is only officially
supported on Qt version 4.3.x. However, we have found in limited tests that
ParaView works satisfactorily with newer versions of Qt than 4.3.x. To
supported on Qt version 4.6.x. However, we have found in limited tests that
ParaView works satisfactorily with Qt than 4.5.x. To
check whether Qt4 is installed, and the version, type:
+ qmake --version
......@@ -44,13 +44,14 @@
+ openSUSE-10.3: Version 4.3.1
+ openSUSE-11.0: Version 4.4.0
+ openSUSE-11.1: Version 4.4.3
+ openSUSE-11.2: Version 4.5.3
Compilation and running of ParaView has been successful using the libraries
downloaded in the "libqt4-dev" package on ubuntu.
If you don't have an appropriate version of Qt installed you can download
the sources from TrollTech e.g.:
ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-4.3.5.tar.bz2
the sources e.g.:
http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.2.tar.gz
and compile and install in /usr/local or some other location that does not
conflict with the pre-installed version.
......@@ -108,7 +109,7 @@
* Building from Sources (Optional)
If you cannot find an appropriate binary pack for your platform, you can build
the complete OpenFOAM from the source-pack. You will first need to compile or
obtain a recent version of gcc (we recomend gcc-4.3.?) for your platform,
obtain a recent version of gcc (we recommend gcc-4.4.?) for your platform,
which may be obtained from http://gcc.gnu.org/.
Install the compiler in
......@@ -157,16 +158,16 @@
Refer to the OpenFOAM User Guide at http://www.OpenFOAM.org/doc/user.html for
more information.
* Compiling Paraview 3.6.1 and the PV3FoamReader module
* Compiling Paraview 3.7.0 and the PV3FoamReader module
If there are problems encountered with ParaView, then it may be necessary to
compile ParaView from sources. The compilation
is a fairly simple process using the makeParaView script
(found in ThirdParty directory), which has worked in our tests with other
packages supplied in the ThirdParty directory, namely cmake-2.6.4 and
gcc-4.3.3. Execute the following:
packages supplied in the ThirdParty directory, namely cmake-2.8.0 and
gcc-4.4.3. Execute the following:
+ cd $WM_THIRD_PARTY_DIR
+ rm -rf paraview-3.6.1/platforms
+ rm -rf platforms/*/paraview-3.6.1
+ rm -rf paraview-3.7.0/platforms
+ rm -rf platforms/*/paraview-3.7.0
+ ./makeParaView
The PV3blockMeshReader and the PV3FoamReader ParaView plugins are compiled
......@@ -178,7 +179,7 @@
*** Compiling Paraview with a local version of Qt
If the user still encounters problems with ParaView, it may relate to the
version of Qt, in which case, it is recommended that the user first
downloads a supported version of Qt /e.g./ 4.3.5 as described in the section
downloads a supported version of Qt /e.g./ 4.5.3 as described in the section
on "Qt". The user should unpack the source pack in the $WM_THIRD_PARTY_DIR.
Then the user can build Qt by executing from within $WM_THIRD_PARTY_DIR:
+ ./makeQt
......
......@@ -356,8 +356,15 @@ class vtkPV3Foam
//- Zone info
void updateInfoZones(vtkDataArraySelection*);
//- Read zone names for zoneType from file
wordList readZoneNames(const word& zoneType);
//- Get non-empty zone names for zoneType from file
wordList getZoneNames(const word& zoneType) const;
//- Get non-empty zone names from mesh info
template<class ZoneType>
wordList getZoneNames
(
const ZoneMesh<ZoneType, polyMesh>&
) const;
//- Add objects of Type to paraview array selection
template<class Type>
......
......@@ -82,9 +82,31 @@ public:
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
template<class ZoneType>
Foam::wordList Foam::vtkPV3Foam::getZoneNames
(
const ZoneMesh<ZoneType, polyMesh>& zmesh
) const
{
wordList names(zmesh.size());
label nZone = 0;
forAll(zmesh, zoneI)
{
if (zmesh[zoneI].size())
{
names[nZone++] = zmesh[zoneI].name();
}
}
names.setSize(nZone);
return names;
}
Foam::wordList Foam::vtkPV3Foam::getZoneNames(const word& zoneType) const
{
wordList zoneNames;
wordList names;
// mesh not loaded - read from file
IOobject ioObj
......@@ -107,14 +129,14 @@ Foam::wordList Foam::vtkPV3Foam::readZoneNames(const word& zoneType)
{
zonesEntries zones(ioObj);
zoneNames.setSize(zones.size());
names.setSize(zones.size());
forAll(zones, zoneI)
{
zoneNames[zoneI] = zones[zoneI].keyword();
names[zoneI] = zones[zoneI].keyword();
}
}
return zoneNames;
return names;
}
......@@ -312,11 +334,11 @@ void Foam::vtkPV3Foam::updateInfoZones
// ~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_)
{
namesLst = meshPtr_->cellZones().names();
namesLst = getZoneNames(meshPtr_->cellZones());
}
else
{
namesLst = readZoneNames("cellZones");
namesLst = getZoneNames("cellZones");
}
arrayRangeCellZones_.reset(arraySelection->GetNumberOfArrays());
......@@ -335,11 +357,11 @@ void Foam::vtkPV3Foam::updateInfoZones
// ~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_)
{
namesLst = meshPtr_->faceZones().names();
namesLst = getZoneNames(meshPtr_->faceZones());
}
else
{
namesLst = readZoneNames("faceZones");
namesLst = getZoneNames("faceZones");
}
arrayRangeFaceZones_.reset(arraySelection->GetNumberOfArrays());
......@@ -358,11 +380,11 @@ void Foam::vtkPV3Foam::updateInfoZones
// ~~~~~~~~~~~~~~~~~~~~~~
if (meshPtr_)
{
namesLst = meshPtr_->pointZones().names();
namesLst = getZoneNames(meshPtr_->pointZones());
}
else
{
namesLst = readZoneNames("pointZones");
namesLst = getZoneNames("pointZones");
}
arrayRangePointZones_.reset(arraySelection->GetNumberOfArrays());
......
......@@ -43,7 +43,6 @@ usage() {
cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] path [wildcard1] .. [wildcardN]
options:
-space treat 'path' as space-delimited (eg, from C-Shell)
-strip remove inaccessible directories
-help print the usage
......@@ -57,7 +56,7 @@ USAGE
}
unset space strip
unset strip
# parse options
while [ "$#" -gt 0 ]
do
......@@ -65,10 +64,6 @@ do
-h | -help)
usage
;;
-space)
space=true
shift
;;
-strip)
strip=true
shift
......@@ -82,12 +77,7 @@ done
[ "$#" -ge 1 ] || usage
if [ "$space" = true ]
then
dirList=$(echo "$1" | sed -e 's/ /:/g')
else
dirList="$1"
fi
dirList="$1"
shift
##DEBUG echo "input>$dirList<" 1>&2
......@@ -140,11 +130,8 @@ done
IFS=' '
set -- $dirList
# join on ':', unless -space option was specified
if [ "$space" != true ]
then
IFS=':'
fi
# rejoin on ':'
IFS=':'
dirList="$*"
# restore IFS
......
......@@ -85,7 +85,8 @@ setRawEntry() {
oldLine=`echo "$oldNumLine" | sed -e 's/^[^:]*://'`
oldKey=`getKey "$oldLine"`
oldVal=`getRawEntry $1 "$2"`
if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ]; then
if [ ! "$oldKey" -o ! "$oldVal" -o ! "$oldLine" ]
then
echo "setRawStringEntry: entry $2 not found in $1"
echo "oldKey=$oldKey"
echo "lineNo=$lineNo"
......@@ -134,9 +135,12 @@ getBoolEntry()
}
# newerFile file1 file2
newerFile() {
# ... could also use if [ $file1 -nt $file2 ] ...
newerFile()
{
latest=`ls -1 -t $1 $2 2> /dev/null | head -1`
if [ "$latest" = $1 ]; then
if [ "$latest" = $1 ]
then
return 0
else
return 1
......@@ -149,8 +153,8 @@ processExists() {
ps -u $LOGNAME -o 'pid' | fgrep $1 >/dev/null
}
printUsage() {
cat << USAGELABEL
usage() {
cat << USAGE
Usage: $PROGNAME [-n] <root> <case> <pid>
or
$PROGNAME -c <root> <case>
......@@ -165,7 +169,8 @@ finish. Restores original controlDict if
The -c option clears any outstanding $PROGNAME for the case.
USAGELABEL
USAGE
exit 1
}
......@@ -174,7 +179,8 @@ restoreDict() {
trap 2 3 15
echo "$PROGNAME : Restoring controlDict from controlDict_bak."
if [ -r ${controlDict}_bak ]; then
if [ -r ${controlDict}_bak ]
then
cp ${controlDict}_bak $controlDict
fi
......@@ -208,61 +214,69 @@ esac
#
# Initial checks
#
if [ $# -lt 3 ]; then
printUsage
exit 1
if [ $# -lt 3 ]
then
usage
fi
STOPNOW=''
if [ $1 = '-n' ]; then
if [ $1 = '-n' ]
then
STOPNOW='yes'
shift
fi
CLEAR=''
if [ $1 = '-c' ]; then
if [ $1 = '-c' ]
then
CLEAR='yes'
shift
if [ $# -ne 2 ]; then
printUsage
exit 1
if [ $# -ne 2 ]
then
usage
fi
ROOT=$1
CASE=$2
else
if [ $# -ne 3 ]; then
printUsage
exit 1
if [ $# -ne 3 ]
then
usage
fi
ROOT=$1
CASE=$2
PID=$3
fi
CASE=`echo $CASE | sed -e 's!/.*!!'` #strip of processorXXX ending
CASE=`echo $CASE | sed -e 's!/.*!!'` # strip of processorXXX ending
#- Pid actually running
if [ ! "$CLEAR" ]; then
if [ ! "$CLEAR" ]
then
processExists $PID
if [ $? -ne 0 ] ;then
if [ $? -ne 0 ]
then
echo "$PROGNAME : process $PID not running."
exit 1
fi
fi
#- case directory writeable
if [ ! -w $ROOT/$CASE ]; then
if [ ! -w $ROOT/$CASE ]
then
echo "$PROGNAME : $ROOT/$CASE is not writeable."
exit 1
fi
#- Controldict writeable
controlDict=$ROOT/$CASE/system/controlDict
if [ ! -w $controlDict ]; then
if [ ! -w $controlDict ]
then
echo "$PROGNAME : $controlDict is not writeable."
exit 1
fi
#- runTimeModifiable
getBoolEntry $controlDict 'runTimeModifiable'
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]
then
echo "$PROGNAME : runTimeModifiable not true in dictionary $controlDict."
exit 1
fi
......@@ -270,12 +284,14 @@ fi
#
#- Check if another foamEndJob running
#
if [ "$CLEAR" ]; then
if [ "$CLEAR" ]
then
pidFiles=`ls $ROOT/$CASE/.foamEndJob* 2>/dev/null`
for pidFile in $pidFiles
do
pid=`cat $pidFile`
if [ "$pid" ]; then
if [ "$pid" ]
then
echo "$PROGNAME : found $PROGNAME (pid $pid) for Foam process"
echo " root: $ROOT"
echo " case: $CASE"
......@@ -288,11 +304,14 @@ if [ "$CLEAR" ]; then
fi
pidFile=$ROOT/$CASE/.foamEndJob${PID}
if [ -f $pidFile ]; then
if [ -f $pidFile ]
then
pid=`cat $pidFile`
if [ "$pid" ]; then
if [ "$pid" ]
then
processExists $pid
if [ $? -eq 0 ] ;then
if [ $? -eq 0 ]
then
echo "$PROGNAME : found running $PROGNAME (pid $pid) for Foam process"
echo " root: $ROOT"
echo " case: $CASE"
......@@ -314,28 +333,32 @@ echo $$ > $pidFile
#- startTime
startTime=`getEntry $controlDict 'startTime'`
if [ ! "$startTime" ]; then
if [ ! "$startTime" ]
then
echo "$PROGNAME : startTime not set in dictionary $controlDict."
exit 1
fi
#- Write interval
writeInterval=`getEntry $controlDict 'writeInterval'`
if [ ! "$writeInterval" ]; then
if [ ! "$writeInterval" ]
then
echo "$PROGNAME : writeInterval not set in dictionary $controlDict."
exit 1
fi
#- stopAt
stopAt=`getEntry $controlDict 'stopAt'`
if [ ! "$stopAt" ]; then
if [ ! "$stopAt" ]
then
echo "$PROGNAME : stopAt not set in dictionary $controlDict."
exit 1
fi
#- endTime
endTime=`getEntry $controlDict 'endTime'`
if [ ! "$endTime" ]; then
if [ ! "$endTime" ]
then
echo "$PROGNAME : endTime not set in dictionary $controlDict."
exit 1
fi
......@@ -353,7 +376,8 @@ cp $controlDict ${controlDict}_bak
#- Set up handler to restore controlDict
trap restoreDict 2 3 15
if [ "$STOPNOW" ]; then
if [ "$STOPNOW" ]
then
setRawEntry $controlDict 'stopAt' 'nextWrite'
setRawEntry $controlDict 'writeInterval' '1'
......@@ -385,7 +409,8 @@ if newerFile ${controlDict} ${controlDict}_bak; then
iter=0
while newerFile ${controlDict} ${controlDict}_bak
do
if [ $iter -ge 120 ]; then
if [ $iter -ge 120 ]
then
#- 120*5 sec = 10 mins passed. Give up
echo "$PROGNAME : File date not yet ok after 10 mins. Giving up."
break
......@@ -412,22 +437,25 @@ while true
do
sleep 5
if [ ! -r ${controlDict}_bak ]; then
if [ ! -r ${controlDict}_bak ]
then
echo "$PROGNAME : ${controlDict}_bak dissappeared. Exiting without restore."
exit 1
fi
if newerFile ${controlDict} ${controlDict}_bak; then
if newerFile ${controlDict} ${controlDict}_bak
then
echo "$PROGNAME : ${controlDict} modified externally. Exiting without restore."
exit 0
fi
processExists $PID
if [ $? -ne 0 ] ;then
if [ $? -ne 0 ]
then
#- Job finished
break
fi
#echo "Foam job $PID still running ..."
# echo "Foam job $PID still running ..."
done
#- Dictionary restore
......
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# License
......@@ -27,8 +27,17 @@
# foamEtcFile
#
# Description
# Locate user/site/shipped file with the semantics used in the
# ~OpenFOAM/fileName expansion
# Locate user/group/shipped file with semantics similar to the
# ~OpenFOAM/fileName expansion.
#
# The -mode option can be used to allow chaining from
# personal settings to site-wide settings.
#
# For example, within the user ~/.OpenFOAM/<VER>/prefs.sh:
# @verbatim
# foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile -m go prefs.sh` \
# && _foamSource $foamPrefs
# @endverbatim
#
#-------------------------------------------------------------------------------
unset listOpt quietOpt
......@@ -41,24 +50,32 @@ usage() {
cat<<USAGE
Usage: ${0##*/} [OPTION] fileName
${0##*/} -list
${0##*/} [OPTION] -list
options:
-l | -list list the directories to be searched
-q | -quiet suppress all normal output
-list list the directories to be searched
-mode <mode> any combination of u(user), g(group), o(other)
-quiet suppress all normal output
-help print the usage
Locate user/group/shipped file with semantics similar to the
~OpenFOAM/fileName expansion.
Locate user/site/shipped file with the semantics used in the
~OpenFOAM/fileName expansion
The options can also be specified as a single character
(eg, '-q' instead of '-quiet'), but must not be grouped.
Exit status 0 when the file is found and output resolved path to stdout.
Exit status 1 for miscellaneous errors.
Exit status 2 when the file is not found.
Exit status
0 when the file is found. Print resolved path to stdout.
1 for miscellaneous errors.
2 when the file is not found.
USAGE
exit 1
}
# default mode is 'ugo'
mode=ugo
# parse options
while [ "$#" -gt 0 ]
do
......@@ -70,6 +87,20 @@ do
listOpt=true
shift
;;
-m | -mode)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
mode="$2"
# sanity check:
case "$mode" in
*u* | *g* | *o* )
;;
*)
usage "'$1' option with invalid mode '$mode'"
;;
esac
shift 2
;;
-q | -quiet)
quietOpt=true
shift
......@@ -83,18 +114,32 @@ do
esac
done
# Save the essential bits of information:
nArgs=$#
fileName="$1"
# The various places to be searched:
set -- \
$HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION \
$HOME/.${WM_PROJECT:-OpenFOAM} \
$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION \
$WM_PROJECT_INST_DIR/site \
$WM_PROJECT_DIR/etc
# Define the various places to be searched:
set -- $(
case "$mode" in
*u*) # user
echo $HOME/.${WM_PROJECT:-OpenFOAM}/$WM_PROJECT_VERSION
echo $HOME/.${WM_PROJECT:-OpenFOAM}
;;
esac
case "$mode" in
*g*) # group
echo $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION
echo $WM_PROJECT_INST_DIR/site
;;
esac
case "$mode" in
*o*) # other
echo $WM_PROJECT_DIR/etc
;;
esac
)
#
......
......@@ -30,14 +30,14 @@
#
#------------------------------------------------------------------------------
usage() {