From aee5a8016a0677b298759a0b77d150c7ae8931ca Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Fri, 18 Mar 2011 07:24:56 +0000
Subject: [PATCH] Zoltan is now optional.

---
 AMDiS/Makefile.in                      |   5 +-
 AMDiS/configure                        | 101 ++++++++++++++-----------
 AMDiS/configure.ac                     |   5 +-
 AMDiS/libtool                          |   6 +-
 AMDiS/src/Makefile.am                  |   9 ++-
 AMDiS/src/Makefile.in                  |  42 +++++-----
 AMDiS/src/parallel/MeshDistributor.cc  |  10 ++-
 AMDiS/src/parallel/PetscSolverSchur.cc |  84 ++++++++++++++++++++
 AMDiS/src/parallel/PetscSolverSchur.h  |  51 +++++++++++++
 AMDiS/src/parallel/ZoltanPartitioner.h |   4 +
 10 files changed, 243 insertions(+), 74 deletions(-)
 create mode 100644 AMDiS/src/parallel/PetscSolverSchur.cc
 create mode 100644 AMDiS/src/parallel/PetscSolverSchur.h

diff --git a/AMDiS/Makefile.in b/AMDiS/Makefile.in
index 5006ea9c..a93e21ab 100644
--- a/AMDiS/Makefile.in
+++ b/AMDiS/Makefile.in
@@ -111,8 +111,6 @@ ENABLE_MKL_FALSE = @ENABLE_MKL_FALSE@
 ENABLE_MKL_TRUE = @ENABLE_MKL_TRUE@
 ENABLE_UMFPACK_FALSE = @ENABLE_UMFPACK_FALSE@
 ENABLE_UMFPACK_TRUE = @ENABLE_UMFPACK_TRUE@
-ENABLE_ZOLTAN_FALSE = @ENABLE_ZOLTAN_FALSE@
-ENABLE_ZOLTAN_TRUE = @ENABLE_ZOLTAN_TRUE@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 FFLAGS = @FFLAGS@
@@ -149,7 +147,10 @@ USE_PARALLEL_AMDIS_FALSE = @USE_PARALLEL_AMDIS_FALSE@
 USE_PARALLEL_AMDIS_TRUE = @USE_PARALLEL_AMDIS_TRUE@
 USE_PARALLEL_DOMAIN_AMDIS_FALSE = @USE_PARALLEL_DOMAIN_AMDIS_FALSE@
 USE_PARALLEL_DOMAIN_AMDIS_TRUE = @USE_PARALLEL_DOMAIN_AMDIS_TRUE@
+USE_ZOLTAN_FALSE = @USE_ZOLTAN_FALSE@
+USE_ZOLTAN_TRUE = @USE_ZOLTAN_TRUE@
 VERSION = @VERSION@
+ZOLTAN_DIR = @ZOLTAN_DIR@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
diff --git a/AMDiS/configure b/AMDiS/configure
index 28b18f23..998fe433 100755
--- a/AMDiS/configure
+++ b/AMDiS/configure
@@ -462,7 +462,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT AMDIS_DEBUG_TRUE AMDIS_DEBUG_FALSE CXX CC AMDIS_INTEL_TRUE AMDIS_INTEL_FALSE AMDIS_OPENMP_TRUE AMDIS_OPENMP_FALSE OPENMP_FLAG MPI_DIR PETSC_DIR USE_PARALLEL_AMDIS_TRUE USE_PARALLEL_AMDIS_FALSE USE_PARALLEL_DOMAIN_AMDIS_TRUE USE_PARALLEL_DOMAIN_AMDIS_FALSE ENABLE_ZOLTAN_TRUE ENABLE_ZOLTAN_FALSE ENABLE_UMFPACK_TRUE ENABLE_UMFPACK_FALSE ENABLE_MKL_TRUE ENABLE_MKL_FALSE DUNE_DIR ENABLE_DUNE_TRUE ENABLE_DUNE_FALSE ENABLE_BOOST_TRUE ENABLE_BOOST_FALSE CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT AMDIS_DEBUG_TRUE AMDIS_DEBUG_FALSE CXX CC AMDIS_INTEL_TRUE AMDIS_INTEL_FALSE AMDIS_OPENMP_TRUE AMDIS_OPENMP_FALSE OPENMP_FLAG MPI_DIR ZOLTAN_DIR USE_ZOLTAN_TRUE USE_ZOLTAN_FALSE PETSC_DIR USE_PARALLEL_AMDIS_TRUE USE_PARALLEL_AMDIS_FALSE USE_PARALLEL_DOMAIN_AMDIS_TRUE USE_PARALLEL_DOMAIN_AMDIS_FALSE ENABLE_UMFPACK_TRUE ENABLE_UMFPACK_FALSE ENABLE_MKL_TRUE ENABLE_MKL_FALSE DUNE_DIR ENABLE_DUNE_TRUE ENABLE_DUNE_FALSE ENABLE_BOOST_TRUE ENABLE_BOOST_FALSE CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1047,6 +1047,7 @@ Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   --with-mpi=MPI_DIR
+  --with-zoltan=ZOLTAN_DIR
   --with-petsc=PETSC_DIR
   --with-dune=DUNE_DIR
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
@@ -2101,6 +2102,27 @@ if test $marmot != false ; then
 fi
 
 
+# Check whether --with-zoltan or --without-zoltan was given.
+if test "${with_zoltan+set}" = set; then
+  withval="$with_zoltan"
+  zoltandir=$withval
+else
+  petscdir=no
+fi;
+ZOLTAN_DIR=$zoltandir
+
+
+
+if test $zoltandir != no; then
+  USE_ZOLTAN_TRUE=
+  USE_ZOLTAN_FALSE='#'
+else
+  USE_ZOLTAN_TRUE='#'
+  USE_ZOLTAN_FALSE=
+fi
+
+
+
 # Check whether --with-petsc or --without-petsc was given.
 if test "${with_petsc+set}" = set; then
   withval="$with_petsc"
@@ -2159,16 +2181,6 @@ else
 fi
 
 
-
-if test $paralleldomain = true; then
-  ENABLE_ZOLTAN_TRUE=
-  ENABLE_ZOLTAN_FALSE='#'
-else
-  ENABLE_ZOLTAN_TRUE='#'
-  ENABLE_ZOLTAN_FALSE=
-fi
-
-
 # Check whether --enable-umfpack or --disable-umfpack was given.
 if test "${enable_umfpack+set}" = set; then
   enableval="$enable_umfpack"
@@ -4451,7 +4463,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 4454 "configure"' > conftest.$ac_ext
+  echo '#line 4466 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5586,7 +5598,7 @@ fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:5589:" \
+echo "$as_me:5601:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6649,11 +6661,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6652: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6664: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6656: \$? = $ac_status" >&5
+   echo "$as_me:6668: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -6917,11 +6929,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6920: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6932: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6924: \$? = $ac_status" >&5
+   echo "$as_me:6936: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -7021,11 +7033,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7024: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7036: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7028: \$? = $ac_status" >&5
+   echo "$as_me:7040: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -9366,7 +9378,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9369 "configure"
+#line 9381 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -9466,7 +9478,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 9469 "configure"
+#line 9481 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11806,11 +11818,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11809: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11821: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:11813: \$? = $ac_status" >&5
+   echo "$as_me:11825: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -11910,11 +11922,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:11913: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:11925: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:11917: \$? = $ac_status" >&5
+   echo "$as_me:11929: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13480,11 +13492,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13483: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13495: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:13487: \$? = $ac_status" >&5
+   echo "$as_me:13499: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -13584,11 +13596,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:13587: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13599: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13591: \$? = $ac_status" >&5
+   echo "$as_me:13603: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15787,11 +15799,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15790: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15802: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15794: \$? = $ac_status" >&5
+   echo "$as_me:15806: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16055,11 +16067,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16058: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16070: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16062: \$? = $ac_status" >&5
+   echo "$as_me:16074: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16159,11 +16171,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16162: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16174: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16166: \$? = $ac_status" >&5
+   echo "$as_me:16178: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18978,6 +18990,13 @@ echo "$as_me: error: conditional \"AMDIS_OPENMP\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${USE_ZOLTAN_TRUE}" && test -z "${USE_ZOLTAN_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"USE_ZOLTAN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"USE_ZOLTAN\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${USE_PARALLEL_AMDIS_TRUE}" && test -z "${USE_PARALLEL_AMDIS_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"USE_PARALLEL_AMDIS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -18992,13 +19011,6 @@ echo "$as_me: error: conditional \"USE_PARALLEL_DOMAIN_AMDIS\" was never defined
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
-if test -z "${ENABLE_ZOLTAN_TRUE}" && test -z "${ENABLE_ZOLTAN_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_ZOLTAN\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"ENABLE_ZOLTAN\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
 if test -z "${ENABLE_UMFPACK_TRUE}" && test -z "${ENABLE_UMFPACK_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"ENABLE_UMFPACK\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -19610,13 +19622,14 @@ s,@AMDIS_OPENMP_TRUE@,$AMDIS_OPENMP_TRUE,;t t
 s,@AMDIS_OPENMP_FALSE@,$AMDIS_OPENMP_FALSE,;t t
 s,@OPENMP_FLAG@,$OPENMP_FLAG,;t t
 s,@MPI_DIR@,$MPI_DIR,;t t
+s,@ZOLTAN_DIR@,$ZOLTAN_DIR,;t t
+s,@USE_ZOLTAN_TRUE@,$USE_ZOLTAN_TRUE,;t t
+s,@USE_ZOLTAN_FALSE@,$USE_ZOLTAN_FALSE,;t t
 s,@PETSC_DIR@,$PETSC_DIR,;t t
 s,@USE_PARALLEL_AMDIS_TRUE@,$USE_PARALLEL_AMDIS_TRUE,;t t
 s,@USE_PARALLEL_AMDIS_FALSE@,$USE_PARALLEL_AMDIS_FALSE,;t t
 s,@USE_PARALLEL_DOMAIN_AMDIS_TRUE@,$USE_PARALLEL_DOMAIN_AMDIS_TRUE,;t t
 s,@USE_PARALLEL_DOMAIN_AMDIS_FALSE@,$USE_PARALLEL_DOMAIN_AMDIS_FALSE,;t t
-s,@ENABLE_ZOLTAN_TRUE@,$ENABLE_ZOLTAN_TRUE,;t t
-s,@ENABLE_ZOLTAN_FALSE@,$ENABLE_ZOLTAN_FALSE,;t t
 s,@ENABLE_UMFPACK_TRUE@,$ENABLE_UMFPACK_TRUE,;t t
 s,@ENABLE_UMFPACK_FALSE@,$ENABLE_UMFPACK_FALSE,;t t
 s,@ENABLE_MKL_TRUE@,$ENABLE_MKL_TRUE,;t t
diff --git a/AMDiS/configure.ac b/AMDiS/configure.ac
index 0fd9bcca..775dea8f 100644
--- a/AMDiS/configure.ac
+++ b/AMDiS/configure.ac
@@ -66,6 +66,10 @@ if test $marmot != false ; then
   AC_SUBST(CC, marmotcc)
 fi
 
+AC_ARG_WITH(zoltan, [  --with-zoltan=ZOLTAN_DIR], zoltandir=$withval, petscdir=no)
+AC_SUBST(ZOLTAN_DIR, $zoltandir)
+AM_CONDITIONAL(USE_ZOLTAN, test $zoltandir != no)
+
 AC_ARG_WITH(petsc, [  --with-petsc=PETSC_DIR], petscdir=$withval, petscdir=no)
 AC_SUBST(PETSC_DIR, $petscdir)
 
@@ -86,7 +90,6 @@ AC_ARG_ENABLE(parallel-domain,
     *) AC_MSG_ERROR(bad value${enableval} for --enable-parallel-domain) ;;
   esac],[paralleldomain=false])
 AM_CONDITIONAL(USE_PARALLEL_DOMAIN_AMDIS, test $paralleldomain = true)
-AM_CONDITIONAL(ENABLE_ZOLTAN, test $paralleldomain = true)
 
 AC_ARG_ENABLE(umfpack,
   [  --enable-umfpack  Compile with the UMFPACK direct solver library],
diff --git a/AMDiS/libtool b/AMDiS/libtool
index 02151259..95d2fe89 100755
--- a/AMDiS/libtool
+++ b/AMDiS/libtool
@@ -44,7 +44,7 @@ available_tags=" CXX F77"
 
 # ### BEGIN LIBTOOL CONFIG
 
-# Libtool was configured on host deimos103:
+# Libtool was configured on host deimos101:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 # End:
 # ### BEGIN LIBTOOL TAG CONFIG: CXX
 
-# Libtool was configured on host deimos103:
+# Libtool was configured on host deimos101:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -7065,7 +7065,7 @@ include_expsyms=""
 
 # ### BEGIN LIBTOOL TAG CONFIG: F77
 
-# Libtool was configured on host deimos103:
+# Libtool was configured on host deimos101:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
diff --git a/AMDiS/src/Makefile.am b/AMDiS/src/Makefile.am
index 5e008925..077f1800 100644
--- a/AMDiS/src/Makefile.am
+++ b/AMDiS/src/Makefile.am
@@ -22,14 +22,19 @@ if USE_PARALLEL_DOMAIN_AMDIS
   parallel/ParMetisPartitioner.cc \
   parallel/PetscSolver.cc \
   parallel/PetscSolverSchur.cc \
-  parallel/StdMpi.cc \
-  parallel/ZoltanPartitioner.cc
+  parallel/StdMpi.cc
   libamdis_la_CXXFLAGS += -DHAVE_PARALLEL_DOMAIN_AMDIS=1
   AMDIS_INCLUDES += -I$(PARMETIS_DIR)
   AMDIS_INCLUDES += -I$(PETSC_DIR)/include -I$(PETSC_DIR)/$(PETSC_ARCH)/include
   AMDIS_INCLUDES += -I$(LIB_DIR)/zoltan_build/include
 endif
 
+if USE_ZOLTAN
+  libamdis_la_CXXFLAGS += -DHAVE_ZOLTAN
+  PARALLEL_AMDIS_SOURCES += parallel/ZoltanPartitioner.cc
+endif
+
+
 if ENABLE_UMFPACK
   libamdis_la_CXXFLAGS += -DHAVE_UMFPACK=1 -DMTL_HAS_UMFPACK
   AMDIS_INCLUDES += -I$(LIB_DIR)/UFconfig \
diff --git a/AMDiS/src/Makefile.in b/AMDiS/src/Makefile.in
index d69efeef..ccf2fbbb 100644
--- a/AMDiS/src/Makefile.in
+++ b/AMDiS/src/Makefile.in
@@ -48,25 +48,26 @@ host_triplet = @host@
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@  parallel/ParMetisPartitioner.cc \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@  parallel/PetscSolver.cc \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@  parallel/PetscSolverSchur.cc \
-@USE_PARALLEL_DOMAIN_AMDIS_TRUE@  parallel/StdMpi.cc \
-@USE_PARALLEL_DOMAIN_AMDIS_TRUE@  parallel/ZoltanPartitioner.cc
+@USE_PARALLEL_DOMAIN_AMDIS_TRUE@  parallel/StdMpi.cc
 
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_2 = -DHAVE_PARALLEL_DOMAIN_AMDIS=1
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@am__append_3 = -I$(PARMETIS_DIR) \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@	-I$(PETSC_DIR)/include \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@	-I$(PETSC_DIR)/$(PETSC_ARCH)/include \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@	-I$(LIB_DIR)/zoltan_build/include
-@ENABLE_UMFPACK_TRUE@am__append_4 = -DHAVE_UMFPACK=1 -DMTL_HAS_UMFPACK
-@ENABLE_UMFPACK_TRUE@am__append_5 = -I$(LIB_DIR)/UFconfig \
+@USE_ZOLTAN_TRUE@am__append_4 = -DHAVE_ZOLTAN
+@USE_ZOLTAN_TRUE@am__append_5 = parallel/ZoltanPartitioner.cc
+@ENABLE_UMFPACK_TRUE@am__append_6 = -DHAVE_UMFPACK=1 -DMTL_HAS_UMFPACK
+@ENABLE_UMFPACK_TRUE@am__append_7 = -I$(LIB_DIR)/UFconfig \
 @ENABLE_UMFPACK_TRUE@	            -I$(LIB_DIR)/AMD/Include \
 @ENABLE_UMFPACK_TRUE@                    -I$(LIB_DIR)/UMFPACK/Include  
 
-@ENABLE_MKL_TRUE@am__append_6 = -DHAVE_MKL=1 -I${MKL_INC}
-@ENABLE_DUNE_TRUE@am__append_7 = -DHAVE_DUNE=1
-@ENABLE_DUNE_TRUE@am__append_8 = -I$(DUNE_DIR)
-@ENABLE_BOOST_TRUE@am__append_9 = -DHAVE_BOOST=1
-@AMDIS_DEBUG_TRUE@am__append_10 = -g -O0 -Wall -DDEBUG=1 $(OPENMP_FLAG) $(INCLUDES) #-pedantic
-@AMDIS_DEBUG_FALSE@am__append_11 = -O3 -Wall -DDEBUG=0 -DNDEBUG $(OPENMP_FLAG) -ftemplate-depth-100 $(INCLUDES) #-pedantic
+@ENABLE_MKL_TRUE@am__append_8 = -DHAVE_MKL=1 -I${MKL_INC}
+@ENABLE_DUNE_TRUE@am__append_9 = -DHAVE_DUNE=1
+@ENABLE_DUNE_TRUE@am__append_10 = -I$(DUNE_DIR)
+@ENABLE_BOOST_TRUE@am__append_11 = -DHAVE_BOOST=1
+@AMDIS_DEBUG_TRUE@am__append_12 = -g -O0 -Wall -DDEBUG=1 $(OPENMP_FLAG) $(INCLUDES) #-pedantic
+@AMDIS_DEBUG_FALSE@am__append_13 = -O3 -Wall -DDEBUG=0 -DNDEBUG $(OPENMP_FLAG) -ftemplate-depth-100 $(INCLUDES) #-pedantic
 subdir = src
 DIST_COMMON = $(nobase_include_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in AUTHORS NEWS
@@ -138,10 +139,10 @@ am__libamdis_la_SOURCES_DIST = parallel/ElementObjectData.cc \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@	libamdis_la-ParMetisPartitioner.lo \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@	libamdis_la-PetscSolver.lo \
 @USE_PARALLEL_DOMAIN_AMDIS_TRUE@	libamdis_la-PetscSolverSchur.lo \
-@USE_PARALLEL_DOMAIN_AMDIS_TRUE@	libamdis_la-StdMpi.lo \
-@USE_PARALLEL_DOMAIN_AMDIS_TRUE@	libamdis_la-ZoltanPartitioner.lo
-am__objects_2 = $(am__objects_1)
-am_libamdis_la_OBJECTS = $(am__objects_2) libamdis_la-AdaptBase.lo \
+@USE_PARALLEL_DOMAIN_AMDIS_TRUE@	libamdis_la-StdMpi.lo
+@USE_ZOLTAN_TRUE@am__objects_2 = libamdis_la-ZoltanPartitioner.lo
+am__objects_3 = $(am__objects_1) $(am__objects_2)
+am_libamdis_la_OBJECTS = $(am__objects_3) libamdis_la-AdaptBase.lo \
 	libamdis_la-AdaptInfo.lo libamdis_la-AdaptInstationary.lo \
 	libamdis_la-AdaptStationary.lo libamdis_la-Assembler.lo \
 	libamdis_la-BasisFunction.lo libamdis_la-Boundary.lo \
@@ -291,8 +292,6 @@ ENABLE_MKL_FALSE = @ENABLE_MKL_FALSE@
 ENABLE_MKL_TRUE = @ENABLE_MKL_TRUE@
 ENABLE_UMFPACK_FALSE = @ENABLE_UMFPACK_FALSE@
 ENABLE_UMFPACK_TRUE = @ENABLE_UMFPACK_TRUE@
-ENABLE_ZOLTAN_FALSE = @ENABLE_ZOLTAN_FALSE@
-ENABLE_ZOLTAN_TRUE = @ENABLE_ZOLTAN_TRUE@
 EXEEXT = @EXEEXT@
 F77 = @F77@
 FFLAGS = @FFLAGS@
@@ -329,7 +328,10 @@ USE_PARALLEL_AMDIS_FALSE = @USE_PARALLEL_AMDIS_FALSE@
 USE_PARALLEL_AMDIS_TRUE = @USE_PARALLEL_AMDIS_TRUE@
 USE_PARALLEL_DOMAIN_AMDIS_FALSE = @USE_PARALLEL_DOMAIN_AMDIS_FALSE@
 USE_PARALLEL_DOMAIN_AMDIS_TRUE = @USE_PARALLEL_DOMAIN_AMDIS_TRUE@
+USE_ZOLTAN_FALSE = @USE_ZOLTAN_FALSE@
+USE_ZOLTAN_TRUE = @USE_ZOLTAN_TRUE@
 VERSION = @VERSION@
+ZOLTAN_DIR = @ZOLTAN_DIR@
 ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
@@ -377,11 +379,11 @@ lib_LTLIBRARIES = libamdis.la libcompositeFEM.la libreinit.la
 LIB_DIR = ../lib
 PARALLEL_DIR = $(SOURCE_DIR)
 PARMETIS_DIR = ../lib/ParMetis-3.1
-AMDIS_INCLUDES = $(am__append_3) $(am__append_5) $(am__append_8)
+AMDIS_INCLUDES = $(am__append_3) $(am__append_7) $(am__append_10)
 libamdis_la_CXXFLAGS = $(am__append_2) $(am__append_4) $(am__append_6) \
-	$(am__append_7) $(am__append_9) $(am__append_10) \
-	$(am__append_11)
-PARALLEL_AMDIS_SOURCES = $(am__append_1)
+	$(am__append_8) $(am__append_9) $(am__append_11) \
+	$(am__append_12) $(am__append_13)
+PARALLEL_AMDIS_SOURCES = $(am__append_1) $(am__append_5)
 PARALLEL_INCLUDES = 
 TEMPLATE_INCLUDES = -I../lib/mtl4 
 INCLUDES = $(AMDIS_INCLUDES) $(PARALLEL_INCLUDES) $(TEMPLATE_INCLUDES)
diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc
index e66e7bbf..4b2f3c65 100644
--- a/AMDiS/src/parallel/MeshDistributor.cc
+++ b/AMDiS/src/parallel/MeshDistributor.cc
@@ -17,7 +17,6 @@
 #include <stdint.h>
 #include <boost/lexical_cast.hpp>
 #include <boost/filesystem.hpp>
-#include <zoltan_cpp.h>
 
 #include "parallel/MeshDistributor.h"
 #include "parallel/MeshManipulation.h"
@@ -104,8 +103,13 @@ namespace AMDiS {
     if (partStr == "parmetis") 
       partitioner = new ParMetisPartitioner(&mpiComm);
 
-    if (partStr == "zoltan")
+    if (partStr == "zoltan") {
+#ifdef HAVE_ZOLTAN
       partitioner = new ZoltanPartitioner(&mpiComm);
+#else
+      ERROR_EXIT("AMDiS was compiled without Zoltan support. There you cannot make use of it!\n");
+#endif
+    }
 
     if (partStr == "simple")
       partitioner = new SimplePartitioner(&mpiComm);
@@ -128,10 +132,12 @@ namespace AMDiS {
     TEST_EXIT(feSpace)("No FE space has been defined for the mesh distributor!\n");
     TEST_EXIT(mesh)("No mesh has been defined for the mesh distributor!\n");
 
+#ifdef HAVE_ZOLTAN
     int a = 0;
     char *b = NULL;
     float zoltanVersion = 0.0;
     Zoltan_Initialize(a, &b, &zoltanVersion);
+#endif
 
     elObjects.setFeSpace(feSpace);
 
diff --git a/AMDiS/src/parallel/PetscSolverSchur.cc b/AMDiS/src/parallel/PetscSolverSchur.cc
new file mode 100644
index 00000000..b28db0fa
--- /dev/null
+++ b/AMDiS/src/parallel/PetscSolverSchur.cc
@@ -0,0 +1,84 @@
+//
+// Software License for AMDiS
+//
+// Copyright (c) 2010 Dresden University of Technology 
+// All rights reserved.
+// Authors: Simon Vey, Thomas Witkowski et al.
+//
+// This file is part of AMDiS
+//
+// See also license.opensource.txt in the distribution.
+
+
+#include <vector>
+#include <set>
+
+#include "parallel/PetscSolverSchur.h"
+
+namespace AMDiS {
+
+  void PetscSolverSchur::providePetscSolver(KSP &solver, PC &pc)
+  {
+    FUNCNAME("PetscSolver::providePetscSolver()");
+
+    typedef map<int, DofContainer> RankToDofContainer;
+    typedef map<DegreeOfFreedom, bool> DofIndexToBool;
+
+    std::set<DegreeOfFreedom> boundaryDofsSet;
+    std::set<DegreeOfFreedom> boundaryLocalDofs;
+    RankToDofContainer& sendDofs = meshDistributor->getSendDofs();
+    for (RankToDofContainer::iterator rankIt = sendDofs.begin(); 
+	 rankIt != sendDofs.end(); ++rankIt)
+      for (DofContainer::iterator dofIt = rankIt->second.begin(); 
+	   dofIt != rankIt->second.end(); ++dofIt) {
+	boundaryLocalDofs.insert(**dofIt);
+
+	for (int i = 0; i < nComponents; i++)
+	  boundaryDofsSet.insert(meshDistributor->mapLocalToGlobal(**dofIt) * nComponents + i);
+      }
+
+    vector<DegreeOfFreedom> boundaryDofs(boundaryDofsSet.begin(), 
+					 boundaryDofsSet.end());
+
+    std::set<DegreeOfFreedom> otherBoundaryLocalDofs;
+    RankToDofContainer& recvDofs = meshDistributor->getRecvDofs();
+    for (RankToDofContainer::iterator rankIt = recvDofs.begin(); 
+	 rankIt != recvDofs.end(); ++rankIt)
+      for (DofContainer::iterator dofIt = rankIt->second.begin(); 
+	   dofIt != rankIt->second.end(); ++dofIt)
+	otherBoundaryLocalDofs.insert(**dofIt);
+
+    std::set<DegreeOfFreedom> interiorDofsSet;
+    DofIndexToBool& isRankDof = meshDistributor->getIsRankDof();
+    for (DofIndexToBool::iterator dofIt = isRankDof.begin(); 
+	 dofIt != isRankDof.end(); ++dofIt)
+      if (dofIt->second && 
+	  boundaryLocalDofs.count(dofIt->first) == 0 && 
+	  otherBoundaryLocalDofs.count(dofIt->first) == 0)
+	for (int i = 0; i < nComponents; i++)	    
+	  interiorDofsSet.insert(meshDistributor->mapLocalToGlobal(dofIt->first) * nComponents + i);
+
+    vector<DegreeOfFreedom> interiorDofs(interiorDofsSet.begin(), 
+					 interiorDofsSet.end());
+
+    IS interiorIs;
+    ISCreateGeneral(PETSC_COMM_WORLD, interiorDofs.size(), &(interiorDofs[0]), 
+		    PETSC_COPY_VALUES, &interiorIs);
+    PCFieldSplitSetIS(pc, "interior", interiorIs);
+
+    IS boundaryIs;
+    ISCreateGeneral(PETSC_COMM_WORLD, boundaryDofs.size(), &(boundaryDofs[0]), 
+		    PETSC_COPY_VALUES, &boundaryIs);
+    PCFieldSplitSetIS(pc, "boundary", boundaryIs);
+
+    KSPCreate(PETSC_COMM_WORLD, &solver);
+    KSPGetPC(solver, &pc);
+    PCSetType(pc, PCFIELDSPLIT);
+
+    KSPSetOperators(solver, petscMatrix, petscMatrix, SAME_NONZERO_PATTERN); 
+    KSPSetTolerances(solver, 0.0, 1e-8, PETSC_DEFAULT, PETSC_DEFAULT);
+    KSPSetFromOptions(solver);
+    PCSetFromOptions(pc);
+  }
+
+}
diff --git a/AMDiS/src/parallel/PetscSolverSchur.h b/AMDiS/src/parallel/PetscSolverSchur.h
new file mode 100644
index 00000000..297622a8
--- /dev/null
+++ b/AMDiS/src/parallel/PetscSolverSchur.h
@@ -0,0 +1,51 @@
+// ============================================================================
+// ==                                                                        ==
+// == AMDiS - Adaptive multidimensional simulations                          ==
+// ==                                                                        ==
+// ==  http://www.amdis-fem.org                                              ==
+// ==                                                                        ==
+// ============================================================================
+//
+// Software License for AMDiS
+//
+// Copyright (c) 2010 Dresden University of Technology 
+// All rights reserved.
+// Authors: Simon Vey, Thomas Witkowski et al.
+//
+// This file is part of AMDiS
+//
+// See also license.opensource.txt in the distribution.
+
+
+
+/** \file PetscSolver.h */
+
+#ifndef AMDIS_PETSC_SOLVER_SCHUR_H
+#define AMDIS_PETSC_SOLVER_SCHUR_H
+
+#include "AMDiS_fwd.h"
+#include "PetscSolver.h"
+
+namespace AMDiS {
+  
+  class PetscSolverSchur : public PetscSolver
+  {
+  public:
+    PetscSolverSchur(std::string nameStr,
+		     ProblemIterationInterface *problemIteration = NULL)
+      : PetscSolver(nameStr, problemIteration)
+    {}
+
+    ~PetscSolverSchur()
+    {}
+
+
+  private:
+    /// Creates the fieldsplit preconditioner to solve the Schur complement system.
+    void providePetscSolver(KSP &solver, PC &pc);
+
+  };
+
+} //namespace AMDiS
+
+#endif
diff --git a/AMDiS/src/parallel/ZoltanPartitioner.h b/AMDiS/src/parallel/ZoltanPartitioner.h
index 86262d6c..a54e32f8 100644
--- a/AMDiS/src/parallel/ZoltanPartitioner.h
+++ b/AMDiS/src/parallel/ZoltanPartitioner.h
@@ -23,6 +23,8 @@
 #ifndef AMDIS_ZOLTAN_PARTITIONER_H
 #define AMDIS_ZOLTAN_PARTITIONER_H
 
+#ifdef HAVE_ZOLTAN
+
 #include <zoltan_cpp.h>
 #include <set>
 #include "AMDiS_fwd.h"
@@ -163,4 +165,6 @@ namespace AMDiS {
 
 }
 
+#endif // HAVE_ZOLTAN
+
 #endif
-- 
GitLab