diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1b7cb29caa5e09336cdaea4db7aa952132bbc5b8..81b1161e7deb61164f3735e2eff38c076386211e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,10 +3,10 @@ project("dune-common" C CXX)
 
 # general stuff
 cmake_minimum_required(VERSION 2.8.6)
-message("CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}|")
+
 # make sure our own modules are found
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules")
-message("CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
+
 # set the script dir for the macros.
 set(DUNE_COMMON_SCRIPT_DIR "${PROJECT_SOURCE_DIR}/cmake/scripts")
 
diff --git a/bin/dunecontrol b/bin/dunecontrol
index e3e20994730e120c898d50afc5b064b81523f3e5..fc657e3a127da91ba2cbc52011296937625d2640 100755
--- a/bin/dunecontrol
+++ b/bin/dunecontrol
@@ -163,14 +163,33 @@ load_opts() {
   local COMMAND=$(echo $command | tr '[:lower:]' '[:upper:]')
   CMD_FLAGS="$(eval echo \$${COMMAND}_FLAGS)"
   local CMD_FLAGS_FROM_FILE=""
-  BUILDDIR=$DUNE_BUILDDIR
+  if test "$command" = "NONE"; then
+    BUILDDIR=$DUNE_BUILDDIR
+    USE_CMAKE=$DUNE_USE_CMAKE
+    if test "x$DUNE_OPTS_FILE" != "x"; then
+      if test -z "$BUILDDIR"; then
+        # no builddir set yet, use build dir from opts file if set
+        # Note: if --use-buiddir is used BUILDDIR will be set already
+        OPTS_FILE_BUILDDIR="$(eval BUILDDIR=""; . $DUNE_OPTS_FILE; eval echo \$BUILDDIR)"
+        if test -n "$OPTS_FILE_BUILDDIR"; then
+          BUILDDIR="$OPTS_FILE_BUILDDIR"
+        fi
+      fi
+      if test -z "$USE_CMAKE"; then
+        # no USE_CMAKE set yet, use USE_CMAKE from opts file if set
+        # Note: if --use-cmake is used USE_CMAKE will be set already
+        OPTS_FILE_USE_CMAKE="$(eval USE_CMAKE=""; . $DUNE_OPTS_FILE; eval echo \$USE_CMAKE)"
+        if test -n "$OPTS_FILE_USE_CMAKE"; then
+          USE_CMAKE="$OPTS_FILE_USE_CMAKE"
+        fi
+      fi
+
+    fi
+  fi
   if test "x$DUNE_OPTS_FILE" != "x"; then
-    # use build dir from opts file if set
-    OPTS_FILE_BUILDDIR="$(eval BUILDDIR=""; . $DUNE_OPTS_FILE; eval echo \$BUILDDIR)"
-    if test -n "$OPTS_FILE_BUILDDIR"; then
-      BUILDDIR="$OPTS_FILE_BUILDDIR"
+    if test "$command" = "configure"; then
+      CMAKE_FLAGS="$(. $DUNE_OPTS_FILE; eval echo \$CMAKE_FLAGS)"
     fi
-    CMAKE_FLAGS="$(. $DUNE_OPTS_FILE; eval echo \$CMAKE_FLAGS)"
     CMD_FLAGS_FROM_FILE="$(eval ${COMMAND}_FLAGS=""; . $DUNE_OPTS_FILE; eval echo \$${COMMAND}_FLAGS)"
   fi
   if test -n "$CMD_FLAGS_FROM_FILE"; then
@@ -179,6 +198,13 @@ load_opts() {
   elif test -n "$CMD_FLAGS"; then
     echo "----- using default flags \$${COMMAND}_FLAGS from environment -----"
   fi
+  
+  if test "x$USE_CMAKE" = "xyes"; then
+    if test -z "$BUILDDIR"; then
+      echo "No build directory provided. Defaulting to the sub directory build-cmake"
+      export BUILDDIR=build-cmake
+    fi
+  fi
 }
 
 ###############################################
@@ -409,9 +435,12 @@ run_default_vcsetup() {
       echo -n "--> Setting Git configuration entries... "
       cat .vcsetup/config | while read; do
         # Filter out comments
-        COMMENT="$(echo $REPLY | $GREP '^#')"
+        local COMMENT="$(echo $REPLY | $GREP '^#')"
         if [ ! "x$COMMENT" = "x$REPLY" ]; then
-          git config $REPLY
+          # parse line into an array first to catch obvious syntax errors
+          # like 'option value; rm -rf /'
+          eval local GIT_ARGS=($REPLY)
+          git config "${GIT_ARGS[@]}"
         fi
       done
       echo "done"
@@ -423,9 +452,12 @@ run_default_vcsetup() {
         echo -n "--> Setting custom Git configuration entries from '$GIT_CONFIG_FILE'... "
         cat "$GIT_CONFIG_FILE" | while read; do
           # Filter out comments
-          COMMENT="$(echo $REPLY | $GREP '^#')"
+          local COMMENT="$(echo $REPLY | $GREP '^#')"
           if [ ! "x$COMMENT" = "x$REPLY" ]; then
-            git config $REPLY
+            # parse line into an array first to catch obvious syntax errors
+            # like 'option value; rm -rf /'
+            eval local GIT_ARGS=($REPLY)
+            git config "${GIT_ARGS[@]}"
           fi
         done
         echo "done"
@@ -518,7 +550,7 @@ run_default_configure () {
   else
     LOCAL_USE_CMAKE=no
   fi
-  echo "LOCAL_USE_CMAKE=$LOCAL_USE_CMAKE $(eval "echo \$PATH_$module")/CMakeLists.txt"
+
   if test -x configure || test "x$LOCAL_USE_CMAKE" = "xyes" ; then
     ACLOCAL_FLAGS="-I ."
     if test -d "m4"; then
@@ -534,7 +566,6 @@ run_default_configure () {
           # Translate the configure PARMS to cmake
           export PARAMS
           export CMAKE_PARAMS
-          echo module_translate_options_am2cmake $m $path/lib
           module_translate_options_am2cmake $m $path/lib
       fi
       if test x$module = x$m; then continue; fi # skip myself
@@ -577,16 +608,16 @@ run_default_configure () {
             PREPARAMS="$PREPARAMS $cflags"
         fi
       done
+      # create build directory if requested
       test -d "$BUILDDIR" || mkdir "$BUILDDIR"
       SRCDIR="$PWD"
       cd "$BUILDDIR"
-      echo `pwd`
       echo "$PREPARAMS cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_MODULE_PATH=\"$CMAKE_MODULE_PATH\" $CMAKE_PARAMS $CMAKE_FLAGS $SRCDIR"
       eval $PREPARAMS cmake "-DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_MODULE_PATH=\"$CMAKE_MODULE_PATH\" $CMAKE_PARAMS $CMAKE_FLAGS $SRCDIR" || exit 1
     else
       PARAMS="$PARAMS ACLOCAL_AMFLAGS=\"$ACLOCAL_FLAGS\""
       echo ./configure "$PARAMS"
-      # create build directory of requested
+      # create build directory if requested
       if test -n "$BUILDDIR"; then
         test -d "$BUILDDIR" || mkdir "$BUILDDIR"
         SRCDIR="$PWD"
@@ -752,7 +783,6 @@ export ONLY=""
 export RESUME_FLAG=no
 export REVERSE_FLAG=no
 export SKIPFIRST=no
-export USE_CMAKE=no
 
 # parse commandline parameters
 while test $# -gt 0; do
@@ -862,7 +892,7 @@ while test $# -gt 0; do
       export SKIPFIRST=yes
     ;;
     --use-cmake)
-      export USE_CMAKE=yes
+      export DUNE_USE_CMAKE=yes
     ;;
     --debug) true ;; # ignore this option, it is handled right at the beginning
     --*)
@@ -879,15 +909,6 @@ while test $# -gt 0; do
     shift
 done
 
-if test "x$USE_CMAKE" = "xyes"; then
-  # load general options. DUNE_BUILDDIR might be overwritten in the opts file
-  load_opts NONE
-  if test -z "$DUNE_BUILDDIR"; then
-    echo "No build directory provided. Defaulting to the sub directory build-cmake"
-    export DUNE_BUILDDIR=build-cmake
-  fi
-fi
-echo "USE_CMAKE=$USE_CMAKE DUNE_BUILDDIR=$DUNE_BUILDDIR"
 # we assume there should be a command...
 if test "x$command" = "x"; then
   usage
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 00e6852a10d206c33b990005680e130fbdeabda3..cee14ed1ca7d33ed5d227337cbab5bbd11a21408 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -10,6 +10,7 @@ set(modules DuneBoost.cmake
   DuneTestMacros.cmake
   DuneTests.cmake
   FindBoostFusion.cmake
+  FindCXX11Conditional.cmake
   FindCXX11Features.cmake
   FindGMP.cmake
   FindInkscape.cmake
diff --git a/cmake/modules/DuneDoc.cmake b/cmake/modules/DuneDoc.cmake
index ea2858d08e4378a0321ad9ad18890520d2ebbf1d..4b19ccec27588c380ccbcaa28ca0794df709d583 100644
--- a/cmake/modules/DuneDoc.cmake
+++ b/cmake/modules/DuneDoc.cmake
@@ -83,7 +83,6 @@ MACRO(dune_add_latex_document tex_file)
   string(REGEX REPLACE "/" "_" "${CMAKE_CURRENT_SOURCE_DIR}/${file}" filevar ${file})
   set(filevar "filevar-NOTFOUND")
   find_file(filevar ${tex_file} ${CMAKE_CURRENT_SOURCE_DIR})
-  message(filevar=${filevar} tex_file=${tex_file} CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR})
   if(filevar)
     if(LATEX_USABLE)
       # add rule to create latex document
diff --git a/cmake/modules/DuneMacros.cmake b/cmake/modules/DuneMacros.cmake
index 18fd0d78e0d0dc4e528e8a0c6d45c6178e234ce8..186352228cc315784d4f91a427fd3e14a8ce9cb5 100644
--- a/cmake/modules/DuneMacros.cmake
+++ b/cmake/modules/DuneMacros.cmake
@@ -419,6 +419,7 @@ macro(dune_project)
 
   # set required compiler flags for C++11 (former C++0x)
   find_package(CXX11Features)
+  find_package(CXX11Conditional)
 
   include(DuneCxaDemangle)
 
@@ -435,7 +436,7 @@ macro(dune_project)
   include_directories("${CMAKE_SOURCE_DIR}")
   link_directories("${CMAKE_SOURCE_DIR}/lib")
   include_directories("${CMAKE_CURRENT_BINARY_DIR}")
-  include_directories("/\${CMAKE_CURRENT_SOURCE_DIR}")
+  include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
   add_definitions(-DHAVE_CONFIG_H)
 
   # Search for MPI and set the relevant variables.
@@ -489,8 +490,11 @@ macro(dune_project)
   include(GNUInstallDirs)
   # Set variable where the cmake modules will be installed.
   # Thus the user can override it and for example install
-  # directly into the CMake installation. This has to be an
-  # absolute path. Default: ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/cmake/modules
+  # directly into the CMake installation. We use a cache variable
+  # that is overridden by a local variable of the same name if
+  # the user does not explicitely set a value for it. Thus the value
+  # will automatically change if the user changes CMAKE_INSTALL_DATAROOTDIR
+  # or CMAKE_INSTALL_PREFIX
   if(NOT DUNE_INSTALL_MODULEDIR)
     set(DUNE_INSTALL_MODULEDIR ""
       CACHE PATH
diff --git a/cmake/modules/DunePkgConfig.cmake b/cmake/modules/DunePkgConfig.cmake
index 20197e932fc1ba42243e735f041be71d6d0930d4..0b6e3fa87b032c3c710e30a92c82159e8b7164f5 100644
--- a/cmake/modules/DunePkgConfig.cmake
+++ b/cmake/modules/DunePkgConfig.cmake
@@ -15,7 +15,18 @@ set(VERSION ${DUNE_MOD_VERSION})
 set(CC ${CMAKE_C_COMPILER})
 set(CXX "${CMAKE_CXX_COMPILER} ${CXX_STD11_FLAGS}")
 
-set(REQUIRES ${DUNE_DEPENDS})
+if(DUNE_DEPENDS)
+  foreach(_DUNE_DEPEND ${DUNE_DEPENDS})
+    string(REGEX REPLACE "\\(" "" REQF1 ${_DUNE_DEPEND})
+    string(REGEX REPLACE "\\)" "" LR ${REQF1})
+    if(REQUIRES)
+      set(REQUIRES "${REQUIRES} ${LR}")
+    else()
+      set(REQUIRES ${LR})
+    endif(REQUIRES)
+  endforeach(_DUNE_DEPEND ${DUNE_DEPENDS})
+endif(DUNE_DEPENDS)
+
 #create pkg-config file
 configure_file(
   ${PROJECT_SOURCE_DIR}/${DUNE_MOD_NAME}.pc.in
@@ -24,7 +35,7 @@ configure_file(
 )
 
 # install pkgconfig file
-if(PKG_CONFIG_FOUND )
+if(PKG_CONFIG_FOUND)
   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DUNE_MOD_NAME}.pc
     DESTINATION lib/pkgconfig)
 endif(PKG_CONFIG_FOUND)
diff --git a/cmake/modules/FindCXX11Conditional.cmake b/cmake/modules/FindCXX11Conditional.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..6c85ca65ed3d01b1b6f558dcd4e077a57f3a9239
--- /dev/null
+++ b/cmake/modules/FindCXX11Conditional.cmake
@@ -0,0 +1,17 @@
+# Module that checks whether the compiler supports
+# C++11 std::conditional.
+#
+# Sets the following variable:
+# HAVE_STD_CONDITIONAL
+#
+# perform tests
+include(CheckCXXSourceCompiles)
+
+check_cxx_source_compiles("
+
+  #include <type_traits>
+
+  int main(void){
+      return std::conditional<true,std::integral_constant<int,0>,void>::type::value;
+  }"
+  HAVE_STD_CONDITIONAL)
diff --git a/cmake/modules/FindMProtect.cmake b/cmake/modules/FindMProtect.cmake
index e4afe68f82b1328165b1a1b54177c542d479d936..955ae1abd259a7d93ac92e4073dbb51874350212 100644
--- a/cmake/modules/FindMProtect.cmake
+++ b/cmake/modules/FindMProtect.cmake
@@ -5,11 +5,9 @@
 # HAVE_SYS_MMAN_H
 # HAVE_MPROTECT
 check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
-message(STATUS HAVE_SYS_MMAN_H=${HAVE_SYS_MMAN_H})
 include(CheckCSourceCompiles)
 check_c_source_compiles("
 #include <sys/mman.h>
 int main(void){
   mprotect(0,0,PROT_NONE);
 }" HAVE_MPROTECT)
-message(STATUS HAVE_MPROTECT=${HAVE_MPROTECT})
diff --git a/cmake/modules/Makefile.am b/cmake/modules/Makefile.am
index 04631b7ddae96c54891037b9e56207a31e14888a..7870a68fa51c92b0a58212bdc6125d7dbf52ceee 100644
--- a/cmake/modules/Makefile.am
+++ b/cmake/modules/Makefile.am
@@ -10,6 +10,7 @@ MODULES = DuneBoost.cmake \
   DuneTestMacros.cmake    \
   DuneTests.cmake         \
   FindBoostFusion.cmake   \
+  FindCXX11Conditional.cmake \
   FindCXX11Features.cmake \
   FindGMP.cmake           \
   FindInkscape.cmake      \
diff --git a/cmake/scripts/BuildTests.cmake.in b/cmake/scripts/BuildTests.cmake.in
index c2aadf7ab12745790f001bb59ae6a9d4eb73829f..fe1045641c68fa6864d73f086bec2aed1d87cb36 100644
--- a/cmake/scripts/BuildTests.cmake.in
+++ b/cmake/scripts/BuildTests.cmake.in
@@ -1,12 +1,9 @@
 MACRO(get_directory_test_target _target _dir)
-  message("$_dir")
   string(REPLACE "@CMAKE_BINARY_DIR@" "" _relative_dir "${_dir}")
-  message("$_relative_dir")
   string(REPLACE "/" "_" ${_target} "${_relative_dir}")
-  message("target=${${_target}}")
 ENDMACRO(get_directory_test_target _target _dir)
 
 get_directory_test_target(_build_test_target "@CMAKE_CURRENT_BINARY_DIR@")
 message("binary_dir=@CMAKE_CURRENT_BINARY_DIR@")
 execute_process(COMMAND @CMAKE_COMMAND@ --build @CMAKE_BINARY_DIR@ 
-  --target ${_build_test_target})
\ No newline at end of file
+  --target ${_build_test_target})
diff --git a/config.h.cmake b/config.h.cmake
index 7453073140623b76a655f9479a9539722f7d7507..dde41d58022b09cc842ff6d71aa1854a71fb20e1 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -108,6 +108,9 @@
 /* Define to 1 if you have the <type_traits> header file. */
 #cmakedefine HAVE_TYPE_TRAITS 1
 
+/* Define to 1 if you have the <type_traits> header file. */
+#cmakedefine HAVE_STD_CONDITIONAL 1
+
 /* Define to 1 if the MPI2 Standard is supported */
 #cmakedefine MPI_2 1
 
diff --git a/doc/doxygen/Doxystyle b/doc/doxygen/Doxystyle
index a328695659ab94d11186cb6a6365c586619eac75..c29eb5633a4c3aadbb6260d8f3cc848797b7b1e3 100644
--- a/doc/doxygen/Doxystyle
+++ b/doc/doxygen/Doxystyle
@@ -107,8 +107,6 @@ INTERNAL_DOCS          = YES
 # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
 # in the documentation. The default is NO.
 
-SHOW_DIRECTORIES       = YES
-
 REFERENCED_BY_RELATION = YES
 REFERENCES_RELATION    = YES
 ALPHABETICAL_INDEX     = YES
@@ -207,7 +205,6 @@ GENERATE_BUGLIST       = YES
 GENERATE_DEPRECATEDLIST= YES
 ENABLED_SECTIONS       = 
 MAX_INITIALIZER_LINES  = 30
-SHOW_DIRECTORIES       = YES
 SHOW_FILES             = YES
 SHOW_NAMESPACES        = YES
 FILE_VERSION_FILTER    = 
diff --git a/dune/common/Makefile.am b/dune/common/Makefile.am
index 51bdd376ef9587ef48332e7948fa48ac57337ff8..2897c989451651ed1108c4cb9bfa3dca65b7c6dc 100644
--- a/dune/common/Makefile.am
+++ b/dune/common/Makefile.am
@@ -7,8 +7,8 @@ noinst_LTLIBRARIES = libcommon.la
 
 libcommon_la_SOURCES =				\
 	debugallocator.cc			\
-	fmatrixev.cc \
-	dynmatrixev.cc                           \
+	fmatrixev.cc                            \
+	dynmatrixev.cc                          \
 	ios_state.cc				\
 	parametertree.cc                        \
 	parametertreeparser.cc			\
@@ -60,9 +60,9 @@ commoninclude_HEADERS = 			\
 	iteratorfacades.hh			\
 	lcm.hh					\
 	lru.hh					\
-	mallocallocator.hh					\
+	mallocallocator.hh			\
 	math.hh					\
-	matvectraits.hh \
+	matvectraits.hh                         \
 	misc.hh					\
 	mpicollectivecommunication.hh		\
 	mpiguard.hh				\
diff --git a/dune/common/lru.hh b/dune/common/lru.hh
index 33eca0934da6639f69a951e90c066e9ac0738506..91ab8ed9406ed0f447c60da9d3b4cf5f60ed1948 100644
--- a/dune/common/lru.hh
+++ b/dune/common/lru.hh
@@ -39,7 +39,7 @@ namespace Dune {
   /**
       @brief LRU Cache Container
 
-      Implementatation of an LRU (least recently used) cache
+      Implementation of an LRU (least recently used) cache
       container. This implementation follows the approach presented in
       http://aim.adc.rmit.edu.au/phd/sgreuter/papers/graphite2003.pdf
    */
@@ -175,26 +175,26 @@ namespace Dune {
     }
 
     /**
-     * @brief mark data associateed with key as most recent
+     * @brief mark data associated with key as most recent
      *
      * @return reference of stored data
      */
     reference touch (const key_type & key)
     {
       /* query _index for iterator */
-      iterator it = _index[key];
+      map_iterator it = _index.find(key);
       if (it == _index.end())
         DUNE_THROW(Dune::RangeError,
           "Failed to touch key " << key << ", it is not in the lru container");
        /* update _data
          move it to the front
        */
-      _data.splice(_data.begin(), _data, it);
-      return it->second;
+      _data.splice(_data.begin(), _data, it->second);
+      return it->second->second;
     }
 
     /**
-     * @brief retief number of entries in the container
+     * @brief Retrieve number of entries in the container
      */
     size_type size() const
     {
@@ -203,6 +203,7 @@ namespace Dune {
 
     /**
      * @brief ensure a maximum size of the container
+     *
      * If new_size is smaller than size the oldest elements are
      * dropped. Otherwise nothing happens.
      */
diff --git a/dune/common/test/.gitignore b/dune/common/test/.gitignore
index a61e60ee5dd4af0287f42c06fbeb2a5b71e7326a..bbf01aca9c63547aac3aadcf5ca51e3be2166c2a 100644
--- a/dune/common/test/.gitignore
+++ b/dune/common/test/.gitignore
@@ -1,39 +1,56 @@
+# Stuff from the build system
 Makefile
 Makefile.in
 .deps
 .libs
+*.gcda
+*.gcno
+*.log
+*.trs
+gmon.out
 semantic.cache
-diagonalmatrixtest
-dynvectortest
-fvectortest
-mpicollectivecommunication
-lrutest
+
+# The test binaries (in alphabetical order)
 arraylisttest
-shared_ptrtest
-testfloatcmp
+arraytest
+bigunsignedinttest
 bitsetvectortest
-iteratorfacadetest
-sllisttest
-tuplestest
-tupleutilitytest
+blockbitfieldtest
+check_fvector_size
+conversiontest
+diagonalmatrixtest
+dynmatrixtest
+dynvectortest
+eigenvaluestest
 enumsettest
+fassigntest
 fmatrixtest
-dynmatrixtest
-poolallocatortest
-*.gcda
-*.gcno
-gmon.out
+fvectortest
 gcdlcmtest
-streamtest
-exprtmpl
-timing_xpr
-timing_old
-timing_flt
-bigunsignedinttest
+iteratorfacadetest
+iteratorfacadetest2
+lrutest
+mpicollectivecommunication
 mpiguardtest
 mpihelpertest
+mpihelpertest2
+nullptr-test
+parametertreetest
+pathtest
+poolallocatortest
+shared_ptrtest
 singletontest
-utilitytest
+shared_ptrtest_config
+shared_ptrtest_dune
+sllisttest
+static_assert_test
+streamtest
+testdebugallocator
+testdebugallocator_fail1
+testdebugallocator_fail2
+testdebugallocator_fail3
+testdebugallocator_fail4
+testdebugallocator_fail5
 testfassign_fail1
 testfassign_fail2
 testfassign_fail3
@@ -44,31 +61,19 @@ testfassign1
 testfassign2
 testfassign3
 testfassign4
-conversiontest
-nullptr-test
-blockbitfieldtest
-fassigntest
-iteratorfacadetest2
-static_assert_test
-parametertreetest
-tags
-pathtest
-TAGS
-mpihelpertest2
+testfloatcmp
 testfconstruct
-arraytest
-shared_ptrtest_config
-shared_ptrtest_dune
+timing_xpr
+timing_old
+timing_flt
+tuplestest
 tuplestest_dune
 tuplestest_std
 tuplestest_tr1
-check_fvector_size
-testdebugallocator
-testdebugallocator_fail1
-testdebugallocator_fail2
-testdebugallocator_fail3
-testdebugallocator_fail4
-testdebugallocator_fail5
-eigenvaluestest
-*.log
-*.trs
+tupleutilitytest
+typetraitstest
+utilitytest
+
+tags
+TAGS
+
diff --git a/dune/common/test/Makefile.am b/dune/common/test/Makefile.am
index 6776c67bb32eae05bff602b960e79b1450137227..a5218adc3c407627c90215baa25145fe572fd716 100644
--- a/dune/common/test/Makefile.am
+++ b/dune/common/test/Makefile.am
@@ -55,6 +55,7 @@ TESTPROGS = \
     tuplestest_std \
     tuplestest_tr1 \
     tupleutilitytest \
+    typetraitstest \
     utilitytest
 
 # which tests to run
@@ -104,60 +105,27 @@ noinst_HEADERS = dummyiterator.hh iteratorfacadetest.hh
 testincludedir = $(includedir)/dune/common/test
 testinclude_HEADERS = checkmatrixinterface.hh iteratortest.hh
 
-# define the programs
-pathtest_SOURCES = pathtest.cc
-
-parametertreetest_SOURCES = parametertreetest.cc
-
-bitsetvectortest_SOURCES = bitsetvectortest.cc
-
-diagonalmatrixtest_SOURCES = diagonalmatrixtest.cc
-
-nullptr_test_SOURCES = nullptr-test.cc nullptr-test2.cc
-nullptr_test_fail_SOURCES = nullptr-test.cc
-nullptr_test_fail_CPPFLAGS = $(AM_CPPFLAGS) -DFAIL
-
-static_assert_test_SOURCES = static_assert_test.cc
-static_assert_test_fail_SOURCES = static_assert_test_fail.cc
-
-fassigntest_SOURCES = fassigntest.cc
-
-bigunsignedinttest_SOURCES=bigunsignedinttest.cc
-bigunsignedinttest_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS)
-
-lrutest_SOURCES = lrutest.cc
-
-sllisttest_SOURCES = sllisttest.cc
-
+# define the programs (in alphabetical order)
 arraylisttest_SOURCES = arraylisttest.cc
 
 arraytest_SOURCES = arraytest.cc
 
-shared_ptrtest_config_SOURCES = shared_ptrtest.cc
-
-shared_ptrtest_dune_SOURCES = shared_ptrtest.cc
-shared_ptrtest_dune_CPPFLAGS = $(AM_CPPFLAGS)   \
-    -DDISABLE_CONFIGURED_SHARED_PTR
-
-tuplestest_dune_SOURCES = tuplestest.cc
-tuplestest_dune_CPPFLAGS = $(AM_CPPFLAGS)       \
-    -DDISABLE_TR1_TUPLE -DDISABLE_STD_TUPLE
+bigunsignedinttest_SOURCES=bigunsignedinttest.cc
+bigunsignedinttest_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_CPPFLAGS)
 
-tuplestest_std_SOURCES = tuplestest.cc
+bitsetvectortest_SOURCES = bitsetvectortest.cc
 
-tuplestest_tr1_SOURCES = tuplestest.cc
-tuplestest_tr1_CPPFLAGS = $(AM_CPPFLAGS)        \
-    -DDISABLE_STD_TUPLE
+check_fvector_size_fail1_SOURCES = check_fvector_size_fail.cc
+check_fvector_size_fail1_CPPFLAGS = $(AM_CPPFLAGS) -DDIM=1
 
-tupleutilitytest_SOURCES = tupleutilitytest.cc
+check_fvector_size_fail2_SOURCES = check_fvector_size_fail.cc
+check_fvector_size_fail2_CPPFLAGS = $(AM_CPPFLAGS) -DDIM=3
 
-streamtest_SOURCES = streamtest.cc
+check_fvector_size_SOURCES = check_fvector_size.cc
 
-# mention headers so that they are distributed too
-iteratorfacadetest_SOURCES = iteratorfacadetest.cc iteratorfacadetest.hh \
-   iteratortest.hh
+conversiontest_SOURCES = conversiontest.cc
 
-iteratorfacadetest2_SOURCES = iteratorfacadetest2.cc
+diagonalmatrixtest_SOURCES = diagonalmatrixtest.cc
 
 dynmatrixtest_SOURCES = dynmatrixtest.cc
 
@@ -166,24 +134,36 @@ dynvectortest_SOURCES = dynvectortest.cc
 eigenvaluestest_SOURCES = eigenvaluestest.cc
 eigenvaluestest_LDADD = $(LAPACK_LIBS) $(LDADD) $(BLAS_LIBS) $(LIBS) $(FLIBS)
 
+enumsettest_SOURCES = enumsettest.cc
+
+fassigntest_SOURCES = fassigntest.cc
+
 fmatrixtest_SOURCES = fmatrixtest.cc
 fmatrixtest_LDADD = $(LAPACK_LIBS) $(LDADD) $(BLAS_LIBS) $(LIBS) $(FLIBS)
 
 fvectortest_SOURCES = fvectortest.cc
 
-check_fvector_size_fail1_SOURCES = check_fvector_size_fail.cc
-check_fvector_size_fail1_CPPFLAGS = $(AM_CPPFLAGS) -DDIM=1
+gcdlcmtest_SOURCES = gcdlcmtest.cc
 
-check_fvector_size_fail2_SOURCES = check_fvector_size_fail.cc
-check_fvector_size_fail2_CPPFLAGS = $(AM_CPPFLAGS) -DDIM=3
+genericiterator_compile_fail_SOURCES = genericiterator_compile_fail.cc
 
-check_fvector_size_SOURCES = check_fvector_size.cc
+# mention headers so that they are distributed too
+iteratorfacadetest_SOURCES = iteratorfacadetest.cc iteratorfacadetest.hh \
+   iteratortest.hh
 
-poolallocatortest_SOURCES = poolallocatortest.cc
+iteratorfacadetest2_SOURCES = iteratorfacadetest2.cc
 
-enumsettest_SOURCES=enumsettest.cc
+lrutest_SOURCES = lrutest.cc
 
-gcdlcmtest_SOURCES = gcdlcmtest.cc
+mpicollectivecommunication_SOURCES = mpicollectivecommunication.cc
+mpicollectivecommunication_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS)
+mpicollectivecommunication_LDADD = $(DUNEMPILIBS) $(LDADD)
+mpicollectivecommunication_LDFLAGS = $(AM_LDFLAGS) $(DUNEMPILDFLAGS)
+
+mpiguardtest_SOURCES = mpiguardtest.cc
+mpiguardtest_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS)
+mpiguardtest_LDADD = $(DUNEMPILIBS) $(LDADD)
+mpiguardtest_LDFLAGS = $(AM_LDFLAGS) $(DUNEMPILDFLAGS)
 
 mpihelpertest_SOURCES = mpihelpertest.cc
 mpihelpertest_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS)
@@ -195,19 +175,32 @@ mpihelpertest2_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS) -DMPIHELPER_PREINITI
 mpihelpertest2_LDADD = $(DUNEMPILIBS) $(LDADD)
 mpihelpertest2_LDFLAGS = $(AM_LDFLAGS) $(DUNEMPILDFLAGS)
 
-mpicollectivecommunication_SOURCES = mpicollectivecommunication.cc
-mpicollectivecommunication_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS)
-mpicollectivecommunication_LDADD = $(DUNEMPILIBS) $(LDADD)
-mpicollectivecommunication_LDFLAGS = $(AM_LDFLAGS) $(DUNEMPILDFLAGS)
+nullptr_test_SOURCES = nullptr-test.cc nullptr-test2.cc
+nullptr_test_fail_SOURCES = nullptr-test.cc
+nullptr_test_fail_CPPFLAGS = $(AM_CPPFLAGS) -DFAIL
 
-mpiguardtest_SOURCES = mpiguardtest.cc
-mpiguardtest_CPPFLAGS = $(AM_CPPFLAGS) $(DUNEMPICPPFLAGS)
-mpiguardtest_LDADD = $(DUNEMPILIBS) $(LDADD)
-mpiguardtest_LDFLAGS = $(AM_LDFLAGS) $(DUNEMPILDFLAGS)
+parametertreetest_SOURCES = parametertreetest.cc
+
+pathtest_SOURCES = pathtest.cc
+
+poolallocatortest_SOURCES = poolallocatortest.cc
+
+shared_ptrtest_config_SOURCES = shared_ptrtest.cc
+
+shared_ptrtest_dune_SOURCES = shared_ptrtest.cc
+shared_ptrtest_dune_CPPFLAGS = $(AM_CPPFLAGS)   \
+    -DDISABLE_CONFIGURED_SHARED_PTR
 
 singletontest_SOURCES = singletontest.cc
 
-utilitytest_SOURCES = utilitytest.cc
+sllisttest_SOURCES = sllisttest.cc
+
+sourcescheck_NOSOURCES = timing.cc
+
+static_assert_test_SOURCES = static_assert_test.cc
+static_assert_test_fail_SOURCES = static_assert_test_fail.cc
+
+streamtest_SOURCES = streamtest.cc
 
 testdebugallocator_SOURCES = testdebugallocator.cc
 testdebugallocator_CPPFLAGS = $(AM_CPPFLAGS)
@@ -266,13 +259,25 @@ testfconstruct_fail1_CPPFLAGS = $(AM_CPPFLAGS) -DFVSIZE=2
 testfconstruct_fail2_SOURCES = testfconstruct.cc
 testfconstruct_fail2_CPPFLAGS = $(AM_CPPFLAGS) -DFVSIZE=5
 
-conversiontest_SOURCES = conversiontest.cc
+testfloatcmp_SOURCES = testfloatcmp.cc
 
-sourcescheck_NOSOURCES = exprtmpl.cc timing.cc
+tuplestest_dune_SOURCES = tuplestest.cc
+tuplestest_dune_CPPFLAGS = $(AM_CPPFLAGS)       \
+    -DDISABLE_TR1_TUPLE -DDISABLE_STD_TUPLE
+
+tuplestest_std_SOURCES = tuplestest.cc
+
+tuplestest_tr1_SOURCES = tuplestest.cc
+tuplestest_tr1_CPPFLAGS = $(AM_CPPFLAGS)        \
+    -DDISABLE_STD_TUPLE
+
+tupleutilitytest_SOURCES = tupleutilitytest.cc
+
+typetraitstest_SOURCES = typetraitstest.cc
+
+utilitytest_SOURCES = utilitytest.cc
 
-testfloatcmp_SOURCES = testfloatcmp.cc
 
-genericiterator_compile_fail_SOURCES = genericiterator_compile_fail.cc
 
 include $(top_srcdir)/am/global-rules
 
diff --git a/dune/common/test/conversiontest.cc b/dune/common/test/conversiontest.cc
index 76d15cf98f77888b231ff858ca77a67650255018..b87b4b00edb21ebc13fca5a5d2c271ccb3a10f7d 100644
--- a/dune/common/test/conversiontest.cc
+++ b/dune/common/test/conversiontest.cc
@@ -1,5 +1,9 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <iostream>
 #include <dune/common/typetraits.hh>
 
diff --git a/dune/common/test/eigenvaluestest.cc b/dune/common/test/eigenvaluestest.cc
index dea8906f6395eb8a0d695c5e195818d0bb96066e..64812d135fd472c783eeeef79540a2bde3069e50 100644
--- a/dune/common/test/eigenvaluestest.cc
+++ b/dune/common/test/eigenvaluestest.cc
@@ -1,15 +1,15 @@
 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 // vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 //==============================================================================
 //!
-//! \file shapefunctions.hpp
-//!
 //! \date Nov 9 2011
 //!
 //! \author Arne Morten Kvarving / SINTEF
 //!
-//! \brief Classes for shape functions. Loosely based on code in dune-grid-howto
-//!
 //==============================================================================
 
 #include <dune/common/fvector.hh>
diff --git a/dune/common/test/exprtmpl.cc b/dune/common/test/exprtmpl.cc
deleted file mode 100644
index 4e57f196eebb4be75798c07d3bd3dfc25cb36f38..0000000000000000000000000000000000000000
--- a/dune/common/test/exprtmpl.cc
+++ /dev/null
@@ -1,333 +0,0 @@
-// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-// vi: set et ts=4 sw=2 sts=2:
-/*
-   TODO:
-   - test deeper Matrix nesting
-   - get rid of
-    int *M;
-   - fix RowBlock::N()
-   - remove second template parameter of FlatColIterator
-   - vectorentry -> exrpressionentry
-   - FlatColIterator<Matrix> does not work if Matrix is mutable
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <iostream>
-#include <fstream>
-#include <dune/common/fvector.hh>
-#include <dune/common/timer.hh>
-//#include <dune/istl/bvector.hh>
-//#include <dune/istl/io.hh>
-#include <dune/common/iteratorfacades.hh>
-
-Indent INDENT;
-
-void test_fvector()
-{
-  typedef Dune::FieldVector<double,2> VB;
-  VB v1(1);
-  VB v2(2);
-
-  typedef Dune::ExprTmpl::ConstRef<VB> RVB;
-  VB v = 0.5 * (v1 + v2 * 2) + 3 * v1 - v2;
-  std::cout << " 0.5 * ( " << v1 << " + " << v2 << " * 2) + 3 * " << v1 << " - " << v2 << std::endl;
-}
-
-void test_blockvector()
-{
-  Dune::FieldVector<double,2> v(10);
-  typedef Dune::FieldVector<double,2> VB;
-  typedef Dune::BlockVector<VB> BV;
-
-  const int sz = 3;
-  BV bv1(sz), bv2(sz);
-  bv1 = 1;
-  bv2 = 0;
-  bv2[1][0]=1;
-  bv2[1][1]=2;
-
-  BV bv(sz);
-  bv = -17;
-  printvector (std::cout, bv, "bv", "r");
-  //  bv.emptyClone(bv1);
-  std::cout << "Assingn from ConstRef\n";
-  bv = 2 * (bv1 + bv2);
-  bv -= 1;
-
-  printvector (std::cout, bv1, "bv1", "r");
-  printvector (std::cout, bv2, "bv2", "r");
-  printvector (std::cout, bv, "bv", "r");
-
-}
-
-void test_blockblockvector()
-{
-  const int bs = 2;
-  const int sz = 3;
-  typedef Dune::FieldVector<double,bs> VB;
-  typedef Dune::BlockVector<VB> BV;
-  typedef Dune::BlockVector<BV> BBV;
-  typedef Dune::ExprTmpl::ConstRef<BV> RBV;
-  BV bv1(sz), bv2(sz);
-  bv1 = 1;
-  bv2 = 0;
-  bv2[1][0]=1;
-  bv2[1][1]=2;
-
-  Dune::ExprTmpl::ConstRef<BV> rbv1(bv1);
-  Dune::ExprTmpl::ConstRef<BV> rbv2(bv2);
-
-  BBV bbv(2);
-  bbv[0].resize(bv1.N());
-  bbv[0] = Dune::ExprTmpl::Expression<RBV>(rbv1);
-  bbv[1].resize(bv2.N());
-  bbv[1] = Dune::ExprTmpl::Expression<RBV>(rbv2);
-
-  Dune::Timer stopwatch;
-  stopwatch.reset();
-  for (int i=0; i<10; i++) bbv *= 2;
-  std::cout << "Time bbv*2: " << stopwatch.elapsed() << std::endl;
-#ifndef NOPRINT
-  //   Dune::FlatIterator<BBV> fit(bbv.begin());
-  //   Dune::FlatIterator<BBV> fend(bbv.end());
-  //   int index = 0;
-  //   for(;fit!=fend;++fit)
-  //   {
-  //     BBV::field_type x;
-  //     x = *fit;
-  //     std::cout << index << "\t" << x << std::endl;
-  //     index++;
-  //   }
-  printvector (std::cout, bv1, "bv1", "r");
-  printvector (std::cout, bv2, "bv1", "r");
-  printvector (std::cout, bbv, "bbv", "r");
-#endif
-  std::cout << "infinity_norm(bbv)=" << infinity_norm(bbv) << std::endl;
-  std::cout << "two_norm(bbv)=" << two_norm(bbv) << std::endl;
-  std::cout << "bbv.two_norm()=" << bbv.two_norm() << std::endl;
-  std::cout << "two_norm2(bbv)=" << two_norm2(bbv) << std::endl;
-  std::cout << "one_norm(bbv)=" << one_norm(bbv) << std::endl;
-}
-
-// namespace Dune {
-
-// namespace ExprTmpl {
-
-// template <class K, int iN, int iM>
-// class MatrixMulVector< FieldMatrix<K,iN,iM>,
-//                        BCRSMatrix< FieldMatrix<K,iN,iM> >,
-//                        BlockVector< FieldVector<K,iM> > >
-// {
-// public:
-//   typedef BCRSMatrix< FieldMatrix<K,iN,iM> > Mat;
-//   typedef BlockVector< FieldVector<K,iM> > Vec;
-//   typedef typename
-//     BlockTypeN<MatrixMulVector<Mat,Mat,Vec>,
-//                MyDepth<FieldMatrix<K,iN,iM>,Mat>::value-1>::type
-//     ParentBlockType;
-//   /* constructor */
-//   MatrixMulVector(const Mat & _A, const Vec & _v, int* _DUNE_TEST_M,
-//                   const ParentBlockType & _parent) :
-//     parent(_parent), M(_DUNE_TEST_M), A(_A), v(_v )
-//     {
-//       int parent_i = M[0];
-//       typename Mat::ConstColIterator it = A[parent_i].begin();
-//       typename Mat::ConstColIterator end = A[parent_i].end();
-//       tmp = 0;
-//       for (; it!=end; ++it)
-//       {
-//         it->umv(tmp,v[it.index()]);
-//       }
-//     };
-//   K operator[] (int i) const {
-//     return tmp[i];
-//   }
-//   int N() const { iN; };
-//   const ParentBlockType & parent;
-// private:
-//   FieldVector<K,iN> tmp;
-//   mutable int* M;
-//   const Mat & A;
-//   const Vec & v;
-// };
-
-// } // NS ExpreTmpl
-
-// } // NS Dune
-
-//template<int BlockSize, int N, int M>
-template<int BN, int BM, int N, int M>
-void test_matrix()
-{
-  std::cout << "test_matrix<" << BN << ", " << BM << ", "
-            << N << ", " << M << ">\n";
-
-  typedef double matvec_t;
-  typedef Dune::FieldVector<matvec_t,BN> LVB;
-  typedef Dune::FieldVector<matvec_t,BM> VB;
-  typedef Dune::FieldMatrix<matvec_t,BN,BM> MB;
-  typedef Dune::BlockVector<LVB> LeftVector;
-  typedef Dune::BlockVector<VB> Vector;
-  typedef Dune::BCRSMatrix<MB> Matrix;
-
-  LVB a(0);
-  VB b(2);
-  MB _DUNE_TEST_M(1);
-  _DUNE_TEST_M[1][1] = 3;
-
-  // a += M * b
-  _DUNE_TEST_M.umv(b,a);
-
-#ifndef NOPRINT
-  printmatrix (std::cout, _DUNE_TEST_M, "Matrix", "r");
-  printvector (std::cout, a, "Vector", "r");
-#endif
-
-  // a = M * b
-#if 0
-  a = _DUNE_TEST_M*b;
-#endif
-
-#ifndef NOPRINT
-  printvector (std::cout, a, "Vector", "r");
-#endif
-
-  Matrix A(N,M,Matrix::row_wise);
-  typename Matrix::CreateIterator i=A.createbegin();
-  typename Matrix::CreateIterator end=A.createend();
-  std::cout << "Building matrix structure\n";
-  // build up the matrix structure
-  int c=0;
-  for (; i!=end; ++i)
-  {
-    // insert a non zero entry for myself
-    i.insert(c);
-    // insert index M-1
-    i.insert(M-1);
-    c++;
-  }
-  std::cout << "...done\n";
-
-#ifndef NOPRINT
-  std::cout << "Matrix coldim=" << A.coldim() << std::endl;
-  std::cout << "Matrix rowdim=" << A.rowdim() << std::endl;
-  std::cout << "Matrix N=" << A.M() << std::endl;
-  std::cout << "Matrix M=" << A.N() << std::endl;
-
-  std::cout << "Assembling matrix\n";
-  typename Matrix::Iterator rit=A.begin();
-  typename Matrix::Iterator rend=A.end();
-  for (; rit!=rend; ++rit)
-  {
-    typename Matrix::ColIterator cit=rit->begin();
-    typename Matrix::ColIterator cend=rit->end();
-    for (; cit!=cend; ++cit)
-    {
-      //    *rit = rit.index();
-      *cit = 10*cit.index()+rit.index();
-    }
-  }
-  std::cout << "...done\n";
-
-  printmatrix (std::cout, A, "Matrix", "r");
-#endif
-
-  LeftVector v(N);
-  LeftVector v2(N);
-  v = 0;
-  Vector x(M);
-  x = 1;
-  Dune::FlatIterator<Vector> fit = x.begin();
-  Dune::FlatIterator<Vector> fend = x.end();
-  c = 0;
-  for (; fit!=fend; ++fit)
-    *fit=c++;
-
-  Dune::Timer stopwatch;
-  stopwatch.reset();
-  A.umv(x,v);
-  std::cout << "Time umv: " << stopwatch.elapsed() << std::endl;
-
-  using namespace Dune;
-#ifndef NOPRINT
-  printvector (std::cout, x, "Vector X", "r");
-  printvector (std::cout, v, "Vector", "r");
-#endif
-
-  v2 = 0;
-  stopwatch.reset();
-  v2 += A * x;
-  std::cout << "Time v2+=A*x: " << stopwatch.elapsed() << std::endl;
-#ifndef NOPRINT
-  printvector (std::cout, v2, "Vector2", "r");
-#endif
-
-#ifndef NOPRINT
-  //   int rowIndex[]={1};
-  //   FlatColIterator<const Matrix> it(A[2].begin(),rowIndex);
-  //   for (int i=0; i<5; i++)
-  //   {
-  //     std::cout << *it << " ";
-  //     ++it;
-  //   }
-  //   std::cout << std::endl;
-#endif
-  std::cout << std::endl;
-}
-
-void test_norm()
-{
-  Dune::FieldVector<double,3> a,b;
-  double c;
-  c = (a-b).two_norm();
-  c = two_norm(a-b);
-}
-
-void test_sproduct()
-{
-  Dune::FieldVector<double,2> v(10);
-  typedef Dune::FieldVector<double,2> VB;
-  typedef Dune::BlockVector<VB> BV;
-
-  const int sz = 3;
-  BV bv1(sz), bv2(sz);
-  bv1 = 1;
-  bv2 = 0;
-  bv2[1][0]=1;
-  bv2[1][1]=2;
-
-  double x;
-  x = bv1[0] * bv2[0];
-  x = bv1 * bv2;
-}
-
-int main()
-{
-  //  Dune::dvverb.attach(std::cout);
-  try
-  {
-    //      test_fvector();
-    //      test_blockvector();
-    test_norm();
-    test_sproduct();
-    test_blockblockvector();
-    test_matrix<2,3,3,4>();
-#ifdef NOPRINT
-    test_matrix<3,6,400000,500000>();
-    test_matrix<6,3,400000,500000>();
-    test_matrix<30,60,4000,5000>();
-    test_matrix<150,150,500,4000>();
-    test_matrix<150,150,1000,2000>();
-#endif
-    //      test_matrix<150,150,2000,1000>(); // fails in fmeta_something
-    //      test_matrix<150,150,4000,500>(); // fails in fmeta_something
-  }
-  catch (Dune::Exception & e)
-  {
-    std::cout << e << std::endl;
-  }
-  return (0);
-}
diff --git a/dune/common/test/tupleutilitytest.cc b/dune/common/test/tupleutilitytest.cc
index 65de1540f109aaf02db7621a71c6e7d0affdf44c..6ee3e4fdd5fb2cc4c9c2a73d0e5010b15e996cc9 100644
--- a/dune/common/test/tupleutilitytest.cc
+++ b/dune/common/test/tupleutilitytest.cc
@@ -99,7 +99,7 @@ struct DivisorAccumulator
 
   typedef typename Data::second_type OldTuple;
   typedef typename Dune::PushBackTuple<OldTuple, PotentialDivisor>::type ExtendedTuple;
-  typedef typename Dune::SelectType<isDivisor, ExtendedTuple, OldTuple>::Type NewTuple;
+  typedef typename Dune::conditional<isDivisor, ExtendedTuple, OldTuple>::type NewTuple;
 
   typedef typename std::pair<typename Data::first_type, NewTuple> type;
 };
@@ -123,7 +123,7 @@ struct PrimeAccumulator
 {
   enum {isPrime = (Divisors<N::value>::value==2)};
 
-  typedef typename Dune::SelectType<isPrime, typename Dune::PushBackTuple<Data, N>::type, Data>::Type type;
+  typedef typename Dune::conditional<isPrime, typename Dune::PushBackTuple<Data, N>::type, Data>::type type;
 };
 
 // Construct list primes
diff --git a/dune/common/test/typetraitstest.cc b/dune/common/test/typetraitstest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a2d05bc7a6eb600a019246a14d4d899eb3763a0f
--- /dev/null
+++ b/dune/common/test/typetraitstest.cc
@@ -0,0 +1,72 @@
+// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// vi: set et ts=4 sw=2 sts=2:
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/** \file
+ * \brief Test the TypeTraits class
+ */
+
+#include <iostream>
+#include <cassert>
+
+#include <dune/common/typetraits.hh>
+
+int main() {
+
+  // Test TypeTraits::isPointer
+  assert( not Dune::TypeTraits<int>::isPointer );
+  assert(     Dune::TypeTraits<int*>::isPointer );
+  assert(     Dune::TypeTraits<int**>::isPointer );
+  assert(     Dune::TypeTraits<int(*)(int)>::isPointer );
+
+  // Test TypeTraits::isReference
+  assert( not Dune::TypeTraits<int>::isReference );
+  assert(     Dune::TypeTraits<int&>::isReference );
+#if HAVE_RVALUE_REFERENCES
+  assert( not Dune::TypeTraits<int&&>::isReference );
+#endif
+
+  // Test TypeTraits::PointeeType
+  assert( (Dune::is_same<Dune::Empty, Dune::TypeTraits<int>::PointeeType>::value) );
+  assert( (Dune::is_same<int,         Dune::TypeTraits<int*>::PointeeType>::value) );
+  assert( (Dune::is_same<int*,        Dune::TypeTraits<int**>::PointeeType>::value) );
+  assert( (Dune::is_same<const int,   Dune::TypeTraits<const int*>::PointeeType>::value) );
+  assert( (Dune::is_same<Dune::Empty, Dune::TypeTraits<int* const>::PointeeType>::value) );
+
+  // Test TypeTraits::ReferredType
+  assert( (Dune::is_same<int, Dune::TypeTraits<int>::ReferredType>::value) );
+  assert( (Dune::is_same<int, Dune::TypeTraits<int&>::ReferredType>::value) );
+
+  // Test is_pointer
+  assert( not Dune::is_pointer<int>::value );
+  assert(     Dune::is_pointer<int*>::value );
+  assert(     Dune::is_pointer<int**>::value );
+  assert(     Dune::is_pointer<int(*)(int)>::value );
+
+  // Test is_reference
+  assert( not Dune::is_lvalue_reference<int>::value );
+  assert(     Dune::is_lvalue_reference<int&>::value );
+#if HAVE_RVALUE_REFERENCES
+  assert( not Dune::is_lvalue_reference<int&&>::value );
+#endif
+
+  // Test remove_pointer
+  // Note: when the argument T is not a pointer, TypeTraits::PointeeType returns Dune::Empty,
+  // while Dune::remove_pointer (as std::remove_pointer), returns T itself
+  assert( (Dune::is_same<int,       Dune::remove_pointer<int>::type>::value) );
+  assert( (Dune::is_same<int,       Dune::remove_pointer<int*>::type>::value) );
+  assert( (Dune::is_same<int*,      Dune::remove_pointer<int**>::type>::value) );
+  assert( (Dune::is_same<const int, Dune::remove_pointer<const int*>::type>::value) );
+  assert( (Dune::is_same<int,       Dune::remove_pointer<int* const>::type>::value) );
+
+  // Test remove_reference
+  assert( (Dune::is_same<int, Dune::remove_reference<int>::type>::value) );
+  assert( (Dune::is_same<int, Dune::remove_reference<int&>::type>::value) );
+#if HAVE_RVALUE_REFERENCES
+  assert( (Dune::is_same<int, Dune::remove_reference<int&&>::type>::value) );
+#endif
+
+  return 0;
+}
diff --git a/dune/common/tupleutility.hh b/dune/common/tupleutility.hh
index 42fe3540e27697086c83c348ad8fd3861b833a0d..9fd019de50faa3db38d753aaa5cc021cfe8bae2d 100644
--- a/dune/common/tupleutility.hh
+++ b/dune/common/tupleutility.hh
@@ -1133,8 +1133,8 @@ namespace Dune {
    *
    * \note Since transformTuple() takes non-const references to the extra
    *       arguments, it will only bind to lvalue extra arguments, unless you
-   *       specify the corresconding template parameter as \c const \c
-   *       SomeType.  Specifically this meands that you cannot simply use
+   *       specify the corresponding template parameter as \c const \c
+   *       SomeType.  Specifically this means that you cannot simply use
    *       literals or function return values as extra arguments. Providing
    *       overloads for all possible combinations of rvalue and lvalue extra
    *       arguments would result in \f$2^{n+1}-1\f$ overloads where \f$n\f$
@@ -1511,10 +1511,10 @@ namespace Dune {
   template<class Tuple, template<class> class Predicate, std::size_t start = 0,
       std::size_t size = tuple_size<Tuple>::value>
   class FirstPredicateIndex :
-    public SelectType<Predicate<typename tuple_element<start,
+    public conditional<Predicate<typename tuple_element<start,
                 Tuple>::type>::value,
         integral_constant<std::size_t, start>,
-        FirstPredicateIndex<Tuple, Predicate, start+1> >::Type
+        FirstPredicateIndex<Tuple, Predicate, start+1> >::type
   {
     dune_static_assert(tuple_size<Tuple>::value == size, "The \"size\" "
                        "template parameter of FirstPredicateIndex is an "
@@ -1572,17 +1572,6 @@ namespace Dune {
    *
    * \tparam Tuple The tuple type to extend
    * \tparam T     The type to be appended to the tuple
-   *
-   * With variadic templates the generic specialization would be:
-   *
-   * \code
-   * template<class... TupleArgs, class T>
-   * struct PushBackTuple<typename Dune::tuple<TupleArgs...>, T>
-   * {
-   *   typedef typename Dune::tuple<TupleArgs..., T> type;
-   * };
-   * \endcode
-   *
    */
   template< class Tuple, class T>
   struct PushBackTuple
@@ -1607,6 +1596,13 @@ namespace Dune {
 
 #ifndef DOXYGEN
 
+#if HAVE_VARIADIC_TEMPLATES
+  template<class... TupleArgs, class T>
+  struct PushBackTuple<typename Dune::tuple<TupleArgs...>, T>
+  {
+    typedef typename Dune::tuple<TupleArgs..., T> type;
+  };
+#else
   template<class T>
   struct PushBackTuple< Dune::tuple<>, T>
   {
@@ -1660,6 +1656,7 @@ namespace Dune {
   {
     typedef typename Dune::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T> type;
   };
+#endif  // HAVE_VARIADIC_TEMPLATES
 
 #endif
 
@@ -1670,17 +1667,6 @@ namespace Dune {
    *
    * \tparam Tuple The tuple type to extend
    * \tparam T     The type to be prepended to the tuple
-   *
-   * With variadic templates the generic specialization would be:
-   *
-   * \code
-   * template<class... TupleArgs, class T>
-   * struct PushFrontTuple<typename Dune::tuple<TupleArgs...>, T>
-   * {
-   *   typedef typename Dune::tuple<T, TupleArgs...> type;
-   * };
-   * \endcode
-   *
    */
   template< class Tuple, class T>
   struct PushFrontTuple
@@ -1705,6 +1691,13 @@ namespace Dune {
 
 #ifndef DOXYGEN
 
+#if HAVE_VARIADIC_TEMPLATES
+  template<class... TupleArgs, class T>
+  struct PushFrontTuple<typename Dune::tuple<TupleArgs...>, T>
+  {
+    typedef typename Dune::tuple<T, TupleArgs...> type;
+  };
+#else
   template<class T>
   struct PushFrontTuple< Dune::tuple<>, T>
   {
@@ -1758,6 +1751,7 @@ namespace Dune {
   {
     typedef typename Dune::tuple<T, T1, T2, T3, T4, T5, T6, T7, T8> type;
   };
+#endif //  HAVE_VARIADIC_TEMPLATES
 
 #endif
 
diff --git a/dune/common/typetraits.hh b/dune/common/typetraits.hh
index 561086be632e88eb429b28b1cf6b5a4bb32deb35..a8744228c0b4c6be36be36680d990c732736d746 100644
--- a/dune/common/typetraits.hh
+++ b/dune/common/typetraits.hh
@@ -9,6 +9,8 @@
 #include <tr1/type_traits>
 #endif
 
+#include <dune/common/deprecated.hh>
+
 namespace Dune
 {
 
@@ -30,6 +32,12 @@ namespace Dune
   /**
    * @brief General type traits class to check whether type is reference or
    * pointer type
+   *
+   * \deprecated This class will be replaced by alternatives found in the C++11 stl.
+   *   - Use is_pointer<T>::value instead of TypeTraits<T>::isPointer
+   *   - Use is_lvalue_reference<T>::value instead of TypeTraits<T>::isReference
+   *   - Use remove_pointer<T>::type instead of TypeTraits<T>::PointeeType
+   *   - Use remove_reference<T>::type instead of TypeTraits<T>::ReferredType
    */
   template <typename T>
   class TypeTraits
@@ -61,10 +69,10 @@ namespace Dune
 
   public:
     enum { isPointer = PointerTraits<T>::result };
-    typedef typename PointerTraits<T>::PointeeType PointeeType;
+    typedef typename PointerTraits<T>::PointeeType PointeeType DUNE_DEPRECATED_MSG("Use remove_pointer instead!");
 
     enum { isReference = ReferenceTraits<T>::result };
-    typedef typename ReferenceTraits<T>::ReferredType ReferredType;
+    typedef typename ReferenceTraits<T>::ReferredType ReferredType DUNE_DEPRECATED_MSG("Use remove_reference instead!");
   };
 
   /**
@@ -370,8 +378,10 @@ namespace Dune
    *
    * If template parameter first is true T1 is selected
    * otherwise T2 will be selected.
-   * The selected type id accessible through the typedef
+   * The selected type is accessible through the typedef
    * Type.
+   *
+   * \deprecated Will be removed after dune-common-2.3, use 'conditional' instead.
    */
   template<bool first, class T1, class T2>
   struct SelectType
@@ -382,15 +392,53 @@ namespace Dune
      * if first is true this will be type T1 and
      * otherwise T2
      */
-    typedef T1 Type;
-  };
+    typedef T1 Type DUNE_DEPRECATED_MSG("Use Dune::conditional::type instead");
+  } DUNE_DEPRECATED;
 
   template<class T1, class T2>
   struct SelectType<false,T1,T2>
   {
-    typedef T2 Type;
+    typedef T2 Type DUNE_DEPRECATED_MSG("Use Dune::conditional::type instead");
   };
 
+#if DOXYGEN || !HAVE_STD_CONDITIONAL
+
+   /**
+   * @brief Select a type based on a condition.
+   *
+   * If template parameter first is true T1 is selected
+   * otherwise T2 will be selected.
+   * The selected type is accessible through the typedef
+   * type.
+   *
+   * \note If available, this uses C++11 std::conditional, otherwise it provides
+   *       a reimplementation.
+   */
+  template<bool first, class T1, class T2>
+  struct conditional
+  {
+    /**
+     * @brief The selected type
+     *
+     * if first is true this will be type T1 and
+     * T2 otherwise
+     */
+    typedef T1 type;
+  };
+
+  template<class T1, class T2>
+  struct conditional<false,T1,T2>
+  {
+    typedef T2 type;
+  };
+
+#else // DOXYGEN || !HAVE_STD_CONDITIONAL
+
+  // pull in default implementation
+  using std::conditional;
+
+#endif // DOXYGEN || !HAVE_STD_CONDITIONAL
+
   ////////////////////////////////////////////////////////////////////////
   //
   // integral_constant (C++0x 20.7.3 "Helper classes")
@@ -423,6 +471,53 @@ namespace Dune
   typedef integral_constant<bool, false> false_type;
 #endif // #else // #if HAVE_INTEGRAL_CONSTANT
 
+  template<typename>
+  struct __is_pointer_helper
+  : public false_type { };
+
+  template<typename T>
+  struct __is_pointer_helper<T*>
+  : public true_type { };
+
+  /// is_pointer
+  template<typename T>
+  struct is_pointer
+  : public integral_constant<bool, (__is_pointer_helper<T>::value)>
+    { };
+
+  // Helper class for is_lvalue_reference
+  template<typename>
+  struct __is_lvalue_reference_helper
+  : public false_type { };
+
+  template<typename T>
+  struct __is_lvalue_reference_helper<T&>
+  : public true_type { };
+
+  /** \brief Determine whether a type is a lvalue reference type */
+  template<typename T>
+  struct is_lvalue_reference
+  : public integral_constant<bool, (__is_lvalue_reference_helper<T>::value)>
+    { };
+
+  template<typename _Tp>
+    struct __remove_pointer_helper
+    { typedef _Tp     type; };
+
+  template<typename _Tp>
+    struct __remove_pointer_helper<_Tp*>
+    { typedef _Tp     type; };
+
+  /** \brief Return the type a pointer type points to
+   *
+   * \note When the argument T is not a pointer, TypeTraits::PointeeType returns Dune::Empty,
+   * while Dune::remove_pointer (as std::remove_pointer), returns T itself.
+   */
+  template<typename _Tp>
+    struct remove_pointer
+    : public __remove_pointer_helper<typename remove_const<_Tp>::type >
+    { };
+
   /** @} */
 }
 #endif
diff --git a/lib/dunecommonam2cmake.lib b/lib/dunecommonam2cmake.lib
index 2a041d7ffe3c763d1343f8136484201a93ac8ac8..e28682e39e2c770b0737587b2640087f9b127faa 100644
--- a/lib/dunecommonam2cmake.lib
+++ b/lib/dunecommonam2cmake.lib
@@ -20,18 +20,18 @@ dune_common_options_am2cmake()
     default_am2cmake_options $CMAKE_PACKAGES
 
     # Check for --enable-parallel and otherwise deactivate MPI
-    echo $PARAMS | grep \\-\\-enable-parallel
+    echo $PARAMS | grep \\-\\-enable-parallel > /dev/null
     if test "$?" -ne 0 ; then
 	CMAKE_PARAMS="$CMAKE_PARAMS -DCMAKE_DISABLE_FIND_PACKAGE_MPI=TRUE"
     fi
     # Check for --disable-gxx0xcheck
-    echo $PARAMS | grep \\-\\-disable-gxx0xcheck
+    echo $PARAMS | grep \\-\\-disable-gxx0xcheck > /dev/null
     if test "$?" -eq 0 ; then
         CMAKE_PARAMS="$CMAKE_PARAMS -DDISABLE_GXX0XCHECK:Bool=TRUE"
     fi
 
     # Check for --disable-gxx0xcheck
-    echo $PARAMS | grep \\-\\-disable-tr1-headers
+    echo $PARAMS | grep \\-\\-disable-tr1-headers > /dev/null
     if test "$?" -eq 0 ; then
         CMAKE_PARAMS="$CMAKE_PARAMS -DDISABLE_TR1_HEADERS:Bool=TRUE"
     fi
diff --git a/m4/CMakeLists.txt b/m4/CMakeLists.txt
index 2dad4917041f0381b95688e6919b5a275c53c1e6..1b062c9cf46b2483d617fe4be737b0dc09f24426 100644
--- a/m4/CMakeLists.txt
+++ b/m4/CMakeLists.txt
@@ -14,6 +14,7 @@ install(PROGRAMS
         cxx0x_variadic.m4
         cxx0x_variadic_constructor_sfinae.m4
         cxx11_initializer_list.m4
+        cxx11_conditional.m4
         dune.m4
         dune_all.m4
         dune_autobuild.m4
diff --git a/m4/Makefile.am b/m4/Makefile.am
index e16142f8b8a829679b1440f14ec92f58521ee09e..bfbdb06fbf56007c359eb62ed5cb1f6775905118 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -18,6 +18,7 @@ ALLM4S = 					\
 	cxx0x_variadic.m4			\
 	cxx0x_variadic_constructor_sfinae.m4    \
 	cxx11_initializer_list.m4		\
+	cxx11_conditional.m4			\
 	dune.m4					\
 	dune_all.m4				\
 	dune_autobuild.m4			\
diff --git a/m4/cxx11_conditional.m4 b/m4/cxx11_conditional.m4
new file mode 100644
index 0000000000000000000000000000000000000000..8bbe0c874e30ffb9eb0d4afa7f245db44d297788
--- /dev/null
+++ b/m4/cxx11_conditional.m4
@@ -0,0 +1,25 @@
+# tests for C++11 conditional support
+# the associated macro is called HAVE_STD_CONDITIONAL
+
+AC_DEFUN([CXX11_CONDITIONAL_CHECK],[
+  AC_CACHE_CHECK([for C++11 std::conditional], dune_cv_cxx11_conditional_support, [
+    AC_REQUIRE([AC_PROG_CXX])
+    AC_REQUIRE([GXX0X])
+    AC_LANG_PUSH([C++])
+    AC_RUN_IFELSE([
+      AC_LANG_PROGRAM([
+
+        #include <type_traits>
+
+        ],
+        [
+          return std::conditional<true,std::integral_constant<int,0>,void>::type::value;
+        ])],
+      dune_cv_cxx11_conditional_support=yes,
+      dune_cv_cxx11_conditional_support=no)
+    AC_LANG_POP
+  ])
+  if test "x$dune_cv_cxx11_conditional_support" = xyes; then
+    AC_DEFINE(HAVE_STD_CONDITIONAL, 1, [Define to 1 if C++11 std::conditional is supported])
+  fi
+])
diff --git a/m4/dune_common.m4 b/m4/dune_common.m4
index 5a9735feca6752006488d6718a9cb71cb5122666..d9debceff2c364d0257acd3fef2190bb4cb31048 100644
--- a/m4/dune_common.m4
+++ b/m4/dune_common.m4
@@ -25,6 +25,7 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
   AC_REQUIRE([VARIADIC_TEMPLATES_CHECK])
   AC_REQUIRE([RVALUE_REFERENCES_CHECK])
   AC_REQUIRE([INITIALIZER_LIST_CHECK])
+  AC_REQUIRE([CXX11_CONDITIONAL_CHECK])
   AC_REQUIRE([DUNE_BOOST_BASE])
   AC_REQUIRE([MAKE_SHARED])
   AC_REQUIRE([DUNE_LINKCXX])
@@ -78,7 +79,7 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
 AC_DEFUN([DUNE_COMMON_CHECK_MODULE],
 [
     DUNE_CHECK_MODULES([dune-common], [common/stdstreams.hh],
-	[#ifndef DUNE_MINIMAL_DEBUG_LEVEL 
+	[#ifndef DUNE_MINIMAL_DEBUG_LEVEL
    #define DUNE_MINIMAL_DEBUG_LEVEL 1
    #endif
 	Dune::derr.active();])
diff --git a/m4/mpi-config.m4 b/m4/mpi-config.m4
index 644f4d5d5487850b03fd6d4423d2ca4bd27cc6c4..b5c5891eb8df3485c98e0181f6214fd7a676b2e5 100644
--- a/m4/mpi-config.m4
+++ b/m4/mpi-config.m4
@@ -5,6 +5,12 @@ mpi_trybuild () {
   return 0
 }
 
+mpi_trybuild_run () {
+  mpi_trybuild "-o conftest ${1}" || return 1
+  ./conftest 2>&1 || return 1
+  return 0
+}
+
 mpi_preprocess () {
   $MPICC -E -c ${1} 2> /dev/null
 }
@@ -177,7 +183,29 @@ _EOF
 
     AC_MSG_RESULT([yes])
     rm -f conftest*
-    return 0    
+    return 0
+  fi
+
+  rm -f conftest*
+  AC_MSG_RESULT([no])
+  return 1
+}
+
+test_mpich3 () {
+  AC_MSG_CHECKING([for mpich 3.x])
+  cat >conftest.c <<_EOF
+#include <mpi.h>
+#include <stdio.h>
+int main() { printf ("%s\n", MPICH_VERSION); return 0; }
+_EOF
+
+  if (mpi_trybuild_run "conftest.c" | grep -q "^3\.") ; then
+    dune_MPI_VERSION="MPICH2"
+    mpi_getmpich2flags
+
+    AC_MSG_RESULT([yes])
+    rm -f conftest*
+    return 0
   fi
 
   rm -f conftest*
@@ -316,6 +344,7 @@ get_mpiparameters() {
   test_mvapich && return
   test_mvapich2 && return
   test_mpich2 && return
+  test_mpich3 && return
   test_ibmmpi && return
   test_intelmpi && return
    
diff --git a/m4/parmetis.m4 b/m4/parmetis.m4
index 8c15ae0f08c32d748ca1ae4b44ce8734027093dc..8e8ae242f553e7feac1de207bf3544ad9d4c7ea1 100644
--- a/m4/parmetis.m4
+++ b/m4/parmetis.m4
@@ -148,13 +148,12 @@ AC_DEFUN([DUNE_PATH_PARMETIS],[
 		  This is only true if MPI was found by configure 
 		  _and_ if the application uses the PARMETIS_CPPFLAGS])
 	  AC_MSG_RESULT(ok)
-	  
-    # add to global list
-	  DUNE_PKG_LIBS="$PARMETIS_LIBS $DUNE_PKG_LIBS"
-	  DUNE_PKG_LDFLAGS="$DUNE_PKG_LDFLAGS $PARMETIS_LDFLAGS"
-	  DUNE_PKG_CPPFLAGS="$DUNE_PKG_CPPFLAGS $PARMETIS_CPPFLAGS"
-	  
-    # re-set variable correctly
+
+          # add to global list
+          DUNE_ADD_ALL_PKG([PARMETIS], [\${PARMETIS_CPPFLAGS}],
+                           [\${PARMETIS_LDFLAGS}], [\${PARMETIS_LIBS}])
+
+          # re-set variable correctly
 	  with_parmetis="yes"
       else
 	  with_parmetis="no"