Commit a1f10bac authored by Carsten Gräser's avatar Carsten Gräser
Browse files

[cleanup] Use sparseRangeFor from dune-matrix-vector

parent 66315020
......@@ -9,7 +9,7 @@
#include <dune/common/typetraits.hh>
#include <dune/common/hybridutilities.hh>
#include <dune/solvers/common/algorithm.hh>
#include <dune/matrix-vector/algorithm.hh>
......@@ -58,13 +58,14 @@ class BoxConstrainedQuadraticFunctionalConstrainedLinearization
static void truncateMatrix(NM& A, const RBV& rowTruncationFlags, const CBV& colTruncationFlags)
{
namespace H = Dune::Hybrid;
using namespace Dune::MatrixVector;
H::ifElse(IsNumber<NM>(), [&](auto id){
if(id(rowTruncationFlags) or id(colTruncationFlags))
A = 0;
}, [&](auto id){
H::forEach(H::integralRange(H::size(id(rowTruncationFlags))), [&](auto&& i) {
auto&& Ai = A[i];
Dune::Solvers::sparseRangeFor(Ai, [&](auto&& Aij, auto&& j) {
sparseRangeFor(Ai, [&](auto&& Aij, auto&& j) {
This::truncateMatrix(Aij, rowTruncationFlags[i], colTruncationFlags[j]);
});
});
......
......@@ -10,7 +10,8 @@
#include <dune/common/typetraits.hh>
#include <dune/common/hybridutilities.hh>
#include <dune/solvers/common/algorithm.hh>
#include <dune/matrix-vector/algorithm.hh>
#include <dune/solvers/common/copyorreference.hh>
#include <dune/tnnmg/concepts.hh>
......@@ -148,7 +149,7 @@ auto coordinateRestriction(const ShiftedBoxConstrainedQuadraticFunctional<M, V,
using LocalLowerObstacle = std::decay_t<decltype(f.originalLowerObstacle()[i])>;
using LocalUpperObstacle = std::decay_t<decltype(f.originalUpperObstacle()[i])>;
using namespace Dune::Solvers;
using namespace Dune::MatrixVector;
namespace H = Dune::Hybrid;
LocalVector ri = f.originalLinearPart()[i];
......
......@@ -10,8 +10,9 @@
#include <dune/common/typeutilities.hh>
#include <dune/common/hybridutilities.hh>
#include <dune/matrix-vector/algorithm.hh>
#include <dune/solvers/common/resize.hh>
#include <dune/solvers/common/algorithm.hh>
#include <dune/solvers/common/copyorreference.hh>
#include <dune/tnnmg/functionals/affineoperator.hh>
......@@ -107,7 +108,7 @@ auto coordinateRestriction(const ShiftedQuadraticFunctional<M,V,R>& f, const Ind
using LocalMatrix = std::decay_t<decltype(f.quadraticPart()[i][i])>;
using LocalVector = std::decay_t<decltype(f.originalLinearPart()[i])>;
using namespace Dune::Solvers;
using namespace Dune::MatrixVector;
namespace H = Dune::Hybrid;
LocalVector ri = f.originalLinearPart()[i];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment