diff --git a/COPYING b/COPYING index 7e02780f0b5e88e02abfb88633829987f065d70d..2101277c180537b6546e0149f606b1b2a369fee6 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,6 @@ GNU GENERAL PUBLIC LICENSE - OpenFOAM(R) is Copyright (C) 1991-2010 OpenCFD Ltd. + OpenFOAM(R) is Copyright (C) 2004-2011 OpenCFD Ltd. Contact: OpenCFD (enquiries@OpenCFD.co.uk) You may use, distribute and copy the OpenFOAM CFD Toolbox under the terms diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H index bcf535873c1cf939735ad08cd53a4540286ce0e5..593b3503e1870d42254582069f7b853ba46a81bf 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H @@ -1,6 +1,6 @@ label nAlphaCorr(readLabel(piso.lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(piso.lookup("nAlphaSubCycles")))); +label nAlphaSubCycles(readLabel(piso.lookup("nAlphaSubCycles"))); if (nAlphaSubCycles > 1) { diff --git a/applications/test/maxMem/Make/options b/applications/test/maxMem/Make/options index 6a57715f81d25c4b903cc2e2c4cafb68eb0c7ed2..1570a9377ecf2e20596ae3a8c953c470641a242d 100644 --- a/applications/test/maxMem/Make/options +++ b/applications/test/maxMem/Make/options @@ -1 +1 @@ -EXE_LIBS = $(LIB_WM_OPTIONS_DIR)/libfbsdmalloc.o +EXE_LIBS = $(FOAM_EXT_LIBBIN)/libfbsdmalloc.o diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files index 90ac11a3e8d1b040eac3f50e87be93b35aa1bfa9..e71b857bb2e229412366860d8eaef07c1192bf3b 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/files @@ -9,4 +9,4 @@ vtkPV3FoamMeshZone.C vtkPV3FoamUpdateInfo.C vtkPV3FoamUtils.C -LIB = $(FOAM_EXT_LIBBIN)/libvtkPV3Foam +LIB = $(FOAM_LIBBIN)/libvtkPV3Foam diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options index 6d10cc1a05bceb1c5ccdcb66e377f22ba64f35fa..b381bd7d43eb74162751c531c7806fe7f0b5aeeb 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/Make/options @@ -19,5 +19,5 @@ LIB_LIBS = \ -lfiniteVolume \ -lgenericPatchFields \ -llagrangian \ - -L$(FOAM_EXT_LIBBIN) -lvtkPV3Readers \ + -L$(FOAM_LIBBIN) -lvtkPV3Readers \ $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/files b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/files index 3d452f747a10e0ef24ab3166dd858a1f31dda161..f084cc9f28fbc5faa5d02b2a857a9e4fc7f5eaf5 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/files +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/files @@ -2,4 +2,4 @@ vtkPV3blockMesh.C vtkPV3blockMeshConvert.C vtkPV3blockMeshUtils.C -LIB = $(FOAM_EXT_LIBBIN)/libvtkPV3blockMesh +LIB = $(FOAM_LIBBIN)/libvtkPV3blockMesh diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/options b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/options index 1964824e54c7348e5c27582d82be8614ead694dc..53f300a9f72cb671e6b2ba589c16322369791c87 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/options +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/Make/options @@ -10,5 +10,5 @@ EXE_INC = \ LIB_LIBS = \ -lmeshTools \ -lblockMesh \ - -L$(FOAM_EXT_LIBBIN) -lvtkPV3Readers \ + -L$(FOAM_LIBBIN) -lvtkPV3Readers \ $(GLIBS) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/Make/files b/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/Make/files index c5f3c12ebd1700638c358ed7f95d99222663d9b6..134b8de963e813e2955fdac51ea10d5e684e6c94 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/Make/files +++ b/applications/utilities/postProcessing/graphics/PV3Readers/vtkPV3Readers/Make/files @@ -1,3 +1,3 @@ vtkPV3Readers.C -LIB = $(FOAM_EXT_LIBBIN)/libvtkPV3Readers +LIB = $(FOAM_LIBBIN)/libvtkPV3Readers diff --git a/bin/foamPack b/bin/foamPack index 59c37a87fe761be5a6139e49a80cbcc75c752367..3faa48cfdf3e8388e201a3fdb997d67535741648 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -73,13 +73,10 @@ do done # check for essential directories -for dir in $packDir -do - [ -d $dir ] || { - echo "Error: directory $dir does not exist" 1>&2 - exit 1 - } -done +[ -d $packDir ] || { + echo "Error: directory $packDir does not exist" 1>&2 + exit 1 +} #------------------------------------------------------------------------------ diff --git a/bin/foamPackBinAll b/bin/foamPackBinAll index d91803197a87b2003f98b3598c18e22a4d73b704..18f67129ed57fe4436b9405e74403068c178c0d4 100755 --- a/bin/foamPackBinAll +++ b/bin/foamPackBinAll @@ -57,10 +57,29 @@ esac } -# obtain archOptions types from lib/ -for archOptions in $packDir/lib/* -do - $binDir/$packBin $@ ${archOptions##*/} -done +if [ -d $packDir/lib ] +then + + # obtain archOptions types from lib/<archOptions> + for archOptions in $packDir/lib/* + do + $binDir/$packBin $@ ${archOptions##*/} + done + +elif [ -d $packDir/platforms ] + + # obtain archOptions types from platforms/<archOptions>/lib + for archOptions in $packDir/platforms/*/lib + do + archOptions=${archOptions%%/lib} + $binDir/$packBin $@ ${archOptions##*/} + done + +else + + echo "Error: directory $packDir does not appear packable" 1>&2 + exit 1 + +fi #------------------------------------------------------------------------------ diff --git a/bin/foamPackThirdParty b/bin/foamPackThirdParty index e0f07178d74e541a8a5e06339479f5b7e49b72c9..37625b42cd36548c1ee26d149e813de8caa5d6ed 100755 --- a/bin/foamPackThirdParty +++ b/bin/foamPackThirdParty @@ -72,13 +72,10 @@ do done # check for essential directories -for dir in $packDir -do - [ -d $dir ] || { - echo "Error: directory $dir does not exist" 1>&2 - exit 1 - } -done +[ -d $packDir ] || { + echo "Error: directory $packDir does not exist" 1>&2 + exit 1 +} #------------------------------------------------------------------------------ diff --git a/bin/tools/foamListBinDirs b/bin/tools/foamListBinDirs index 2a25a8709c77f16c0ffcc8207e18169abcf94635..336bd91cdef8abe88f7c0271e92c8bb511a8c069 100755 --- a/bin/tools/foamListBinDirs +++ b/bin/tools/foamListBinDirs @@ -67,19 +67,35 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') #------------------------------------------------------------------------------ # check for essential directories -for dir in $packDir $packDir/lib/$archOptions -do - [ -d $dir ] || { - echo "Error: directory $dir does not exist" 1>&2 - exit 1 - } -done - -# check new/old places for executables - same as $FOAM_APPBIN -[ -d $packDir/bin/$archOptions -o -d $packDir/applications/bin/$archOptions ] || { +[ -d $packDir ] || { + echo "Error: directory $packDir does not exist" 1>&2 + exit 1 +} + + +# +# check places for libraries - same as $FOAM_LIBBIN +# this has moved around a bit in the recent past +# +[ -d $packDir/lib/$archOptions ] || \ +[ -d $packDir/platforms/$archOptions/lib ] || { +cat <<LIB_CHECK 1>&2 +Error: no directory for libraries exists: + $packDir/lib/$archOptions + $packDir/platforms/$archOptions/lib +LIB_CHECK + exit 1 +} + +# +# check places for executables - same as $FOAM_APPBIN +# this has moved around a bit in the recent past +# +[ -d $packDir/applications/bin/$archOptions ] || \ +[ -d $packDir/platforms/$archOptions/bin ] || { cat <<BIN_CHECK 1>&2 Error: no directory for executables exists: - $packDir/bin/$archOptions + $packDir/platforms/$archOptions/bin $packDir/applications/bin/$archOptions BIN_CHECK exit 1 @@ -90,14 +106,15 @@ BIN_CHECK # list of directories dirList=$( for dir in \ - $packDir/bin/$archOptions \ - $packDir/lib/$archOptions \ - $packDir/applications/bin/$archOptions \ + $packDir/platforms/$archOptions/bin \ + $packDir/platforms/$archOptions/lib \ $packDir/wmake/bin/$archCompiler \ $packDir/wmake/bin/$archOS \ $packDir/wmake/rules/General \ $packDir/wmake/rules/$archCompiler \ $packDir/wmake/rules/$archOS \ + $packDir/applications/bin/$archOptions \ + $packDir/lib/$archOptions \ ; do [ -d $dir ] && echo $dir diff --git a/bin/tools/foamListThirdPartyBinDirs b/bin/tools/foamListThirdPartyBinDirs index 319961b944173c234be9971193e8c7af8af066ad..872049628e203e49bfa23034ab654ddc40e483fa 100755 --- a/bin/tools/foamListThirdPartyBinDirs +++ b/bin/tools/foamListThirdPartyBinDirs @@ -66,7 +66,7 @@ arch3264=$(echo "$archOS" | sed -e 's@64@-64@') #------------------------------------------------------------------------------ # check for essential directories -for dir in $packDir $packDir/lib/$archOptions +for dir in $packDir $packDir/platforms/$archOptions/lib do [ -d $dir ] || { echo "Error: directory $dir does not exist" 1>&2 @@ -78,12 +78,6 @@ done # list of directories dirList=$( for dir in \ - $packDir/bin/$archOptions \ - $packDir/bin/$archCompiler \ - $packDir/bin/$archOS \ - $packDir/lib/$archOptions \ - $packDir/lib/$archCompiler \ - $packDir/lib/$archOS \ $packDir/platforms/$archOptions \ $packDir/platforms/$archCompiler \ $packDir/platforms/$archOS \ diff --git a/bin/tools/pre-commit-hook b/bin/tools/pre-commit-hook index 7710f0ca52c6a32b92d8e0ca0d077fdb35cc289c..d44edba275e1336e5aeeeeaabee4bb930e4f46b8 100755 --- a/bin/tools/pre-commit-hook +++ b/bin/tools/pre-commit-hook @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -53,7 +53,7 @@ hookName="pre-commit" die() { echo "$hookName hook failure" 1>&2 - echo '-----------------------' 1>&2 + echo '-----------------------------------' 1>&2 echo '' 1>&2 echo "$@" 1>&2 echo '' 1>&2 @@ -105,8 +105,8 @@ dieOnBadFiles() { if [ -n "$badFiles" ] then - echo '$hookName hook failure' 1>&2 - echo '-----------------------' 1>&2 + echo "$hookName hook failure" 1>&2 + echo '-----------------------------------' 1>&2 echo "$@" 1>&2 echo '' 1>&2 echo "File(s):" 1>&2 diff --git a/bin/tools/pre-receive-hook b/bin/tools/pre-receive-hook index 048feb3188af3aff0683fe8c1724bb839e4b950f..cf4dcb42be6bc0f55b9573cc233b492cfa179499 100755 --- a/bin/tools/pre-receive-hook +++ b/bin/tools/pre-receive-hook @@ -3,7 +3,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -47,7 +47,7 @@ hookName="pre-receive" die() { echo "$hookName hook failure" 1>&2 - echo '-----------------------' 1>&2 + echo '-----------------------------------' 1>&2 echo '' 1>&2 echo "$@" 1>&2 echo '' 1>&2 @@ -68,8 +68,8 @@ dieOnBadFiles() { if [ -n "$badFiles" ] then - echo '$hookName hook failure' 1>&2 - echo '-----------------------' 1>&2 + echo "$hookName hook failure" 1>&2 + echo '-----------------------------------' 1>&2 echo "$@" 1>&2 echo '' 1>&2 echo "File(s):" 1>&2 diff --git a/etc/aliases.csh b/etc/aliases.csh index 0da2259b201dc213ab851759819f294131fd876b..6e1deee991bf5d5c3f2b97095191065cd69329ed 100644 --- a/etc/aliases.csh +++ b/etc/aliases.csh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -44,9 +44,9 @@ alias wmDP 'wmSET WM_PRECISION_OPTION=DP' alias wmSchedON 'setenv WM_SCHEDULER $WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedOFF 'unsetenv WM_SCHEDULER' -# Change paraview version +# Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ -alias foamPV 'setenv ParaView_VERSION \!*; source $WM_PROJECT_DIR/etc/apps/paraview3/cshrc; echo paraview-$ParaView_VERSION' +alias foamPV 'source `$WM_PROJECT_DIR/etc/apps/paraview3/cshrc` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' # Change directory aliases diff --git a/etc/aliases.sh b/etc/aliases.sh index 504473d2cbeaaacac7704be3f07c487ec1c8c13b..2f049825ec5606a364d4b7e94a4c581e567e78c7 100644 --- a/etc/aliases.sh +++ b/etc/aliases.sh @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -44,16 +44,13 @@ alias wmDP='wmSET WM_PRECISION_OPTION=DP' alias wmSchedON='export WM_SCHEDULER=$WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedOFF='unset WM_SCHEDULER' -# Change paraview version +# Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ unset foamPV foamPV() { - export ParaView_VERSION=$1 - . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc + . $WM_PROJECT_DIR/etc/apps/paraview3/bashrc ParaView_VERSION=$1 echo "paraview-$ParaView_VERSION (major: $ParaView_MAJOR)" - echo "dir: $ParaView_DIR" - [ -d "$ParaView_DIR" ] || echo "WARNING: directory does not exist" } diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 0e1b0ab17d1a99937ad8e61629e4fe5ea92e1c9e..8d9ae615f5942f61cc25a465e7285ac9596e849c 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -50,17 +50,25 @@ do done -# set VERSION and MAJOR (version) variables -if [ -z "$ParaView_VERSION" ] -then - ParaView_VERSION=3.8.0 - ParaView_MAJOR=unknown - echo "Warning in app/paraview3/bashrc:" 1>&2 - echo " ParaView_VERSION not set, using '$ParaView_VERSION'" 1>&2 -fi -[ -n "$ParaView_MAJOR" ] || ParaView_MAJOR=unknown +#- ParaView version, automatically determine major version +export ParaView_VERSION=3.8.0 +export ParaView_MAJOR=detect + + +# Evaluate command-line parameters for ParaView +while [ $# -gt 0 ] +do + case "$1" in + ParaView*=*) + # name=value -> export name=value + eval "export $1" + ;; + esac + shift +done + -# if needed, set MAJOR version to correspond to VERSION +# set MAJOR version to correspond to VERSION # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION case "$ParaView_VERSION" in "$ParaView_MAJOR".* ) @@ -82,7 +90,7 @@ if [ -r $ParaView_DIR -o -r $paraviewInstDir ] then export PATH=$ParaView_DIR/bin:$PATH export LD_LIBRARY_PATH=$ParaView_DIR/lib/paraview-$ParaView_MAJOR:$LD_LIBRARY_PATH - export PV_PLUGIN_PATH=$FOAM_EXT_LIBBIN/paraview-$ParaView_MAJOR + export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview-$ParaView_MAJOR # add in python libraries if required paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index bfbe3038fd233180ed798c7b4359c957ee21328e..dda442713570538a8968b54a3c58af369aaf842b 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -48,17 +48,24 @@ foreach cmake ( cmake-2.8.3 cmake-2.8.1 ) endif end -# set VERSION and MAJOR (version) variables -if ( ! $?ParaView_VERSION ) -then - setenv ParaView_VERSION 3.8.0 - setenv ParaView_MAJOR unknown - echo "Warning in app/paraview3/cshrc:" - echo " ParaView_VERSION not set, using '$ParaView_VERSION'" -fi -if ( ! $?ParaView_MAJOR ) setenv ParaView_MAJOR unknown +#- ParaView version, automatically determine major version: +setenv ParaView_VERSION 3.8.0 +setenv ParaView_MAJOR detect -# if needed, set MAJOR version to correspond to VERSION + +# Evaluate command-line parameters for ParaView +while ( $#argv > 0 ) + switch ($argv[1]) + case ParaView*=*: + # name=value -> setenv name value + eval "setenv $argv[1]:s/=/ /" + breaksw + endsw + shift +end + + +# set MAJOR version to correspond to VERSION # ParaView_MAJOR is "<digits>.<digits>" from ParaView_VERSION switch ("$ParaView_VERSION") case "$ParaView_MAJOR".*: @@ -80,7 +87,7 @@ setenv ParaView_DIR $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview- if ( -r $ParaView_DIR || -r $paraviewInstDir ) then setenv PATH ${ParaView_DIR}/bin:${PATH} setenv LD_LIBRARY_PATH "${ParaView_DIR}/lib/paraview-${ParaView_MAJOR}:${LD_LIBRARY_PATH}" - setenv PV_PLUGIN_PATH $FOAM_EXT_LIBBIN/paraview-${ParaView_MAJOR} + setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview-${ParaView_MAJOR} # add in python libraries if required set paraviewPython=$ParaView_DIR/Utilities/VTKPythonWrapping diff --git a/etc/apps/scotch/bashrc b/etc/apps/scotch/bashrc index fcd19bfaa35cd49306fb7e6901c6efc948f1f82b..0fb6952110d09fa9cc2c6aab67e149f4b9e48e7f 100644 --- a/etc/apps/scotch/bashrc +++ b/etc/apps/scotch/bashrc @@ -36,10 +36,5 @@ export SCOTCH_VERSION=scotch_5.1.11 export SCOTCH_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$SCOTCH_VERSION -# mpi-qualified include directory -export SCOTCH_MPI_INCLUDE=$SCOTCH_ARCH_PATH/include/${FOAM_MPI_LIBBIN##*/} - -# mpi-qualified lib directory -export SCOTCH_MPI_LIBBIN=$SCOTCH_ARCH_PATH/lib/${FOAM_MPI_LIBBIN##*/} # ----------------------------------------------------------------------------- diff --git a/etc/bashrc b/etc/bashrc index 02d37cbb65b1cf4dc10f6ff0e21bd4624a762d31..95c83e82f8012185453f70e92842fea3138756a8 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -57,10 +57,6 @@ foamInstall=$HOME/$WM_PROJECT #- note the location for later use (eg, in job scripts) : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR -#- ParaView version, automatically determine major version: -export ParaView_VERSION=3.8.0 -export ParaView_MAJOR=unknown - #- Compiler location: # foamCompiler= system | ThirdParty (OpenFOAM) foamCompiler=system @@ -134,6 +130,36 @@ _foamSource() done } +# Evaluate command-line parameters +_foamEval() +{ + while [ $# -gt 0 ] + do + case "$1" in + *=) + # name= -> unset name + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "unset ${1%=}" + eval "unset ${1%=}" + ;; + *=*) + # name=value -> export name=value + [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "export $1" + eval "export $1" + ;; + *) + # filename: source it + if [ -f "$1" ] + then + _foamSource "$1" + else + _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile "$1"` + fi + ;; + esac + shift + done +} + # Add in preset user or site preferences: _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` @@ -141,29 +167,7 @@ _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` # Evaluate command-line parameters and record settings for later # these can be used to set/unset values, or specify prefs files export FOAM_SETTINGS="$@" -while [ $# -gt 0 ] -do - case "$1" in - *=) - # name= -> unset name - eval "unset ${1%=}" - ;; - *=*) - # name=value -> export name=value - eval "export $1" - ;; - *) - # filename: source it - if [ -f "$1" ] - then - _foamSource "$1" - else - _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile "$1"` - fi - ;; - esac - shift -done +_foamEval $@ # Detect system type and set environment variables appropriately @@ -311,6 +315,6 @@ fi # cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unset cleaned foamClean foamInstall foamOldDirs -unset _foamSource +unset _foamSource _foamEval # ----------------------------------------------------------------- end-of-file diff --git a/etc/cshrc b/etc/cshrc index fb65228cb3c46a89558b69c25dae2adf0926d437..9b9f04c47c2a2d1d6bd0e70280d7de40f69fd46a 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -56,10 +56,6 @@ set foamInstall = $HOME/$WM_PROJECT #- note the location for later use (eg, in job scripts) if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall -#- ParaView version, automatically determine major version: -setenv ParaView_VERSION 3.8.0 -setenv ParaView_MAJOR unknown - #- Compiler location: # foamCompiler= system | ThirdParty (OpenFOAM) set foamCompiler=system @@ -256,9 +252,7 @@ if (! $?MANPATH) setenv MANPATH '' #- Clean PATH (path) set cleaned=`$foamClean "$PATH" "$foamOldDirs"` -if ( $status == 0 ) then - setenv PATH $cleaned -endif +if ( $status == 0 ) setenv PATH $cleaned #- Clean LD_LIBRARY_PATH set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` diff --git a/etc/settings.csh b/etc/settings.csh index d6967a6627a04dc6c601c253bbcceb5ed033c5c5..a3f9a743c0cd1c82b8a411b1908b8b2dc55d18b0 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -48,20 +48,20 @@ setenv WM_LINK_LANGUAGE c++ setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION # base executables/libraries -setenv FOAM_APPBIN $WM_PROJECT_DIR/bin/$WM_OPTIONS -setenv FOAM_LIBBIN $WM_PROJECT_DIR/lib/$WM_OPTIONS +setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin +setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib # external (ThirdParty) libraries -setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/lib/$WM_OPTIONS +setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib # shared site executables/libraries # similar naming convention as ~OpenFOAM expansion -setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS -setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS +setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin +setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib # user executables/libraries -setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/bin/$WM_OPTIONS -setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS +setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin +setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib # convenience setenv FOAM_APP $WM_PROJECT_DIR/applications @@ -90,7 +90,6 @@ unsetenv MPFR_ARCH_PATH # Location of compiler installation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ( ! $?foamCompiler ) then -then foamCompiler=system echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" echo " foamCompiler not set, using '$foamCompiler'" @@ -253,13 +252,13 @@ unset boost_version cgal_version # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ -unsetenv MPI_ARCH_PATH MPI_HOME +unsetenv MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN switch ("$WM_MPLIB") case OPENMPI: - #set mpi_version=openmpi-1.4.1 - set mpi_version=openmpi-1.5.1 - setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version + #setenv FOAM_MPI openmpi-1.4.1 + setenv FOAM_MPI openmpi-1.5.1 + setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI # Tell OpenMPI where to find its install directory setenv OPAL_PREFIX $MPI_ARCH_PATH @@ -267,14 +266,11 @@ case OPENMPI: _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib _foamAddMan $MPI_ARCH_PATH/man - - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/$mpi_version - unset mpi_version breaksw case SYSTEMOPENMPI: # Use the system installed openmpi, get library directory via mpicc - set mpi_version=openmpi-system + setenv FOAM_MPI openmpi-system # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI setenv PINC "`mpicc --showme:compile`" @@ -289,25 +285,21 @@ case SYSTEMOPENMPI: endif _foamAddLib $libDir - - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/$mpi_version - unset mpi_version libDir + unset libDir breaksw case MPICH: - set mpi_version=mpich2-1.1.1p1 - setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version - setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version + setenv FOAM_MPI mpich2-1.1.1p1 + setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI + setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib _foamAddMan $MPI_ARCH_PATH/share/man - - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/$mpi_version - unset mpi_version breaksw case MPICH-GM: + setenv FOAM_MPI mpich-gm setenv MPI_ARCH_PATH /opt/mpi setenv MPICH_PATH $MPI_ARCH_PATH setenv GM_LIB_PATH /opt/gm/lib64 @@ -315,11 +307,10 @@ case MPICH-GM: _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $GM_LIB_PATH - - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/mpich-gm breaksw case HPMPI: + setenv FOAM_MPI hpmpi setenv MPI_HOME /opt/hpmpi setenv MPI_ARCH_PATH $MPI_HOME @@ -339,23 +330,22 @@ case HPMPI: echo Unknown processor type `uname -m` for Linux breaksw endsw - - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/hpmpi breaksw case GAMMA: + setenv FOAM_MPI gamma setenv MPI_ARCH_PATH /usr - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/gamma breaksw case MPI: + setenv FOAM_MPI mpi setenv MPI_ARCH_PATH /opt/mpi - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/mpi breaksw case FJMPI: + setenv FOAM_MPI fjmpi setenv MPI_ARCH_PATH /opt/FJSVmpi2 - setenv FOAM_MPI_LIBBIN $FOAM_EXT_LIBBIN/mpi + _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib/sparcv9 _foamAddLib /opt/FSUNf90/lib/sparcv9 @@ -363,20 +353,25 @@ case FJMPI: breaksw case QSMPI: + setenv FOAM_MPI qsmpi setenv MPI_ARCH_PATH /usr/lib/mpi - setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib - breaksw default: - setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/dummy + setenv FOAM_MPI dummy breaksw endsw -_foamAddLib $FOAM_MPI_LIBBIN + +# add (non-dummy) MPI implementation +# dummy MPI already added to LD_LIBRARY_PATH and has no external libraries +if ( "$FOAM_MPI" != dummy ) then + _foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}:${FOAM_EXT_LIBBIN}/${FOAM_MPI} +endif + # Set the minimum MPI buffer size (used by all platforms except SGI MPI) @@ -392,13 +387,6 @@ else endif -# Enable the hoard memory allocator if available -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#if ( -f $FOAM_EXT_LIBBIN/libhoard.so ) then -# setenv LD_PRELOAD $FOAM_EXT_LIBBIN/libhoard.so:$LD_PRELOAD -#endif - - # cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unalias _foamAddPath _foamAddLib _foamAddMan diff --git a/etc/settings.sh b/etc/settings.sh index 28eaa516607732b6dc1fe5abd15cd6ead70f8879..46c39f59decc3d649b1e14a60d31730a137592d6 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -71,20 +71,20 @@ export WM_LINK_LANGUAGE=c++ export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION # base executables/libraries -export FOAM_APPBIN=$WM_PROJECT_DIR/bin/$WM_OPTIONS -export FOAM_LIBBIN=$WM_PROJECT_DIR/lib/$WM_OPTIONS +export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin +export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib # external (ThirdParty) libraries -export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/lib/$WM_OPTIONS +export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib # shared site executables/libraries # similar naming convention as ~OpenFOAM expansion -export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS -export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS +export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin +export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib # user executables/libraries -export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/bin/$WM_OPTIONS -export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS +export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin +export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib # convenience export FOAM_APP=$WM_PROJECT_DIR/applications @@ -273,13 +273,13 @@ unset boost_version cgal_version # Communications library # ~~~~~~~~~~~~~~~~~~~~~~ -unset MPI_ARCH_PATH MPI_HOME +unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN case "$WM_MPLIB" in OPENMPI) - #mpi_version=openmpi-1.4.1 - mpi_version=openmpi-1.5.1 - export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version + #export FOAM_MPI=openmpi-1.4.1 + export FOAM_MPI=openmpi-1.5.1 + export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI # Tell OpenMPI where to find its install directory export OPAL_PREFIX=$MPI_ARCH_PATH @@ -287,14 +287,11 @@ OPENMPI) _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib _foamAddMan $MPI_ARCH_PATH/man - - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/$mpi_version - unset mpi_version ;; SYSTEMOPENMPI) # Use the system installed openmpi, get library directory via mpicc - mpi_version=openmpi-system + export FOAM_MPI=openmpi-system # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI export PINC="`mpicc --showme:compile`" @@ -310,25 +307,21 @@ SYSTEMOPENMPI) fi _foamAddLib $libDir - - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/$mpi_version - unset mpi_version libDir + unset libDir ;; MPICH) - mpi_version=mpich2-1.1.1p1 - export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version - export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version + export FOAM_MPI=mpich2-1.1.1p1 + export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI + export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib _foamAddMan $MPI_ARCH_PATH/share/man - - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/$mpi_version - unset mpi_version ;; MPICH-GM) + export FOAM_MPI=mpich-gm export MPI_ARCH_PATH=/opt/mpi export MPICH_PATH=$MPI_ARCH_PATH export GM_LIB_PATH=/opt/gm/lib64 @@ -336,11 +329,10 @@ MPICH-GM) _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib _foamAddLib $GM_LIB_PATH - - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/mpich-gm ;; HPMPI) + export FOAM_MPI=hpmpi export MPI_HOME=/opt/hpmpi export MPI_ARCH_PATH=$MPI_HOME @@ -361,23 +353,21 @@ HPMPI) echo Unknown processor type `uname -m` for Linux ;; esac - - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/hpmpi ;; GAMMA) + export FOAM_MPI=gamma export MPI_ARCH_PATH=/usr - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/gamma ;; MPI) + export FOAM_MPI=mpi export MPI_ARCH_PATH=/opt/mpi - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/mpi ;; FJMPI) + export FOAM_MPI=fjmpi export MPI_ARCH_PATH=/opt/FJSVmpi2 - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/mpi _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib/sparcv9 @@ -386,20 +376,25 @@ FJMPI) ;; QSMPI) + export FOAM_MPI=qsmpi export MPI_ARCH_PATH=/usr/lib/mpi - export FOAM_MPI_LIBBIN=$FOAM_EXT_LIBBIN/qsmpi _foamAddPath $MPI_ARCH_PATH/bin _foamAddLib $MPI_ARCH_PATH/lib - ;; *) - export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/dummy + export FOAM_MPI=dummy ;; esac -_foamAddLib $FOAM_MPI_LIBBIN +# add (non-dummy) MPI implementation +# dummy MPI already added to LD_LIBRARY_PATH and has no external libraries +if [ "$FOAM_MPI" != dummy ] +then + _foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI +fi + # Set the minimum MPI buffer size (used by all platforms except SGI MPI) @@ -413,14 +408,6 @@ fi export MPI_BUFFER_SIZE -# Enable the hoard memory allocator if available -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#if [ -f $FOAM_EXT_LIBBIN/libhoard.so ] -#then -# export LD_PRELOAD=$FOAM_EXT_LIBBIN/libhoard.so:$LD_PRELOAD -#fi - - # cleanup environment: # ~~~~~~~~~~~~~~~~~~~~ unset _foamAddPath _foamAddLib _foamAddMan foamCompiler minBufferSize diff --git a/src/OSspecific/POSIX/signals/sigFpe.C b/src/OSspecific/POSIX/signals/sigFpe.C index a0557933d9014c5bf97ef13b0dce407d89227d55..18ee90456a35ae3d362c1fb5c739f46480a8fa50 100644 --- a/src/OSspecific/POSIX/signals/sigFpe.C +++ b/src/OSspecific/POSIX/signals/sigFpe.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,9 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "sigFpe.H" - +#include "error.H" #include "JobInfo.H" #include "OSspecific.H" #include "IOstreams.H" @@ -52,51 +51,42 @@ License struct sigaction Foam::sigFpe::oldAction_; -#if defined(LINUX) +#ifdef LINUX -void *(*Foam::sigFpe::old_malloc_hook)(size_t, const void *) = NULL; +void *(*Foam::sigFpe::oldMallocHook_)(size_t, const void *) = NULL; -void* Foam::sigFpe::my_malloc_hook(size_t size, const void *caller) +void* Foam::sigFpe::nanMallocHook_(size_t size, const void *caller) { void *result; // Restore all old hooks - __malloc_hook = old_malloc_hook; + __malloc_hook = oldMallocHook_; // Call recursively - result = malloc (size); + result = malloc(size); - // initialize to signalling nan + // initialize to signalling NaN # ifdef WM_SP const uint32_t sNAN = 0x7ff7fffflu; - - int nScalars = size / sizeof(scalar); - uint32_t* dPtr = reinterpret_cast<uint32_t*>(result); - for (int i = 0; i < nScalars; i++) - { - *dPtr++ = sNAN; - } - # else const uint64_t sNAN = 0x7ff7ffffffffffffllu; - - int nScalars = size/sizeof(scalar); - uint64_t* dPtr = reinterpret_cast<uint64_t*>(result); - for (int i = 0; i < nScalars; i++) +# endif + + const size_t nScalars = size/sizeof(scalar); + for (size_t i = 0; i < nScalars; ++i) { *dPtr++ = sNAN; } -# endif // Restore our own hooks - __malloc_hook = my_malloc_hook; + __malloc_hook = nanMallocHook_; return result; } @@ -106,14 +96,14 @@ void* Foam::sigFpe::my_malloc_hook(size_t size, const void *caller) #ifdef LINUX_GNUC -void Foam::sigFpe::sigFpeHandler(int) +void Foam::sigFpe::sigHandler(int) { // Reset old handling if (sigaction(SIGFPE, &oldAction_, NULL) < 0) { FatalErrorIn ( - "Foam::sigSegv::sigFpeHandler()" + "Foam::sigSegv::sigHandler()" ) << "Cannot reset SIGFPE trapping" << abort(FatalError); } @@ -166,7 +156,7 @@ Foam::sigFpe::~sigFpe() // Reset to standard malloc if (oldAction_.sa_handler) { - __malloc_hook = old_malloc_hook; + __malloc_hook = oldMallocHook_; } # endif @@ -189,13 +179,10 @@ void Foam::sigFpe::set(const bool verbose) if (env("FOAM_SIGFPE")) { - if (verbose) - { - Info<< "SigFpe : Enabling floating point exception trapping" - << " (FOAM_SIGFPE)." << endl; - } + bool supported = false; # ifdef LINUX_GNUC + supported = true; feenableexcept ( @@ -205,7 +192,7 @@ void Foam::sigFpe::set(const bool verbose) ); struct sigaction newAction; - newAction.sa_handler = sigFpeHandler; + newAction.sa_handler = sigHandler; newAction.sa_flags = SA_NODEFER; sigemptyset(&newAction.sa_mask); if (sigaction(SIGFPE, &newAction, &oldAction_) < 0) @@ -219,6 +206,7 @@ void Foam::sigFpe::set(const bool verbose) # elif defined(sgiN32) || defined(sgiN32Gcc) + supported = true; sigfpe_[_DIVZERO].abort=1; sigfpe_[_OVERFL].abort=1; @@ -240,23 +228,50 @@ void Foam::sigFpe::set(const bool verbose) ); # endif - } - if (env("FOAM_SETNAN")) - { if (verbose) { - Info<< "SetNaN : Initialising allocated memory to NaN" - << " (FOAM_SETNAN)." << endl; + if (supported) + { + Info<< "sigFpe : Enabling floating point exception trapping" + << " (FOAM_SIGFPE)." << endl; + } + else + { + Info<< "sigFpe : Floating point exception trapping" + << " - not supported on this platform" << endl; + } } + } + + + if (env("FOAM_SETNAN")) + { + bool supported = false; # ifdef LINUX_GNUC + supported = true; // Set our malloc - __malloc_hook = Foam::sigFpe::my_malloc_hook; + __malloc_hook = Foam::sigFpe::nanMallocHook_; # endif + + + if (verbose) + { + if (supported) + { + Info<< "SetNaN : Initialising allocated memory to NaN" + << " (FOAM_SETNAN)." << endl; + } + else + { + Info<< "SetNaN : Initialise allocated memory to NaN" + << " - not supported on this platform" << endl; + } + } } } diff --git a/src/OSspecific/POSIX/signals/sigFpe.H b/src/OSspecific/POSIX/signals/sigFpe.H index ea81c98f8d0db1d8506dc66aeebf1f6d97adce56..9ecad0c87cabcbc48dda4747f62b06dfa7b145e5 100644 --- a/src/OSspecific/POSIX/signals/sigFpe.H +++ b/src/OSspecific/POSIX/signals/sigFpe.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,6 @@ SourceFiles #ifndef sigFpe_H #define sigFpe_H -#include "OSspecific.H" #include <signal.h> #if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) @@ -73,10 +72,10 @@ class sigFpe # ifdef LINUX //- Saved old malloc - static void *(*old_malloc_hook)(size_t, const void *); + static void *(*oldMallocHook_)(size_t, const void *); - //- nan malloc function. From malloc_hook manpage. - static void* my_malloc_hook(size_t size, const void *caller); + //- NaN malloc function. From malloc_hook manpage. + static void* nanMallocHook_(size_t size, const void *caller); # endif @@ -86,7 +85,7 @@ class sigFpe # ifdef LINUX_GNUC //- Handler for caught signals - static void sigFpeHandler(int); + static void sigHandler(int); # endif @@ -96,6 +95,7 @@ public: // Constructors + //- Construct null sigFpe(); @@ -105,6 +105,8 @@ public: // Member functions + //- Activate SIGFPE signal handler when FOAM_SIGFPE is %set + // Fill memory with NaN when FOAM_SETNAN is %set void set(const bool verbose); }; diff --git a/src/OSspecific/POSIX/signals/sigInt.C b/src/OSspecific/POSIX/signals/sigInt.C index c9d5d2bafc02fc489aed231e3ff0210a290a57fc..acefe43d5a0b93e2ecfd31cdea1a524e187eb968 100644 --- a/src/OSspecific/POSIX/signals/sigInt.C +++ b/src/OSspecific/POSIX/signals/sigInt.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "sigInt.H" +#include "error.H" #include "JobInfo.H" #include "IOstreams.H" @@ -32,16 +32,17 @@ License struct sigaction Foam::sigInt::oldAction_; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::sigInt::sigIntHandler(int) +void Foam::sigInt::sigHandler(int) { // Reset old handling if (sigaction(SIGINT, &oldAction_, NULL) < 0) { FatalErrorIn ( - "Foam::sigInt::sigIntHandler()" + "Foam::sigInt::sigHandler()" ) << "Cannot reset SIGINT trapping" << abort(FatalError); } @@ -80,7 +81,7 @@ Foam::sigInt::~sigInt() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::sigInt::set(const bool verbose) +void Foam::sigInt::set(const bool) { if (oldAction_.sa_handler) { @@ -92,7 +93,7 @@ void Foam::sigInt::set(const bool verbose) } struct sigaction newAction; - newAction.sa_handler = sigIntHandler; + newAction.sa_handler = sigHandler; newAction.sa_flags = SA_NODEFER; sigemptyset(&newAction.sa_mask); if (sigaction(SIGINT, &newAction, &oldAction_) < 0) diff --git a/src/OSspecific/POSIX/signals/sigInt.H b/src/OSspecific/POSIX/signals/sigInt.H index d9d34062c29d4dd911d9c0216986793f38316b19..e124ac3098fccf33617a96178b0a1e62200e26cb 100644 --- a/src/OSspecific/POSIX/signals/sigInt.H +++ b/src/OSspecific/POSIX/signals/sigInt.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,9 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#include "OSspecific.H" +#ifndef sigInt_H +#define sigInt_H + #include <signal.h> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,13 +62,14 @@ class sigInt // Private Member Functions - static void sigIntHandler(int); + static void sigHandler(int); public: // Constructors + //- Construct null sigInt(); @@ -76,6 +79,7 @@ public: // Member functions + //- Activate SIGINT signal handler void set(const bool verbose); }; @@ -84,4 +88,8 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/src/OSspecific/POSIX/signals/sigQuit.C b/src/OSspecific/POSIX/signals/sigQuit.C index 481b6c50716f267e6d92a1439b269e0597a7c996..e88f74dfa41d370252148c37f16d8a48d4588f82 100644 --- a/src/OSspecific/POSIX/signals/sigQuit.C +++ b/src/OSspecific/POSIX/signals/sigQuit.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "sigQuit.H" +#include "error.H" #include "JobInfo.H" #include "IOstreams.H" @@ -32,16 +32,17 @@ License struct sigaction Foam::sigQuit::oldAction_; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::sigQuit::sigQuitHandler(int) +void Foam::sigQuit::sigHandler(int) { // Reset old handling if (sigaction(SIGQUIT, &oldAction_, NULL) < 0) { FatalErrorIn ( - "Foam::sigQuit::sigQuitHandler()" + "Foam::sigQuit::sigHandler()" ) << "Cannot reset SIGQUIT trapping" << abort(FatalError); } @@ -94,7 +95,7 @@ void Foam::sigQuit::set(const bool verbose) } struct sigaction newAction; - newAction.sa_handler = sigQuitHandler; + newAction.sa_handler = sigHandler; newAction.sa_flags = SA_NODEFER; sigemptyset(&newAction.sa_mask); if (sigaction(SIGQUIT, &newAction, &oldAction_) < 0) diff --git a/src/OSspecific/POSIX/signals/sigQuit.H b/src/OSspecific/POSIX/signals/sigQuit.H index a4933e00a1646f6b1ebba5a7c7b2ce316b66cc5f..57afd98df424fbad2b55c45d471f197be5ac4323 100644 --- a/src/OSspecific/POSIX/signals/sigQuit.H +++ b/src/OSspecific/POSIX/signals/sigQuit.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,9 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#include "OSspecific.H" +#ifndef sigQuit_H +#define sigQuit_H + #include <signal.h> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,13 +62,15 @@ class sigQuit // Private Member Functions - static void sigQuitHandler(int); + //- Handler for caught signals + static void sigHandler(int); public: // Constructors + //- Construct null sigQuit(); @@ -76,6 +80,7 @@ public: // Member functions + //- Activate SIGQUIT signal handler void set(const bool verbose); }; @@ -84,4 +89,8 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/src/OSspecific/POSIX/signals/sigSegv.C b/src/OSspecific/POSIX/signals/sigSegv.C index a4fad40b8b47147ee09198cc02d3f100c44a537f..98a02a9defbe3f45415f1db243ed6d0a5f68d169 100644 --- a/src/OSspecific/POSIX/signals/sigSegv.C +++ b/src/OSspecific/POSIX/signals/sigSegv.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "sigSegv.H" +#include "error.H" #include "JobInfo.H" #include "IOstreams.H" @@ -32,16 +32,17 @@ License struct sigaction Foam::sigSegv::oldAction_; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::sigSegv::sigSegvHandler(int) +void Foam::sigSegv::sigHandler(int) { // Reset old handling if (sigaction(SIGSEGV, &oldAction_, NULL) < 0) { FatalErrorIn ( - "Foam::sigSegv::sigSegvHandler()" + "Foam::sigSegv::sigHandler()" ) << "Cannot reset SIGSEGV trapping" << abort(FatalError); } @@ -82,7 +83,7 @@ Foam::sigSegv::~sigSegv() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::sigSegv::set(const bool verbose) +void Foam::sigSegv::set(const bool) { if (oldAction_.sa_handler) { @@ -94,7 +95,7 @@ void Foam::sigSegv::set(const bool verbose) } struct sigaction newAction; - newAction.sa_handler = sigSegvHandler; + newAction.sa_handler = sigHandler; newAction.sa_flags = SA_NODEFER; sigemptyset(&newAction.sa_mask); if (sigaction(SIGSEGV, &newAction, &oldAction_) < 0) diff --git a/src/OSspecific/POSIX/signals/sigSegv.H b/src/OSspecific/POSIX/signals/sigSegv.H index b8cf2398fe48ba324f92c2e9e0b1230ad5d57e45..a3de76f329c25944f0f9d3a28f5061acccdc9681 100644 --- a/src/OSspecific/POSIX/signals/sigSegv.H +++ b/src/OSspecific/POSIX/signals/sigSegv.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,9 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#include "OSspecific.H" +#ifndef sigSegv_H +#define sigSegv_H + #include <signal.h> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -60,13 +62,15 @@ class sigSegv // Private Member Functions - static void sigSegvHandler(int); + //- Handler for caught signals + static void sigHandler(int); public: // Constructors + //- Construct null sigSegv(); @@ -76,6 +80,7 @@ public: // Member functions + //- Activate SIGSEGV signal handler void set(const bool verbose); }; @@ -84,4 +89,8 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 5423753eb42860e7d850e2867bf7b5d295ebd61f..370f42b2fa3567f59171ebe9df867a68d3bf9b91 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,10 +58,10 @@ Foam::argList::initValidTables::initValidTables() validParOptions.set("parallel", ""); argList::addOption ( - "roots", "(dir1 .. dirn)", + "roots", "(dir1 .. dirN)", "slave root directories for distributed running" ); - validParOptions.set("roots", "(dir1 .. dirn)"); + validParOptions.set("roots", "(dir1 .. dirN)"); Pstream::addValidParOptions(validParOptions); } @@ -138,8 +138,8 @@ void Foam::argList::noBanner() void Foam::argList::noParallel() { - optionUsage.erase("parallel"); - validOptions.erase("parallel"); + removeOption("parallel"); + removeOption("roots"); validParOptions.clear(); } @@ -537,10 +537,10 @@ Foam::argList::argList if (options_.found("roots")) { + source = "'-roots' option"; IStringStream str(options_["roots"]); str >> roots; dictNProcs = roots.size()+1; - source = "roots-command-line"; } else { @@ -593,7 +593,7 @@ Foam::argList::argList { forAll(roots, i) { - roots[i] = roots[i].expand(); + roots[i].expand(); } if (roots.size() != Pstream::nProcs()-1) diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index 7d8ac59b9ec3b907d063ddd5c0e987c323b5dbf1..33e951ce071be4de82a94e0255570d107661162b 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,7 +59,7 @@ Description Note - The document browser used is defined by the @b FOAM_DOC_BROWSER environment variable or the <tt>Documentation/docBrowser</tt> entry - in the <tt>~OpenFOAM/controlDict</tt> file. + in the <tt>~OpenFOAM/controlDict</tt> file. The \%f token is used as a placeholder for the file name. - The valid (mandatory) arguments can be adjusted by directly manipulating the argList::validArgs static member. @@ -83,6 +83,7 @@ SourceFiles #include "fileName.H" #include "parRun.H" #include "IStringStream.H" +#include "OSspecific.H" #include "sigFpe.H" #include "sigInt.H" @@ -94,7 +95,9 @@ SourceFiles namespace Foam { -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +/*---------------------------------------------------------------------------*\ + Class argList Declaration +\*---------------------------------------------------------------------------*/ class argList { @@ -165,7 +168,7 @@ public: //- Max screen width for displaying usage (default: 80) static string::size_type usageMax; - //! @cond ignoreDocumentation + //! @cond internalClass class initValidTables { public: diff --git a/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C b/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C index 1ca2f9929d70b0d6ed1e052df0e570116913871d..bd401abe860060420f79f35b2aa8fe7172a4393c 100644 --- a/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C +++ b/src/OpenFOAM/meshes/boundBox/boundBoxTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C b/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C index 7b5d16d722a18a9791eb453f82de1db5408eac54..113fc5a001b4a6b2cdd74325f58b3d6cd8b602f6 100644 --- a/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C +++ b/src/OpenFOAM/primitives/hashes/SHA1/SHA1Digest.C @@ -31,8 +31,8 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // //! @cond fileScope -const char hexChars[] = "0123456789abcdef"; -//! @endcond fileScope +static const char hexChars[] = "0123456789abcdef"; +//! @endcond // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -87,6 +87,20 @@ void Foam::SHA1Digest::clear() } +bool Foam::SHA1Digest::empty() const +{ + for (unsigned i = 0; i < length; ++i) + { + if (v_[i]) + { + return false; + } + } + + return true; +} + + // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const @@ -103,9 +117,79 @@ bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const } +bool Foam::SHA1Digest::operator==(const std::string& hexdigits) const +{ + // null or empty string is not an error - interpret as '0000..' + if (hexdigits.empty()) + { + return empty(); + } + + // incorrect length - can never match + if (hexdigits.size() != length*2) + { + return false; + } + + for (unsigned i = 0, charI = 0; i < length; ++i, charI += 2) + { + const char c1 = hexChars[((v_[i] >> 4) & 0xF)]; + const char c2 = hexChars[(v_[i] & 0xF)]; + + if (c1 != hexdigits[charI] || c2 != hexdigits[charI+1]) + { + return false; + } + } + + return true; +} + + +bool Foam::SHA1Digest::operator==(const char* hexdigits) const +{ + // null or empty string is not an error - interpret as '0000..' + if (!hexdigits || !*hexdigits) + { + return empty(); + } + + // incorrect length - can never match + if (strlen(hexdigits) != length*2) + { + return false; + } + + for (unsigned i = 0, charI = 0; i < length; ++i, charI += 2) + { + const char c1 = hexChars[((v_[i] >> 4) & 0xF)]; + const char c2 = hexChars[(v_[i] & 0xF)]; + + if (c1 != hexdigits[charI] || c2 != hexdigits[charI+1]) + { + return false; + } + } + + return true; +} + + bool Foam::SHA1Digest::operator!=(const SHA1Digest& rhs) const { - return !this->operator==(rhs); + return !operator==(rhs); +} + + +bool Foam::SHA1Digest::operator!=(const std::string& rhs) const +{ + return !operator==(rhs); +} + + +bool Foam::SHA1Digest::operator!=(const char* rhs) const +{ + return !operator==(rhs); } diff --git a/src/Pstream/gamma/Make/files b/src/Pstream/gamma/Make/files index a0374cb9c395bb3ca8473880c823774ceaeb0dae..a3a8fc6b607668fdca3b91713e97b77b488d5110 100644 --- a/src/Pstream/gamma/Make/files +++ b/src/Pstream/gamma/Make/files @@ -3,4 +3,4 @@ Pstream.C OPwrite.C IPread.C -LIB = $(FOAM_MPI_LIBBIN)/libPstream +LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libPstream diff --git a/src/Pstream/mpi/Make/files b/src/Pstream/mpi/Make/files index eccdf776646facdf15c41782c80a2eccf10f7c5f..c01382d678de41f7dcff40a1427e1a567a960e6b 100644 --- a/src/Pstream/mpi/Make/files +++ b/src/Pstream/mpi/Make/files @@ -3,4 +3,4 @@ UIPread.C UPstream.C PstreamGlobals.C -LIB = $(FOAM_MPI_LIBBIN)/libPstream +LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libPstream diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C index eca6aaec36592df58415709cd5c2b30c3f2f553d..fa7dc5c127520e70b4d5c932da4c185d11abb5da 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -167,6 +167,14 @@ Foam::autoPtr<Foam::coordinateRotation> Foam::coordinateRotation::New } +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::coordinateRotation::clear() +{ + this->tensor::operator=(sphericalTensor::I); +} + + // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // void Foam::coordinateRotation::operator=(const dictionary& rhs) diff --git a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H index d759296afffa6f420c8747cea290aeaf023a3464..55fcd9ca16a3759f353736cc7df6ddc870079e77 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H +++ b/src/meshTools/coordinateSystems/coordinateRotation/coordinateRotation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -165,6 +165,9 @@ public: // Member Functions + //- Reset rotation to an identity rotation + virtual void clear(); + //- Return local-to-global transformation tensor const tensor& R() const { diff --git a/src/meshTools/coordinateSystems/coordinateSystem.C b/src/meshTools/coordinateSystems/coordinateSystem.C index 8a97574b21580b66961558b5a0065ff597cdab92..9b43631d1f49283a1822b7099763b6f6b20a001f 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.C +++ b/src/meshTools/coordinateSystems/coordinateSystem.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -290,6 +290,15 @@ Foam::tmp<Foam::vectorField> Foam::coordinateSystem::globalToLocal } +void Foam::coordinateSystem::clear() +{ + note_.clear(); + origin_ = point::zero; + R_.clear(); + Rtr_ = sphericalTensor::I; +} + + void Foam::coordinateSystem::write(Ostream& os) const { os << type() diff --git a/src/meshTools/coordinateSystems/coordinateSystem.H b/src/meshTools/coordinateSystems/coordinateSystem.H index fba2f3253fca3a1b34c5e066798ec898e82c27e4..ab673cd83b0af1d2db8c6f9a74b569abf56f26af 100644 --- a/src/meshTools/coordinateSystems/coordinateSystem.H +++ b/src/meshTools/coordinateSystems/coordinateSystem.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -397,6 +397,10 @@ public: return origin_; } + //- Reset origin and rotation to an identity coordinateSystem + // Also resets the note + virtual void clear(); + // Write diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index cb053bcc3e811423065066a35578544f55d49fda..a1a58a2a0f51f421f60ae8437c45ed0f710fd56e 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -1,7 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -# get SCOTCH_VERSION, SCOTCH_ARCH_PATH, SCOTCH_MPI_INCLUDE +# get SCOTCH_VERSION, SCOTCH_ARCH_PATH settings=`$WM_PROJECT_DIR/bin/foamEtcFile apps/scotch/bashrc` if [ -f "$settings" ] then @@ -19,7 +19,7 @@ wmakeLnInclude decompositionMethods wmake libso scotchDecomp wmake libso metisDecomp -if [ -d "$FOAM_MPI_LIBBIN" ] +if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ] then ( WM_OPTIONS=${WM_OPTIONS}$WM_MPLIB diff --git a/src/parallel/decompose/metisDecomp/Make/files b/src/parallel/decompose/metisDecomp/Make/files index 030326722ab549d205e6020e1a2c235ae31304f5..39ee731e4d02e5c17cd2a3fb56fbe12606424ad7 100644 --- a/src/parallel/decompose/metisDecomp/Make/files +++ b/src/parallel/decompose/metisDecomp/Make/files @@ -1,3 +1,3 @@ metisDecomp.C -LIB = $(FOAM_EXT_LIBBIN)/libmetisDecomp +LIB = $(FOAM_LIBBIN)/libmetisDecomp diff --git a/src/parallel/decompose/ptscotchDecomp/Make/files b/src/parallel/decompose/ptscotchDecomp/Make/files index d2494e36bad20791ada67c423ff195048666429c..8f83423f7e95c6c02df4f3028f95235cbbd321d2 100644 --- a/src/parallel/decompose/ptscotchDecomp/Make/files +++ b/src/parallel/decompose/ptscotchDecomp/Make/files @@ -1,3 +1,3 @@ ptscotchDecomp.C -LIB = $(FOAM_MPI_LIBBIN)/libptscotchDecomp +LIB = $(FOAM_LIBBIN)/$(FOAM_MPI)/libptscotchDecomp diff --git a/src/parallel/decompose/ptscotchDecomp/Make/options b/src/parallel/decompose/ptscotchDecomp/Make/options index d4f56eb39a42e7e3a48d3eeda17d20f2384bc525..ea5b0c3ad86980e25b0df4a363698d05c9a1fd65 100644 --- a/src/parallel/decompose/ptscotchDecomp/Make/options +++ b/src/parallel/decompose/ptscotchDecomp/Make/options @@ -3,9 +3,9 @@ sinclude $(RULES)/mplib$(WM_MPLIB) EXE_INC = \ $(PFLAGS) $(PINC) \ - -I$(SCOTCH_MPI_INCLUDE) \ + -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \ -I/usr/include/scotch \ -I../decompositionMethods/lnInclude LIB_LIBS = \ - -L$(FOAM_MPI_LIBBIN) -lptscotch -lptscotcherrexit -lrt + -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -lptscotch -lptscotcherrexit -lrt diff --git a/src/parallel/decompose/scotchDecomp/Make/files b/src/parallel/decompose/scotchDecomp/Make/files index dbb178726c9cf9ffc7e81497d8062562e8c5fce9..59717fa15c8d33b2b3e3389075356565d2da2726 100644 --- a/src/parallel/decompose/scotchDecomp/Make/files +++ b/src/parallel/decompose/scotchDecomp/Make/files @@ -1,3 +1,3 @@ scotchDecomp.C -LIB = $(FOAM_EXT_LIBBIN)/libscotchDecomp +LIB = $(FOAM_LIBBIN)/libscotchDecomp diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index 9e330e22b0572ed80506aafff1100cbfd03a3e22..412794795b2f22189c68b08ae51678f739b3701a 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -188,7 +188,7 @@ Foam::forces::forces fDName_(""), rhoRef_(VGREAT), pRef_(0), - CofR_(vector::zero), + coordSys_(), forcesFilePtr_(NULL) { // Check if the available mesh is an fvMesh otherise deactivate @@ -225,14 +225,13 @@ void Foam::forces::read(const dictionary& dict) if (active_) { log_ = dict.lookupOrDefault<Switch>("log", false); + directForceDensity_ = dict.lookupOrDefault("directForceDensity", false); const fvMesh& mesh = refCast<const fvMesh>(obr_); patchSet_ = mesh.boundaryMesh().patchSet(wordList(dict.lookup("patches"))); - dict.readIfPresent("directForceDensity", directForceDensity_); - if (directForceDensity_) { // Optional entry for fDName @@ -245,8 +244,8 @@ void Foam::forces::read(const dictionary& dict) ) { active_ = false; - WarningIn("void forces::read(const dictionary& dict)") - << "Could not find " << fDName_ << " in database." << nl + WarningIn("void forces::read(const dictionary&)") + << "Could not find " << fDName_ << " in database." << nl << " De-activating forces." << endl; } @@ -272,7 +271,7 @@ void Foam::forces::read(const dictionary& dict) { active_ = false; - WarningIn("void forces::read(const dictionary& dict)") + WarningIn("void forces::read(const dictionary&)") << "Could not find " << UName_ << ", " << pName_; if (rhoName_ != "rhoInf") @@ -280,8 +279,8 @@ void Foam::forces::read(const dictionary& dict) Info<< " or " << rhoName_; } - Info<< " in database." << nl << " De-activating forces." - << endl; + Info<< " in database." << nl + << " De-activating forces." << endl; } // Reference density needed for incompressible calculations @@ -291,8 +290,14 @@ void Foam::forces::read(const dictionary& dict) pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0); } + coordSys_.clear(); + // Centre of rotation for moment calculations - CofR_ = dict.lookup("CofR"); + // specified directly, from coordinate system, or implicitly (0 0 0) + if (!dict.readIfPresent<point>("CofR", coordSys_.origin())) + { + coordSys_ = coordinateSystem(dict, obr_); + } } } @@ -345,6 +350,8 @@ void Foam::forces::writeFileHeader() forcesFilePtr_() << "# Time" << tab << "forces(pressure, viscous) moment(pressure, viscous)" + << tab + << "local forces(pressure, viscous) local moment(pressure, viscous)" << endl; } } @@ -373,13 +380,32 @@ void Foam::forces::write() if (Pstream::master()) { - forcesFilePtr_() << obr_.time().value() << tab << fm << endl; + forcesMoments fmLocal; + + fmLocal.first().first() = + coordSys_.localVector(fm.first().first()); + + fmLocal.first().second() = + coordSys_.localVector(fm.first().second()); + + fmLocal.second().first() = + coordSys_.localVector(fm.second().first()); + + fmLocal.second().second() = + coordSys_.localVector(fm.second().second()); + + forcesFilePtr_() << obr_.time().value() + << tab << fm + << tab << fmLocal << endl; if (log_) { Info<< "forces output:" << nl << " forces(pressure, viscous)" << fm.first() << nl << " moment(pressure, viscous)" << fm.second() << nl + << " local:" << nl + << " forces(pressure, viscous)" << fmLocal.first() << nl + << " moment(pressure, viscous)" << fmLocal.second() << nl << endl; } } @@ -408,7 +434,10 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const { label patchi = iter.key(); - vectorField Md(mesh.C().boundaryField()[patchi] - CofR_); + vectorField Md + ( + mesh.C().boundaryField()[patchi] - coordSys_.origin() + ); scalarField sA(mag(Sfb[patchi])); @@ -452,7 +481,10 @@ Foam::forces::forcesMoments Foam::forces::calcForcesMoment() const { label patchi = iter.key(); - vectorField Md(mesh.C().boundaryField()[patchi] - CofR_); + vectorField Md + ( + mesh.C().boundaryField()[patchi] - coordSys_.origin() + ); vectorField pf(Sfb[patchi]*(p.boundaryField()[patchi] - pRef)); diff --git a/src/postProcessing/functionObjects/forces/forces/forces.H b/src/postProcessing/functionObjects/forces/forces/forces.H index 75470871abc243a29843d58d502310a787030450..dc796e4afd1dc840883e72798c11d06c7775aacb 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.H +++ b/src/postProcessing/functionObjects/forces/forces/forces.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,11 +28,25 @@ Description Calculates the forces and moments by integrating the pressure and skin-friction forces over a given list of patches. - Member function calcForcesMoment()calculates and returns the forces and - moments. - - Member function forces::write() calls calcForcesMoment() and writes the - forces and moments into the file \<timeDir\>/forces.dat + Member function forces::write() calculates the forces/moments and + writes the forces/moments into the file \<timeDir\>/forces.dat + +Note + The centre of rotation for moment calculations can either be specified + by an @c CofR entry, or be taken from origin of the local coordinateSystem. + For example, + @verbatim + CofR (0 0 0); + @endverbatim + or + @verbatim + coordinateSystem + { + origin (0 0 0); + e3 (0 0 1); + e1 (1 0 0); + } + @endverbatim SourceFiles forces.C @@ -43,6 +57,8 @@ SourceFiles #ifndef forces_H #define forces_H +#include "coordinateSystem.H" +#include "coordinateSystems.H" #include "primitiveFieldsFwd.H" #include "volFieldsFwd.H" #include "HashSet.H" @@ -69,15 +85,14 @@ class forces { public: - // Tuple which holds the pressure (.first()) and viscous (.second) forces + // Tuple for pressure (.first()) and viscous (.second()) forces typedef Tuple2<vector, vector> pressureViscous; - // Tuple which holds the forces (.first()) and moment (.second) + // Tuple for forces (.first()) and moment (.second()) // pressure/viscous forces Tuples. typedef Tuple2<pressureViscous, pressureViscous> forcesMoments; - //- Sum operation class to accumulate the pressure, viscous forces - // and moments + //- Sum operation class to accumulate pressure/viscous forces and moments class sumOp { public: @@ -92,12 +107,12 @@ public: ( pressureViscous ( - fm1.first().first() + fm2.first().first(), + fm1.first().first() + fm2.first().first(), fm1.first().second() + fm2.first().second() ), pressureViscous ( - fm1.second().first() + fm2.second().first(), + fm1.second().first() + fm2.second().first(), fm1.second().second() + fm2.second().second() ) ); @@ -147,8 +162,8 @@ protected: //- Reference pressure scalar pRef_; - //- Centre of rotation - vector CofR_; + //- Coordinate system used when evaluting forces/moments + coordinateSystem coordSys_; //- Forces/moment file ptr diff --git a/src/triSurface/triSurface/triSurface.H b/src/triSurface/triSurface/triSurface.H index b889449e44165df102a48aeded234fc6aaa2036f..838c4acc4dbd166b19b1bc2dc0450e8c6c38db98 100644 --- a/src/triSurface/triSurface/triSurface.H +++ b/src/triSurface/triSurface/triSurface.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -223,9 +223,6 @@ public: // Public typedefs - //- Face type used - typedef labelledTri FaceType; - //- Placeholder only, but do not remove - it is needed for GeoMesh typedef bool BoundaryMesh; diff --git a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C index 8e6fb5827e96f9f230013733a19d48461678e6f3..6d10a3718eac7ca36db54a734320298c5b15ad0f 100644 --- a/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C +++ b/src/turbulenceModels/incompressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/reactions b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/reactions index 478bb46642ee40fb1806e867cfb509c43f0fde3a..5f5ae52ee2c8012316d1b5b0d59fa90077e2959c 100644 --- a/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/reactions +++ b/tutorials/combustion/reactingFoam/ras/counterFlowFlame2D/constant/reactions @@ -17,4 +17,3 @@ reactions Ta 14906; } } - diff --git a/wmake/Makefile b/wmake/Makefile index 7ff37450ba8f9cc52f45d0dd083f9c3da6722219..72fd3ed087c5582c789520701fd72ab35895f9b8 100644 --- a/wmake/Makefile +++ b/wmake/Makefile @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. +# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -56,8 +56,7 @@ WM_SCRIPTS = $(WM_DIR)/scripts #------------------------------------------------------------------------------ LIB_SRC = $(WM_PROJECT_DIR)/src -LIB_DIR = $(WM_PROJECT_DIR)/lib -LIB_WM_OPTIONS_DIR = $(LIB_DIR)/$(WM_OPTIONS) +LIB_PLATFORMS = $(WM_PROJECT_DIR)/platforms/$(WM_OPTIONS)/lib OBJECTS_DIR = $(MAKE_DIR)/$(WM_OPTIONS) CLASSES_DIR = $(MAKE_DIR)/classes @@ -148,7 +147,7 @@ LIB_HEADER_DIRS = \ $(EXE): $(OBJECTS) @$(WM_SCRIPTS)/makeTargetDir $(EXE) - $(LINKEXE) $(OBJECTS) -L$(LIB_WM_OPTIONS_DIR) \ + $(LINKEXE) $(OBJECTS) -L$(LIB_PLATFORMS) \ $(EXE_LIBS) $(PROJECT_LIBS) $(SYS_LIBS) $(LINK_LIBS) $(GLIBS) -o $(EXE) exe: $(SEXE) @@ -173,7 +172,7 @@ $(LIB).$(SO): $(OBJECTS) @$(WM_SCRIPTS)/makeTargetDir $(LIB) @rm -f so_locations @cd $(OBJECTS_DIR) ; \ - $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_WM_OPTIONS_DIR) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO) + $(LINKLIBSO) $(LOCAL_OBJECTS) -L$(LIB_PLATFORMS) $(LIB_LIBS) $(GLIB_LIBS) -o $(LIB).$(SO) lib: $(LIB).a @echo \'$(LIB).a\' is up to date.