5#ifndef DUNE_ISTL_FASTAMGSMOOTHER_HH 
    6#define DUNE_ISTL_FASTAMGSMOOTHER_HH 
   16    template<std::
size_t level>
 
   17    struct GaussSeidelPresmoothDefect {
 
   19      template<
typename M, 
typename X, 
typename Y>
 
   20      static void apply(
const M& A, X& x, Y& d,
 
   23        typedef typename M::ConstRowIterator RowIterator;
 
   24        typedef typename M::ConstColIterator ColIterator;
 
   26        typename Y::iterator dIter=d.begin();
 
   27        typename Y::const_iterator bIter=b.begin();
 
   28        typename X::iterator xIter=x.begin();
 
   30        for(RowIterator row=A.begin(), end=A.end(); row != end;
 
   31            ++row, ++dIter, ++xIter, ++bIter)
 
   33          ColIterator col=(*row).begin();
 
   36          for (; col.index()<row.index(); ++col)
 
   39              *dIter -= (*col)*x[col.index()];
 
   41              (*col).mmv(x[col.index()],*dIter);     
 
   43          assert(row.index()==col.index());
 
   47          if constexpr (
Dune::IsNumber<std::decay_t<
decltype(*diag)>>::value)
 
   48            *xIter = (*dIter)/(*diag);
 
   50            diag->solve(*xIter,*dIter);
 
   55          for(col=(*row).begin(); col.index()<row.index(); ++col)
 
   58              d[col.index()] -= (*col)*(*xIter);
 
   60              col->mmv(*xIter, d[col.index()]);     
 
   66    template<std::
size_t level>
 
   67    struct GaussSeidelPostsmoothDefect {
 
   69      template<
typename M, 
typename X, 
typename Y>
 
   70      static void apply(
const M& A, X& x, Y& d,
 
   73        typedef typename M::ConstRowIterator RowIterator;
 
   74        typedef typename M::ConstColIterator ColIterator;
 
   75        typedef typename Y::block_type YBlock;
 
   77        typename Y::iterator dIter=d.beforeEnd();
 
   78        typename X::iterator xIter=x.beforeEnd();
 
   79        typename Y::const_iterator bIter=b.beforeEnd();
 
   81        for(RowIterator row=A.beforeEnd(), end=A.beforeBegin(); row != end;
 
   82            --row, --dIter, --xIter, --bIter)
 
   84          ColIterator endCol=(*row).beforeBegin();
 
   85          ColIterator col=(*row).beforeEnd();
 
   88          for (; col.index()>row.index(); --col)
 
   91              *dIter -= (*col)*x[col.index()];
 
   93              (*col).mmv(x[col.index()],*dIter);     
 
   95          assert(row.index()==col.index());
 
   99          for (--col; col!=endCol; --col)
 
  101            if constexpr (
Dune::IsNumber<std::decay_t<
decltype(*col)>>::value)
 
  102              v -= (*col)*x[col.index()];
 
  104              (*col).mmv(x[col.index()],v);     
 
  108          if constexpr (
Dune::IsNumber<std::decay_t<
decltype(*diag)>>::value)
 
  111            diag->solve(*xIter,v);
 
Dune namespace.
Definition: alignedallocator.hh:13
 
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition: typetraits.hh:194
 
Traits for type conversions and type information.