From a0a753a6d144f7c51a03b9a000f66223c1b0ba6f Mon Sep 17 00:00:00 2001
From: Christoph Grueninger <christoph.grueninger@iws.uni-stuttgart.de>
Date: Mon, 25 Feb 2013 17:39:55 +0000
Subject: [PATCH] Fix tests using AMG linear solver backend when PDELab is not
 present. (reviewed by bernd)

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10261 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/linear/amgbackend.hh              |  5 ++++-
 test/decoupled/2p/test_impesadaptive.cc |  4 ++--
 test/decoupled/2p/test_impesproblem.hh  |  8 ++++++--
 test/decoupled/2p/test_impeswithamg.cc  | 14 ++++++++++++++
 test/implicit/1p/1ptestproblem.hh       |  9 +++++++--
 test/implicit/1p/test_box1pwithamg.cc   | 14 ++++++++++++++
 test/implicit/1p/test_cc1pwithamg.cc    | 14 ++++++++++++++
 7 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/dumux/linear/amgbackend.hh b/dumux/linear/amgbackend.hh
index a8992acbb4..f23477f426 100644
--- a/dumux/linear/amgbackend.hh
+++ b/dumux/linear/amgbackend.hh
@@ -24,6 +24,8 @@
 #ifndef DUMUX_AMGBACKEND_HH
 #define DUMUX_AMGBACKEND_HH
 
+#if HAVE_DUNE_PDELAB
+
 #include <dune/pdelab/gridoperator/gridoperator.hh>
 #include <dune/pdelab/backend/novlpistlsolverbackend.hh>
 #include <dune/pdelab/backend/ovlpistlsolverbackend.hh>
@@ -404,4 +406,5 @@ private:
 
 } // namespace Dumux
 
-#endif
+#endif // HAVE_DUNE_PDELAB
+#endif // DUMUX_AMGBACKEND_HH
diff --git a/test/decoupled/2p/test_impesadaptive.cc b/test/decoupled/2p/test_impesadaptive.cc
index eb29603786..07389c83eb 100644
--- a/test/decoupled/2p/test_impesadaptive.cc
+++ b/test/decoupled/2p/test_impesadaptive.cc
@@ -65,6 +65,6 @@ int main(int argc, char** argv)
 int main()
 {
     std::cerr << "You need to have ALUGrid installed to run this test\n";
-    return 1;
+    return 77;
 }
-#endif
+#endif // HAVE_ALUGRID
diff --git a/test/decoupled/2p/test_impesproblem.hh b/test/decoupled/2p/test_impesproblem.hh
index a1bd73b717..52f35a5dc1 100644
--- a/test/decoupled/2p/test_impesproblem.hh
+++ b/test/decoupled/2p/test_impesproblem.hh
@@ -49,8 +49,12 @@
 #include<dumux/decoupled/2p/transport/fv/evalcflfluxcoats.hh>
 
 #ifdef USE_AMGBACKEND
+#if HAVE_DUNE_PDELAB
 #include <dumux/linear/amgbackend.hh>
-#endif
+#else // HAVE_DUNE_PDELAB
+#warning You have to install dune-pdelab to use the AMG backend.
+#endif // HAVE_DUNE_PDELAB
+#endif //USE_AMGBACKEND
 
 namespace Dumux
 {
@@ -128,7 +132,7 @@ SET_TYPE_PROP(IMPESTestProblem, EvalCflFluxFunction, Dumux::EvalCflFluxCoats<Typ
 
 SET_SCALAR_PROP(IMPESTestProblem, ImpetCFLFactor, 0.95);
 
-#ifdef USE_AMGBACKEND
+#if defined(USE_AMGBACKEND) && HAVE_DUNE_PDELAB
 // 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/decoupled/2p/test_impeswithamg.cc b/test/decoupled/2p/test_impeswithamg.cc
index e8b7b98055..2f3b8d81f9 100644
--- a/test/decoupled/2p/test_impeswithamg.cc
+++ b/test/decoupled/2p/test_impeswithamg.cc
@@ -24,6 +24,8 @@
  */
 #include "config.h"
 
+#if HAVE_DUNE_PDELAB
+
 #include "test_impesproblem.hh"
 #include <dumux/common/start.hh>
 
@@ -63,3 +65,15 @@ int main(int argc, char** argv)
     typedef TTAG(IMPESTestProblemWithAMG) ProblemTypeTag;
     return Dumux::start<ProblemTypeTag>(argc, argv, usage);
 }
+#else
+
+#warning You need to have dune-pdelab installed to run this test
+
+#include <iostream>
+
+int main()
+{
+    std::cerr << "You need to have dune-pdelab installed to run this test\n";
+    return 77;
+}
+#endif // HAVE_DUNE_PDELAB
diff --git a/test/implicit/1p/1ptestproblem.hh b/test/implicit/1p/1ptestproblem.hh
index b52ee62df1..35b8a048b6 100644
--- a/test/implicit/1p/1ptestproblem.hh
+++ b/test/implicit/1p/1ptestproblem.hh
@@ -39,9 +39,14 @@
 #include <dumux/implicit/common/implicitporousmediaproblem.hh>
 #include <dumux/material/components/simpleh2o.hh>
 #include <dumux/material/fluidsystems/liquidphase.hh>
+
 #ifdef USE_AMGBACKEND
+#if HAVE_DUNE_PDELAB
 #include <dumux/linear/amgbackend.hh>
-#endif
+#else // HAVE_DUNE_PDELAB
+#warning You have to install dune-pdelab to use the AMG backend.
+#endif // HAVE_DUNE_PDELAB
+#endif //USE_AMGBACKEND
 
 #include "1ptestspatialparams.hh"
 
@@ -87,7 +92,7 @@ SET_INT_PROP(OnePTestProblem, LinearSolverVerbosity, 0);
 SET_INT_PROP(OnePTestProblem, LinearSolverPreconditionerIterations, 1);
 SET_SCALAR_PROP(OnePTestProblem, LinearSolverPreconditionerRelaxation, 1.0);
 
-#ifdef USE_AMGBACKEND
+#if defined(USE_AMGBACKEND) && HAVE_DUNE_PDELAB
 NEW_TYPE_TAG(OnePTestBoxProblemWithAMG, INHERITS_FROM(OnePTestBoxProblem));
 NEW_TYPE_TAG(OnePTestCCProblemWithAMG, INHERITS_FROM(OnePTestCCProblem));
 // Solver settings for the tests using AMG
diff --git a/test/implicit/1p/test_box1pwithamg.cc b/test/implicit/1p/test_box1pwithamg.cc
index d37ee109c6..43def75bcf 100644
--- a/test/implicit/1p/test_box1pwithamg.cc
+++ b/test/implicit/1p/test_box1pwithamg.cc
@@ -21,6 +21,8 @@
  *
  * \brief test for the one-phase box model
  */
+#if HAVE_DUNE_PDELAB
+
 #include "config.h"
 #include "1ptestproblem.hh"
 #include <dumux/common/start.hh>
@@ -62,3 +64,15 @@ int main(int argc, char** argv)
     typedef TTAG(OnePTestBoxProblemWithAMG) ProblemTypeTag;
     return Dumux::start<ProblemTypeTag>(argc, argv, usage);
 }
+#else
+
+#warning You need to have dune-pdelab installed to run this test
+
+#include <iostream>
+
+int main()
+{
+    std::cerr << "You need to have dune-pdelab installed to run this test\n";
+    return 77;
+}
+#endif // HAVE_DUNE_PDELAB
diff --git a/test/implicit/1p/test_cc1pwithamg.cc b/test/implicit/1p/test_cc1pwithamg.cc
index 22ed34dae3..b0122c6203 100644
--- a/test/implicit/1p/test_cc1pwithamg.cc
+++ b/test/implicit/1p/test_cc1pwithamg.cc
@@ -21,6 +21,8 @@
  *
  * \brief test for the one-phase box model
  */
+#if HAVE_DUNE_PDELAB
+
 #include "config.h"
 #include "1ptestproblem.hh"
 #include <dumux/common/start.hh>
@@ -62,3 +64,15 @@ int main(int argc, char** argv)
     typedef TTAG(OnePTestCCProblemWithAMG) ProblemTypeTag;
     return Dumux::start<ProblemTypeTag>(argc, argv, usage);
 }
+#else
+
+#warning You need to have dune-pdelab installed to run this test
+
+#include <iostream>
+
+int main()
+{
+    std::cerr << "You need to have dune-pdelab installed to run this test\n";
+    return 77;
+}
+#endif // HAVE_DUNE_PDELAB
-- 
GitLab