Skip to content
Snippets Groups Projects
Commit e40fa48a authored by Max Kahnt's avatar Max Kahnt
Browse files

Use truncate to apply ignore node for arbitrary types.

parent 6eb61e07
No related branches found
No related tags found
No related merge requests found
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=8 sw=4 sts=4:
#include <dune/solvers/common/canignore.hh>
#include <dune/matrix-vector/genericvectortools.hh>
template <class MatrixType, class VectorType, class Ignore>
void CGStep<MatrixType, VectorType, Ignore>::check() const
......@@ -14,9 +15,7 @@ void CGStep<MatrixType, VectorType, Ignore>::preprocess()
// Compute the residual (r starts out as the rhs)
this->mat_->mmv(*x_,r_);
if (this->hasIgnore())
for (size_t i=0; i < r_.size(); ++i)
if (this->ignore()[i].any())
r_[i] = 0;
Dune::MatrixVector::Generic::truncate(r_, this->ignore());
if (preconditioner_) {
using CanIgnore_t = CanIgnore<Ignore>;
......@@ -47,9 +46,7 @@ void CGStep<MatrixType, VectorType, Ignore>::iterate()
r_.axpy(-alpha, q); // r_1 = r_0 - alpha_0 Ap_0
if (this->hasIgnore())
for (size_t i=0; i < r_.size(); ++i)
if (this->ignore()[i].any())
r_[i] = 0;
Dune::MatrixVector::Generic::truncate(r_, this->ignore());
if (preconditioner_)
preconditioner_->apply(q, r_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment