diff --git a/patches/pdelab-1.0.1.patch b/patches/pdelab-1.0.1.patch index b52635f510aa4fdd46eb78659c17ef78ff47e87b..44ddfcc7768c0039a784bb17904ab582ace69461 100644 --- a/patches/pdelab-1.0.1.patch +++ b/patches/pdelab-1.0.1.patch @@ -1,8 +1,19 @@ Index: dune/pdelab/backend/istlvectorbackend.hh =================================================================== ---- dune/pdelab/backend/istlvectorbackend.hh (revision 2221) +--- dune/pdelab/backend/istlvectorbackend.hh (revision 2292) +++ dune/pdelab/backend/istlvectorbackend.hh (working copy) -@@ -30,6 +30,8 @@ +@@ -3,6 +3,10 @@ + #ifndef DUNE_ISTLVECTORBACKEND_HH + #define DUNE_ISTLVECTORBACKEND_HH + ++// Needed to detect in Dumux whether PDELab is patched. ++// TODO: this should be replaced by a proper configure test. ++#define DUNE_PDELAB_IS_PATCHED_FOR_DUMUX ++ + #include<vector> + + #include<dune/common/fvector.hh> +@@ -30,6 +34,8 @@ typedef typename ContainerType::size_type size_type; typedef ISTLVectorBackend<BLOCKSIZE> Backend; @@ -11,7 +22,7 @@ Index: dune/pdelab/backend/istlvectorbackend.hh ISTLBlockVectorContainer (const T& t_) : container(t_.globalSize()/BLOCKSIZE) {} ISTLBlockVectorContainer (const T& t_, const E& e) : container(t_.globalSize()/BLOCKSIZE) -@@ -89,6 +91,11 @@ +@@ -89,6 +95,11 @@ return container.two_norm(); } @@ -23,7 +34,7 @@ Index: dune/pdelab/backend/istlvectorbackend.hh typename Dune::template FieldTraits<E>::real_type one_norm() const { return container.one_norm(); -@@ -163,6 +170,16 @@ +@@ -163,6 +174,16 @@ return container.size()*BLOCKSIZE; } @@ -42,7 +53,7 @@ Index: dune/pdelab/backend/istlvectorbackend.hh { Index: dune/pdelab/backend/novlpistlsolverbackend.hh =================================================================== ---- dune/pdelab/backend/novlpistlsolverbackend.hh (revision 2221) +--- dune/pdelab/backend/novlpistlsolverbackend.hh (revision 2292) +++ dune/pdelab/backend/novlpistlsolverbackend.hh (working copy) @@ -1153,7 +1153,7 @@ int verbose_=1, bool reuse_=false, @@ -68,7 +79,7 @@ Index: dune/pdelab/backend/novlpistlsolverbackend.hh #if HAVE_MPI Index: dune/pdelab/backend/ovlpistlsolverbackend.hh =================================================================== ---- dune/pdelab/backend/ovlpistlsolverbackend.hh (revision 2221) +--- dune/pdelab/backend/ovlpistlsolverbackend.hh (revision 2292) +++ dune/pdelab/backend/ovlpistlsolverbackend.hh (working copy) @@ -794,7 +794,7 @@ ISTLBackend_AMG(const GFS& gfs_, unsigned maxiter_=5000, @@ -79,12 +90,13 @@ Index: dune/pdelab/backend/ovlpistlsolverbackend.hh verbose(verbose_), reuse(reuse_), firstapply(true), usesuperlu(usesuperlu_) { -@@ -855,11 +855,11 @@ +@@ -855,11 +855,12 @@ \param[in] r right hand side \param[in] reduction to be achieved */ - void apply(M& A, V& z, V& r, typename V::ElementType reduction) -+ void apply(MatrixType& A, V& z, V& r, typename V::ElementType reduction) ++ template <class Vector> ++ void apply(MatrixType& A, Vector& z, Vector& r, typename V::ElementType reduction) { Timer watch; Comm oocc(gfs.gridView().comm()); @@ -93,9 +105,19 @@ Index: dune/pdelab/backend/ovlpistlsolverbackend.hh typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<MatrixType, Dune::Amg::FirstDiagonal> > Criterion; #if HAVE_MPI +@@ -891,7 +892,8 @@ + Solver<VectorType> solver(oop,sp,*amg,reduction,maxiter,verb); + Dune::InverseOperatorResult stat; + +- solver.apply(BlockProcessor<GFS>::getVector(z),BlockProcessor<GFS>::getVector(r),stat); ++// solver.apply(BlockProcessor<GFS>::getVector(z),BlockProcessor<GFS>::getVector(r),stat); ++ solver.apply(z,r,stat); + stats.tsolve= watch.elapsed(); + res.converged = stat.converged; + res.iterations = stat.iterations; Index: dune/pdelab/backend/seqistlsolverbackend.hh =================================================================== ---- dune/pdelab/backend/seqistlsolverbackend.hh (revision 2221) +--- dune/pdelab/backend/seqistlsolverbackend.hh (revision 2292) +++ dune/pdelab/backend/seqistlsolverbackend.hh (working copy) @@ -542,10 +542,10 @@ \param[in] r right hand side diff --git a/test/implicit/1p/1ptestproblem.hh b/test/implicit/1p/1ptestproblem.hh index 8c8f60bd4eb35e50173c5e58f107330633444899..540037396f4f3dc2cbeace12835b393a2f72d382 100644 --- a/test/implicit/1p/1ptestproblem.hh +++ b/test/implicit/1p/1ptestproblem.hh @@ -40,13 +40,17 @@ #include <dumux/material/components/simpleh2o.hh> #include <dumux/material/fluidsystems/liquidphase.hh> -#ifdef USE_AMGBACKEND #if HAVE_DUNE_PDELAB + +// Check if DUNE-PDELab has been patched for our needs. +// TODO: this should be replaced by a proper configure test. +#include <dune/pdelab/backend/istlvectorbackend.hh> + +#ifdef DUNE_PDELAB_IS_PATCHED_FOR_DUMUX #include <dumux/linear/amgbackend.hh> -#else // HAVE_DUNE_PDELAB -#warning You have to install dune-pdelab to use the AMG backend. +#endif // DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + #endif // HAVE_DUNE_PDELAB -#endif //USE_AMGBACKEND #include "1ptestspatialparams.hh" @@ -92,7 +96,7 @@ SET_INT_PROP(OnePTestProblem, LinearSolverVerbosity, 0); SET_INT_PROP(OnePTestProblem, LinearSolverPreconditionerIterations, 1); SET_SCALAR_PROP(OnePTestProblem, LinearSolverPreconditionerRelaxation, 1.0); -#if defined(USE_AMGBACKEND) && HAVE_DUNE_PDELAB +#ifdef DUNE_PDELAB_IS_PATCHED_FOR_DUMUX 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/Makefile.am b/test/implicit/1p/Makefile.am index 2982eeba6aefa34e683c9fc6c955e75d4d4f864a..7edde9a77bbd05df84e9d0f3df4600d027231836 100644 --- a/test/implicit/1p/Makefile.am +++ b/test/implicit/1p/Makefile.am @@ -4,13 +4,8 @@ noinst_HEADERS = *.hh EXTRA_DIST=*.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 diff --git a/test/implicit/1p/test_box1pwithamg.cc b/test/implicit/1p/test_box1pwithamg.cc index 6d867b78705f4f7169426f6b88c5eaaddc109582..5e706888c024f4290906014f40b76599e8dafd04 100644 --- a/test/implicit/1p/test_box1pwithamg.cc +++ b/test/implicit/1p/test_box1pwithamg.cc @@ -25,6 +25,11 @@ #if HAVE_DUNE_PDELAB +// Check if DUNE-PDELab has been patched for our needs. +// TODO: this should be replaced by a proper configure test. +#include <dune/pdelab/backend/istlvectorbackend.hh> +#ifdef DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + #include "1ptestproblem.hh" #include <dumux/common/start.hh> @@ -65,15 +70,30 @@ int main(int argc, char** argv) typedef TTAG(OnePTestBoxProblemWithAMG) ProblemTypeTag; return Dumux::start<ProblemTypeTag>(argc, argv, usage); } -#else +#else // DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + +#warning You need to have a patched dune-pdelab to run this test, see ../../../patches/README for details. + +#include <iostream> + +int main() +{ + std::cerr << "You need to have a patched dune-pdelab to run this test, " + "see ../../../patches/README for details." << std::endl;; + return 77; +} + +#endif // DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + +#else // HAVE_DUNE_PDELAB -#warning You need to have dune-pdelab installed to run this test +#warning You need to have dune-pdelab installed and patched to run this test. #include <iostream> int main() { - std::cerr << "You need to have dune-pdelab installed to run this test\n"; + std::cerr << "You need to have dune-pdelab installed and patched 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 35ec85095444fd160e4399fdf73f38902e9dceb1..dd92e136bd672b2226e6ad397229112a2a9e108a 100644 --- a/test/implicit/1p/test_cc1pwithamg.cc +++ b/test/implicit/1p/test_cc1pwithamg.cc @@ -25,6 +25,11 @@ #if HAVE_DUNE_PDELAB +// Check if DUNE-PDELab has been patched for our needs. +// TODO: this should be replaced by a proper configure test. +#include <dune/pdelab/backend/istlvectorbackend.hh> +#ifdef DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + #include "1ptestproblem.hh" #include <dumux/common/start.hh> @@ -65,15 +70,30 @@ int main(int argc, char** argv) typedef TTAG(OnePTestCCProblemWithAMG) ProblemTypeTag; return Dumux::start<ProblemTypeTag>(argc, argv, usage); } -#else +#else // DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + +#warning You need to have a patched dune-pdelab to run this test, see ../../../patches/README for details. + +#include <iostream> + +int main() +{ + std::cerr << "You need to have a patched dune-pdelab to run this test, " + "see ../../../patches/README for details." << std::endl;; + return 77; +} + +#endif // DUNE_PDELAB_IS_PATCHED_FOR_DUMUX + +#else // HAVE_DUNE_PDELAB -#warning You need to have dune-pdelab installed to run this test +#warning You need to have dune-pdelab installed and patched to run this test. #include <iostream> int main() { - std::cerr << "You need to have dune-pdelab installed to run this test\n"; + std::cerr << "You need to have dune-pdelab installed and patched to run this test.\n"; return 77; } #endif // HAVE_DUNE_PDELAB