diff --git a/Allwmake.mingw b/Allwmake.mingw
new file mode 100644
index 000000000..4e269f909
--- /dev/null
+++ b/Allwmake.mingw
@@ -0,0 +1,76 @@
+#!/bin/sh
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# Script
+# Allwmake.mingw
+#
+# Description
+# Top-level build script for use with MSYS shell for MinGW-based builds on Windows.
+#
+# Author:
+# Cesare Guardino, Alstom Power Ltd., (2015)
+#
+#------------------------------------------------------------------------------
+
+cd ${0%/*} || exit 1 # run from this directory
+
+echo
+echo "======================== FOAM-EXTEND MINGW WINDOWS TOP-LEVEL BUILD SCRIPT ========================"
+
+if [ "$PWD" != "$WM_PROJECT_DIR" ]
+then
+ echo "Error: Current directory is not \$WM_PROJECT_DIR"
+ echo " The environment variable are not consistent with the installation."
+ echo " Check the OpenFOAM entries in your dot-files and source them."
+ exit 1
+fi
+
+cd $WM_PROJECT_DIR/ThirdParty/mingwBuild
+echo
+echo "In directory `pwd`"
+echo "Configuring your OpenMPI installation ..."
+./configure_OpenMPI.sh
+PACKAGES_DIR=$WM_PROJECT_DIR/ThirdParty/packages
+if [ -d $PACKAGES_DIR ] ; then
+ echo "Third-party dependencies packages $PACKAGES_DIR already exists."
+else
+ echo "Building third-party dependencies ... (see `pwd`/build.log)"
+ ./build.sh > build.log 2>&1
+ echo "Installing third-party dependencies ..."
+ rm -rf $PACKAGES_DIR
+ mv x64/install $PACKAGES_DIR
+fi
+
+cd $WM_PROJECT_DIR
+echo
+echo "In directory `pwd`"
+echo "Build foam-extend ... (see `pwd`/Allwmake.log)"
+./Allwmake > Allwmake.log 2>&1
+echo "Copying MinGW dependencies to $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/libwinpthread-1.dll $FOAM_APPBIN
+
+echo
+echo "All done!"
diff --git a/ThirdParty/mingwBuild/build.sh b/ThirdParty/mingwBuild/build.sh
new file mode 100644
index 000000000..96919484d
--- /dev/null
+++ b/ThirdParty/mingwBuild/build.sh
@@ -0,0 +1,293 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# Script
+# build.sh
+#
+# Description
+# Downloads, extracts, builds and installs thirdy-party dependencies.
+#
+# Author:
+# Cesare Guardino, Alstom Power Ltd., (2015)
+#
+#------------------------------------------------------------------------------
+
+# {{{ DEFINE UTILITY FUNCTIONS
+download() {
+ file=$1
+ url=$2
+
+ if [ -f $BUILD_HOME/downloads/$file ] ; then
+ echo "Using already existing file $BUILD_HOME/downloads/$file"
+ else
+ wget --no-check-certificate $url -O $BUILD_HOME/downloads/$file
+ fi
+}
+
+extract() {
+ file=$1
+ program=$2
+
+ cp -p $BUILD_HOME/downloads/$file .
+ package=`basename $file`
+ if [ "$program" = "7zip" ] ; then
+ "$ZIP_EXE" x $package
+ else
+ $program -cd $package | tar xvf -
+ fi
+ rm $package
+}
+
+unzip_dir() {
+ dir=$1
+
+ mkdir $dir
+ cd $dir
+ extract $dir.zip 7zip
+ cd ..
+}
+
+patch() {
+ dir=$1
+
+ cp -rp $BUILD_HOME/$ARCH/patches/$dir .
+}
+
+mkchk() {
+ dir=$1
+
+ if [ ! -d $dir ] ; then
+ mkdir $dir
+ fi
+}
+
+mkdel() {
+ dir=$1
+
+ rm -rf $dir > /dev/null 2>&1
+ mkdir $dir
+}
+# }}}
+
+# {{{ DEFINE PROCESS FUNCTIONS
+start() {
+ echo "======================== FOAM-EXTEND THIRD-PARTY DEPENDENCIES WINDOWS BUILD SCRIPT ========================"
+}
+
+initialise() {
+ echo ""
+
+ if [ ! "$MINGW_HOME" ] ; then
+ echo "*** ERROR: MINGW_HOME environment variable not specified."
+ exit 1
+ else
+ echo "Using MINGW_HOME=$MINGW_HOME"
+ fi
+
+ BUILD_HOME=`pwd`
+ ZIP_EXE="7z.exe"
+ ARCH="x64"
+
+ BUILD_DIR=$BUILD_HOME/$ARCH/build
+ INSTALL_DIR=$BUILD_HOME/$ARCH/install
+ OUT_DIR=$BUILD_HOME/$ARCH/output
+
+ mkchk $BUILD_HOME/downloads
+
+ echo ""
+ echo "All stdout/stderr output is redirected to the directory $OUT_DIR"
+ echo "All builds occur in the directory $BUILD_DIR"
+ echo "The script will install the completed builds in the directory $INSTALL_DIR"
+}
+
+cleanup() {
+ echo ""
+ echo "Removing previous builds ..."
+
+ mkdel $BUILD_DIR
+ mkdel $INSTALL_DIR
+ mkdel $OUT_DIR
+}
+
+build_library() {
+ PACKAGE=$1
+
+ echo "- Building $PACKAGE ..."
+ LOG_FILE=$OUT_DIR/$PACKAGE.log
+ cd $BUILD_DIR
+
+ case $PACKAGE in
+
+ dlfcn-win32-master)
+ 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
+ cd $PACKAGE
+ ./configure --prefix=$INSTALL_DIR/system >> $LOG_FILE 2>&1
+ make >> $LOG_FILE 2>&1
+ mkdir $INSTALL_DIR/system
+ make install >> $LOG_FILE 2>&1
+ ;;
+
+ system)
+ cd $INSTALL_DIR
+ patch system
+ ;;
+
+ 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
+ unzip_dir $PACKAGE >> $LOG_FILE 2>&1
+ patch $PACKAGE
+ ;;
+
+ metis-5.1.0)
+ 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
+ patch $PACKAGE
+ cd $PACKAGE
+ mkdir build/windows
+ cd build/windows
+ cmake -G "MSYS Makefiles" -DCMAKE_CONFIGURATION-TYPES="Release" -DGKLIB_PATH="../../GKlib" ../.. >> $LOG_FILE 2>&1
+ make >> $LOG_FILE 2>&1
+ mkdir $INSTALL_DIR/$PACKAGE
+ mkdir $INSTALL_DIR/$PACKAGE/bin
+ mkdir $INSTALL_DIR/$PACKAGE/include
+ mkdir $INSTALL_DIR/$PACKAGE/lib
+ cp -p programs/*.exe $INSTALL_DIR/$PACKAGE/bin
+ cp -p ../../include/metis.h $INSTALL_DIR/$PACKAGE/include
+ cp -p libmetis/libmetis.a $INSTALL_DIR/$PACKAGE/lib
+ ;;
+
+ parmetis-4.0.3)
+ 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
+ patch $PACKAGE
+ cd $PACKAGE
+ mkdir build/windows
+ cd build/windows
+ cmake -G "MSYS Makefiles" -DCMAKE_CONFIGURATION-TYPES="Release" -DGKLIB_PATH="../../metis/GKlib" ../.. >> $LOG_FILE 2>&1
+ $BUILD_HOME/parmetis_includes_hack.pl
+ make >> $LOG_FILE 2>&1
+ mkdir $INSTALL_DIR/$PACKAGE
+ mkdir $INSTALL_DIR/$PACKAGE/bin
+ mkdir $INSTALL_DIR/$PACKAGE/include
+ mkdir $INSTALL_DIR/$PACKAGE/lib
+ cp -p programs/*.exe $INSTALL_DIR/$PACKAGE/bin
+ cp -p ../../metis/include/metis.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 libparmetis/libparmetis.a $INSTALL_DIR/$PACKAGE/lib
+ ;;
+
+ ParMGridGen-1.0)
+ 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
+ extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
+ patch $PACKAGE
+ cd $PACKAGE
+ make serial >> $LOG_FILE 2>&1
+ make parallel >> $LOG_FILE 2>&1
+ mkdir $INSTALL_DIR/$PACKAGE
+ mkdir $INSTALL_DIR/$PACKAGE/bin
+ mkdir $INSTALL_DIR/$PACKAGE/include
+ mkdir $INSTALL_DIR/$PACKAGE/lib
+ cp -p *.exe $INSTALL_DIR/$PACKAGE/bin
+ cp -p libmgrid.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 ParMGridGen/IMParMetis-2.0/libIMparmetis.a $INSTALL_DIR/$PACKAGE/lib
+ cp -p MGridGen/IMlib/*.h $INSTALL_DIR/$PACKAGE/include
+ cp -p MGridGen/Lib/*.h $INSTALL_DIR/$PACKAGE/include
+ export EXTRA_SYSTEM_HOME=
+ ;;
+
+ scotch_6.0.0)
+ 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
+ extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
+ patch $PACKAGE
+ cd $PACKAGE/src
+ make scotch >> $LOG_FILE 2>&1
+ make ptscotch >> $LOG_FILE 2>&1
+ mkdir $INSTALL_DIR/$PACKAGE
+ make install prefix=$INSTALL_DIR/$PACKAGE >> $PACKAGE.log 2>&1
+ export PTHREADS_HOME=
+ ;;
+
+ mesquite-2.1.2)
+ 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
+ extract "$PACKAGE.tar.gz" gzip >> $LOG_FILE 2>&1
+ cd $PACKAGE
+ cp -p $MINGW_HOME/bin/libstdc++-6.dll utils
+ ./configure --prefix=$INSTALL_DIR >> $LOG_FILE 2>&1
+ make >> $LOG_FILE 2>&1
+ mkdir $INSTALL_DIR/$PACKAGE
+ make install prefix=$INSTALL_DIR/$PACKAGE >> $LOG_FILE 2>&1
+ export CPPFLAGS=
+ ;;
+
+ *)
+ echo "*** ERROR: Unknown package '$PACKAGE'"
+ exit 1
+ ;;
+ esac
+}
+
+build_libraries() {
+ echo ""
+ echo "Building libraries ..."
+ build_library dlfcn-win32-master
+ build_library system
+ build_library pthreads-w32-2-9-1-release
+ build_library metis-5.1.0
+ build_library parmetis-4.0.3
+ build_library ParMGridGen-1.0
+ build_library scotch_6.0.0
+ build_library mesquite-2.1.2
+}
+
+create_dirs() {
+ echo ""
+ echo "Checking for build directories and creating them if required ..."
+
+ mkchk $BUILD_DIR
+ mkchk $INSTALL_DIR
+ mkchk $OUT_DIR
+}
+
+finish() {
+ echo ""
+ echo "All done!"
+}
+# }}}
+
+# {{{ MAIN EXECUTION
+cd ${0%/*} || exit 1 # run from this directory
+start
+initialise
+mkchk $ARCH
+cleanup
+build_libraries
+finish
+# }}}
diff --git a/ThirdParty/mingwBuild/clean.sh b/ThirdParty/mingwBuild/clean.sh
new file mode 100644
index 000000000..e49724843
--- /dev/null
+++ b/ThirdParty/mingwBuild/clean.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# Script
+# build.sh
+#
+# Description
+# Removes previous thirdy-party dependencies build directories (does not remove installed packages directory)
+#
+# Author:
+# Cesare Guardino, Alstom Power Ltd., (2015)
+#
+#------------------------------------------------------------------------------
+
+# {{{ DEFINE UTILITY FUNCTIONS
+remove_dir() {
+ dir=$1
+
+ rm -rf $dir > /dev/null 2>&1
+}
+# }}}
+
+# {{{ DEFINE PROCESS FUNCTIONS
+start() {
+ echo "======================== FOAM-EXTEND THIRD-PARTY DEPENDENCIES WINDOWS CLEAN SCRIPT ========================"
+}
+
+initialise() {
+ echo ""
+
+ BUILD_HOME=`pwd`
+ ARCH="x64"
+
+ BUILD_DIR=$BUILD_HOME/$ARCH/build
+ INSTALL_DIR=$BUILD_HOME/$ARCH/install
+ OUT_DIR=$BUILD_HOME/$ARCH/output
+}
+
+cleanup() {
+ echo ""
+ echo "Removing previous builds ..."
+
+ remove_dir $BUILD_DIR
+ remove_dir $INSTALL_DIR
+ remove_dir $OUT_DIR
+ remove_dir $BUILD_HOME/downloads
+}
+
+finish() {
+ echo ""
+ echo "All done!"
+}
+# }}}
+
+# {{{ MAIN EXECUTION
+cd ${0%/*} || exit 1 # run from this directory
+start
+initialise
+cleanup
+finish
+# }}}
diff --git a/ThirdParty/mingwBuild/configure_OpenMPI.sh b/ThirdParty/mingwBuild/configure_OpenMPI.sh
new file mode 100644
index 000000000..fe4a83d23
--- /dev/null
+++ b/ThirdParty/mingwBuild/configure_OpenMPI.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# Script
+# configure_OpenMPI.sh
+#
+# Description
+# Generates static OpenMPI library to enable compilation with MINGW toolchain.
+#
+# Author:
+# Cesare Guardino, Alstom Power Ltd., (2015)
+#
+#------------------------------------------------------------------------------
+
+if [ -f "$MPI_ROOTDIR/lib/libmpi.a" ] ; then
+ echo "$MPI_ROOTDIR/lib/libmpi.a already exists."
+ exit 1
+fi
+
+INSTALL=1
+if [ $1 ] ; then
+ if [ $1 = "--no-install" ] ; then
+ INSTALL=0
+ echo "*** WARNING: Will not install exported libmpi.a and libmpi.def"
+ fi
+fi
+
+tmp=`echo $RANDOM$RANDOM$RANDOM`
+current_dir=`pwd`
+mkdir -p /tmp/$tmp
+cd /tmp/$tmp
+
+pexports $MPI_ROOTDIR/bin/libmpi.dll > libmpi.def
+dlltool --dllname libmpi.dll --def libmpi.def --output-lib libmpi.a
+
+if [ $INSTALL -eq 1 ] ; then
+ mv libmpi.a $MPI_ROOTDIR/lib
+ mv libmpi.def $MPI_ROOTDIR/lib
+ cd $current_dir
+ rm -rf /tmp/$tmp
+ echo "Installed exported libraries into $MPI_ROOTDIR/lib"
+else
+ cd $current_dir
+ echo "Exported libraries left in directory /tmp/$tmp"
+fi
+
diff --git a/ThirdParty/mingwBuild/parmetis_includes_hack.pl b/ThirdParty/mingwBuild/parmetis_includes_hack.pl
new file mode 100644
index 000000000..787146a8a
--- /dev/null
+++ b/ThirdParty/mingwBuild/parmetis_includes_hack.pl
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+#------------------------------------------------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# Script
+# parmetis_includes_hack.pl
+#
+# Description
+# Adds OpenMPI lib/includes dirs to CMake-generated GCC options.
+#
+# Author:
+# Cesare Guardino, Alstom Power Ltd., (2015)
+#
+#------------------------------------------------------------------------------
+
+use strict;
+use warnings;
+
+use File::Find;
+
+my $MPI_ROOTDIR = $ENV{"MPI_ROOTDIR"};
+$MPI_ROOTDIR =~ s/^\/\w//;
+my $drive_letter = $&;
+$drive_letter =~ s/\///;
+$MPI_ROOTDIR = uc($drive_letter) . ":" . $MPI_ROOTDIR;
+
+my @dirs = (".");
+find(\&wanted, @dirs);
+
+sub wanted
+{
+ my $file = $_;
+ my $path = $File::Find::name;
+
+ if ($file eq "linklibs.rsp" or $file eq "includes_C.rsp")
+ {
+ open (FILE, '<', $file) or die ("ERROR: Can't open '$path' [$!]");
+ my @contents = ;
+ close (FILE);
+
+ 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' [$!]");
+ foreach my $line (@contents)
+ {
+ chomp($line);
+ print FILE $line . $string;
+ }
+ close (FILE);
+ }
+}
diff --git a/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/MGridGen/IMlib/IMlib.h b/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/MGridGen/IMlib/IMlib.h
new file mode 100644
index 000000000..29733b2e1
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/MGridGen/IMlib/IMlib.h
@@ -0,0 +1,285 @@
+/*
+ * IMlib.h
+ *
+ * Irene's library of most frequently used routines
+ *
+ */
+
+#ifndef _IMLIB_H_
+#define _IMLIB_H_
+
+
+/* Undefine the following #define in order to use short int as the idxtype */
+#define IDXTYPE_INT
+/* Undefine the following #define in order to use float as the realtype */
+/*#define TYPE_REAL*/
+
+/* Indexes are as long as integers for now */
+#ifdef IDXTYPE_INT
+typedef int idxtype;
+#else
+typedef short idxtype;
+#endif
+
+/* floats for now */
+#ifdef TYPE_REAL
+typedef float realtype;
+#else
+typedef double realtype;
+#endif
+
+
+/*************************************************************************
+* Header file inclusion section
+**************************************************************************/
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "rand48.h"
+
+#ifdef DMALLOC
+#include
+#else
+#include
+#endif
+
+/*************************************************************************
+* Data structure definition section
+**************************************************************************/
+/*-------------------------------------------------------------
+ * The following data structure stores int key-value pairs
+ *-------------------------------------------------------------*/
+struct IKeyValueType {
+ int key;
+ int val;
+};
+
+typedef struct IKeyValueType IKeyValueType;
+
+
+/*-------------------------------------------------------------
+ * The following data structure stores int key-value pairs
+ *-------------------------------------------------------------*/
+struct idxKeyValueType {
+ idxtype key;
+ idxtype val;
+};
+
+typedef struct idxKeyValueType idxKeyValueType;
+
+
+/*-------------------------------------------------------------
+ * The following data structure stores int-key - double-value pairs
+ *-------------------------------------------------------------*/
+struct FKeyValueType {
+ double key;
+ int val, val1, val2;
+};
+
+typedef struct FKeyValueType FKeyValueType;
+
+
+/*-------------------------------------------------------------
+ * The following data structure stores int-key - double-value pairs
+ *-------------------------------------------------------------*/
+struct realKeyValueType {
+ realtype key;
+ int val, val1, val2;
+};
+
+typedef struct realKeyValueType realKeyValueType;
+
+/*************************************************************************
+* Definition Section
+**************************************************************************/
+#define LTERM (void **) 0 /* List terminator for IMfree() */
+
+
+
+/*************************************************************************
+* Macros Section
+**************************************************************************/
+/*-------------------------------------------------------------
+ * Usefull commands
+ *-------------------------------------------------------------*/
+#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 amin(a, b) ((a) >= (b) ? (b) : (a))
+#define RandomInRange(u) ((int)(drand48()*((double)(u))))
+#define RandomInRangeFast(u) ((rand()>>3)%(u))
+#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 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 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 realcopy(n, a, b) (realtype *)memcpy((void *)(b), (void *)(a), sizeof(realtype)*(n))
+
+
+/*-------------------------------------------------------------
+ * Timing macros
+ *-------------------------------------------------------------*/
+#define cleartimer(tmr) (tmr = 0.0)
+#define starttimer(tmr) (tmr -= seconds())
+#define stoptimer(tmr) (tmr += seconds())
+#define gettimer(tmr) (tmr)
+
+
+/*-------------------------------------------------------------
+ * Debuging memory leaks
+ *-------------------------------------------------------------*/
+#ifdef DMALLOC
+#define imalloc(n, msg) (malloc(sizeof(int)*(n)))
+#define fmalloc(n, msg) (malloc(sizeof(double)*(n)))
+#define idxmalloc(n, msg) ((idxtype *)malloc(sizeof(idxtype)*(n)))
+#define realmalloc(n, msg) ((realtype *)malloc(sizeof(realtype)*(n)))
+#define ismalloc(n, val, msg) (iset((n), (val), malloc(sizeof(int)*(n))))
+#define idxsmalloc(n, val, msg) (idxset((n), (val), (idxtype *)malloc(sizeof(idxtype)*(n))))
+#define fsmalloc(n, val, msg) (fset((n), (val), malloc(sizeof(double)*(n))))
+#define realsmalloc(n, val, msg) (realset((n), (val), (realtype *)malloc(sizeof(realtype)*(n))))
+#define IMmalloc(a, b) (malloc((a)))
+#endif
+
+#ifdef DMALLOC
+# define MALLOC_CHECK(ptr) \
+ if (malloc_verify((ptr)) == DMALLOC_VERIFY_ERROR) { \
+ printf("***MALLOC_CHECK failed on line %d of file %s: " #ptr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define MALLOC_CHECK(ptr) ;
+#endif
+
+
+/*-------------------------------------------------------------
+ * CSR conversion macros
+ *-------------------------------------------------------------*/
+#define MAKECSR(i, n, a) \
+ do { \
+ for (i=1; i0; i--) a[i] = a[i-1]; \
+ a[0] = 0; \
+ } while(0)
+
+
+/*-------------------------------------------------------------
+ * Program Assertions
+ *-------------------------------------------------------------*/
+#ifdef DEBUG
+# define ASSERT(expr) \
+ if (!(expr)) { \
+ printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define ASSERT(expr) ;
+#endif
+
+#ifdef DEBUG
+# define ASSERTP(expr,msg) \
+ if (!(expr)) { \
+ printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ printf msg ; \
+ printf("\n"); \
+ abort(); \
+ }
+#else
+# define ASSERTP(expr,msg) ;
+#endif
+
+
+/*************************************************************************
+* Function prototypes
+**************************************************************************/
+/*-------------------------------------------------------------
+ * blas.c
+ *-------------------------------------------------------------*/
+int *iset(int, int, int *);
+idxtype *idxset(int, idxtype, idxtype *);
+double *fset(int, double, double *);
+realtype *realset(int, realtype, realtype *);
+int iamax(int, int *);
+int idxamax(int, idxtype *);
+int famax(int, double *);
+int iamin(int, int *);
+int idxamin(int, idxtype *);
+int famin(int, double *);
+int charsum(int, char *);
+int isum(int, int *);
+int idxsum(int, idxtype *);
+double ssum(int, double *);
+double ssum_strd(int, double *, int);
+void sscale(int, double, double *);
+double snorm2(int, double *);
+double sdot(int, double *, double *);
+void saxpy(int, double, double *, int, double *, int);
+
+
+/*-------------------------------------------------------------
+ * file.c
+ *-------------------------------------------------------------*/
+FILE *IMfopen(char *, char *, char *);
+void IMfclose(FILE *);
+
+/*-------------------------------------------------------------
+ * memory.c
+ *-------------------------------------------------------------*/
+#ifndef DMALLOC
+int *imalloc(int, char *);
+idxtype *idxmalloc(int, char *);
+double *fmalloc(int, char *);
+realtype *realmalloc(int, char *);
+int *ismalloc(int, int, char *);
+idxtype *idxsmalloc(int, idxtype, char *);
+double *fsmalloc(int, double, char *);
+realtype *realsmalloc(int, realtype, char *);
+void *IMmalloc(int, char *);
+#endif
+/* void IMfree(void **, ...); */
+
+
+/*-------------------------------------------------------------
+ * util.c
+ *-------------------------------------------------------------*/
+void *errexit(char *,...);
+int IMlog2(int);
+double flog2(double);
+int ispow2(int);
+double seconds(void);
+
+
+/*-------------------------------------------------------------
+ * Sorting routines
+ *-------------------------------------------------------------*/
+void dfkeysort(int, FKeyValueType *);
+void dkeysort(int, IKeyValueType *);
+void ifkeysort(int, FKeyValueType *);
+void ifkeysort2(int, FKeyValueType *);
+void ifloatsort(int, double *);
+void iintsort(int, int *);
+void ikeysort(int, IKeyValueType *);
+void idxkeysort(int, idxKeyValueType *);
+void ikeysort2(int, IKeyValueType *);
+void idxkeysort2(int, idxKeyValueType *);
+
+/*-------------------------------------------------------------
+ * sort.c
+ *-------------------------------------------------------------*/
+void ikeyvalsort_org(int, IKeyValueType *);
+int IncKeyValueCmp(const void *, const void *);
+void dkeyvalsort(int, IKeyValueType *);
+void BucketSortKeysInc(int, idxtype, idxtype *, int *, int *);
+int DecKeyValueCmp(const void *, const void *);
+int BSearch(int, idxtype *, int);
+void RandomPermute(int, idxtype *, int);
+void RandomPermuteFine(int, int *, int);
+void FastRandomPermute(int, idxtype *, int);
+
+#endif
diff --git a/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/MGridGen/Lib/mgridgen.c b/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/MGridGen/Lib/mgridgen.c
new file mode 100644
index 000000000..6ee11c58a
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/MGridGen/Lib/mgridgen.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2001, Regents of the University of Minnesota
+ *
+ * mgridgen.c
+ *
+ * This file contains the top level routines for the sparse hierarchical
+ * clustering algorithm.
+ *
+ * George Irene
+ */
+
+#include "mgridgen.h"
+#include "rand48.h"
+
+
+/*************************************************************************
+* This function is the entry point for the SHCluster() routine.
+**************************************************************************/
+void MGridGen(int nvtxs, idxtype *xadj, realtype *vvol, realtype *vsurf,
+ idxtype *adjncy, realtype *adjwgt, int minsize, int maxsize,
+ int *options, int *nmoves, int *nparts, idxtype *part)
+{
+ GraphType graph;
+ CtrlType ctrl;
+
+ srand(4321);
+ srand48(7654321L);
+
+ /*------------------------------------------------------------
+ * Set up the various control structures
+ *------------------------------------------------------------*/
+ ctrl.CType = options[OPTION_CTYPE];
+ ctrl.RType = options[OPTION_RTYPE];
+ ctrl.dbglvl = options[OPTION_DBGLVL];
+ ctrl.dim = options[OPTION_DIM];
+ ctrl.minsize = minsize;
+ ctrl.maxsize = maxsize;
+ ctrl.nparts = -1;
+
+ /*------------------------------------------------------------
+ * Set up the graph
+ *------------------------------------------------------------*/
+ SetUpGraph(&graph, nvtxs, xadj, vvol, vsurf, adjncy, adjwgt);
+
+ CreateGrid(&ctrl, &graph);
+
+ *nparts = ctrl.nparts;
+ icopy(nvtxs, graph.where, part);
+ *nmoves = graph.nmoves;
+
+ FreeGraph(&graph);
+}
+
+
+/*************************************************************************
+* This function is the entry point for performing refinement
+**************************************************************************/
+void MGridGenRefine(int nvtxs, idxtype *xadj, realtype *vvol, realtype *vsurf,
+ idxtype *adjncy, idxtype *fusedinfo, realtype *adjwgt,
+ int minsize, int maxsize, int *options, int *nmoves,
+ int *nparts, idxtype *part)
+{
+ int i;
+ GraphType graph;
+ CtrlType ctrl;
+
+ srand(4321);
+ srand48(7654321L);
+
+ /*------------------------------------------------------------
+ * Set up the various control structures
+ *------------------------------------------------------------*/
+ ctrl.CType = options[OPTION_CTYPE];
+ ctrl.RType = options[OPTION_RTYPE];
+ ctrl.dbglvl = options[OPTION_DBGLVL];
+ ctrl.dim = options[OPTION_DIM];
+ ctrl.minsize = minsize;
+ ctrl.maxsize = maxsize;
+ ctrl.nparts = -1;
+
+ /*------------------------------------------------------------
+ * Set up the graph
+ *------------------------------------------------------------*/
+ SetUpGraph(&graph, nvtxs, xadj, vvol, vsurf, adjncy, adjwgt);
+ graph.cmap = NULL;
+
+ graph.where = idxmalloc(graph.nvtxs, "graph.where");
+ for (i=0; i>2)%(u))
+
+#define amax(a, b) ((a) >= (b) ? (a) : (b))
+#define amin(a, b) ((a) >= (b) ? (b) : (a))
+
+#define AND(a, b) ((a) < 0 ? ((-(a))&(b)) : ((a)&(b)))
+#define OR(a, b) ((a) < 0 ? -((-(a))|(b)) : ((a)|(b)))
+#define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b)))
+
+#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 scopy(n, a, b) memcpy((b), (a), sizeof(float)*(n))
+#define idxcopy(n, a, b) memcpy((b), (a), sizeof(idxtype)*(n))
+#define realcopy(n, a, b) memcpy((b), (a), sizeof(realtype)*(n))
+
+
+#define HASHFCT(key, size) ((key)%(size))
+
+
+/*************************************************************************
+* Timer macros
+**************************************************************************/
+#define cleartimer(tmr) (tmr = 0.0)
+#define starttimer(tmr) (tmr -= MPI_Wtime())
+#define stoptimer(tmr) (tmr += MPI_Wtime())
+#define gettimer(tmr) (tmr)
+
+
+/*************************************************************************
+* This macro is used to handle dbglvl
+**************************************************************************/
+#define IFSET(a, flag, cmd) if ((a)&(flag)) (cmd);
+
+/*************************************************************************
+* These macros are used for debuging memory leaks
+**************************************************************************/
+#ifdef DMALLOC
+#define imalloc(n, msg) (malloc(sizeof(int)*(n)))
+#define fmalloc(n, msg) (malloc(sizeof(float)*(n)))
+#define idxmalloc(n, msg) (malloc(sizeof(idxtype)*(n)))
+#define realmalloc(n, msg) ((realtype *)malloc(sizeof(realtype)*(n)))
+#define ismalloc(n, val, msg) (iset((n), (val), malloc(sizeof(int)*(n))))
+#define idxsmalloc(n, val, msg) (idxset((n), (val), malloc(sizeof(idxtype)*(n))))
+#define realsmalloc(n, val, msg) (realset((n), (val), (realtype *)malloc(sizeof(realtype)*(n))))
+#define IMmalloc(a, b) (malloc(a))
+#endif
+
+#ifdef DMALLOC
+# define MALLOC_CHECK(ptr) \
+ if (malloc_verify((ptr)) == DMALLOC_VERIFY_ERROR) { \
+ printf("***MALLOC_CHECK failed on line %d of file %s: " #ptr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define MALLOC_CHECK(ptr) ;
+#endif
+
+/*************************************************************************
+* This macro converts a length array in a CSR one
+**************************************************************************/
+#define MAKECSR(i, n, a) \
+ do { \
+ for (i=1; i0; i--) a[i] = a[i-1]; \
+ a[0] = 0; \
+ } while(0)
+
+
+
+
+#ifdef DEBUG
+# define ASSERT(ctrl, expr) \
+ if (!(expr)) { \
+ myprintf(ctrl, "***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define ASSERT(ctrl, expr) ;
+#endif
+
+#ifdef DEBUG
+# define ASSERTP(ctrl, expr,msg) \
+ if (!(expr)) { \
+ myprintf(ctrl, "***ASSERTION failed on line %d of file %s:" #expr "\n", \
+ __LINE__, __FILE__); \
+ myprintf msg ; \
+ abort(); \
+ }
+#else
+# define ASSERTP(ctrl, expr,msg) ;
+#endif
+
+#ifdef DEBUGS
+# define ASSERTS(expr) \
+ if (!(expr)) { \
+ printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define ASSERTS(expr) ;
+#endif
+
+#ifdef DEBUGS
+# define ASSERTSP(expr, msg) \
+ if (!(expr)) { \
+ printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ printf msg ; \
+ abort(); \
+ }
+#else
+# define ASSERTSP(expr, msg) ;
+#endif
diff --git a/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/ParMGridGen/ParLib/macros.h b/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/ParMGridGen/ParLib/macros.h
new file mode 100644
index 000000000..37b66c306
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/ParMGridGen-1.0/ParMGridGen/ParLib/macros.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2001, Regents of the University of Minnesota
+ *
+ * macros.h
+ *
+ * This file contains macros used in multilevel
+ *
+ * George Irene
+ */
+
+#include "rand48.h"
+
+/*************************************************************************
+* 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 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))))
+
+
+/*************************************************************************
+* The following macro returns a random number in the specified range
+**************************************************************************/
+#define RandomInRange(u) ((int)(drand48()*((double)(u))))
+
+#define amax(a, b) ((a) >= (b) ? (a) : (b))
+#define amin(a, b) ((a) >= (b) ? (b) : (a))
+
+#define AND(a, b) ((a) < 0 ? ((-(a))&(b)) : ((a)&(b)))
+#define OR(a, b) ((a) < 0 ? -((-(a))|(b)) : ((a)|(b)))
+#define XOR(a, b) ((a) < 0 ? -((-(a))^(b)) : ((a)^(b)))
+
+#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 HASHFCT(key, size) ((key)%(size))
+
+
+/*************************************************************************
+* Timer macros
+**************************************************************************/
+#undef cleartimer
+#undef starttimer
+#undef stoptimer
+#undef gettimer
+#define cleartimer(tmr) (tmr = 0.0)
+#define starttimer(tmr) (tmr -= MPI_Wtime())
+#define stoptimer(tmr) (tmr += MPI_Wtime())
+#define gettimer(tmr) (tmr)
+
+
+/*************************************************************************
+* This macro is used to handle dbglvl
+**************************************************************************/
+#define IFSET(a, flag, cmd) if ((a)&(flag)) (cmd);
+
+#undef ASSERT
+#undef ASSERTP
+
+#ifdef DEBUG
+# define ASSERT(ctrl, expr) \
+ if (!(expr)) { \
+ MGridmyprintf(ctrl, "***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define ASSERT(ctrl, expr) ;
+#endif
+
+#ifdef DEBUG
+# define ASSERTP(ctrl, expr,msg) \
+ if (!(expr)) { \
+ MGridmyprintf(ctrl, "***ASSERTION failed on line %d of file %s:" #expr "\n", \
+ __LINE__, __FILE__); \
+ MGridmyprintf msg ; \
+ abort(); \
+ }
+#else
+# define ASSERTP(ctrl, expr,msg) ;
+#endif
+
+#ifdef DEBUGS
+# define ASSERTS(expr) \
+ if (!(expr)) { \
+ printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ abort(); \
+ }
+#else
+# define ASSERTS(expr) ;
+#endif
+
+#ifdef DEBUGS
+# define ASSERTSP(expr, msg) \
+ if (!(expr)) { \
+ printf("***ASSERTION failed on line %d of file %s: " #expr "\n", \
+ __LINE__, __FILE__); \
+ printf msg ; \
+ abort(); \
+ }
+#else
+# define ASSERTSP(expr, msg) ;
+#endif
diff --git a/ThirdParty/mingwBuild/x64/patches/metis-5.1.0/GKlib/gk_arch.h b/ThirdParty/mingwBuild/x64/patches/metis-5.1.0/GKlib/gk_arch.h
new file mode 100644
index 000000000..1f9bef352
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/metis-5.1.0/GKlib/gk_arch.h
@@ -0,0 +1,71 @@
+/*!
+\file gk_arch.h
+\brief This file contains various architecture-specific declerations
+
+\date Started 3/27/2007
+\author George
+\version\verbatim $Id: gk_arch.h 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
+*/
+
+#ifndef _GK_ARCH_H_
+#define _GK_ARCH_H_
+
+/*************************************************************************
+* Architecture-specific differences in header files
+**************************************************************************/
+#ifdef LINUX
+#if !defined(__USE_XOPEN)
+#define __USE_XOPEN
+#endif
+#if !defined(_XOPEN_SOURCE)
+#define _XOPEN_SOURCE 600
+#endif
+#if !defined(__USE_XOPEN2K)
+#define __USE_XOPEN2K
+#endif
+#endif
+
+
+#ifdef HAVE_EXECINFO_H
+#include
+#endif
+
+
+#ifdef __MSC__
+ #include "ms_stdint.h"
+ #include "ms_inttypes.h"
+ #include "ms_stat.h"
+#else
+#ifndef SUNOS
+ #include
+#endif
+ #include
+ #include
+// #include
+ #include
+#endif
+
+
+/*************************************************************************
+* Architecture-specific modifications
+**************************************************************************/
+#ifdef WIN32
+typedef ptrdiff_t ssize_t;
+#endif
+
+
+#ifdef SUNOS
+#define PTRDIFF_MAX INT64_MAX
+#endif
+
+#ifdef __MSC__
+/* MSC does not have rint() function */
+#define rint(x) ((int)((x)+0.5))
+
+/* MSC does not have INFINITY defined */
+#ifndef INFINITY
+#define INFINITY FLT_MAX
+#endif
+#endif
+
+#endif
diff --git a/ThirdParty/mingwBuild/x64/patches/metis-5.1.0/GKlib/gk_getopt.h b/ThirdParty/mingwBuild/x64/patches/metis-5.1.0/GKlib/gk_getopt.h
new file mode 100644
index 000000000..e53f97d81
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/metis-5.1.0/GKlib/gk_getopt.h
@@ -0,0 +1,64 @@
+/*!
+\file gk_getopt.h
+\brief This file contains GNU's externs/structs/prototypes
+
+\date Started 3/27/2007
+\author George
+\version\verbatim $Id: gk_getopt.h 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
+*/
+
+#ifndef _GK_GETOPT_H_
+#define _GK_GETOPT_H_
+
+
+/* Externals from getopt.c */
+//extern char *gk_optarg;
+//extern int gk_optind;
+//extern int gk_opterr;
+//extern int gk_optopt;
+
+
+/*! \brief The structure that stores the information about the command-line options
+
+This structure describes a single long option name for the sake of
+gk_getopt_long(). The argument long_options must be an array
+of these structures, one for each long option. Terminate the array with
+an element containing all zeros.
+*/
+struct gk_option {
+ char *name; /*!< This field is the name of the option. */
+ int has_arg; /*!< This field says whether the option takes an argument.
+ It is an integer, and there are three legitimate values:
+ no_argument, required_argument and optional_argument.
+ */
+ int *flag; /*!< See the discussion on ::gk_option#val */
+ int val; /*!< These fields control how to report or act on the option
+ when it occurs.
+
+ If flag is a null pointer, then the val is a value which
+ identifies this option. Often these values are chosen
+ to uniquely identify particular long options.
+
+ If flag is not a null pointer, it should be the address
+ of an int variable which is the flag for this option.
+ The value in val is the value to store in the flag to
+ indicate that the option was seen. */
+};
+
+/* Names for the values of the `has_arg' field of `struct gk_option'. */
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+
+/* Function prototypes */
+//extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
+//extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
+// struct gk_option *__longopts, int *__longind);
+//extern int gk_getopt_long_only (int __argc, char **__argv,
+// char *__shortopts, struct gk_option *__longopts, int *__longind);
+
+
+
+#endif
+
diff --git a/ThirdParty/mingwBuild/x64/patches/parmetis-4.0.3/metis/GKlib/gk_arch.h b/ThirdParty/mingwBuild/x64/patches/parmetis-4.0.3/metis/GKlib/gk_arch.h
new file mode 100644
index 000000000..1f9bef352
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/parmetis-4.0.3/metis/GKlib/gk_arch.h
@@ -0,0 +1,71 @@
+/*!
+\file gk_arch.h
+\brief This file contains various architecture-specific declerations
+
+\date Started 3/27/2007
+\author George
+\version\verbatim $Id: gk_arch.h 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
+*/
+
+#ifndef _GK_ARCH_H_
+#define _GK_ARCH_H_
+
+/*************************************************************************
+* Architecture-specific differences in header files
+**************************************************************************/
+#ifdef LINUX
+#if !defined(__USE_XOPEN)
+#define __USE_XOPEN
+#endif
+#if !defined(_XOPEN_SOURCE)
+#define _XOPEN_SOURCE 600
+#endif
+#if !defined(__USE_XOPEN2K)
+#define __USE_XOPEN2K
+#endif
+#endif
+
+
+#ifdef HAVE_EXECINFO_H
+#include
+#endif
+
+
+#ifdef __MSC__
+ #include "ms_stdint.h"
+ #include "ms_inttypes.h"
+ #include "ms_stat.h"
+#else
+#ifndef SUNOS
+ #include
+#endif
+ #include
+ #include
+// #include
+ #include
+#endif
+
+
+/*************************************************************************
+* Architecture-specific modifications
+**************************************************************************/
+#ifdef WIN32
+typedef ptrdiff_t ssize_t;
+#endif
+
+
+#ifdef SUNOS
+#define PTRDIFF_MAX INT64_MAX
+#endif
+
+#ifdef __MSC__
+/* MSC does not have rint() function */
+#define rint(x) ((int)((x)+0.5))
+
+/* MSC does not have INFINITY defined */
+#ifndef INFINITY
+#define INFINITY FLT_MAX
+#endif
+#endif
+
+#endif
diff --git a/ThirdParty/mingwBuild/x64/patches/parmetis-4.0.3/metis/GKlib/gk_getopt.h b/ThirdParty/mingwBuild/x64/patches/parmetis-4.0.3/metis/GKlib/gk_getopt.h
new file mode 100644
index 000000000..e53f97d81
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/parmetis-4.0.3/metis/GKlib/gk_getopt.h
@@ -0,0 +1,64 @@
+/*!
+\file gk_getopt.h
+\brief This file contains GNU's externs/structs/prototypes
+
+\date Started 3/27/2007
+\author George
+\version\verbatim $Id: gk_getopt.h 10711 2011-08-31 22:23:04Z karypis $ \endverbatim
+*/
+
+#ifndef _GK_GETOPT_H_
+#define _GK_GETOPT_H_
+
+
+/* Externals from getopt.c */
+//extern char *gk_optarg;
+//extern int gk_optind;
+//extern int gk_opterr;
+//extern int gk_optopt;
+
+
+/*! \brief The structure that stores the information about the command-line options
+
+This structure describes a single long option name for the sake of
+gk_getopt_long(). The argument long_options must be an array
+of these structures, one for each long option. Terminate the array with
+an element containing all zeros.
+*/
+struct gk_option {
+ char *name; /*!< This field is the name of the option. */
+ int has_arg; /*!< This field says whether the option takes an argument.
+ It is an integer, and there are three legitimate values:
+ no_argument, required_argument and optional_argument.
+ */
+ int *flag; /*!< See the discussion on ::gk_option#val */
+ int val; /*!< These fields control how to report or act on the option
+ when it occurs.
+
+ If flag is a null pointer, then the val is a value which
+ identifies this option. Often these values are chosen
+ to uniquely identify particular long options.
+
+ If flag is not a null pointer, it should be the address
+ of an int variable which is the flag for this option.
+ The value in val is the value to store in the flag to
+ indicate that the option was seen. */
+};
+
+/* Names for the values of the `has_arg' field of `struct gk_option'. */
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+
+/* Function prototypes */
+//extern int gk_getopt(int __argc, char **__argv, char *__shortopts);
+//extern int gk_getopt_long(int __argc, char **__argv, char *__shortopts,
+// struct gk_option *__longopts, int *__longind);
+//extern int gk_getopt_long_only (int __argc, char **__argv,
+// char *__shortopts, struct gk_option *__longopts, int *__longind);
+
+
+
+#endif
+
diff --git a/ThirdParty/mingwBuild/x64/patches/pthreads-w32-2-9-1-release/Pre-built.2/include/sched.h b/ThirdParty/mingwBuild/x64/patches/pthreads-w32-2-9-1-release/Pre-built.2/include/sched.h
new file mode 100644
index 000000000..2372bb65b
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/pthreads-w32-2-9-1-release/Pre-built.2/include/sched.h
@@ -0,0 +1,183 @@
+/*
+ * Module: sched.h
+ *
+ * Purpose:
+ * Provides an implementation of POSIX realtime extensions
+ * as defined in
+ *
+ * POSIX 1003.1b-1993 (POSIX.1b)
+ *
+ * --------------------------------------------------------------------------
+ *
+ * Pthreads-win32 - POSIX Threads Library for Win32
+ * Copyright(C) 1998 John E. Bossom
+ * Copyright(C) 1999,2005 Pthreads-win32 contributors
+ *
+ * Contact Email: rpj@callisto.canberra.edu.au
+ *
+ * The current list of contributors is contained
+ * in the file CONTRIBUTORS included with the source
+ * code distribution. The list can also be seen at the
+ * following World Wide Web location:
+ * http://sources.redhat.com/pthreads-win32/contributors.html
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+#if !defined(_SCHED_H)
+#define _SCHED_H
+
+#undef PTW32_SCHED_LEVEL
+
+#if defined(_POSIX_SOURCE)
+#define PTW32_SCHED_LEVEL 0
+/* Early POSIX */
+#endif
+
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
+#undef PTW32_SCHED_LEVEL
+#define PTW32_SCHED_LEVEL 1
+/* Include 1b, 1c and 1d */
+#endif
+
+#if defined(INCLUDE_NP)
+#undef PTW32_SCHED_LEVEL
+#define PTW32_SCHED_LEVEL 2
+/* Include Non-Portable extensions */
+#endif
+
+#define PTW32_SCHED_LEVEL_MAX 3
+
+#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL)
+#define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX
+/* Include everything */
+#endif
+
+
+#if defined(__GNUC__) && !defined(__declspec)
+# error Please upgrade your GNU compiler to one that supports __declspec.
+#endif
+
+/*
+ * When building the library, you should define PTW32_BUILD so that
+ * the variables/functions are exported correctly. When using the library,
+ * do NOT define PTW32_BUILD, and then the variables/functions will
+ * be imported correctly.
+ */
+#if !defined(PTW32_STATIC_LIB)
+# if defined(PTW32_BUILD)
+# define PTW32_DLLPORT __declspec (dllexport)
+# else
+# define PTW32_DLLPORT __declspec (dllimport)
+# endif
+#else
+# define PTW32_DLLPORT
+#endif
+
+/*
+ * This is a duplicate of what is in the autoconf config.h,
+ * which is only used when building the pthread-win32 libraries.
+ */
+
+#if !defined(PTW32_CONFIG_H)
+# if defined(WINCE)
+# define NEED_ERRNO
+# define NEED_SEM
+# endif
+# if defined(__MINGW64__)
+# define HAVE_STRUCT_TIMESPEC
+# define HAVE_MODE_T
+# elif defined(_UWIN) || defined(__MINGW32__)
+# define HAVE_MODE_T
+# endif
+#endif
+
+/*
+ *
+ */
+
+#if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
+#if defined(NEED_ERRNO)
+#include "need_errno.h"
+#else
+#include
+#endif
+#endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */
+
+#if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN)
+# if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX
+/* For pid_t */
+# include
+/* Required by Unix 98 */
+# include
+# else
+ typedef __int64 pid_t;
+# endif
+#else
+ typedef int pid_t;
+#endif
+
+/* Thread scheduling policies */
+
+enum {
+ SCHED_OTHER = 0,
+ SCHED_FIFO,
+ SCHED_RR,
+ SCHED_MIN = SCHED_OTHER,
+ SCHED_MAX = SCHED_RR
+};
+
+struct sched_param {
+ int sched_priority;
+};
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif /* __cplusplus */
+
+PTW32_DLLPORT int __cdecl sched_yield (void);
+
+PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
+
+PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
+
+PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
+
+PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
+
+/*
+ * Note that this macro returns ENOTSUP rather than
+ * ENOSYS as might be expected. However, returning ENOSYS
+ * should mean that sched_get_priority_{min,max} are
+ * not implemented as well as sched_rr_get_interval.
+ * This is not the case, since we just don't support
+ * round-robin scheduling. Therefore I have chosen to
+ * return the same value as sched_setscheduler when
+ * SCHED_RR is passed to it.
+ */
+#define sched_rr_get_interval(_pid, _interval) \
+ ( errno = ENOTSUP, (int) -1 )
+
+
+#if defined(__cplusplus)
+} /* End of extern "C" */
+#endif /* __cplusplus */
+
+#undef PTW32_SCHED_LEVEL
+#undef PTW32_SCHED_LEVEL_MAX
+
+#endif /* !_SCHED_H */
+
diff --git a/ThirdParty/mingwBuild/x64/patches/scotch_6.0.0/src/Makefile.inc b/ThirdParty/mingwBuild/x64/patches/scotch_6.0.0/src/Makefile.inc
new file mode 100644
index 000000000..8fc051b5d
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/scotch_6.0.0/src/Makefile.inc
@@ -0,0 +1,70 @@
+# This make include file is intended for building under MinGW32. As is,
+# it relies on :
+# - pthread-win32 (http://sourceware.org/pthreads-win32/),
+# - zlib (http://www.zlib.net/)
+# - mpich2 (http://www.mcs.anl.gov/research/projects/mpich2/).
+# It must be adapted to reflect your environment, in particular
+# installation root directories, include path and library name.
+# Since all files are linked with the MPI libraries, this file is
+# for compiling PT-Scotch only. To compile Scotch, remove the
+# -DSCOTCH_PTSCOTCH flag, as well as all references to MPI in the
+# CFLAGS and CLIBFLAGS =
+#LDFLAGS variables.
+
+#MPI_ROOTDIR = /c/Programs/OpenMPI_v1.6.1-x64
+
+EXE =
+LIB = .a
+OBJ = .o
+
+MAKE = make
+AR = ar
+ARFLAGS = -ruv
+CAT = cat
+CCS = gcc
+CCP = mpicc
+CCD = mpicc -I$(MPI_ROOTDIR)/include
+
+#--- Compiler/loader flags
+CFLAGS_CPL = -O0 -g3 --std=c99
+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
+CLIBFLAGS =
+LDFLAGS =
+
+PGMFILES=$(PROGRAMFILES)
+
+#--- MPI
+CFLAGS_INC += -I$(MPI_ROOTDIR)/include
+#--- Comment/Uncomment for threaded MPI
+CLIBFLAGS =
+LDFLAGS += -L$(MPI_ROOTDIR)/bin -lm -lmpi -lmpid
+#CLIBFLAGS =
+#LDFLAGS += -L$(MPI_ROOTDIR)/lib -lm -lmpich2mt
+
+#--- Pthread : Uncomment for pthread support
+#PTHREAD_ROOTDIR = $(PGMFILES)/pthread-win32
+#CFLAGS_INC += -I$(PTHREAD_ROOTDIR)/include
+#CLIBFLAGS =
+LDFLAGS += -L$(PTHREADS_HOME)/Pre-built.2/lib/x64 -lpthreadGC2
+
+#--- zlib: Uncomment for compressed files
+#ZLIB_ROOTDIR = $(PGMFILES)/zlib-1.2.3
+#CFLAGS_INC += -I$(ZLIB_ROOTDIR)/include
+#CLIBFLAGS =
+LDFLAGS += -lz
+
+#--- COMMON_PTHREAD: Uncomment for compressed files
+#CFLAGS_DEF += -DCOMMON_PTHREAD -DCOMMON_FILE_COMPRESS_GZ
+
+#--- SCOTCH_PTHREAD: Uncomment for threaded MPI
+#CFLAGS_DEF += -DSCOTCH_PTHREAD
+
+CFLAGS = $(CFLAGS_CPL) $(CFLAGS_INC) $(CFLAGS_DEF)
+CP = cp
+LEX = flex -Pscotchyy -olex.yy.c
+LN = cp
+MKDIR = mkdir
+MV = mv
+RANLIB = ranlib
+YACC = bison -pscotchyy -y -b y
diff --git a/ThirdParty/mingwBuild/x64/patches/system/include/rand48.h b/ThirdParty/mingwBuild/x64/patches/system/include/rand48.h
new file mode 100644
index 000000000..cb3694a7e
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/system/include/rand48.h
@@ -0,0 +1,19 @@
+#ifndef RAND48_H
+#define RAND48_H
+
+#define drand48() (rand()*(1./RAND_MAX))
+static long _rand = 1;
+
+static __inline__ void srand48(long seed)
+{
+ _rand = seed;
+}
+
+static __inline__ long lrand48(void)
+{
+ long val = (int)(abs(10000.0*sin(_rand)));
+ _rand++;
+ return val;
+}
+
+#endif //RAND48_H
diff --git a/ThirdParty/mingwBuild/x64/patches/system/include/sys/times.h b/ThirdParty/mingwBuild/x64/patches/system/include/sys/times.h
new file mode 100644
index 000000000..d04a32c19
--- /dev/null
+++ b/ThirdParty/mingwBuild/x64/patches/system/include/sys/times.h
@@ -0,0 +1,40 @@
+// From http://www.linuxjournal.com/article/5574
+
+#ifndef _TIMES_H
+#define _TIMES_H
+
+#ifdef _WIN32
+#include
+#include
+#include
+
+int gettimeofday(struct timeval* t,void* timezone);
+
+// from linux's sys/times.h
+
+//#include
+
+#define __need_clock_t
+#include
+
+
+/* Structure describing CPU time used by a process and its children. */
+struct tms
+ {
+ clock_t tms_utime; /* User CPU time. */
+ clock_t tms_stime; /* System CPU time. */
+
+ clock_t tms_cutime; /* User 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
+ dead children (and their dead children) in BUFFER.
+ Return the elapsed real time, or (clock_t) -1 for errors.
+ All times are in CLK_TCKths of a second. */
+clock_t times (struct tms *__buffer);
+
+typedef long long suseconds_t ;
+
+#endif
+#endif
\ No newline at end of file
diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/Make/options b/applications/solvers/compressible/rhoCentralFoam/BCs/Make/options
index 87f38a6a0..999e0466c 100644
--- a/applications/solvers/compressible/rhoCentralFoam/BCs/Make/options
+++ b/applications/solvers/compressible/rhoCentralFoam/BCs/Make/options
@@ -3,7 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude
-EXE_LIBS = \
+LIB_LIBS = \
-lfiniteVolume \
-lbasicThermophysicalModels \
-lspecie
diff --git a/applications/solvers/compressible/rhoCentralFoam/Make/options b/applications/solvers/compressible/rhoCentralFoam/Make/options
index 6b901e96d..9c63e2d73 100644
--- a/applications/solvers/compressible/rhoCentralFoam/Make/options
+++ b/applications/solvers/compressible/rhoCentralFoam/Make/options
@@ -4,6 +4,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-IBCs/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
+
EXE_LIBS = \
-lfiniteVolume \
-lbasicThermophysicalModels \
diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options
index 42c2cb54c..f64e1701f 100644
--- a/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options
+++ b/applications/solvers/multiphase/twoPhaseEulerFoam/interfacialModels/Make/options
@@ -3,4 +3,5 @@ EXE_INC = \
-I../phaseModel/lnInclude
LIB_LIBS = \
+ -lfiniteVolume \
-lphaseModel
diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/Make/options
index 2fcce9913..feffca4e5 100644
--- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/Make/options
+++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/Make/options
@@ -3,3 +3,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I../phaseModel/lnInclude \
-I../interfacialModels/lnInclude
+
+LIB_LIBS = \
+ -lfiniteVolume \
+ -lphaseModel
diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/Make/options b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/Make/options
index 0ec113920..64e4b542f 100644
--- a/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/Make/options
+++ b/applications/solvers/multiphase/twoPhaseEulerFoam/phaseModel/Make/options
@@ -3,4 +3,5 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude
LIB_LIBS = \
+ -lfiniteVolume \
-lincompressibleTransportModels
diff --git a/applications/solvers/solidMechanics/deprecatedSolvers/materialModels/Make/options b/applications/solvers/solidMechanics/deprecatedSolvers/materialModels/Make/options
index fa15f1245..71b787396 100644
--- a/applications/solvers/solidMechanics/deprecatedSolvers/materialModels/Make/options
+++ b/applications/solvers/solidMechanics/deprecatedSolvers/materialModels/Make/options
@@ -1,5 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
-EXE_LIBS = \
+LIB_LIBS = \
-lfiniteVolume
diff --git a/applications/solvers/surfaceTracking/freeSurface/Make/options b/applications/solvers/surfaceTracking/freeSurface/Make/options
index 574ef6cc7..54fa5dd4b 100644
--- a/applications/solvers/surfaceTracking/freeSurface/Make/options
+++ b/applications/solvers/surfaceTracking/freeSurface/Make/options
@@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/tetFiniteElement/lnInclude \
-I$(LIB_SRC)/dynamicMesh/meshMotion/tetMotionSolver/lnInclude
-EXE_LIBS = \
+LIB_LIBS = \
-lfiniteArea \
-lfiniteVolume \
-lmeshTools \
diff --git a/applications/utilities/thermophysical/chemkinToFoam/Make/options b/applications/utilities/thermophysical/chemkinToFoam/Make/options
index 7fe5ba407..52a0cb8ee 100644
--- a/applications/utilities/thermophysical/chemkinToFoam/Make/options
+++ b/applications/utilities/thermophysical/chemkinToFoam/Make/options
@@ -1,6 +1,13 @@
+ifneq ($(FLEX_DIR), "")
+EXE_INC = \
+ -I$(FLEX_DIR)/include \
+ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude
+else
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude
+endif
EXE_LIBS = \
-lreactionThermophysicalModels \
diff --git a/etc/bashrc b/etc/bashrc
index bd08ad0a8..47f3e9c10 100755
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -56,6 +56,12 @@ foamInstall=$HOME/$WM_PROJECT
# END OF (NORMAL) USER EDITABLE PART
################################################################################
+# Set $USER if it has not been set (eg. on Windows/MSYS systems)
+if [ -z $USER ]
+then
+ export USER=`whoami`
+fi
+
# note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
@@ -192,6 +198,15 @@ export FOAM_SIGFPE=
export WM_ARCH=`uname -s`
case $WM_ARCH in
+MINGW32_NT-6.1)
+ WM_ARCH=MINGW32_NT-6.1
+ export WM_ARCH_BASE=mingw
+ export WM_COMPILER_LIB_ARCH=64
+ export WM_CFLAGS='-m64 -fPIC'
+ export WM_CXXFLAGS='-m64 -fPIC'
+ export WM_LDFLAGS='-m64'
+ ;;
+
Linux)
WM_ARCH=linux
diff --git a/etc/bashrc.mingw b/etc/bashrc.mingw
new file mode 100644
index 000000000..4ba174686
--- /dev/null
+++ b/etc/bashrc.mingw
@@ -0,0 +1,127 @@
+#!/bin/sh
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# Script
+# etc/bashrc.mingw
+#
+# Description
+# Startup file for FOAM for use with MSYS shell for MinGW-based builds on Windows.
+# Calls the main etc/bashrc script.
+# Sourced from ~/.profile or ~/.bashrc
+#
+# Author:
+# Cesare Guardino, Alstom Power Ltd., (2015)
+#
+#------------------------------------------------------------------------------
+
+# {{{ DEFINE USER EDITABLE FUNCTIONS
+set_system_paths() {
+ echo "Setting installations directories of required tools ..."
+ export CMAKE_HOME=/c/Programs/cmake-3.2.3-win32-x86
+ #export GIT_HOME=/c/Programs/Git
+ #export JAVA_HOME="/c/Program Files/Java/jre1.8.0_45"
+ export MINGW_HOME=/c/Programs/x86_64-4.8.2-release-win32-seh-rt_v3-rev3/mingw64
+ export MPI_ROOTDIR=/c/Programs/OpenMPI_v1.6.1-x64
+ export PERL_HOME=/c/Programs/strawberry-perl-5.20.2.1-64bit/perl
+ #export PEXPORTS_HOME=/c/Programs/pexports-0.46-mingw32
+ #export PYTHON_HOME=/c/Programs/Python27
+ #export SUBVERSION_HOME=/c/Programs/svn-win32-1.8.13
+ export WGET_HOME=/c/Programs/wget-1.11.4-1
+ export ZIP_HOME="/c/Program Files/7-Zip"
+}
+
+add_to_path() {
+ echo "Adding required tools to PATH ..."
+ export PATH=$ZIP_HOME:$PATH
+ export PATH=$WGET_HOME/bin:$PATH
+ #export PATH=$JAVA_HOME/bin:$PATH
+ #export PATH=$PYTHON_HOME:$PATH
+ #export PATH=$SUBVERSION_HOME/bin:$PATH
+ #export PATH=$GIT_HOME/cmd:$PATH
+ export PATH=$PERL_HOME/bin:$PATH
+ export PATH=$CMAKE_HOME/bin:$PATH
+ export PATH=$MPI_ROOTDIR/bin:$PATH
+ #export PATH=$PEXPORTS_HOME/bin:$PATH
+ export PATH=$MINGW_HOME/bin:$PATH
+}
+# }}}
+
+# {{{ DEFINE PROCESS FUNCTIONS
+setup_foam_env() {
+ : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
+ export export FLEX_DIR=$(echo $WD\.. | sed 's/\\/\//g' | sed 's/\(.*\):/\/\1/')
+ FOAM_ETC_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+ export FOAM_INST_DIR=$(readlink -f $FOAM_ETC_DIR/../..)
+ . $FOAM_ETC_DIR/bashrc
+ . $FOAM_ETC_DIR/prefs.sh.mingw
+}
+
+set_OMPI_env() {
+ echo "Setting OpenMPI environment settings ..."
+ export OMPI_MPICC=gcc.exe
+ export OMPI_MPIXX=g++.exe
+ export OMPI_CXXFLAGS==-I$MPI_ROOTDIR/include
+ export OMPI_CFLAGS=-I$MPI_ROOTDIR/include
+ export OMPI_CXXFLAGS=-I$MPI_ROOTDIR/include
+ export OMPI_LDFLAGS=-L$MPI_ROOTDIR/lib
+ export OMPI_LIBS=$OMPI_LDFLAGS
+}
+
+check_versions() {
+ echo "Checking versions of installed system tools (based on PATH) ..."
+ echo "7-Zip: " `which 7z` [`(7z --help 2>&1) 2> /dev/null | head -2`]
+ echo "CMake: " `which cmake` [`(cmake --version 2>&1) 2> /dev/null | head -1`]
+ echo "G++: " `which g++` [`(g++ --version 2>&1) 2> /dev/null | head -1`]
+ echo "GCC: " `which gcc` [`(gcc --version 2>&1) 2> /dev/null | head -1`]
+ echo "Git: " `which git` [`(git --version 2>&1) 2> /dev/null | head -1`]
+ echo "Java: " `which java` [`(java -version 2>&1) 2> /dev/null | head -1`]
+ echo "Make: " `which make` [`(make --version 2>&1) 2> /dev/null | head -1`]
+ echo "MinGW-w64: " $MINGW_HOME
+ echo "OpenMPI: " `which mpirun` [`(mpirun --version 2>&1) 2> /dev/null | head -1`]
+ echo "PEexports: " `which pexports` [`(pexports -v 2>&1) 2> /dev/null | head -1`]
+ echo "Perl: " `which perl` [`(perl -v 2>&1) 2> /dev/null | head -2`]
+ echo "Python: " `which python` [`(python --version 2>&1) 2> /dev/null | head -1`]
+ echo "Subversion: " `which svn` [`(svn --version 2>&1) 2> /dev/null | head -1`]
+ echo "Wget: " `which wget` [`(wget --version 2>&1) 2> /dev/null | head -3`]
+}
+
+finish() {
+ echo
+ echo "=========================================================================================="
+ echo "FOAM_INST_DIR=$FOAM_INST_DIR"
+ echo "ENVIRONMENT SETUP COMPLETE."
+ echo "=========================================================================================="
+ echo
+}
+# }}}
+
+# {{{ MAIN EXECUTION
+set_system_paths
+setup_foam_env
+add_to_path
+set_OMPI_env
+check_versions
+finish
+# }}}
+
diff --git a/etc/prefs.sh.mingw b/etc/prefs.sh.mingw
new file mode 100644
index 000000000..6a4f9cc7e
--- /dev/null
+++ b/etc/prefs.sh.mingw
@@ -0,0 +1,242 @@
+#----------------------------------*-sh-*--------------------------------------
+# ========= |
+# \\ / F ield | foam-extend: Open Source CFD
+# \\ / O peration | Version: 3.2
+# \\ / A nd | Web: http://www.foam-extend.org
+# \\/ M anipulation | For copyright notice see file Copyright
+#------------------------------------------------------------------------------
+# License
+# This file is part of foam-extend.
+#
+# 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
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# foam-extend is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with foam-extend. If not, see .
+#
+# File
+# etc/prefs.sh
+#
+# Description
+# Preset variables for the FOAM configuration - POSIX shell syntax.
+#
+# The prefs.sh file will be sourced by the FOAM etc/bashrc when it is
+# found
+#
+#------------------------------------------------------------------------------
+
+export FOAM_VERBOSE=1
+
+# Specify system compiler
+# ~~~~~~~~~~~~~~~~~~~~~~~
+#compilerInstall=System
+#compilerInstall=FOAM
+
+# Specify system openmpi
+# ~~~~~~~~~~~~~~~~~~~~~~
+#
+# Normally, you don't need to set more than these 3 env. variables
+# The other openmpi related variables will be initialized using
+# the command mpicc --showme:
+#
+#export WM_MPLIB=SYSTEMOPENMPI
+export OPENMPI_DIR=$MPI_ROOTDIR
+export OPENMPI_BIN_DIR=$OPENMPI_DIR/bin
+#
+#export OPENMPI_LIB_DIR="`$OPENMPI_BIN_DIR/mpicc --showme:libdirs`"
+#export OPENMPI_INCLUDE_DIR="`$OPENMPI_BIN_DIR/mpicc --showme:incdirs`"
+#export OPENMPI_COMPILE_FLAGS="`$OPENMPI_BIN_DIR/mpicc --showme:compile`"
+#export OPENMPI_LINK_FLAGS="`$OPENMPI_BIN_DIR/mpicc --showme:link`"
+
+# Specify system installed ThirdParty packages/libraries
+# NB: The packages installed under $WM_THIRD_PARTY_DIR
+# will always override these values.
+# So build your ThirdParty directory accordingly.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# System installed CUDA
+#export CUDA_SYSTEM=1
+#export CUDA_DIR=path_to_system_installed_cuda
+#export CUDA_BIN_DIR=$CUDA_DIR/bin
+#export CUDA_LIB_DIR=$CUDA_DIR/lib
+#export CUDA_INCLUDE_DIR=$CUDA_DIR/include
+#export CUDA_ARCH=sm_20
+
+# System installed Mesquite
+#export MESQUITE_SYSTEM=1
+export MESQUITE_DIR=$WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2
+export MESQUITE_BIN_DIR=$MESQUITE_DIR/bin
+export MESQUITE_LIB_DIR=$MESQUITE_DIR/lib
+export MESQUITE_INCLUDE_DIR=$MESQUITE_DIR/include
+
+# System installed Metis
+#export METIS_SYSTEM=1
+export METIS_DIR=$WM_THIRD_PARTY_DIR/packages/metis-5.1.0
+export METIS_BIN_DIR=$METIS_DIR/bin
+export METIS_LIB_DIR=$METIS_DIR/lib
+export METIS_INCLUDE_DIR=$METIS_DIR/include
+
+# System installed ParMetis
+#export PARMETIS_SYSTEM=1
+export PARMETIS_DIR=$WM_THIRD_PARTY_DIR/packages/parmetis-4.0.3
+export PARMETIS_BIN_DIR=$PARMETIS_DIR/bin
+export PARMETIS_LIB_DIR=$PARMETIS_DIR/lib
+export PARMETIS_INCLUDE_DIR=$PARMETIS_DIR/include
+
+# System installed ParMGridgen
+#export PARMGRIDGEN_SYSTEM=1
+export PARMGRIDGEN_DIR=$WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0
+export PARMGRIDGEN_BIN_DIR=$PARMGRIDGEN_DIR/bin
+export PARMGRIDGEN_LIB_DIR=$PARMGRIDGEN_DIR/lib
+export PARMGRIDGEN_INCLUDE_DIR=$PARMGRIDGEN_DIR/include
+
+# System installed Libccmio
+#export LIBCCMIO_SYSTEM=1
+#export LIBCCMIO_DIR=path_to_system_installed_libccmio
+#export LIBCCMIO_BIN_DIR=$LIBCCMIO_DIR/bin
+#export LIBCCMIO_LIB_DIR=$LIBCCMIO_DIR/lib
+#export LIBCCMIO_INCLUDE_DIR=$LIBCCMIO_DIR/include
+
+# System installed Scotch
+#export SCOTCH_SYSTEM=1
+export SCOTCH_DIR=$WM_THIRD_PARTY_DIR/packages/scotch_6.0.0
+export SCOTCH_BIN_DIR=$SCOTCH_DIR/bin
+export SCOTCH_LIB_DIR=$SCOTCH_DIR/lib
+export SCOTCH_INCLUDE_DIR=$SCOTCH_DIR/include
+
+# System installed CMake
+#export CMAKE_SYSTEM=1
+#export CMAKE_DIR=path_to_system_installed_cmake
+#export CMAKE_BIN_DIR=$CMAKE_DIR/bin
+
+# System installed Python
+#export PYTHON_SYSTEM=1
+#export PYTHON_DIR=path_to_system_installed_python
+#export PYTHON_BIN_DIR=$PYTHON_DIR/bin
+
+# System installed PyFoam
+#export PYFOAM_SYSTEM=1
+#export PYFOAM_DIR=path_to_system_installed_python
+#export PYFOAM_BIN_DIR=$PYFOAM_DIR/bin
+
+# System installed hwloc
+#export HWLOC_SYSTEM=1
+#export HWLOC_DIR=path_to_system_installed_hwloc
+#export HWLOC_BIN_DIR=$HWLOC_DIR/bin
+
+# System installed Qt
+# This is the only package we assume is system installed by default.
+# So we don't use a variable called QT_SYSTEM, but instead a variable
+# called QT_THIRD_PARTY in order to override to the ThirdParty QT
+# package.
+#
+# If you choose to use the system installed version of QT, keep
+# the variable QT_THIRD_PARTY commented, and uncomment the initialization
+# of the variable QT_DIR and QT_BIN_DIR. Make sure both variables are
+# properly initialized.
+#
+# If you choose instead to use the ThirdParty version of QT, only uncomment
+# the variable QT_THIRD_PARTY and set it to 1. Keep the initialization
+# of the variables QT_DIR nd QT_BIN_DIR commented. The QT ThirdParty scripts
+# will take care of setting the variables QT_DIR and QT_BIN_DIR to the
+# proper values.
+#
+#export QT_THIRD_PARTY=1
+#export QT_DIR=path_to_system_installed_qt
+#export QT_BIN_DIR=$QT_DIR/bin
+
+# System installed ParaView
+#export PARAVIEW_SYSTEM=1
+#export PARAVIEW_DIR=path_to_system_installed_paraview
+#export PARAVIEW_BIN_DIR=$PARAVIEW_DIR/bin
+
+# System installed bison
+#export BISON_SYSTEM=1
+
+# System installed flex
+#export FLEX_SYSTEM=1
+
+# System installed m4
+#export M4_SYSTEM=1
+
+# Specify ParaView version
+# ~~~~~~~~~~~~~~~~~~~~~~~~
+#export ParaView_VERSION=git # eg, cvs/git version
+#export ParaView_MAJOR=3.7
+
+
+# System identifier for the FOAM CDash test harness on foam-extend
+#
+# By default, your system FQN/hostname will be used as the system identifier
+# when publishing your test harness results on the FOAM CDash server
+# on foam-extend.
+# You can override your identifier using this environment variable
+#export CDASH_SUBMIT_LOCAL_HOST_ID=choose_your_CDash_system_identifer
+
+# Mac OS X MacPorts root directory.
+# The default value is '/opt/local/etc/macports'.
+# In order to disable the usage of MacPorts on Mac OSX, simply initialize this
+# variable to a non-existing directory, or to a dummy value.
+#export MACOSX_MACPORTS_ROOT="_not_using_"
+
+# ThirdParty packages: build control variables
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# By enabling any of these variables, you will active the compilation and
+# installation of the corresponding ThirdParty package
+#
+# For AllMake.stage1
+#export WM_THIRD_PARTY_USE_GCC_492=1
+#export WM_THIRD_PARTY_USE_GCC_484=1
+#export WM_THIRD_PARTY_USE_GCC_463=1
+#export WM_THIRD_PARTY_USE_GCC_451=1
+#export WM_THIRD_PARTY_USE_GCC_445=1
+#export WM_THIRD_PARTY_USE_PYTHON_27=1
+#export WM_THIRD_PARTY_USE_M4_1416=1
+#export WM_THIRD_PARTY_USE_BISON_27=1
+#export WM_THIRD_PARTY_USE_FLEX_2535=1
+#export WM_THIRD_PARTY_USE_CMAKE_322=1
+
+#
+# For AllMake.stage2
+#export WM_THIRD_PARTY_USE_OPENMPI_184=1
+#export WM_THIRD_PARTY_USE_OPENMPI_184_ConfigureAdditionalArgs='--enable-mpi-cxx --with-openib=/usr --with-openib-libdir=/usr/lib64'
+#export WM_THIRD_PARTY_USE_OPENMPI_165=1
+#export WM_THIRD_PARTY_USE_OPENMPI_165_ConfigureAdditionalArgs='--enable-mpi-cxx --with-openib=/usr --with-openib-libdir=/usr/lib64'
+#export WM_THIRD_PARTY_USE_OPENMPI_15=1
+#export WM_THIRD_PARTY_USE_OPENMPI_143=1
+#export WM_THIRD_PARTY_USE_OPENMPI_141=1
+
+#
+# For AllMake.stage3
+#export WM_THIRD_PARTY_USE_METIS_510=1
+#export WM_THIRD_PARTY_USE_PARMGRIDGEN_10=1
+#export WM_THIRD_PARTY_USE_LIBCCMIO_261=1
+#export WM_THIRD_PARTY_USE_MESQUITE_212=1
+#export WM_THIRD_PARTY_USE_SCOTCH_604=1
+##export WM_THIRD_PARTY_USE_SCOTCH_600=1
+#export WM_THIRD_PARTY_USE_PARMETIS_403=1
+##export WM_THIRD_PARTY_USE_ZOLTAN_36=1
+#export WM_THIRD_PARTY_USE_PYFOAM_064=1
+#export WM_THIRD_PARTY_USE_HWLOC_1101=1
+#export WM_THIRD_PARTY_USE_HWLOC_172=1
+
+#
+# For AllMake.stage4
+#export WM_THIRD_PARTY_USE_QT_486=1
+#export WM_THIRD_PARTY_USE_PARAVIEW_431=1
+#export WM_THIRD_PARTY_USE_PARAVIEW_410=1
+
+
+# Add in preset user preferences: will override site preferences
+#if [ -e $WM_PROJECT_USER_DIR/etc/prefs.sh ]
+#then
+# _foamSource $WM_PROJECT_USER_DIR/etc/prefs.sh
+#fi
+# ----------------------------------------------------------------- end-of-file
diff --git a/etc/settings.sh b/etc/settings.sh
index ea573e647..b7c0e53e6 100644
--- a/etc/settings.sh
+++ b/etc/settings.sh
@@ -250,6 +250,12 @@ OPENMPI)
_foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
fi
+ # On windows set mpi_version explicitly
+ if [ "$WM_ARCH_BASE" == "mingw" ]
+ then
+ mpi_version=openmpi-1.6.1
+ fi
+
export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
unset mpi_version
;;
@@ -498,6 +504,13 @@ esac
_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)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
minBufferSize=20000000
diff --git a/src/OSspecific/MSWindows/MSwindows.C b/src/OSspecific/MSWindows/MSwindows.C
new file mode 100644
index 000000000..7d827ebaf
--- /dev/null
+++ b/src/OSspecific/MSWindows/MSwindows.C
@@ -0,0 +1,1418 @@
+/*---------------------------------------------------------------------------*\
+ Copyright : (C) 2011 Symscape
+ Website : www.symscape.com
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Description
+ MS Windows specific functions
+
+\*---------------------------------------------------------------------------*/
+
+#include "OSspecific.H"
+#include "MSwindows.H"
+#include "foamVersion.H"
+#include "fileName.H"
+#include "fileStat.H"
+
+#include
+#include
+#include
+#include