Skip to content
Snippets Groups Projects

CGStep: hold preconditioner in a `shared_ptr`

Merged Ansgar Burchardt requested to merge cgstep-preconditioner-as-shared_ptr into master
2 files
+ 18
11
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -4,6 +4,9 @@
#include <dune/solvers/common/canignore.hh>
#include <dune/matrix-vector/genericvectortools.hh>
namespace Dune {
namespace Solvers {
template <class MatrixType, class VectorType, class Ignore>
void CGStep<MatrixType, VectorType, Ignore>::check() const
{
@@ -19,7 +22,7 @@ void CGStep<MatrixType, VectorType, Ignore>::preprocess()
if (preconditioner_) {
using CanIgnore_t = CanIgnore<Ignore>;
CanIgnore_t *asCanIgnore = dynamic_cast<CanIgnore_t*>(preconditioner_);
CanIgnore_t *asCanIgnore = dynamic_cast<CanIgnore_t*>(preconditioner_.get());
if (asCanIgnore != nullptr and this->hasIgnore())
asCanIgnore->setIgnore(this->ignore());
@@ -59,3 +62,6 @@ void CGStep<MatrixType, VectorType, Ignore>::iterate()
p_ += q;
r_squared_old_ = r_squared;
}
} /* namespace Solvers */
} /* namespace Dune */
Loading