Skip to content
Snippets Groups Projects
Commit a656b05f authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

a preconditioned Richardson step

[[Imported from SVN: r3601]]
parent 1fd3c1cf
No related branches found
No related tags found
No related merge requests found
......@@ -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
#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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment