From 45c36722c8b9cca0ba5037dd0cf694cb678f613b Mon Sep 17 00:00:00 2001
From: Bernd Flemisch <bernd@iws.uni-stuttgart.de>
Date: Fri, 8 Mar 2013 07:43:23 +0000
Subject: [PATCH] added patches for dune-istl 2.2.1 and dune-pdelab 1.1.0,
 adapted the README and the CHANGELOG

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10364 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 CHANGELOG                  |   9 +--
 patches/README             |   6 +-
 patches/istl-2.2.1.patch   |  20 ++++++
 patches/pdelab-1.1.0.patch | 134 +++++++++++++++++++++++++++++++++++++
 4 files changed, 159 insertions(+), 10 deletions(-)
 create mode 100644 patches/istl-2.2.1.patch
 create mode 100644 patches/pdelab-1.1.0.patch

diff --git a/CHANGELOG b/CHANGELOG
index 88941a726f..aaa67a7ff6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -34,9 +34,7 @@ Differences Between DuMuX 2.2 and DuMuX 2.3
     implicit and the decoupled models, see test_*1pwithamg in 
     test/implicit/1p and test_impeswithamg in test/decoupled/2p. 
     DUNE-PDELab and possibly DUNE-ISTL have to be patched, see the file 
-    README in the patches directory. Furthermore, the preprocessor 
-    variable USE_AMGBACKEND has to be defined, see the corresponding 
-    Makefile.ams.
+    README in the patches directory. 
 
   - The decoupled models have been parallelized, see test_impeswithamg in 
     test/decoupled/2p. They work in parallel only if the AMGBackend is used 
@@ -103,11 +101,6 @@ Differences Between DuMuX 2.2 and DuMuX 2.3
   not print any warning if a deprecated property name is used.
   - CompositionFromFugacitiesSolver has been renamed to Constraintsolver.
 
-* Deprecated CONSTANTS/ENUMS, to be removed after 2.3: BEWARE: The compiler will
-  not print any warning if a deprecated constant/enum is used.
-
-* Deprecated MEMBER FUNCTIONS, to be removed after 2.3:
-
 * Deprecated public MEMBER VARIABLES, to be removed after 2.3: BEWARE: The
   compiler will not print any warning if a deprecated public member variable 
   is used.
diff --git a/patches/README b/patches/README
index ae837f9e9e..0cde5223fa 100644
--- a/patches/README
+++ b/patches/README
@@ -1,8 +1,10 @@
 - In order to use the AMGBackend, you have to apply the patch 
-  pdelab-1.0.1.patch in your directory containing DUNE-PDELab 1.0.1, e.g.:
+  pdelab-1.0.1.patch / pdelab-1.1.0.patch in your directory containing
+  DUNE-PDELab 1.0.1 / 1.1.0, e.g.:
   patch -p0 <../dumux/patches/pdelab-1.0.1.patch
 
 - If the AMGBackend should be used without SuperLU as coarse grid solver, it can
   be benefitial to decrease the corresponding tolerance. To do so, apply the
-  patch istl-2.2.0.patch in your directory containing DUNE-ISTL 2.2, e.g.:
+  patch istl-2.2.0.patch / istl-2.2.1.patch in your directory containing
+  DUNE-ISTL 2.2.0 / 2.2.1, e.g.:
   patch -p0 <../dumux/patches/istl-2.2.0.patch
diff --git a/patches/istl-2.2.1.patch b/patches/istl-2.2.1.patch
new file mode 100644
index 0000000000..6b13cd8344
--- /dev/null
+++ b/patches/istl-2.2.1.patch
@@ -0,0 +1,20 @@
+Index: dune/istl/paamg/amg.hh
+===================================================================
+--- dune/istl/paamg/amg.hh	(revision 1705)
++++ dune/istl/paamg/amg.hh	(working copy)
+@@ -504,13 +504,13 @@
+ 		  // We are still participating on this level
+ 		  solver_ = new BiCGSTABSolver<X>(const_cast<M&>(matrices_->matrices().coarsest().getRedistributed()), 
+ 						  *scalarProduct_, 
+-						  *coarseSmoother_, 1E-2, 10000, 0);
++						  *coarseSmoother_, 1E-12, 10000, 0);
+ 		else
+ 		  solver_ = 0;
+ 	      }else
+ 	      solver_ = new BiCGSTABSolver<X>(const_cast<M&>(*matrices_->matrices().coarsest()), 
+ 					      *scalarProduct_, 
+-					      *coarseSmoother_, 1E-2, 1000, 0);
++					      *coarseSmoother_, 1E-12, 1000, 0);
+ 	  }
+       }
+     }
diff --git a/patches/pdelab-1.1.0.patch b/patches/pdelab-1.1.0.patch
new file mode 100644
index 0000000000..f6712f4875
--- /dev/null
+++ b/patches/pdelab-1.1.0.patch
@@ -0,0 +1,134 @@
+Index: dune/pdelab/backend/istlvectorbackend.hh
+===================================================================
+--- dune/pdelab/backend/istlvectorbackend.hh	(revision 2292)
++++ dune/pdelab/backend/istlvectorbackend.hh	(working copy)
+@@ -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;
+ 
++      ISTLBlockVectorContainer ()
++      {}
+       ISTLBlockVectorContainer (const T& t_) : container(t_.globalSize()/BLOCKSIZE)
+       {}
+       ISTLBlockVectorContainer (const T& t_, const E& e) : container(t_.globalSize()/BLOCKSIZE)
+@@ -89,6 +95,11 @@
+         return container.two_norm();
+       }
+ 
++      typename Dune::template FieldTraits<E>::real_type two_norm2() const
++      {
++        return container.two_norm2();
++      }
++
+       typename Dune::template FieldTraits<E>::real_type one_norm() const
+       {
+         return container.one_norm();
+@@ -163,6 +174,16 @@
+         return container.size()*BLOCKSIZE;
+       }
+ 
++      size_t size() const
++      {
++        return container.size();
++      }
++
++      void resize(size_t n) 
++      {
++        container.resize(n);
++      }
++
+       template<typename X>
+       void std_copy_to (std::vector<X>& x) const
+       {
+Index: dune/pdelab/backend/novlpistlsolverbackend.hh
+===================================================================
+--- dune/pdelab/backend/novlpistlsolverbackend.hh	(revision 2292)
++++ dune/pdelab/backend/novlpistlsolverbackend.hh	(working copy)
+@@ -1251,7 +1251,7 @@
+                             int verbose_=1, bool reuse_=false,
+                             bool usesuperlu_=true)
+         : gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_),
+-          params(15,2000,1.2,1.6,Dune::Amg::atOnceAccu),
++          params(15,2000,1.2,1.6,Dune::Amg::noAccu/*Dune::Amg::atOnceAccu*/),
+           verbose(verbose_), reuse(reuse_), firstapply(true),
+           usesuperlu(usesuperlu_)
+       {
+@@ -1314,10 +1314,10 @@
+         \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)
+       {
+         Timer watch;
+-        MatrixType& mat=A.base();
++        MatrixType& mat=A;
+         typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<MatrixType,
+           Dune::Amg::FirstDiagonal> > Criterion;
+ #if HAVE_MPI
+Index: dune/pdelab/backend/ovlpistlsolverbackend.hh
+===================================================================
+--- dune/pdelab/backend/ovlpistlsolverbackend.hh	(revision 2292)
++++ dune/pdelab/backend/ovlpistlsolverbackend.hh	(working copy)
+@@ -803,7 +803,7 @@
+       ISTLBackend_AMG(const GFS& gfs_, unsigned maxiter_=5000, 
+                       int verbose_=1, bool reuse_=false,
+                       bool usesuperlu_=true)
+-        : gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_), params(15,2000),
++        : gfs(gfs_), phelper(gfs,verbose_), maxiter(maxiter_), params(15,2000,1.2,1.6,Dune::Amg::atOnceAccu),
+           verbose(verbose_), reuse(reuse_), firstapply(true),
+           usesuperlu(usesuperlu_)
+       {
+@@ -864,11 +864,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)
++      template <class Vector>
++      void apply(MatrixType& A, Vector& z, Vector& r, typename V::ElementType reduction)
+       {
+         Timer watch;
+         Comm oocc(gfs.gridView().comm());
+-        MatrixType& mat=A.base();
++        MatrixType& mat=A;
+         typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<MatrixType,
+           Dune::Amg::FirstDiagonal> > Criterion;
+ #if HAVE_MPI
+@@ -900,8 +901,7 @@
+         Solver<VectorType> solver(oop,sp,*amg,reduction,maxiter,verb);
+         Dune::InverseOperatorResult stat;
+         
+-        solver.apply(BlockProcessor<GFS,skipBlocksizeCheck>::getVector(z),
+-            BlockProcessor<GFS,skipBlocksizeCheck>::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 2292)
++++ dune/pdelab/backend/seqistlsolverbackend.hh	(working copy)
+@@ -543,10 +543,10 @@
+         \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)
+       {
+         Timer watch;
+-        MatrixType& mat=A.base();
++        MatrixType& mat=A;
+         typedef Dune::Amg::CoarsenCriterion<Dune::Amg::SymmetricCriterion<MatrixType,
+           Dune::Amg::FirstDiagonal> > Criterion;
+         SmootherArgs smootherArgs;
-- 
GitLab