diff --git a/dune/solvers/iterationsteps/Makefile.am b/dune/solvers/iterationsteps/Makefile.am index f4372b658944cc91dc43fb9313617668a324c3c2..b18e7f478b7889b6a28325f36386fde6237c7984 100644 --- a/dune/solvers/iterationsteps/Makefile.am +++ b/dune/solvers/iterationsteps/Makefile.am @@ -4,7 +4,9 @@ iterationstepsdir = $(includedir)/dune/dune-solvers/iterationsteps iterationsteps_HEADERS = amgstep.hh blockgsstep.hh blockgsstep.cc iterationstep.hh \ lineariterationstep.hh linegsstep.hh linegsstep.cc mmgstep.hh mmgstep.cc \ multigridstep.hh multigridstep.cc \ - projectedblockgsstep.hh projectedblockgsstep.cc projectedlinegsstep.cc projectedlinegsstep.hh truncatedblockgsstep.hh \ + projectedblockgsstep.hh projectedblockgsstep.cc projectedlinegsstep.cc projectedlinegsstep.hh \ + richardsonstep.hh \ + truncatedblockgsstep.hh \ truncatedsaddlepointgsstep.hh trustregiongsstep.cc trustregiongsstep.hh include $(top_srcdir)/am/global-rules diff --git a/dune/solvers/iterationsteps/richardsonstep.hh b/dune/solvers/iterationsteps/richardsonstep.hh new file mode 100644 index 0000000000000000000000000000000000000000..4ae49b4fd7ad09f7ec104b17bf151e92e592b573 --- /dev/null +++ b/dune/solvers/iterationsteps/richardsonstep.hh @@ -0,0 +1,58 @@ +#ifndef DUNE_RICHARDSON_STEP_HH +#define DUNE_RICHARDSON_STEP_HH + +#include <dune/common/bitsetvector.hh> + +#include <dune/solvers/common/preconditioner.hh> +#include <dune/solvers/iterationsteps/iterationstep.hh> + +/** \brief A single preconditioned and damped Richardson step +*/ +template<class VectorType, + class BitVectorType = Dune::BitSetVector<VectorType::block_type::dimension> > + class RichardsonStep + : public IterationStep<VectorType, BitVectorType> +{ + +public: + + /** \brief Constructor */ + RichardsonStep(const Preconditioner<VectorType>* preconditioner, + double damping + ) + : preconditioner_(preconditioner), + damping_(damping) + {} + + //! Perform one iteration + virtual void iterate(); + + /** \brief Retrieve the solution */ + virtual VectorType getSol(); + + const Preconditioner<VectorType>* preconditioner_; + + double damping_; + +}; + +template<class VectorType, class BitVectorType> +inline +VectorType RichardsonStep<VectorType, BitVectorType>::getSol() +{ + return *(this->x_); +} + +template<class VectorType, class BitVectorType> +inline +void RichardsonStep<VectorType, BitVectorType>::iterate() +{ + VectorType residual; + + preconditioner_->apply(*this->x_, residual); + + this->x_->axpy(damping_, residual); + +} + +#endif