diff --git a/dune/istl/eigenvalue/arpackpp.hh b/dune/istl/eigenvalue/arpackpp.hh index 53a8f37fa6953428d89cfdbd5aa2491aca45782d..c62eb9c7dfcfe4c159388aa747d59a658609cec6 100644 --- a/dune/istl/eigenvalue/arpackpp.hh +++ b/dune/istl/eigenvalue/arpackpp.hh @@ -13,6 +13,7 @@ #include <dune/common/fvector.hh> // provides Dune::FieldVector #include <dune/common/exceptions.hh> // provides DUNE_THROW(...) +#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel #include <dune/istl/bvector.hh> // provides Dune::BlockVector #include <dune/istl/istlexception.hh> // provides Dune::ISTLError #include <dune/istl/io.hh> // provides Dune::printvector(...) @@ -64,7 +65,7 @@ namespace Dune { // assert that BCRSMatrix type has blocklevel 2 static_assert - (BCRSMatrix::blocklevel == 2, + (blockLevel<BCRSMatrix>() == 2, "Only BCRSMatrices with blocklevel 2 are supported."); // allocate memory for auxiliary block vector objects diff --git a/dune/istl/eigenvalue/poweriteration.hh b/dune/istl/eigenvalue/poweriteration.hh index 51b8c5f78cf186834b056f4e95ae150bfc8374fd..2da068e0662de57abaaa56cf0e5e487bf7c35b70 100644 --- a/dune/istl/eigenvalue/poweriteration.hh +++ b/dune/istl/eigenvalue/poweriteration.hh @@ -16,6 +16,7 @@ #include <dune/common/exceptions.hh> // provides DUNE_THROW(...) +#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel #include <dune/istl/operators.hh> // provides Dune::LinearOperator #include <dune/istl/solvercategory.hh> // provides Dune::SolverCategory::sequential #include <dune/istl/solvertype.hh> // provides Dune::IsDirectSolver @@ -215,7 +216,7 @@ namespace Dune { // assert that BCRSMatrix type has blocklevel 2 static_assert - (BCRSMatrix::blocklevel == 2, + (blockLevel<BCRSMatrix>() == 2, "Only BCRSMatrices with blocklevel 2 are supported."); // assert that BCRSMatrix type has square blocks diff --git a/dune/istl/eigenvalue/test/matrixinfo.hh b/dune/istl/eigenvalue/test/matrixinfo.hh index cd1e732bf70bebd3c013b8795f82af12bec2e452..96bfbe327e09842be9609c10646ca7b5c5e9c140 100644 --- a/dune/istl/eigenvalue/test/matrixinfo.hh +++ b/dune/istl/eigenvalue/test/matrixinfo.hh @@ -11,6 +11,7 @@ #include <dune/common/exceptions.hh> // provides DUNE_THROW(...), Dune::Exception #include <dune/common/fvector.hh> // provides Dune::FieldVector +#include <dune/istl/blocklevel.hh> // provides Dune::blockLevel #include <dune/istl/bvector.hh> // provides Dune::BlockVector #include <dune/istl/superlu.hh> // provides Dune::SuperLU #include <dune/istl/preconditioners.hh> // provides Dune::SeqGS @@ -69,7 +70,7 @@ public: { // assert that BCRSMatrix type has blocklevel 2 static_assert - (BCRSMatrix::blocklevel == 2, + (Dune::blockLevel<BCRSMatrix>() == 2, "Only BCRSMatrices with blocklevel 2 are supported."); // assert that BCRSMatrix type has square blocks diff --git a/dune/istl/paamg/fastamg.hh b/dune/istl/paamg/fastamg.hh index 59336ef2eccf24fa2d8c9d7cef2f9cf433d43e77..38064873f9c200424a9f8d04758954b1715c086d 100644 --- a/dune/istl/paamg/fastamg.hh +++ b/dune/istl/paamg/fastamg.hh @@ -610,17 +610,19 @@ namespace Dune void FastAMG<M,X,PI,A> ::presmooth(LevelContext& levelContext, Domain& x, const Range& b) { - GaussSeidelPresmoothDefect<M::matrix_type::blocklevel>::apply(levelContext.matrix->getmat(), - x, - *levelContext.residual, - b); + constexpr auto bl = blockLevel<typename M::matrix_type>(); + GaussSeidelPresmoothDefect<bl>::apply(levelContext.matrix->getmat(), + x, + *levelContext.residual, + b); } template<class M, class X, class PI, class A> void FastAMG<M,X,PI,A> ::postsmooth(LevelContext& levelContext, Domain& x, const Range& b) { - GaussSeidelPostsmoothDefect<M::matrix_type::blocklevel> + constexpr auto bl = blockLevel<typename M::matrix_type>(); + GaussSeidelPostsmoothDefect<bl> ::apply(levelContext.matrix->getmat(), x, *levelContext.residual, b); } diff --git a/dune/istl/test/matrixtest.cc b/dune/istl/test/matrixtest.cc index 3b141a091167abce9bab7078a878d5581263a091..ca7c3a8664e6a4d24a3f734e2b04608d840e858d 100644 --- a/dune/istl/test/matrixtest.cc +++ b/dune/istl/test/matrixtest.cc @@ -10,6 +10,7 @@ #include <dune/common/fmatrix.hh> #include <dune/common/diagonalmatrix.hh> #include <dune/common/unused.hh> +#include <dune/istl/blocklevel.hh> #include <dune/istl/bcrsmatrix.hh> #include <dune/istl/matrix.hh> #include <dune/istl/bdmatrix.hh> @@ -77,7 +78,7 @@ void testMatrix(MatrixType& matrix, X& x, Y& y) typedef typename MatrixType::ConstColIterator ConstColIterator DUNE_UNUSED; - assert(MatrixType::blocklevel >= 0); + static_assert(maxBlockLevel<MatrixType>() >= 0, "Block level has to be at least 1 for a matrix!"); // //////////////////////////////////////////////////////// // Count number of rows, columns, and nonzero entries diff --git a/dune/python/istl/bvector.hh b/dune/python/istl/bvector.hh index 5f7006de9b1971e0707bbd803de0231aca2b4530..72d7e62aeacd0871b6328d1879c715a3d82c0d5d 100644 --- a/dune/python/istl/bvector.hh +++ b/dune/python/istl/bvector.hh @@ -20,6 +20,7 @@ #include <dune/python/pybind11/pybind11.h> #include <dune/istl/bvector.hh> +#include <dune/istl/blocklevel.hh> namespace Dune { @@ -59,7 +60,7 @@ namespace Dune if( info.format != pybind11::format_descriptor< field_type >::format() ) throw pybind11::value_error( "Incompatible buffer format." ); - if( info.ndim != BlockVector::blocklevel ) + if( info.ndim != blockLevel<BlockVector>() ) throw pybind11::value_error( "Block vectors can only be initialized from one-dimensional buffers." ); copy( static_cast< const char * >( info.ptr ), info.shape.data(), info.strides.data(), v );