From 747d6c0f7ee18f5174ca2085c1cfff46d194aaaa Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Wed, 6 Feb 2013 18:16:25 +0000
Subject: [PATCH] Set a preprocessor variable USE_AMGBACKEND for the tests that
 use the AMG backend. Checking for this variable avoids that PDELab has to be
 patched even if one does not want to use the backend. Not a very elegant
 solution, better ones are welcome. Brought to attention by Markus.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10183 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 test/decoupled/2p/Makefile.am          | 1 +
 test/decoupled/2p/test_impesproblem.hh | 4 ++--
 test/implicit/1p/1ptestproblem.hh      | 8 ++++++--
 test/implicit/1p/Makefile.am           | 5 +++++
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/test/decoupled/2p/Makefile.am b/test/decoupled/2p/Makefile.am
index c9d58eba87..e6c9b62243 100644
--- a/test/decoupled/2p/Makefile.am
+++ b/test/decoupled/2p/Makefile.am
@@ -12,6 +12,7 @@ test_impes_SOURCES = test_impes.cc
 test_impesadaptive_SOURCES = test_impesadaptive.cc
 
 test_impeswithamg_SOURCES = test_impeswithamg.cc
+test_impeswithamg_CXXFLAGS = -DUSE_AMGBACKEND
 
 test_transport_SOURCES = test_transport.cc
 
diff --git a/test/decoupled/2p/test_impesproblem.hh b/test/decoupled/2p/test_impesproblem.hh
index d773b640ad..a1bd73b717 100644
--- a/test/decoupled/2p/test_impesproblem.hh
+++ b/test/decoupled/2p/test_impesproblem.hh
@@ -48,7 +48,7 @@
 
 #include<dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh>
 
-#if HAVE_DUNE_PDELAB
+#ifdef USE_AMGBACKEND
 #include <dumux/linear/amgbackend.hh>
 #endif
 
@@ -128,7 +128,7 @@ SET_TYPE_PROP(IMPESTestProblem, EvalCflFluxFunction, Dumux::EvalCflFluxCoats<Typ
 
 SET_SCALAR_PROP(IMPESTestProblem, ImpetCFLFactor, 0.95);
 
-#if HAVE_DUNE_PDELAB
+#ifdef USE_AMGBACKEND
 // set up an additional problem where the AMG backend is used
 NEW_TYPE_TAG(IMPESTestProblemWithAMG, INHERITS_FROM(IMPESTestProblem));
 // use the AMG backend for the corresponding test
diff --git a/test/implicit/1p/1ptestproblem.hh b/test/implicit/1p/1ptestproblem.hh
index 3068f520d9..b52ee62df1 100644
--- a/test/implicit/1p/1ptestproblem.hh
+++ b/test/implicit/1p/1ptestproblem.hh
@@ -39,7 +39,9 @@
 #include <dumux/implicit/common/implicitporousmediaproblem.hh>
 #include <dumux/material/components/simpleh2o.hh>
 #include <dumux/material/fluidsystems/liquidphase.hh>
+#ifdef USE_AMGBACKEND
 #include <dumux/linear/amgbackend.hh>
+#endif
 
 #include "1ptestspatialparams.hh"
 
@@ -53,8 +55,6 @@ namespace Properties
 NEW_TYPE_TAG(OnePTestProblem, INHERITS_FROM(OneP));
 NEW_TYPE_TAG(OnePTestBoxProblem, INHERITS_FROM(BoxModel, OnePTestProblem));
 NEW_TYPE_TAG(OnePTestCCProblem, INHERITS_FROM(CCModel, OnePTestProblem));
-NEW_TYPE_TAG(OnePTestBoxProblemWithAMG, INHERITS_FROM(OnePTestBoxProblem));
-NEW_TYPE_TAG(OnePTestCCProblemWithAMG, INHERITS_FROM(OnePTestCCProblem));
 
 SET_PROP(OnePTestProblem, Fluid)
 {
@@ -87,9 +87,13 @@ SET_INT_PROP(OnePTestProblem, LinearSolverVerbosity, 0);
 SET_INT_PROP(OnePTestProblem, LinearSolverPreconditionerIterations, 1);
 SET_SCALAR_PROP(OnePTestProblem, LinearSolverPreconditionerRelaxation, 1.0);
 
+#ifdef USE_AMGBACKEND
+NEW_TYPE_TAG(OnePTestBoxProblemWithAMG, INHERITS_FROM(OnePTestBoxProblem));
+NEW_TYPE_TAG(OnePTestCCProblemWithAMG, INHERITS_FROM(OnePTestCCProblem));
 // Solver settings for the tests using AMG
 SET_TYPE_PROP(OnePTestBoxProblemWithAMG, LinearSolver, Dumux::AMGBackend<TypeTag> );
 SET_TYPE_PROP(OnePTestCCProblemWithAMG, LinearSolver, Dumux::AMGBackend<TypeTag> );
+#endif
 
 // Enable gravity
 SET_BOOL_PROP(OnePTestProblem, ProblemEnableGravity, true);
diff --git a/test/implicit/1p/Makefile.am b/test/implicit/1p/Makefile.am
index 1fd82a0f14..73688b0dff 100644
--- a/test/implicit/1p/Makefile.am
+++ b/test/implicit/1p/Makefile.am
@@ -4,8 +4,13 @@ noinst_HEADERS = *.hh
 EXTRA_DIST=*reference.vtu *.input grids/*.dgf CMakeLists.txt
 
 test_box1p_SOURCES = test_box1p.cc
+
 test_cc1p_SOURCES = test_cc1p.cc
+
 test_box1pwithamg_SOURCES = test_box1pwithamg.cc
+test_box1pwithamg_CXXFLAGS = -DUSE_AMGBACKEND
+
 test_cc1pwithamg_SOURCES = test_cc1pwithamg.cc
+test_cc1pwithamg_CXXFLAGS = -DUSE_AMGBACKEND
 
 include $(top_srcdir)/am/global-rules
-- 
GitLab