mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user