Compilation tweaks for mingw

This commit is contained in:
Dominik Christ 2015-08-04 13:39:06 +01:00
parent 0d734cb9c0
commit 7367164292
32 changed files with 820 additions and 833 deletions

View file

@ -1,78 +1,78 @@
#!/bin/sh #!/bin/sh
#----------------------------------*-sh-*-------------------------------------- #----------------------------------*-sh-*--------------------------------------
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2 # \\ / O peration | Version: 3.2
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of foam-extend. # This file is part of foam-extend.
# #
# foam-extend is free software: you can redistribute it and/or modify it # foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the # under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your # Free Software Foundation, either version 3 of the License, or (at your
# option) any later version. # option) any later version.
# #
# foam-extend is distributed in the hope that it will be useful, but # foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>. # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
# #
# Script # Script
# Allwmake.mingw # Allwmake.mingw
# #
# Description # Description
# Top-level build script for use with MSYS shell for MinGW-based builds on Windows. # Top-level build script for use with MSYS shell for MinGW-based builds on Windows.
# #
# Author: # Author:
# Cesare Guardino, Alstom Power Ltd., (2015) # Cesare Guardino, Alstom Power Ltd., (2015)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
echo echo
echo "=============== FOAM-EXTEND MINGW WINDOWS TOP-LEVEL BUILD SCRIPT ===============" echo "=============== FOAM-EXTEND MINGW WINDOWS TOP-LEVEL BUILD SCRIPT ==============="
if [ "$PWD" != "$WM_PROJECT_DIR" ] if [ "$PWD" != "$WM_PROJECT_DIR" ]
then then
echo "Error: Current directory is not \$WM_PROJECT_DIR" echo "Error: Current directory is not \$WM_PROJECT_DIR"
echo " The environment variable are not consistent with the installation." echo " The environment variable are not consistent with the installation."
echo " Check the OpenFOAM entries in your dot-files and source them." echo " Check the OpenFOAM entries in your dot-files and source them."
exit 1 exit 1
fi fi
cd $WM_PROJECT_DIR/ThirdParty/mingwBuild cd $WM_PROJECT_DIR/ThirdParty/mingwBuild
echo echo
echo "In directory `pwd`" echo "In directory `pwd`"
echo "Configuring your OpenMPI installation ..." echo "Configuring your OpenMPI installation ..."
./configure_OpenMPI.sh ./configure_OpenMPI.sh
PACKAGES_DIR=$WM_PROJECT_DIR/ThirdParty/packages PACKAGES_DIR=$WM_PROJECT_DIR/ThirdParty/packages
if [ -d $PACKAGES_DIR ] ; then if [ -d $PACKAGES_DIR ] ; then
echo "Third-party dependencies packages $PACKAGES_DIR already exists." echo "Third-party dependencies packages $PACKAGES_DIR already exists."
else else
echo "Building third-party dependencies ... (see `pwd`/build.log)" echo "Building third-party dependencies ... (see `pwd`/build.log)"
./build.sh > build.log 2>&1 ./build.sh > build.log 2>&1
echo "Installing third-party dependencies ..." echo "Installing third-party dependencies ..."
rm -rf $PACKAGES_DIR rm -rf $PACKAGES_DIR
mv x64/install $PACKAGES_DIR mv x64/install $PACKAGES_DIR
fi fi
cd $WM_PROJECT_DIR cd $WM_PROJECT_DIR
echo echo
echo "In directory `pwd`" echo "In directory `pwd`"
echo "Build foam-extend ... (see `pwd`/Allwmake.log)" echo "Build foam-extend ... (see `pwd`/Allwmake.log)"
./Allwmake > Allwmake.log 2>&1 ./Allwmake > Allwmake.log 2>&1
echo "Copying MinGW dependencies to $FOAM_APPBIN ..." echo "Copying MinGW dependencies to $FOAM_APPBIN ..."
cp -p $MINGW_HOME/bin/libgcc_s_seh-1.dll $FOAM_APPBIN cp -p $MINGW_HOME/bin/libgcc_s_seh-1.dll $FOAM_APPBIN
cp -p $MINGW_HOME/bin/libstdc++-6.dll $FOAM_APPBIN cp -p $MINGW_HOME/bin/libstdc++-6.dll $FOAM_APPBIN
cp -p $MINGW_HOME/bin/libwinpthread-1.dll $FOAM_APPBIN cp -p $MINGW_HOME/bin/libwinpthread-1.dll $FOAM_APPBIN
echo "Creating release package ... (see `pwd`/createWindowsBinaryPackage.log)" echo "Creating release package ... (see `pwd`/createWindowsBinaryPackage.log)"
./bin/createWindowsBinaryPackage > createWindowsBinaryPackage.log 2>&1 ./bin/createWindowsBinaryPackage > createWindowsBinaryPackage.log 2>&1
echo echo
echo "All done!" echo "All done!"

View file

@ -1,293 +1,293 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2 # \\ / O peration | Version: 3.2
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of foam-extend. # This file is part of foam-extend.
# #
# foam-extend is free software: you can redistribute it and/or modify it # foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the # under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your # Free Software Foundation, either version 3 of the License, or (at your
# option) any later version. # option) any later version.
# #
# foam-extend is distributed in the hope that it will be useful, but # foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>. # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
# #
# Script # Script
# build.sh # build.sh
# #
# Description # Description
# Downloads, extracts, builds and installs thirdy-party dependencies. # Downloads, extracts, builds and installs thirdy-party dependencies.
# #
# Author: # Author:
# Cesare Guardino, Alstom Power Ltd., (2015) # Cesare Guardino, Alstom Power Ltd., (2015)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# {{{ DEFINE UTILITY FUNCTIONS # {{{ DEFINE UTILITY FUNCTIONS
download() { download() {
file=$1 file=$1
url=$2 url=$2
if [ -f $BUILD_HOME/downloads/$file ] ; then if [ -f $BUILD_HOME/downloads/$file ] ; then
echo "Using already existing file $BUILD_HOME/downloads/$file" echo "Using already existing file $BUILD_HOME/downloads/$file"
else else
wget --no-check-certificate $url -O $BUILD_HOME/downloads/$file wget --no-check-certificate $url -O $BUILD_HOME/downloads/$file
fi fi
} }
extract() { extract() {
file=$1 file=$1
program=$2 program=$2
cp -p $BUILD_HOME/downloads/$file . cp -p $BUILD_HOME/downloads/$file .
package=`basename $file` package=`basename $file`
if [ "$program" = "7zip" ] ; then if [ "$program" = "7zip" ] ; then
"$ZIP_EXE" x $package "$ZIP_EXE" x $package
else else
$program -cd $package | tar xvf - $program -cd $package | tar xvf -
fi fi
rm $package rm $package
} }
unzip_dir() { unzip_dir() {
dir=$1 dir=$1
mkdir $dir mkdir $dir
cd $dir cd $dir
extract $dir.zip 7zip extract $dir.zip 7zip
cd .. cd ..
} }
patch() { patch() {
dir=$1 dir=$1
cp -rp $BUILD_HOME/$ARCH/patches/$dir . cp -rp $BUILD_HOME/$ARCH/patches/$dir .
} }
mkchk() { mkchk() {
dir=$1 dir=$1
if [ ! -d $dir ] ; then if [ ! -d $dir ] ; then
mkdir $dir mkdir $dir
fi fi
} }
mkdel() { mkdel() {
dir=$1 dir=$1
rm -rf $dir > /dev/null 2>&1 rm -rf $dir > /dev/null 2>&1
mkdir $dir mkdir $dir
} }
# }}} # }}}
# {{{ DEFINE PROCESS FUNCTIONS # {{{ DEFINE PROCESS FUNCTIONS
start() { start() {
echo "======================== FOAM-EXTEND THIRD-PARTY DEPENDENCIES WINDOWS BUILD SCRIPT ========================" echo "======================== FOAM-EXTEND THIRD-PARTY DEPENDENCIES WINDOWS BUILD SCRIPT ========================"
} }
initialise() { initialise() {
echo "" echo ""
if [ ! "$MINGW_HOME" ] ; then if [ ! "$MINGW_HOME" ] ; then
echo "*** ERROR: MINGW_HOME environment variable not specified." echo "*** ERROR: MINGW_HOME environment variable not specified."
exit 1 exit 1
else else
echo "Using MINGW_HOME=$MINGW_HOME" echo "Using MINGW_HOME=$MINGW_HOME"
fi fi
BUILD_HOME=`pwd` BUILD_HOME=`pwd`
ZIP_EXE="7z.exe" ZIP_EXE="7z.exe"
ARCH="x64" ARCH="x64"
BUILD_DIR=$BUILD_HOME/$ARCH/build BUILD_DIR=$BUILD_HOME/$ARCH/build
INSTALL_DIR=$BUILD_HOME/$ARCH/install INSTALL_DIR=$BUILD_HOME/$ARCH/install
OUT_DIR=$BUILD_HOME/$ARCH/output OUT_DIR=$BUILD_HOME/$ARCH/output
mkchk $BUILD_HOME/downloads mkchk $BUILD_HOME/downloads
echo "" echo ""
echo "All stdout/stderr output is redirected to the directory $OUT_DIR" echo "All stdout/stderr output is redirected to the directory $OUT_DIR"
echo "All builds occur in the directory $BUILD_DIR" echo "All builds occur in the directory $BUILD_DIR"
echo "The script will install the completed builds in the directory $INSTALL_DIR" echo "The script will install the completed builds in the directory $INSTALL_DIR"
} }
cleanup() { cleanup() {
echo "" echo ""
echo "Removing previous builds ..." echo "Removing previous builds ..."
mkdel $BUILD_DIR mkdel $BUILD_DIR
mkdel $INSTALL_DIR mkdel $INSTALL_DIR
mkdel $OUT_DIR mkdel $OUT_DIR
} }
build_library() { build_library() {
PACKAGE=$1 PACKAGE=$1
echo "- Building $PACKAGE ..." echo "- Building $PACKAGE ..."
LOG_FILE=$OUT_DIR/$PACKAGE.log LOG_FILE=$OUT_DIR/$PACKAGE.log
cd $BUILD_DIR cd $BUILD_DIR
case $PACKAGE in case $PACKAGE in
dlfcn-win32-master) dlfcn-win32-master)
download $PACKAGE.zip https://github.com/dlfcn-win32/dlfcn-win32/archive/master.zip > $LOG_FILE 2>&1 download $PACKAGE.zip https://github.com/dlfcn-win32/dlfcn-win32/archive/master.zip > $LOG_FILE 2>&1
extract $PACKAGE.zip 7zip >> $LOG_FILE 2>&1 extract $PACKAGE.zip 7zip >> $LOG_FILE 2>&1
cd $PACKAGE cd $PACKAGE
./configure --prefix=$INSTALL_DIR/system >> $LOG_FILE 2>&1 ./configure --prefix=$INSTALL_DIR/system >> $LOG_FILE 2>&1
make >> $LOG_FILE 2>&1 make >> $LOG_FILE 2>&1
mkdir $INSTALL_DIR/system mkdir $INSTALL_DIR/system
make install >> $LOG_FILE 2>&1 make install >> $LOG_FILE 2>&1
;; ;;
system) system)
cd $INSTALL_DIR cd $INSTALL_DIR
patch system patch system
;; ;;
pthreads-w32-2-9-1-release) pthreads-w32-2-9-1-release)
download $PACKAGE.zip ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip > $LOG_FILE 2>&1 download $PACKAGE.zip ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip > $LOG_FILE 2>&1
unzip_dir $PACKAGE >> $LOG_FILE 2>&1 unzip_dir $PACKAGE >> $LOG_FILE 2>&1
patch $PACKAGE patch $PACKAGE
;; ;;
metis-5.1.0) metis-5.1.0)
download $PACKAGE.tar.gz http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/$PACKAGE.tar.gz > $LOG_FILE 2>&1 download $PACKAGE.tar.gz http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/$PACKAGE.tar.gz > $LOG_FILE 2>&1
extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1 extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
patch $PACKAGE patch $PACKAGE
cd $PACKAGE cd $PACKAGE
mkdir build/windows mkdir build/windows
cd build/windows cd build/windows
cmake -G "MSYS Makefiles" -DCMAKE_CONFIGURATION-TYPES="Release" -DGKLIB_PATH="../../GKlib" ../.. >> $LOG_FILE 2>&1 cmake -G "MSYS Makefiles" -DCMAKE_CONFIGURATION-TYPES="Release" -DGKLIB_PATH="../../GKlib" ../.. >> $LOG_FILE 2>&1
make >> $LOG_FILE 2>&1 make >> $LOG_FILE 2>&1
mkdir $INSTALL_DIR/$PACKAGE mkdir $INSTALL_DIR/$PACKAGE
mkdir $INSTALL_DIR/$PACKAGE/bin mkdir $INSTALL_DIR/$PACKAGE/bin
mkdir $INSTALL_DIR/$PACKAGE/include mkdir $INSTALL_DIR/$PACKAGE/include
mkdir $INSTALL_DIR/$PACKAGE/lib mkdir $INSTALL_DIR/$PACKAGE/lib
cp -p programs/*.exe $INSTALL_DIR/$PACKAGE/bin cp -p programs/*.exe $INSTALL_DIR/$PACKAGE/bin
cp -p ../../include/metis.h $INSTALL_DIR/$PACKAGE/include cp -p ../../include/metis.h $INSTALL_DIR/$PACKAGE/include
cp -p libmetis/libmetis.a $INSTALL_DIR/$PACKAGE/lib cp -p libmetis/libmetis.a $INSTALL_DIR/$PACKAGE/lib
;; ;;
parmetis-4.0.3) parmetis-4.0.3)
download $PACKAGE.tar.gz http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/$PACKAGE.tar.gz > $LOG_FILE 2>&1 download $PACKAGE.tar.gz http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/$PACKAGE.tar.gz > $LOG_FILE 2>&1
extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1 extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
patch $PACKAGE patch $PACKAGE
cd $PACKAGE cd $PACKAGE
mkdir build/windows mkdir build/windows
cd build/windows cd build/windows
cmake -G "MSYS Makefiles" -DCMAKE_CONFIGURATION-TYPES="Release" -DGKLIB_PATH="../../metis/GKlib" ../.. >> $LOG_FILE 2>&1 cmake -G "MSYS Makefiles" -DCMAKE_CONFIGURATION-TYPES="Release" -DGKLIB_PATH="../../metis/GKlib" ../.. >> $LOG_FILE 2>&1
$BUILD_HOME/parmetis_includes_hack.pl $BUILD_HOME/parmetis_includes_hack.pl
make >> $LOG_FILE 2>&1 make >> $LOG_FILE 2>&1
mkdir $INSTALL_DIR/$PACKAGE mkdir $INSTALL_DIR/$PACKAGE
mkdir $INSTALL_DIR/$PACKAGE/bin mkdir $INSTALL_DIR/$PACKAGE/bin
mkdir $INSTALL_DIR/$PACKAGE/include mkdir $INSTALL_DIR/$PACKAGE/include
mkdir $INSTALL_DIR/$PACKAGE/lib mkdir $INSTALL_DIR/$PACKAGE/lib
cp -p programs/*.exe $INSTALL_DIR/$PACKAGE/bin cp -p programs/*.exe $INSTALL_DIR/$PACKAGE/bin
cp -p ../../metis/include/metis.h $INSTALL_DIR/$PACKAGE/include cp -p ../../metis/include/metis.h $INSTALL_DIR/$PACKAGE/include
cp -p ../../include/parmetis.h $INSTALL_DIR/$PACKAGE/include cp -p ../../include/parmetis.h $INSTALL_DIR/$PACKAGE/include
cp -p libmetis/libmetis.a $INSTALL_DIR/$PACKAGE/lib cp -p libmetis/libmetis.a $INSTALL_DIR/$PACKAGE/lib
cp -p libparmetis/libparmetis.a $INSTALL_DIR/$PACKAGE/lib cp -p libparmetis/libparmetis.a $INSTALL_DIR/$PACKAGE/lib
;; ;;
ParMGridGen-1.0) ParMGridGen-1.0)
export EXTRA_SYSTEM_HOME=$INSTALL_DIR/system export EXTRA_SYSTEM_HOME=$INSTALL_DIR/system
download $PACKAGE.tar.gz http://www.mgnet.org/mgnet/Codes/parmgridgen/$PACKAGE.tar.gz > $LOG_FILE 2>&1 download $PACKAGE.tar.gz http://www.mgnet.org/mgnet/Codes/parmgridgen/$PACKAGE.tar.gz > $LOG_FILE 2>&1
extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1 extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
patch $PACKAGE patch $PACKAGE
cd $PACKAGE cd $PACKAGE
make serial >> $LOG_FILE 2>&1 make serial >> $LOG_FILE 2>&1
make parallel >> $LOG_FILE 2>&1 make parallel >> $LOG_FILE 2>&1
mkdir $INSTALL_DIR/$PACKAGE mkdir $INSTALL_DIR/$PACKAGE
mkdir $INSTALL_DIR/$PACKAGE/bin mkdir $INSTALL_DIR/$PACKAGE/bin
mkdir $INSTALL_DIR/$PACKAGE/include mkdir $INSTALL_DIR/$PACKAGE/include
mkdir $INSTALL_DIR/$PACKAGE/lib mkdir $INSTALL_DIR/$PACKAGE/lib
cp -p *.exe $INSTALL_DIR/$PACKAGE/bin cp -p *.exe $INSTALL_DIR/$PACKAGE/bin
cp -p libmgrid.a $INSTALL_DIR/$PACKAGE/lib cp -p libmgrid.a $INSTALL_DIR/$PACKAGE/lib
cp -p libparmgrid.a $INSTALL_DIR/$PACKAGE/lib cp -p libparmgrid.a $INSTALL_DIR/$PACKAGE/lib
cp -p MGridGen/IMlib/libIMlib.a $INSTALL_DIR/$PACKAGE/lib cp -p MGridGen/IMlib/libIMlib.a $INSTALL_DIR/$PACKAGE/lib
cp -p ParMGridGen/IMParMetis-2.0/libIMparmetis.a $INSTALL_DIR/$PACKAGE/lib cp -p ParMGridGen/IMParMetis-2.0/libIMparmetis.a $INSTALL_DIR/$PACKAGE/lib
cp -p MGridGen/IMlib/*.h $INSTALL_DIR/$PACKAGE/include cp -p MGridGen/IMlib/*.h $INSTALL_DIR/$PACKAGE/include
cp -p MGridGen/Lib/*.h $INSTALL_DIR/$PACKAGE/include cp -p MGridGen/Lib/*.h $INSTALL_DIR/$PACKAGE/include
export EXTRA_SYSTEM_HOME= export EXTRA_SYSTEM_HOME=
;; ;;
scotch_6.0.0) scotch_6.0.0)
export PTHREADS_HOME=$BUILD_DIR/pthreads-w32-2-9-1-release export PTHREADS_HOME=$BUILD_DIR/pthreads-w32-2-9-1-release
download $PACKAGE.tar.gz https://gforge.inria.fr/frs/download.php/31831 > $LOG_FILE 2>&1 download $PACKAGE.tar.gz https://gforge.inria.fr/frs/download.php/31831 > $LOG_FILE 2>&1
extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1 extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
patch $PACKAGE patch $PACKAGE
cd $PACKAGE/src cd $PACKAGE/src
make scotch >> $LOG_FILE 2>&1 make scotch >> $LOG_FILE 2>&1
make ptscotch >> $LOG_FILE 2>&1 make ptscotch >> $LOG_FILE 2>&1
mkdir $INSTALL_DIR/$PACKAGE mkdir $INSTALL_DIR/$PACKAGE
make install prefix=$INSTALL_DIR/$PACKAGE >> $PACKAGE.log 2>&1 make install prefix=$INSTALL_DIR/$PACKAGE >> $PACKAGE.log 2>&1
export PTHREADS_HOME= export PTHREADS_HOME=
;; ;;
mesquite-2.1.2) mesquite-2.1.2)
export CPPFLAGS=-fpermissive export CPPFLAGS=-fpermissive
download $PACKAGE.tar.gz http://downloads.sourceforge.net/project/openfoam-extend/foam-extend-3.0/ThirdParty/$PACKAGE.tar.gz > $LOG_FILE 2>&1 download $PACKAGE.tar.gz http://downloads.sourceforge.net/project/openfoam-extend/foam-extend-3.0/ThirdParty/$PACKAGE.tar.gz > $LOG_FILE 2>&1
extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1 extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
cd $PACKAGE cd $PACKAGE
cp -p $MINGW_HOME/bin/libstdc++-6.dll utils cp -p $MINGW_HOME/bin/libstdc++-6.dll utils
./configure --prefix=$INSTALL_DIR >> $LOG_FILE 2>&1 ./configure --prefix=$INSTALL_DIR >> $LOG_FILE 2>&1
make >> $LOG_FILE 2>&1 make >> $LOG_FILE 2>&1
mkdir $INSTALL_DIR/$PACKAGE mkdir $INSTALL_DIR/$PACKAGE
make install prefix=$INSTALL_DIR/$PACKAGE >> $LOG_FILE 2>&1 make install prefix=$INSTALL_DIR/$PACKAGE >> $LOG_FILE 2>&1
export CPPFLAGS= export CPPFLAGS=
;; ;;
*) *)
echo "*** ERROR: Unknown package '$PACKAGE'" echo "*** ERROR: Unknown package '$PACKAGE'"
exit 1 exit 1
;; ;;
esac esac
} }
build_libraries() { build_libraries() {
echo "" echo ""
echo "Building libraries ..." echo "Building libraries ..."
build_library dlfcn-win32-master build_library dlfcn-win32-master
build_library system build_library system
build_library pthreads-w32-2-9-1-release build_library pthreads-w32-2-9-1-release
build_library metis-5.1.0 build_library metis-5.1.0
build_library parmetis-4.0.3 build_library parmetis-4.0.3
build_library ParMGridGen-1.0 build_library ParMGridGen-1.0
build_library scotch_6.0.0 build_library scotch_6.0.0
build_library mesquite-2.1.2 build_library mesquite-2.1.2
} }
create_dirs() { create_dirs() {
echo "" echo ""
echo "Checking for build directories and creating them if required ..." echo "Checking for build directories and creating them if required ..."
mkchk $BUILD_DIR mkchk $BUILD_DIR
mkchk $INSTALL_DIR mkchk $INSTALL_DIR
mkchk $OUT_DIR mkchk $OUT_DIR
} }
finish() { finish() {
echo "" echo ""
echo "All done!" echo "All done!"
} }
# }}} # }}}
# {{{ MAIN EXECUTION # {{{ MAIN EXECUTION
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
start start
initialise initialise
mkchk $ARCH mkchk $ARCH
cleanup cleanup
build_libraries build_libraries
finish finish
# }}} # }}}

View file

@ -1,82 +1,82 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2 # \\ / O peration | Version: 3.2
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of foam-extend. # This file is part of foam-extend.
# #
# foam-extend is free software: you can redistribute it and/or modify it # foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the # under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your # Free Software Foundation, either version 3 of the License, or (at your
# option) any later version. # option) any later version.
# #
# foam-extend is distributed in the hope that it will be useful, but # foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>. # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
# #
# Script # Script
# build.sh # build.sh
# #
# Description # Description
# Removes previous thirdy-party dependencies build directories (does not remove installed packages directory) # Removes previous thirdy-party dependencies build directories (does not remove installed packages directory)
# #
# Author: # Author:
# Cesare Guardino, Alstom Power Ltd., (2015) # Cesare Guardino, Alstom Power Ltd., (2015)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# {{{ DEFINE UTILITY FUNCTIONS # {{{ DEFINE UTILITY FUNCTIONS
remove_dir() { remove_dir() {
dir=$1 dir=$1
rm -rf $dir > /dev/null 2>&1 rm -rf $dir > /dev/null 2>&1
} }
# }}} # }}}
# {{{ DEFINE PROCESS FUNCTIONS # {{{ DEFINE PROCESS FUNCTIONS
start() { start() {
echo "======================== FOAM-EXTEND THIRD-PARTY DEPENDENCIES WINDOWS CLEAN SCRIPT ========================" echo "======================== FOAM-EXTEND THIRD-PARTY DEPENDENCIES WINDOWS CLEAN SCRIPT ========================"
} }
initialise() { initialise() {
echo "" echo ""
BUILD_HOME=`pwd` BUILD_HOME=`pwd`
ARCH="x64" ARCH="x64"
BUILD_DIR=$BUILD_HOME/$ARCH/build BUILD_DIR=$BUILD_HOME/$ARCH/build
INSTALL_DIR=$BUILD_HOME/$ARCH/install INSTALL_DIR=$BUILD_HOME/$ARCH/install
OUT_DIR=$BUILD_HOME/$ARCH/output OUT_DIR=$BUILD_HOME/$ARCH/output
} }
cleanup() { cleanup() {
echo "" echo ""
echo "Removing previous builds ..." echo "Removing previous builds ..."
remove_dir $BUILD_DIR remove_dir $BUILD_DIR
remove_dir $INSTALL_DIR remove_dir $INSTALL_DIR
remove_dir $OUT_DIR remove_dir $OUT_DIR
remove_dir $BUILD_HOME/downloads remove_dir $BUILD_HOME/downloads
} }
finish() { finish() {
echo "" echo ""
echo "All done!" echo "All done!"
} }
# }}} # }}}
# {{{ MAIN EXECUTION # {{{ MAIN EXECUTION
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
start start
initialise initialise
cleanup cleanup
finish finish
# }}} # }}}

View file

@ -1,67 +1,66 @@
#!/bin/sh #!/bin/sh
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2 # \\ / O peration | Version: 3.2
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of foam-extend. # This file is part of foam-extend.
# #
# foam-extend is free software: you can redistribute it and/or modify it # foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the # under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your # Free Software Foundation, either version 3 of the License, or (at your
# option) any later version. # option) any later version.
# #
# foam-extend is distributed in the hope that it will be useful, but # foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>. # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
# #
# Script # Script
# configure_OpenMPI.sh # configure_OpenMPI.sh
# #
# Description # Description
# Generates static OpenMPI library to enable compilation with MINGW toolchain. # Generates static OpenMPI library to enable compilation with MINGW toolchain.
# #
# Author: # Author:
# Cesare Guardino, Alstom Power Ltd., (2015) # Cesare Guardino, Alstom Power Ltd., (2015)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ -f "$MPI_ROOTDIR/lib/libmpi.a" ] ; then if [ -f "$MPI_ROOTDIR/lib/libmpi.a" ] ; then
echo "$MPI_ROOTDIR/lib/libmpi.a already exists." echo "$MPI_ROOTDIR/lib/libmpi.a already exists."
exit 1 exit 1
fi fi
INSTALL=1 INSTALL=1
if [ $1 ] ; then if [ $1 ] ; then
if [ $1 = "--no-install" ] ; then if [ $1 = "--no-install" ] ; then
INSTALL=0 INSTALL=0
echo "*** WARNING: Will not install exported libmpi.a and libmpi.def" echo "*** WARNING: Will not install exported libmpi.a and libmpi.def"
fi fi
fi fi
tmp=`echo $RANDOM$RANDOM$RANDOM` tmp=`echo $RANDOM$RANDOM$RANDOM`
current_dir=`pwd` current_dir=`pwd`
mkdir -p /tmp/$tmp mkdir -p /tmp/$tmp
cd /tmp/$tmp cd /tmp/$tmp
pexports $MPI_ROOTDIR/bin/libmpi.dll > libmpi.def pexports $MPI_ROOTDIR/bin/libmpi.dll > libmpi.def
dlltool --dllname libmpi.dll --def libmpi.def --output-lib libmpi.a dlltool --dllname libmpi.dll --def libmpi.def --output-lib libmpi.a
if [ $INSTALL -eq 1 ] ; then if [ $INSTALL -eq 1 ] ; then
mv libmpi.a $MPI_ROOTDIR/lib mv libmpi.a $MPI_ROOTDIR/lib
mv libmpi.def $MPI_ROOTDIR/lib mv libmpi.def $MPI_ROOTDIR/lib
cd $current_dir cd $current_dir
rm -rf /tmp/$tmp rm -rf /tmp/$tmp
echo "Installed exported libraries into $MPI_ROOTDIR/lib" echo "Installed exported libraries into $MPI_ROOTDIR/lib"
else else
cd $current_dir cd $current_dir
echo "Exported libraries left in directory /tmp/$tmp" echo "Exported libraries left in directory /tmp/$tmp"
fi fi

View file

@ -1,70 +1,70 @@
#!/usr/bin/perl #!/usr/bin/perl
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# ========= | # ========= |
# \\ / F ield | foam-extend: Open Source CFD # \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 3.2 # \\ / O peration | Version: 3.2
# \\ / A nd | Web: http://www.foam-extend.org # \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright # \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of foam-extend. # This file is part of foam-extend.
# #
# foam-extend is free software: you can redistribute it and/or modify it # foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the # under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your # Free Software Foundation, either version 3 of the License, or (at your
# option) any later version. # option) any later version.
# #
# foam-extend is distributed in the hope that it will be useful, but # foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>. # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
# #
# Script # Script
# parmetis_includes_hack.pl # parmetis_includes_hack.pl
# #
# Description # Description
# Adds OpenMPI lib/includes dirs to CMake-generated GCC options. # Adds OpenMPI lib/includes dirs to CMake-generated GCC options.
# #
# Author: # Author:
# Cesare Guardino, Alstom Power Ltd., (2015) # Cesare Guardino, Alstom Power Ltd., (2015)
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
use strict; use strict;
use warnings; use warnings;
use File::Find; use File::Find;
my $MPI_ROOTDIR = $ENV{"MPI_ROOTDIR"}; my $MPI_ROOTDIR = $ENV{"MPI_ROOTDIR"};
$MPI_ROOTDIR =~ s/^\/\w//; $MPI_ROOTDIR =~ s/^\/\w//;
my $drive_letter = $&; my $drive_letter = $&;
$drive_letter =~ s/\///; $drive_letter =~ s/\///;
$MPI_ROOTDIR = uc($drive_letter) . ":" . $MPI_ROOTDIR; $MPI_ROOTDIR = uc($drive_letter) . ":" . $MPI_ROOTDIR;
my @dirs = ("."); my @dirs = (".");
find(\&wanted, @dirs); find(\&wanted, @dirs);
sub wanted sub wanted
{ {
my $file = $_; my $file = $_;
my $path = $File::Find::name; my $path = $File::Find::name;
if ($file eq "linklibs.rsp" or $file eq "includes_C.rsp") if ($file eq "linklibs.rsp" or $file eq "includes_C.rsp")
{ {
open (FILE, '<', $file) or die ("ERROR: Can't open '$path' [$!]"); open (FILE, '<', $file) or die ("ERROR: Can't open '$path' [$!]");
my @contents = <FILE>; my @contents = <FILE>;
close (FILE); close (FILE);
my $string = ($file eq "linklibs.rsp") ? "-L$MPI_ROOTDIR/lib -lmpi" : "-I$MPI_ROOTDIR/include"; my $string = ($file eq "linklibs.rsp") ? "-L$MPI_ROOTDIR/lib -lmpi" : "-I$MPI_ROOTDIR/include";
open (FILE, '>', $file) or die ("ERROR: Can't open '$path' [$!]"); open (FILE, '>', $file) or die ("ERROR: Can't open '$path' [$!]");
foreach my $line (@contents) foreach my $line (@contents)
{ {
chomp($line); chomp($line);
print FILE $line . $string; print FILE $line . $string;
} }
close (FILE); close (FILE);
} }
} }

View file

@ -1,6 +1,6 @@
/* /*
* IMlib.h * IMlib.h
* *
* Irene's library of most frequently used routines * Irene's library of most frequently used routines
* *
*/ */
@ -104,16 +104,16 @@ typedef struct realKeyValueType realKeyValueType;
* Macros Section * Macros Section
**************************************************************************/ **************************************************************************/
/*------------------------------------------------------------- /*-------------------------------------------------------------
* Usefull commands * Usefull commands
*-------------------------------------------------------------*/ *-------------------------------------------------------------*/
#define sign(a, b) ((b) >= 0 ? ((a) >= 0.0 ? a : -a) : ((a) >= 0.0 ? -a : a)) #define sign(a, b) ((b) >= 0 ? ((a) >= 0.0 ? a : -a) : ((a) >= 0.0 ? -a : a))
#define amax(a, b) ((a) >= (b) ? (a) : (b)) #define amax(a, b) ((a) >= (b) ? (a) : (b))
#define amin(a, b) ((a) >= (b) ? (b) : (a)) #define amin(a, b) ((a) >= (b) ? (b) : (a))
#define RandomInRange(u) ((int)(drand48()*((double)(u)))) #define RandomInRange(u) ((int)(drand48()*((double)(u))))
#define RandomInRangeFast(u) ((rand()>>3)%(u)) #define RandomInRangeFast(u) ((rand()>>3)%(u))
#define SWAP(a, b, tmp) do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0) #define SWAP(a, b, tmp) do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)
#define INC_DEC(a, b, val) do {(a) += (val); (b) -= (val);} while(0) #define INC_DEC(a, b, val) do {(a) += (val); (b) -= (val);} while(0)
#define icopy(n, a, b) (int *)memcpy((void *)(b), (void *)(a), sizeof(int)*(n)) #define icopy(n, a, b) (int *)memcpy((void *)(b), (void *)(a), sizeof(int)*(n))
#define idxcopy(n, a, b) (idxtype *)memcpy((void *)(b), (void *)(a), sizeof(idxtype)*(n)) #define idxcopy(n, a, b) (idxtype *)memcpy((void *)(b), (void *)(a), sizeof(idxtype)*(n))
#define scopy(n, a, b) (double *)memcpy((void *)(b), (void *)(a), sizeof(double)*(n)) #define scopy(n, a, b) (double *)memcpy((void *)(b), (void *)(a), sizeof(double)*(n))
#define fcopy(n, a, b) (double *)memcpy((void *)(b), (void *)(a), sizeof(double)*(n)) #define fcopy(n, a, b) (double *)memcpy((void *)(b), (void *)(a), sizeof(double)*(n))
@ -128,7 +128,7 @@ typedef struct realKeyValueType realKeyValueType;
#define stoptimer(tmr) (tmr += seconds()) #define stoptimer(tmr) (tmr += seconds())
#define gettimer(tmr) (tmr) #define gettimer(tmr) (tmr)
/*------------------------------------------------------------- /*-------------------------------------------------------------
* Debuging memory leaks * Debuging memory leaks
*-------------------------------------------------------------*/ *-------------------------------------------------------------*/
@ -153,7 +153,7 @@ typedef struct realKeyValueType realKeyValueType;
} }
#else #else
# define MALLOC_CHECK(ptr) ; # define MALLOC_CHECK(ptr) ;
#endif #endif
/*------------------------------------------------------------- /*-------------------------------------------------------------
@ -164,7 +164,7 @@ typedef struct realKeyValueType realKeyValueType;
for (i=1; i<n; i++) a[i] += a[i-1]; \ for (i=1; i<n; i++) a[i] += a[i-1]; \
for (i=n; i>0; i--) a[i] = a[i-1]; \ for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \ a[0] = 0; \
} while(0) } while(0)
/*------------------------------------------------------------- /*-------------------------------------------------------------
@ -179,7 +179,7 @@ typedef struct realKeyValueType realKeyValueType;
} }
#else #else
# define ASSERT(expr) ; # define ASSERT(expr) ;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
# define ASSERTP(expr,msg) \ # define ASSERTP(expr,msg) \
@ -192,7 +192,7 @@ typedef struct realKeyValueType realKeyValueType;
} }
#else #else
# define ASSERTP(expr,msg) ; # define ASSERTP(expr,msg) ;
#endif #endif
/************************************************************************* /*************************************************************************
@ -270,7 +270,7 @@ void ikeysort2(int, IKeyValueType *);
void idxkeysort2(int, idxKeyValueType *); void idxkeysort2(int, idxKeyValueType *);
/*------------------------------------------------------------- /*-------------------------------------------------------------
* sort.c * sort.c
*-------------------------------------------------------------*/ *-------------------------------------------------------------*/
void ikeyvalsort_org(int, IKeyValueType *); void ikeyvalsort_org(int, IKeyValueType *);
int IncKeyValueCmp(const void *, const void *); int IncKeyValueCmp(const void *, const void *);

View file

@ -27,7 +27,7 @@ void MGridGen(int nvtxs, idxtype *xadj, realtype *vvol, realtype *vsurf,
srand48(7654321L); srand48(7654321L);
/*------------------------------------------------------------ /*------------------------------------------------------------
* Set up the various control structures * Set up the various control structures
*------------------------------------------------------------*/ *------------------------------------------------------------*/
ctrl.CType = options[OPTION_CTYPE]; ctrl.CType = options[OPTION_CTYPE];
ctrl.RType = options[OPTION_RTYPE]; ctrl.RType = options[OPTION_RTYPE];
@ -68,7 +68,7 @@ void MGridGenRefine(int nvtxs, idxtype *xadj, realtype *vvol, realtype *vsurf,
srand48(7654321L); srand48(7654321L);
/*------------------------------------------------------------ /*------------------------------------------------------------
* Set up the various control structures * Set up the various control structures
*------------------------------------------------------------*/ *------------------------------------------------------------*/
ctrl.CType = options[OPTION_CTYPE]; ctrl.CType = options[OPTION_CTYPE];
ctrl.RType = options[OPTION_RTYPE]; ctrl.RType = options[OPTION_RTYPE];

View file

@ -1,5 +1,5 @@
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Which make to use # Which make to use
make = gmake make = gmake
# Which compiler to use # Which compiler to use
@ -12,7 +12,7 @@ PARCC = gcc
OPTFLAGS = -O3 OPTFLAGS = -O3
# What options to be used by the compiler # What options to be used by the compiler
COPTIONS = COPTIONS =
# Which loader to use # Which loader to use
LD = gcc LD = gcc
@ -21,7 +21,7 @@ PARLD = gcc
# What options to be used by the loader # What options to be used by the loader
LDOPTIONS = -O3 LDOPTIONS = -O3
# Where to put the executable # Where to put the executable
BINDIR = ../.. BINDIR = ../..
# Additional libraries # Additional libraries
@ -51,7 +51,7 @@ AR = ar rv
RANLIB = ar -ts RANLIB = ar -ts
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# #
# Do not change any of the following # Do not change any of the following
# #
VERNUM = 1.0 VERNUM = 1.0

View file

@ -24,7 +24,7 @@
#define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b))) #define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b)))
#define SWAP(a, b, tmp) \ #define SWAP(a, b, tmp) \
do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0) do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)
#define INC_DEC(a, b, val) \ #define INC_DEC(a, b, val) \
do {(a) += (val); (b) -= (val);} while(0) do {(a) += (val); (b) -= (val);} while(0)
@ -75,7 +75,7 @@
} }
#else #else
# define MALLOC_CHECK(ptr) ; # define MALLOC_CHECK(ptr) ;
#endif #endif
/************************************************************************* /*************************************************************************
* This macro converts a length array in a CSR one * This macro converts a length array in a CSR one
@ -85,7 +85,7 @@
for (i=1; i<n; i++) a[i] += a[i-1]; \ for (i=1; i<n; i++) a[i] += a[i-1]; \
for (i=n; i>0; i--) a[i] = a[i-1]; \ for (i=n; i>0; i--) a[i] = a[i-1]; \
a[0] = 0; \ a[0] = 0; \
} while(0) } while(0)
@ -99,7 +99,7 @@
} }
#else #else
# define ASSERT(ctrl, expr) ; # define ASSERT(ctrl, expr) ;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
# define ASSERTP(ctrl, expr,msg) \ # define ASSERTP(ctrl, expr,msg) \
@ -111,7 +111,7 @@
} }
#else #else
# define ASSERTP(ctrl, expr,msg) ; # define ASSERTP(ctrl, expr,msg) ;
#endif #endif
#ifdef DEBUGS #ifdef DEBUGS
# define ASSERTS(expr) \ # define ASSERTS(expr) \
@ -122,7 +122,7 @@
} }
#else #else
# define ASSERTS(expr) ; # define ASSERTS(expr) ;
#endif #endif
#ifdef DEBUGS #ifdef DEBUGS
# define ASSERTSP(expr, msg) \ # define ASSERTSP(expr, msg) \
@ -134,4 +134,4 @@
} }
#else #else
# define ASSERTSP(expr, msg) ; # define ASSERTSP(expr, msg) ;
#endif #endif

View file

@ -13,7 +13,7 @@
/************************************************************************* /*************************************************************************
* This macro is used to normalize the weights of two nodes * This macro is used to normalize the weights of two nodes
**************************************************************************/ **************************************************************************/
#define ARATIO1(dim, surf, vol) ((dim == 2) ? (pow((surf), 2)/(vol)) : (pow((surf), 1.5)/(vol))) #define ARATIO1(dim, surf, vol) ((dim == 2) ? (pow((surf), 2)/(vol)) : (pow((surf), 1.5)/(vol)))
#define ARATIO(dim, surf, vol) ((dim == 2) ? ((surf)*(surf)/(vol)) : (sqrt((surf)*(surf)*(surf))/(vol))) #define ARATIO(dim, surf, vol) ((dim == 2) ? ((surf)*(surf)/(vol)) : (sqrt((surf)*(surf)*(surf))/(vol)))
#define ARATIO2(dim, surf, vol) ((dim == 2) ? ((surf)*(surf)*(surf)*(surf)/(vol)*(vol)) : ((surf)*(surf)*(surf)/((vol)*(vol)))) #define ARATIO2(dim, surf, vol) ((dim == 2) ? ((surf)*(surf)*(surf)*(surf)/(vol)*(vol)) : ((surf)*(surf)*(surf)/((vol)*(vol))))
@ -31,7 +31,7 @@
#define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b))) #define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b)))
#define SWAP(a, b, tmp) \ #define SWAP(a, b, tmp) \
do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0) do {(tmp) = (a); (a) = (b); (b) = (tmp);} while(0)
#define INC_DEC(a, b, val) \ #define INC_DEC(a, b, val) \
do {(a) += (val); (b) -= (val);} while(0) do {(a) += (val); (b) -= (val);} while(0)
@ -70,7 +70,7 @@
} }
#else #else
# define ASSERT(ctrl, expr) ; # define ASSERT(ctrl, expr) ;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
# define ASSERTP(ctrl, expr,msg) \ # define ASSERTP(ctrl, expr,msg) \
@ -82,7 +82,7 @@
} }
#else #else
# define ASSERTP(ctrl, expr,msg) ; # define ASSERTP(ctrl, expr,msg) ;
#endif #endif
#ifdef DEBUGS #ifdef DEBUGS
# define ASSERTS(expr) \ # define ASSERTS(expr) \
@ -93,7 +93,7 @@
} }
#else #else
# define ASSERTS(expr) ; # define ASSERTS(expr) ;
#endif #endif
#ifdef DEBUGS #ifdef DEBUGS
# define ASSERTSP(expr, msg) \ # define ASSERTSP(expr, msg) \
@ -105,4 +105,4 @@
} }
#else #else
# define ASSERTSP(expr, msg) ; # define ASSERTSP(expr, msg) ;
#endif #endif

View file

@ -31,7 +31,7 @@
#endif #endif
#ifdef __MSC__ #ifdef __MSC__
#include "ms_stdint.h" #include "ms_stdint.h"
#include "ms_inttypes.h" #include "ms_inttypes.h"
#include "ms_stat.h" #include "ms_stat.h"
@ -60,7 +60,7 @@ typedef ptrdiff_t ssize_t;
#ifdef __MSC__ #ifdef __MSC__
/* MSC does not have rint() function */ /* MSC does not have rint() function */
#define rint(x) ((int)((x)+0.5)) #define rint(x) ((int)((x)+0.5))
/* MSC does not have INFINITY defined */ /* MSC does not have INFINITY defined */
#ifndef INFINITY #ifndef INFINITY

View file

@ -18,30 +18,30 @@
//extern int gk_optopt; //extern int gk_optopt;
/*! \brief The structure that stores the information about the command-line options /*! \brief The structure that stores the information about the command-line options
This structure describes a single long option name for the sake of This structure describes a single long option name for the sake of
gk_getopt_long(). The argument <tt>long_options</tt> must be an array gk_getopt_long(). The argument <tt>long_options</tt> must be an array
of these structures, one for each long option. Terminate the array with of these structures, one for each long option. Terminate the array with
an element containing all zeros. an element containing all zeros.
*/ */
struct gk_option { struct gk_option {
char *name; /*!< This field is the name of the option. */ char *name; /*!< This field is the name of the option. */
int has_arg; /*!< This field says whether the option takes an argument. int has_arg; /*!< This field says whether the option takes an argument.
It is an integer, and there are three legitimate values: It is an integer, and there are three legitimate values:
no_argument, required_argument and optional_argument. no_argument, required_argument and optional_argument.
*/ */
int *flag; /*!< See the discussion on ::gk_option#val */ int *flag; /*!< See the discussion on ::gk_option#val */
int val; /*!< These fields control how to report or act on the option int val; /*!< These fields control how to report or act on the option
when it occurs. when it occurs.
If flag is a null pointer, then the val is a value which If flag is a null pointer, then the val is a value which
identifies this option. Often these values are chosen identifies this option. Often these values are chosen
to uniquely identify particular long options. to uniquely identify particular long options.
If flag is not a null pointer, it should be the address If flag is not a null pointer, it should be the address
of an int variable which is the flag for this option. of an int variable which is the flag for this option.
The value in val is the value to store in the flag to The value in val is the value to store in the flag to
indicate that the option was seen. */ indicate that the option was seen. */
}; };

View file

@ -31,7 +31,7 @@
#endif #endif
#ifdef __MSC__ #ifdef __MSC__
#include "ms_stdint.h" #include "ms_stdint.h"
#include "ms_inttypes.h" #include "ms_inttypes.h"
#include "ms_stat.h" #include "ms_stat.h"
@ -60,7 +60,7 @@ typedef ptrdiff_t ssize_t;
#ifdef __MSC__ #ifdef __MSC__
/* MSC does not have rint() function */ /* MSC does not have rint() function */
#define rint(x) ((int)((x)+0.5)) #define rint(x) ((int)((x)+0.5))
/* MSC does not have INFINITY defined */ /* MSC does not have INFINITY defined */
#ifndef INFINITY #ifndef INFINITY

View file

@ -18,30 +18,30 @@
//extern int gk_optopt; //extern int gk_optopt;
/*! \brief The structure that stores the information about the command-line options /*! \brief The structure that stores the information about the command-line options
This structure describes a single long option name for the sake of This structure describes a single long option name for the sake of
gk_getopt_long(). The argument <tt>long_options</tt> must be an array gk_getopt_long(). The argument <tt>long_options</tt> must be an array
of these structures, one for each long option. Terminate the array with of these structures, one for each long option. Terminate the array with
an element containing all zeros. an element containing all zeros.
*/ */
struct gk_option { struct gk_option {
char *name; /*!< This field is the name of the option. */ char *name; /*!< This field is the name of the option. */
int has_arg; /*!< This field says whether the option takes an argument. int has_arg; /*!< This field says whether the option takes an argument.
It is an integer, and there are three legitimate values: It is an integer, and there are three legitimate values:
no_argument, required_argument and optional_argument. no_argument, required_argument and optional_argument.
*/ */
int *flag; /*!< See the discussion on ::gk_option#val */ int *flag; /*!< See the discussion on ::gk_option#val */
int val; /*!< These fields control how to report or act on the option int val; /*!< These fields control how to report or act on the option
when it occurs. when it occurs.
If flag is a null pointer, then the val is a value which If flag is a null pointer, then the val is a value which
identifies this option. Often these values are chosen identifies this option. Often these values are chosen
to uniquely identify particular long options. to uniquely identify particular long options.
If flag is not a null pointer, it should be the address If flag is not a null pointer, it should be the address
of an int variable which is the flag for this option. of an int variable which is the flag for this option.
The value in val is the value to store in the flag to The value in val is the value to store in the flag to
indicate that the option was seen. */ indicate that the option was seen. */
}; };

View file

@ -3,7 +3,7 @@
* *
* Purpose: * Purpose:
* Provides an implementation of POSIX realtime extensions * Provides an implementation of POSIX realtime extensions
* as defined in * as defined in
* *
* POSIX 1003.1b-1993 (POSIX.1b) * POSIX 1003.1b-1993 (POSIX.1b)
* *
@ -12,25 +12,25 @@
* Pthreads-win32 - POSIX Threads Library for Win32 * Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom * Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors * Copyright(C) 1999,2005 Pthreads-win32 contributors
* *
* Contact Email: rpj@callisto.canberra.edu.au * Contact Email: rpj@callisto.canberra.edu.au
* *
* The current list of contributors is contained * The current list of contributors is contained
* in the file CONTRIBUTORS included with the source * in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the * code distribution. The list can also be seen at the
* following World Wide Web location: * following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html * http://sources.redhat.com/pthreads-win32/contributors.html
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB; * License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc., * if not, write to the Free Software Foundation, Inc.,
@ -180,4 +180,3 @@ PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
#undef PTW32_SCHED_LEVEL_MAX #undef PTW32_SCHED_LEVEL_MAX
#endif /* !_SCHED_H */ #endif /* !_SCHED_H */

View file

@ -23,14 +23,14 @@ ARFLAGS = -ruv
CAT = cat CAT = cat
CCS = gcc CCS = gcc
CCP = mpicc CCP = mpicc
CCD = mpicc -I$(MPI_ROOTDIR)/include CCD = mpicc -I$(MPI_ROOTDIR)/include
#--- Compiler/loader flags #--- Compiler/loader flags
CFLAGS_CPL = -O0 -g3 --std=c99 CFLAGS_CPL = -O0 -g3 --std=c99
CFLAGS_INC = CFLAGS_INC =
CFLAGS_DEF = -DCOMMON_RANDOM_FIXED_SEED -DCOMMON_STUB_FORK -DSCOTCH_PTSCOTCH -DSCOTCH_RENAME -D'pipe(pfds)=_pipe(pfds,1024,0x8000)' -DHAVE_STDINT_H=0 -DHAVE_UINT_T=1 CFLAGS_DEF = -DCOMMON_RANDOM_FIXED_SEED -DCOMMON_STUB_FORK -DSCOTCH_PTSCOTCH -DSCOTCH_RENAME -D'pipe(pfds)=_pipe(pfds,1024,0x8000)' -DHAVE_STDINT_H=0 -DHAVE_UINT_T=1
CLIBFLAGS = CLIBFLAGS =
LDFLAGS = LDFLAGS =
PGMFILES=$(PROGRAMFILES) PGMFILES=$(PROGRAMFILES)

View file

@ -1,19 +1,19 @@
#ifndef RAND48_H #ifndef RAND48_H
#define RAND48_H #define RAND48_H
#define drand48() (rand()*(1./RAND_MAX)) #define drand48() (rand()*(1./RAND_MAX))
static long _rand = 1; static long _rand = 1;
static __inline__ void srand48(long seed) static __inline__ void srand48(long seed)
{ {
_rand = seed; _rand = seed;
} }
static __inline__ long lrand48(void) static __inline__ long lrand48(void)
{ {
long val = (int)(abs(10000.0*sin(_rand))); long val = (int)(abs(10000.0*sin(_rand)));
_rand++; _rand++;
return val; return val;
} }
#endif //RAND48_H #endif //RAND48_H

View file

@ -1,40 +1,40 @@
// From http://www.linuxjournal.com/article/5574 // From http://www.linuxjournal.com/article/5574
#ifndef _TIMES_H #ifndef _TIMES_H
#define _TIMES_H #define _TIMES_H
#ifdef _WIN32 #ifdef _WIN32
#include <sys/timeb.h> #include <sys/timeb.h>
#include <sys/types.h> #include <sys/types.h>
#include <winsock2.h> #include <winsock2.h>
int gettimeofday(struct timeval* t,void* timezone); int gettimeofday(struct timeval* t,void* timezone);
// from linux's sys/times.h // from linux's sys/times.h
//#include <features.h> //#include <features.h>
#define __need_clock_t #define __need_clock_t
#include <time.h> #include <time.h>
/* Structure describing CPU time used by a process and its children. */ /* Structure describing CPU time used by a process and its children. */
struct tms struct tms
{ {
clock_t tms_utime; /* User CPU time. */ clock_t tms_utime; /* User CPU time. */
clock_t tms_stime; /* System CPU time. */ clock_t tms_stime; /* System CPU time. */
clock_t tms_cutime; /* User CPU time of dead children. */ clock_t tms_cutime; /* User CPU time of dead children. */
clock_t tms_cstime; /* System CPU time of dead children. */ clock_t tms_cstime; /* System CPU time of dead children. */
}; };
/* Store the CPU time used by this process and all its /* Store the CPU time used by this process and all its
dead children (and their dead children) in BUFFER. dead children (and their dead children) in BUFFER.
Return the elapsed real time, or (clock_t) -1 for errors. Return the elapsed real time, or (clock_t) -1 for errors.
All times are in CLK_TCKths of a second. */ All times are in CLK_TCKths of a second. */
clock_t times (struct tms *__buffer); clock_t times (struct tms *__buffer);
typedef long long suseconds_t ; typedef long long suseconds_t ;
#endif #endif
#endif #endif

View file

@ -47,9 +47,9 @@ set_system_paths() {
export PARAVIEW_HOME=$PROGRAMS_HOME/ParaView-4.3.1 export PARAVIEW_HOME=$PROGRAMS_HOME/ParaView-4.3.1
#export PERL_HOME=$PROGRAMS_HOME/strawberry-perl-5.20.2.1-64bit/perl #export PERL_HOME=$PROGRAMS_HOME/strawberry-perl-5.20.2.1-64bit/perl
export PEXPORTS_HOME=$PROGRAMS_HOME/pexports export PEXPORTS_HOME=$PROGRAMS_HOME/pexports
export PYTHON_HOME=$PROGRAMS_HOME/Python27 #export PYTHON_HOME=$PROGRAMS_HOME/Python27
export SUBVERSION_HOME=$PROGRAMS_HOME/svn-win32-1.8.13 #export SUBVERSION_HOME=$PROGRAMS_HOME/svn-win32-1.8.13
export WGET_HOME=$PROGRAMS_HOME/wget export WGET_HOME=$PROGRAMS_HOME/wget-1.11.4-1
export ZIP_HOME="/c/Program Files/7-Zip" export ZIP_HOME="/c/Program Files/7-Zip"
} }
@ -58,13 +58,13 @@ add_to_path() {
echo "Adding user-defined installed system tools to PATH ..." echo "Adding user-defined installed system tools to PATH ..."
export PATH=$ZIP_HOME:$PATH export PATH=$ZIP_HOME:$PATH
export PATH=$WGET_HOME/bin:$PATH export PATH=$WGET_HOME/bin:$PATH
export PATH=$PYTHON_HOME:$PATH #export PATH=$PYTHON_HOME:$PATH
export PATH=$SUBVERSION_HOME/bin:$PATH #export PATH=$SUBVERSION_HOME/bin:$PATH
export PATH=$GIT_HOME/cmd:$PATH export PATH=$GIT_HOME/cmd:$PATH
#export PATH=$PERL_HOME/bin:$PATH #export PATH=$PERL_HOME/bin:$PATH
export PATH=$CMAKE_HOME/bin:$PATH export PATH=$CMAKE_HOME/bin:$PATH
export PATH=$MPI_ROOTDIR/bin:$PATH export PATH=$MPI_ROOTDIR/bin:$PATH
export PATH=$PEXPORTS_HOME:$PATH export PATH=$PEXPORTS_HOME/bin:$PATH
export PATH=$MINGW_HOME/bin:$PATH export PATH=$MINGW_HOME/bin:$PATH
} }
# }}} # }}}

View file

@ -504,13 +504,6 @@ esac
_foamAddLib $FOAM_MPI_LIBBIN _foamAddLib $FOAM_MPI_LIBBIN
# Add DLLs on PATH for Windows (cannot use LD_LIBRARY_PATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if [ "$WM_ARCH_BASE" == "mingw" ]
then
_foamAddPath $FOAM_LIBBIN $FOAM_LIBBIN/$mpi_version
fi
# Set the minimum MPI buffer size (used by all platforms except SGI MPI) # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
minBufferSize=20000000 minBufferSize=20000000

View file

@ -44,7 +44,7 @@ Description
defineTypeNameAndDebug(Foam::MSwindows, 0); defineTypeNameAndDebug(Foam::MSwindows, 0);
namespace Foam namespace Foam
{ {
// Don't abort under windows, causes abort dialog to // Don't abort under windows, causes abort dialog to
@ -80,10 +80,10 @@ std::string MSwindows::getLastError()
LPVOID lpMsgBuf; LPVOID lpMsgBuf;
LPVOID lpDisplayBuf; LPVOID lpDisplayBuf;
DWORD dw = GetLastError(); DWORD dw = GetLastError();
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS, FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, NULL,
@ -92,8 +92,8 @@ std::string MSwindows::getLastError()
(LPTSTR) &lpMsgBuf, (LPTSTR) &lpMsgBuf,
0, NULL ); 0, NULL );
lpDisplayBuf = LocalAlloc(LMEM_ZEROINIT, lpDisplayBuf = LocalAlloc(LMEM_ZEROINIT,
(lstrlen(static_cast<LPCTSTR>(lpMsgBuf))+40)*sizeof(TCHAR)); (lstrlen(static_cast<LPCTSTR>(lpMsgBuf))+40)*sizeof(TCHAR));
sprintf(static_cast<LPTSTR>(lpDisplayBuf), sprintf(static_cast<LPTSTR>(lpDisplayBuf),
"Error %d: %s", int(dw), static_cast<LPCTSTR>(lpMsgBuf)); "Error %d: %s", int(dw), static_cast<LPCTSTR>(lpMsgBuf));
@ -115,10 +115,10 @@ namespace MSwindows
//- Remove quotes, if any, from std::string //- Remove quotes, if any, from std::string
void removeQuotes(std::string & arg); void removeQuotes(std::string & arg);
//- Convert windows directory slash (back-slash) to unix (forward-slash). //- Convert windows directory slash (back-slash) to unix (forward-slash).
//- Windows is fine with unix like directory slashes. //- Windows is fine with unix like directory slashes.
//- Foam's file io (see src/OpenFOAM/db/IOstreams/Sstreams/OSwrite.C) //- Foam's file io (see src/OpenFOAM/db/IOstreams/Sstreams/OSwrite.C)
//- uses back-slash as escape character and continuation, //- uses back-slash as escape character and continuation,
//- so not an option to have windows file paths with back-slashes //- so not an option to have windows file paths with back-slashes
void toUnixSlash(string & arg); void toUnixSlash(string & arg);
@ -144,17 +144,17 @@ namespace MSwindows
HANDLE findHandle_; HANDLE findHandle_;
fileName nextName_; fileName nextName_;
bool hasMore_; bool hasMore_;
public: public:
DirectoryIterator(const fileName & directory); DirectoryIterator(const fileName & directory);
~DirectoryIterator(); ~DirectoryIterator();
//- Initialization succeeded //- Initialization succeeded
bool isValid() const; bool isValid() const;
//- Has more? //- Has more?
bool hasNext() const; bool hasNext() const;
//- Next item //- Next item
const fileName & next(); const fileName & next();
}; // class DirectoryIterator }; // class DirectoryIterator
@ -181,7 +181,7 @@ void MSwindows::toUnixSlash(string & arg)
const std::string UNC("//"); const std::string UNC("//");
// Preserve UNC i.e., \\machine-name\... // Preserve UNC i.e., \\machine-name\...
if (0 == arg.find(UNC)) if (0 == arg.find(UNC))
{ {
arg.replace(UNC, "\\\\"); arg.replace(UNC, "\\\\");
} }
@ -201,10 +201,10 @@ std::string MSwindows::getUserName()
{ {
nameAsString = buffer; nameAsString = buffer;
} }
else else
{ {
if (ERROR_INSUFFICIENT_BUFFER == ::GetLastError() && if (ERROR_INSUFFICIENT_BUFFER == ::GetLastError() &&
32768 > actualBufferSize) 32768 > actualBufferSize)
{ {
AutoArray<TCHAR> actualBuffer(actualBufferSize); AutoArray<TCHAR> actualBuffer(actualBufferSize);
::GetUserName(actualBuffer.get(), &actualBufferSize); ::GetUserName(actualBuffer.get(), &actualBufferSize);
@ -246,18 +246,18 @@ bool MSwindows::DirectoryIterator::isValid() const
return valid; return valid;
} }
MSwindows::DirectoryIterator::DirectoryIterator(const fileName & directory) MSwindows::DirectoryIterator::DirectoryIterator(const fileName & directory)
{ {
const fileName directoryContents = directory/"*"; const fileName directoryContents = directory/"*";
findHandle_ = ::FindFirstFile(directoryContents.c_str(), &findData_); findHandle_ = ::FindFirstFile(directoryContents.c_str(), &findData_);
hasMore_ = isValid(); hasMore_ = isValid();
} }
MSwindows::DirectoryIterator::~DirectoryIterator() MSwindows::DirectoryIterator::~DirectoryIterator()
{ {
if (isValid()) if (isValid())
{ {
::FindClose(findHandle_); ::FindClose(findHandle_);
} }
@ -332,7 +332,7 @@ std::string toUnixPath(const std::string & path)
bool env(const word& envName) bool env(const word& envName)
{ {
const DWORD actualBufferSize = const DWORD actualBufferSize =
::GetEnvironmentVariable(envName.c_str(), NULL, 0); ::GetEnvironmentVariable(envName.c_str(), NULL, 0);
const bool envExists = (0 < actualBufferSize); const bool envExists = (0 < actualBufferSize);
@ -344,10 +344,10 @@ string getEnv(const word& envName)
{ {
std::string envAsString; std::string envAsString;
const DWORD actualBufferSize = const DWORD actualBufferSize =
::GetEnvironmentVariable(envName.c_str(), NULL, 0); ::GetEnvironmentVariable(envName.c_str(), NULL, 0);
if (0 < actualBufferSize) if (0 < actualBufferSize)
{ {
MSwindows::AutoArray<TCHAR> actualBuffer(actualBufferSize); MSwindows::AutoArray<TCHAR> actualBuffer(actualBufferSize);
::GetEnvironmentVariable(envName.c_str(), ::GetEnvironmentVariable(envName.c_str(),
@ -368,7 +368,7 @@ bool setEnv
const bool overwrite const bool overwrite
) )
{ {
const bool success = const bool success =
::SetEnvironmentVariable(envName.c_str(), value.c_str()); ::SetEnvironmentVariable(envName.c_str(), value.c_str());
return success; return success;
} }
@ -381,7 +381,7 @@ word hostName()
TCHAR buffer[bufferSize]; TCHAR buffer[bufferSize];
DWORD actualBufferSize = bufferSize; DWORD actualBufferSize = bufferSize;
const bool success = const bool success =
::GetComputerName(buffer, &actualBufferSize); ::GetComputerName(buffer, &actualBufferSize);
const string computerName = success ? buffer : string::null; const string computerName = success ? buffer : string::null;
return computerName; return computerName;
@ -401,7 +401,7 @@ word userName()
{ {
std::string name = getEnv("USERNAME"); std::string name = getEnv("USERNAME");
if (name.empty()) if (name.empty())
{ {
name = MSwindows::getUserName(); name = MSwindows::getUserName();
} }
@ -421,7 +421,7 @@ fileName home()
{ {
std::string homeDir = getEnv("HOME"); std::string homeDir = getEnv("HOME");
if (homeDir.empty()) if (homeDir.empty())
{ {
homeDir = getEnv("USERPROFILE"); homeDir = getEnv("USERPROFILE");
} }
@ -440,18 +440,18 @@ fileName cwd()
{ {
string currentDirectory; string currentDirectory;
const DWORD actualBufferSize = const DWORD actualBufferSize =
::GetCurrentDirectory(0, NULL); ::GetCurrentDirectory(0, NULL);
if (0 < actualBufferSize) if (0 < actualBufferSize)
{ {
MSwindows::AutoArray<TCHAR> actualBuffer(actualBufferSize); MSwindows::AutoArray<TCHAR> actualBuffer(actualBufferSize);
::GetCurrentDirectory(actualBufferSize, ::GetCurrentDirectory(actualBufferSize,
actualBuffer.get()); actualBuffer.get());
currentDirectory = actualBuffer.get(); currentDirectory = actualBuffer.get();
MSwindows::toUnixSlash(currentDirectory); MSwindows::toUnixSlash(currentDirectory);
} }
else else
{ {
FatalErrorIn("cwd()") FatalErrorIn("cwd()")
<< "Couldn't get the current working directory" << "Couldn't get the current working directory"
@ -465,7 +465,7 @@ fileName cwd()
bool chDir(const fileName& dir) bool chDir(const fileName& dir)
{ {
const bool success = ::SetCurrentDirectory(dir.c_str()); const bool success = ::SetCurrentDirectory(dir.c_str());
return success; return success;
} }
@ -690,7 +690,7 @@ bool mkDir(const fileName& pathName, const mode_t mode)
{ {
chMod(pathName, mode); chMod(pathName, mode);
} }
else else
{ {
const DWORD error = ::GetLastError(); const DWORD error = ::GetLastError();
@ -710,12 +710,12 @@ bool mkDir(const fileName& pathName, const mode_t mode)
{ {
success = mkDir(pathName, mode); success = mkDir(pathName, mode);
} }
break; break;
} }
} }
if (!success) if (!success)
{ {
FatalErrorIn("mkDir(const fileName&, mode_t)") FatalErrorIn("mkDir(const fileName&, mode_t)")
<< "Couldn't create directory: " << pathName << "Couldn't create directory: " << pathName
@ -753,7 +753,7 @@ fileName::Type type(const fileName& name)
fileName::Type fileType = fileName::UNDEFINED; fileName::Type fileType = fileName::UNDEFINED;
const DWORD attrs = ::GetFileAttributes(name.c_str()); const DWORD attrs = ::GetFileAttributes(name.c_str());
if (attrs != INVALID_FILE_ATTRIBUTES) if (attrs != INVALID_FILE_ATTRIBUTES)
{ {
fileType = (attrs & FILE_ATTRIBUTE_DIRECTORY) ? fileType = (attrs & FILE_ATTRIBUTE_DIRECTORY) ?
fileName::DIRECTORY : fileName::DIRECTORY :
@ -765,7 +765,7 @@ fileName::Type type(const fileName& name)
static static
bool bool
isGzFile(const fileName& name) isGzFile(const fileName& name)
{ {
std::string gzName(name); std::string gzName(name);
@ -781,7 +781,7 @@ isGzFile(const fileName& name)
bool exists(const fileName& name, const bool checkGzip) bool exists(const fileName& name, const bool checkGzip)
{ {
const DWORD attrs = ::GetFileAttributes(name.c_str()); const DWORD attrs = ::GetFileAttributes(name.c_str());
const bool success = (attrs != INVALID_FILE_ATTRIBUTES) || const bool success = (attrs != INVALID_FILE_ATTRIBUTES) ||
(checkGzip && isGzFile(name)); (checkGzip && isGzFile(name));
return success; return success;
@ -803,8 +803,8 @@ bool isDir(const fileName& name)
bool isFile(const fileName& name, const bool checkGzip) bool isFile(const fileName& name, const bool checkGzip)
{ {
const DWORD attrs = ::GetFileAttributes(name.c_str()); const DWORD attrs = ::GetFileAttributes(name.c_str());
const bool success = ((attrs != INVALID_FILE_ATTRIBUTES) && const bool success = ((attrs != INVALID_FILE_ATTRIBUTES) &&
!(attrs & FILE_ATTRIBUTE_DIRECTORY)) || !(attrs & FILE_ATTRIBUTE_DIRECTORY)) ||
(checkGzip && isGzFile(name)); (checkGzip && isGzFile(name));
return success; return success;
@ -913,7 +913,7 @@ fileNameList readDir
// Reset the length of the entries list // Reset the length of the entries list
dirEntries.setSize(nEntries); dirEntries.setSize(nEntries);
return dirEntries; return dirEntries;
} }
@ -947,16 +947,16 @@ bool cp(const fileName& src, const fileName& dest)
// Open and check streams. // Open and check streams.
// Use binary mode in case we read binary. // Use binary mode in case we read binary.
// Causes windows reading to fail if we don't. // Causes windows reading to fail if we don't.
std::ifstream srcStream(src.c_str(), std::ifstream srcStream(src.c_str(),
ios_base::in|ios_base::binary); ios_base::in|ios_base::binary);
if (!srcStream) if (!srcStream)
{ {
return false; return false;
} }
// Use binary mode in case we write binary. // Use binary mode in case we write binary.
// Causes windows reading to fail if we don't. // Causes windows reading to fail if we don't.
std::ofstream destStream(destFile.c_str(), std::ofstream destStream(destFile.c_str(),
ios_base::out|ios_base::binary); ios_base::out|ios_base::binary);
if (!destStream) if (!destStream)
{ {
@ -996,7 +996,7 @@ bool cp(const fileName& src, const fileName& dest)
{ {
if (MSwindows::debug) if (MSwindows::debug)
{ {
Info<< "Copying : " << src/contents[i] Info<< "Copying : " << src/contents[i]
<< " to " << destFile/contents[i] << endl; << " to " << destFile/contents[i] << endl;
} }
@ -1047,13 +1047,13 @@ bool mv(const fileName& srcFile, const fileName& destFile)
Info<< "Move : " << srcFile << " to " << destFile << endl; Info<< "Move : " << srcFile << " to " << destFile << endl;
} }
const fileName destName = const fileName destName =
((destFile.type() == fileName::DIRECTORY) ((destFile.type() == fileName::DIRECTORY)
&& (srcFile.type() != fileName::DIRECTORY)) ? && (srcFile.type() != fileName::DIRECTORY)) ?
destFile/srcFile.name() : destFile/srcFile.name() :
destFile; destFile;
const bool success = const bool success =
(0 == std::rename(srcFile.c_str(), destName.c_str())); (0 == std::rename(srcFile.c_str(), destName.c_str()));
return success; return success;
@ -1109,7 +1109,7 @@ bool rm(const fileName& file)
bool success = (0 == std::remove(file.c_str())); bool success = (0 == std::remove(file.c_str()));
// If deleting plain file name failed try with .gz // If deleting plain file name failed try with .gz
if (!success) if (!success)
{ {
const std::string fileGz = file + ".gz"; const std::string fileGz = file + ".gz";
success = (0 == std::remove(fileGz.c_str())); success = (0 == std::remove(fileGz.c_str()));
@ -1137,7 +1137,7 @@ bool rmDir(const fileName& directory)
while (success && dirIt.hasNext()) while (success && dirIt.hasNext())
{ {
const fileName & fName = dirIt.next(); const fileName & fName = dirIt.next();
if (fName != "." && fName != "..") if (fName != "." && fName != "..")
{ {
@ -1170,12 +1170,12 @@ bool rmDir(const fileName& directory)
} }
} }
} }
if (success) if (success)
{ {
success = ::RemoveDirectory(directory.c_str()); success = ::RemoveDirectory(directory.c_str());
if (!success) if (!success)
{ {
WarningIn("rmdir(const fileName&)") WarningIn("rmdir(const fileName&)")
<< "failed to remove directory " << directory << endl; << "failed to remove directory " << directory << endl;
@ -1207,7 +1207,7 @@ void fdClose(const int fd)
( (
"Foam::fdClose(const int fd)" "Foam::fdClose(const int fd)"
) << "close error on " << fd << endl ) << "close error on " << fd << endl
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -1246,7 +1246,7 @@ int system(const string& command)
// Explicitly track loaded libraries, rather than use // Explicitly track loaded libraries, rather than use
// EnumerateLoadedModules64 and have to link against // EnumerateLoadedModules64 and have to link against
// Dbghelp.dll // Dbghelp.dll
// Details at http://msdn.microsoft.com/en-us/library/ms679316(v=vs.85).aspx // Details at http://msdn.microsoft.com/en-us/library/ms679316(v=vs.85).aspx
typedef std::map<void*, std::string> OfLoadedLibs; typedef std::map<void*, std::string> OfLoadedLibs;
@ -1282,11 +1282,11 @@ void* dlOpen(const fileName& libName, const bool check)
winLibName = "lib"; winLibName = "lib";
winLibName += libName; winLibName += libName;
winLibName += dllExt; winLibName += dllExt;
handle = ::LoadLibrary(winLibName.c_str()); handle = ::LoadLibrary(winLibName.c_str());
} }
if (NULL != handle) if (NULL != handle)
{ {
getLoadedLibs()[handle] = libName; getLoadedLibs()[handle] = libName;
} }
@ -1317,14 +1317,14 @@ bool dlClose(void* const handle)
<< " : FreeLibrary of handle " << handle << endl; << " : FreeLibrary of handle " << handle << endl;
} }
const bool success = const bool success =
::FreeLibrary(static_cast<HMODULE>(handle)); ::FreeLibrary(static_cast<HMODULE>(handle));
if (success) if (success)
{ {
getLoadedLibs().erase(handle); getLoadedLibs().erase(handle);
} }
return success; return success;
} }

View file

@ -644,7 +644,7 @@ template <class CHART> inline int CBoundaryElxT <CHART> :: IsWordChar(CHART ch)
// //
// Bracket // Bracket
// //
template <class CHART> class CBracketElxT : public ElxInterface template <class CHART> class CBracketElxT : public ElxInterface
{ {
public: public:
int Match (CContext * pContext) const; int Match (CContext * pContext) const;
@ -782,7 +782,7 @@ template <class CHART> int CBracketElxT <CHART> :: MatchNext(CContext * pContext
// //
// Deletage // Deletage
// //
template <class CHART> class CDelegateElxT : public ElxInterface template <class CHART> class CDelegateElxT : public ElxInterface
{ {
public: public:
int Match (CContext * pContext) const; int Match (CContext * pContext) const;
@ -2993,7 +2993,7 @@ template <class CHART> ElxInterface * CBuilderT <CHART> :: BuildRecursive(int &
m_grouplist[nThisBackref] = pList; m_grouplist[nThisBackref] = pList;
// right // right
MoveNext(); // skip ')' MoveNext(); // skip ')'
return pList; return pList;
} }

View file

@ -167,11 +167,11 @@ void printSourceFileAndLine
// After an idea published by Rush Manbert at http://lists.apple.com/archives/xcode-users/2006/Apr/msg00528.html // After an idea published by Rush Manbert at http://lists.apple.com/archives/xcode-users/2006/Apr/msg00528.html
template<int level> template<int level>
void *getStackAddress() void *getStackAddress()
{ {
const unsigned int stackLevel=level; const unsigned int stackLevel=level;
return ( return (
__builtin_frame_address(level) __builtin_frame_address(level)
? __builtin_return_address(stackLevel) ? __builtin_return_address(stackLevel)
: (void *)0 : (void *)0
); );
@ -212,7 +212,7 @@ void *getStackAddress(int level)
} }
} }
unsigned backtrace(void **bt, unsigned maxAddrs) unsigned backtrace(void **bt, unsigned maxAddrs)
{ {
unsigned valid=0; unsigned valid=0;
bool ok=true; bool ok=true;
@ -220,7 +220,7 @@ unsigned backtrace(void **bt, unsigned maxAddrs)
for(int level=0;level<maxAddrs;level++) { for(int level=0;level<maxAddrs;level++) {
if(ok) { if(ok) {
bt[level]=getStackAddress(level); bt[level]=getStackAddress(level);
if(bt[level]!=(void *)0) { if(bt[level]!=(void *)0) {
valid=level; valid=level;
} else { } else {
@ -235,7 +235,7 @@ unsigned backtrace(void **bt, unsigned maxAddrs)
} }
// This function is a potential memory leak. But I don't care because the program is terminating anyway // This function is a potential memory leak. But I don't care because the program is terminating anyway
char **backtrace_symbols(void **bt,unsigned nr) char **backtrace_symbols(void **bt,unsigned nr)
{ {
char **strings=(char **)malloc(sizeof(char *)*nr); char **strings=(char **)malloc(sizeof(char *)*nr);

View file

@ -33,7 +33,7 @@ License
// Boost http://www.boost.org/libs/regex/doc/ // Boost http://www.boost.org/libs/regex/doc/
// GRETA http://research.microsoft.com/projects/greta/ // GRETA http://research.microsoft.com/projects/greta/
// Henry Spencer's http://arglist.com/regex/ // Henry Spencer's http://arglist.com/regex/
// //
// Chose DEELX http://www.regexlab.com/en/deelx/ // Chose DEELX http://www.regexlab.com/en/deelx/
// for its ease of integration - one header file // for its ease of integration - one header file
#include "deelx.h" #include "deelx.h"
@ -152,18 +152,18 @@ bool Foam::regExp::match(const string& str, List<string>& groups) const
const MatchResult results = preg_->MatchExact(str.c_str()); const MatchResult results = preg_->MatchExact(str.c_str());
isMatch = (0 < results.IsMatched()); isMatch = (0 < results.IsMatched());
if( isMatch ) if( isMatch )
{ {
int const notFound = -1; int const notFound = -1;
int start, end; int start, end;
const int groupsCount = results.MaxGroupNumber(); const int groupsCount = results.MaxGroupNumber();
groups.setSize(groupsCount); groups.setSize(groupsCount);
for (int i = 0; groupsCount > i; ++i) for (int i = 0; groupsCount > i; ++i)
{ {
start = results.GetGroupStart(i); start = results.GetGroupStart(i);
end = results.GetGroupEnd(i); end = results.GetGroupEnd(i);
if ((notFound < start) && (notFound < end)) if ((notFound < start) && (notFound < end))
{ {
groups[i] = str.substr(start, end - start); groups[i] = str.substr(start, end - start);

View file

@ -58,7 +58,7 @@ void Foam::sigFpe::sigFpeHandler(int)
( (
"Foam::sigSegv::sigFpeHandler()" "Foam::sigSegv::sigFpeHandler()"
) << "Cannot reset SIGFPE trapping" ) << "Cannot reset SIGFPE trapping"
<< abort(FatalError); << abort(FatalError);
} }
// Update jobInfo file // Update jobInfo file
@ -99,7 +99,7 @@ Foam::sigFpe::~sigFpe()
( (
"Foam::sigFpe::~sigFpe()" "Foam::sigFpe::~sigFpe()"
) << "Cannot reset SIGFPE trapping" ) << "Cannot reset SIGFPE trapping"
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -134,11 +134,11 @@ void Foam::sigFpe::set(const bool verbose)
} }
/* /*
fpOld_ = _controlfp(0, 0); fpOld_ = _controlfp(0, 0);
const unsigned int fpNew = const unsigned int fpNew =
fpOld_ & ~(_EM_ZERODIVIDE | _EM_INVALID | _EM_OVERFLOW); fpOld_ & ~(_EM_ZERODIVIDE | _EM_INVALID | _EM_OVERFLOW);
_controlfp(fpNew, _MCW_EM); _controlfp(fpNew, _MCW_EM);
oldAction_ = ::signal(SIGFPE, &Foam::sigFpe::sigFpeHandler); oldAction_ = ::signal(SIGFPE, &Foam::sigFpe::sigFpeHandler);
if( SIG_ERR == oldAction_ ) if( SIG_ERR == oldAction_ )
{ {
@ -148,7 +148,7 @@ void Foam::sigFpe::set(const bool verbose)
( (
"Foam::sigFpe::set()" "Foam::sigFpe::set()"
) << "Cannot set SIGFPE trapping" ) << "Cannot set SIGFPE trapping"
<< abort(FatalError); << abort(FatalError);
} }
*/ */
} }

View file

@ -46,7 +46,7 @@ void Foam::sigQuit::sigQuitHandler(int)
( (
"Foam::sigQuit::sigQuitHandler()" "Foam::sigQuit::sigQuitHandler()"
) << "Cannot reset SIGQUIT trapping" ) << "Cannot reset SIGQUIT trapping"
<< abort(FatalError); << abort(FatalError);
} }
// Update jobInfo file // Update jobInfo file
@ -81,7 +81,7 @@ Foam::sigQuit::~sigQuit()
{ {
FatalErrorIn("Foam::sigQuit::~sigQuit()") FatalErrorIn("Foam::sigQuit::~sigQuit()")
<< "Cannot reset SIGBREAK trapping" << "Cannot reset SIGBREAK trapping"
<< abort(FatalError); << abort(FatalError);
} }
} }
} }
@ -100,7 +100,7 @@ void Foam::sigQuit::set(const bool verbose)
<< abort(FatalError); << abort(FatalError);
} }
oldAction_ = ::signal(SIGBREAK, &Foam::sigQuit::sigQuitHandler); oldAction_ = ::signal(SIGBREAK, &Foam::sigQuit::sigQuitHandler);
if( SIG_ERR == oldAction_ ) if( SIG_ERR == oldAction_ )
{ {
@ -110,7 +110,7 @@ void Foam::sigQuit::set(const bool verbose)
( (
"Foam::sigQuit::set()" "Foam::sigQuit::set()"
) << "Cannot set SIGQUIT trapping" ) << "Cannot set SIGQUIT trapping"
<< abort(FatalError); << abort(FatalError);
} }
} }

View file

@ -46,7 +46,7 @@ void Foam::sigSegv::sigSegvHandler(int)
( (
"Foam::sigSegv::sigSegvHandler()" "Foam::sigSegv::sigSegvHandler()"
) << "Cannot reset SIGSEGV trapping" ) << "Cannot reset SIGSEGV trapping"
<< abort(FatalError); << abort(FatalError);
} }
// Update jobInfo file // Update jobInfo file
@ -81,7 +81,7 @@ Foam::sigSegv::~sigSegv()
( (
"Foam::sigSegv::~sigSegv()" "Foam::sigSegv::~sigSegv()"
) << "Cannot reset SIGSEGV trapping" ) << "Cannot reset SIGSEGV trapping"
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -99,7 +99,7 @@ void Foam::sigSegv::set(const bool verbose)
<< abort(FatalError); << abort(FatalError);
} }
oldAction_ = ::signal(SIGSEGV, &Foam::sigSegv::sigSegvHandler); oldAction_ = ::signal(SIGSEGV, &Foam::sigSegv::sigSegvHandler);
if( SIG_ERR == oldAction_ ) if( SIG_ERR == oldAction_ )
{ {
@ -109,7 +109,7 @@ void Foam::sigSegv::set(const bool verbose)
( (
"Foam::sigSegv::set()" "Foam::sigSegv::set()"
) << "Cannot set SIGSEGV trapping" ) << "Cannot set SIGSEGV trapping"
<< abort(FatalError); << abort(FatalError);
} }
} }

View file

@ -108,15 +108,15 @@ Foam::timer::timer(const unsigned int newTimeOut)
<< " seconds." << endl; << " seconds." << endl;
} }
const bool success = const bool success =
::CreateTimerQueueTimer(&hTimer_, ::CreateTimerQueueTimer(&hTimer_,
NULL, NULL,
(WAITORTIMERCALLBACK)timerExpired, (WAITORTIMERCALLBACK)timerExpired,
NULL , NULL ,
newTimeOut * 1000, newTimeOut * 1000,
0, 0); 0, 0);
if (!success) if (!success)
{ {
hTimer_ = NULL; hTimer_ = NULL;
FatalErrorIn FatalErrorIn
@ -124,7 +124,7 @@ Foam::timer::timer(const unsigned int newTimeOut)
"Foam::timer::timer(const unsigned int)" "Foam::timer::timer(const unsigned int)"
) << "CreateTimerQueueTimer, " ) << "CreateTimerQueueTimer, "
<< MSwindows::getLastError() << MSwindows::getLastError()
<< abort(FatalError); << abort(FatalError);
} }
} }
} }
@ -137,18 +137,18 @@ Foam::timer::~timer()
if (newTimeOut_ > 0) if (newTimeOut_ > 0)
{ {
// Reset timer // Reset timer
const bool timerSuccess = const bool timerSuccess =
::DeleteTimerQueueTimer(NULL, hTimer_, NULL); ::DeleteTimerQueueTimer(NULL, hTimer_, NULL);
hTimer_ = NULL; hTimer_ = NULL;
if (!timerSuccess) if (!timerSuccess)
{ {
FatalErrorIn FatalErrorIn
( (
"Foam::timer::~timer() " "Foam::timer::~timer() "
) << "DeleteTimerQueueTimer, " ) << "DeleteTimerQueueTimer, "
<< MSwindows::getLastError() << MSwindows::getLastError()
<< abort(FatalError); << abort(FatalError);
} }
if (debug) if (debug)

View file

@ -50,13 +50,13 @@ namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<> template<> inline
tmp<BlockLduSystem<vector, scalar> > gaussDivScheme<vector>::fvmUDiv tmp<BlockLduSystem<vector, scalar> > gaussDivScheme<vector>::fvmUDiv
( (
const GeometricField<vector, fvPatchField, volMesh>& const GeometricField<vector, fvPatchField, volMesh>&
) const; ) const;
template<> template<> inline
tmp<BlockLduSystem<vector, scalar> > gaussDivScheme<vector>::fvmUDiv tmp<BlockLduSystem<vector, scalar> > gaussDivScheme<vector>::fvmUDiv
( (
const surfaceScalarField& flux, const surfaceScalarField& flux,

View file

@ -24,5 +24,3 @@ EXE_INC = \
LIB_LIBS = \ LIB_LIBS = \
-L$(PARMGRIDGEN_LIB_DIR) -lMGridGen -L$(PARMGRIDGEN_LIB_DIR) -lMGridGen
endif endif

View file

@ -1,2 +1 @@
by bgschaid. 2010-10-06 on Centos 5.5 with gcc 4.1 by bgschaid. 2010-10-06 on Centos 5.5 with gcc 4.1

View file

@ -1,4 +1,3 @@
PFLAGS = PFLAGS =
PINC = -I$(MPI_ARCH_PATH)/include PINC = -I$(MPI_ARCH_PATH)/include
PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi PLIBS = -L$(MPI_ARCH_PATH)/lib -lmpi