Skip to content
Snippets Groups Projects
Commit 849db9b0 authored by lh1887's avatar lh1887
Browse files

Add setMatrix() method to DenseMultigridTransfer

See #14.
parent b43fc5e7
No related branches found
No related tags found
No related merge requests found
Pipeline #
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_SOLVERS_FIXEDSTEPSOLVER_HH
#define DUNE_SOLVERS_FIXEDSTEPSOLVER_HH
#include <memory>
#include <dune/solvers/common/defaultbitvector.hh>
#include <dune/solvers/common/resize.hh>
namespace Dune {
namespace Solvers {
/**
* \brief An iterative solver using a fixed number of iterations
*
* \tparam Matrix Matrix type of the system
* \tparam Vector Vector type of the system
*/
template<class Matrix, class Vector, class Step>
class FixedStepSolver
{
using BitVector = Dune::Solvers::DefaultBitVector_t<Vector>;
public:
/** \brief Constructor
* \param step The iteration step object to use
* \param noOfSteps The number of steps to take
*/
FixedStepSolver(const std::shared_ptr<Step> step, unsigned int noOfSteps=1)
  • Contributor

    Das const hier ist jetzt allerdings unnötig... (dürfte sogar eine Warnung produzieren).

  • Author Developer

    Stimmt. Das sollte auch gar nicht in diesen Commit und war aus dune-tnnmg kopiert.

  • Please register or sign in to reply
: step_(step),
noOfSteps_(noOfSteps)
{}
/** \brief Solve */
void operator()(Vector& x, const Matrix& m, const Vector& r)
{
Dune::Solvers::resizeInitialize(ignore_, x, false);
step_->setIgnore(ignore_);
step_->setProblem(m, x, r);
step_->preprocess();
for (unsigned int i=0; i<noOfSteps_; i++)
step_->iterate();
}
private:
std::shared_ptr<Step> step_;
unsigned int noOfSteps_;
BitVector ignore_;
};
} // end namespace Solvers
} // end namespace Dune
#endif // DUNE_SOLVERS_FIXEDSTEPSOLVER_HH
......@@ -121,6 +121,11 @@ public:
return matrix_;
}
/** \brief Set matrix */
template<class M>
void setMatrix(M&& m) {
matrix_ = std::forward<M>(m);
}
protected:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment