changed: get rid of duplicate MatrixBlock headers/classes

this has already led to some confusion. move some of the code
upstream to opm-models and remove the rest of the duplicated code.

the remainder of MatrixBlock.hpp is renamed to SmallDenseMatrixUtils.hpp
This commit is contained in:
Arne Morten Kvarving
2022-08-24 09:57:49 +02:00
parent 3faccb4a17
commit 447d77b579
9 changed files with 161 additions and 695 deletions

View File

@@ -21,7 +21,7 @@
#define BOOST_TEST_MODULE InvertSpecializationTest
#include <boost/test/unit_test.hpp>
#include <opm/simulators/linalg/MatrixBlock.hpp>
#include <opm/simulators/linalg/matrixblock.hh>
void checkIdentity(Dune::FieldMatrix<double, 4, 4> M) {
@@ -41,7 +41,7 @@ void checkIdentity(Dune::FieldMatrix<double, 4, 4> M) {
BOOST_AUTO_TEST_CASE(Invert4x4)
{
typedef Dune::FieldMatrix<double, 4, 4> BaseType;
using BaseType = Dune::FieldMatrix<double, 4, 4>;
BaseType matrix;
BaseType eye;
BaseType inverse;
@@ -56,17 +56,15 @@ BOOST_AUTO_TEST_CASE(Invert4x4)
matrix[3][0] = 5;
matrix[0][3] = 14;
double det = Dune::FMatrixHelp::invertMatrix(matrix, inverse);
double det = Opm::detail::invertMatrix4<Opm::detail::FMat4>(matrix, inverse);
BOOST_CHECK_CLOSE(4, det, 1e-14);
// check matrix * inverse close to identiy
checkIdentity(matrix.rightmultiply(inverse));
// check return identity matrix if singular matrix
inverse = 0.0;
double det2 = Dune::FMatrixHelp::invertMatrix(matrix_sing, inverse);
BOOST_CHECK_CLOSE(1.0, det2, 1e-14);
checkIdentity(inverse);
// check singular matrix
double det2 = Opm::detail::invertMatrix4<Opm::detail::FMat4>(matrix_sing, inverse);
BOOST_CHECK_CLOSE(0.0, det2, 1e-14);
}