mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add more testcases for solve_transposed_3x3()
This commit is contained in:
parent
a911d5d2be
commit
d58aa58791
@ -29,17 +29,30 @@
|
||||
|
||||
BOOST_AUTO_TEST_CASE(testsolvetransposed3x3)
|
||||
{
|
||||
std::vector<double> A = {-0.0973322, 1.18758e-08, -0.000185231,
|
||||
0.125114, 1.24919e-11, 0,
|
||||
-11.3854, 1.32995e-06, 0.065447};
|
||||
const unsigned numTests = 3;
|
||||
const unsigned blockSize = 3;
|
||||
|
||||
std::vector<std::vector<double> > A = {{-0.0973322, 1.18758e-08, -0.000185231,
|
||||
0.125114, 1.24919e-11, 0,
|
||||
-11.3854, 1.32995e-06, 0.065447},
|
||||
{-0.00354818, 2.24354e-08, 55.9563,
|
||||
0.284031, 2.83543e-11, 0,
|
||||
-62.1156, 0.000392767, 6350.26},
|
||||
{1, 0, 2,
|
||||
3, 1, 0,
|
||||
0, 0, 3}};
|
||||
|
||||
std::vector<double> b = {0, 1, 0};
|
||||
std::vector<double> x(3);
|
||||
std::vector<double> x_expected = {63886256.67, 66154278, 180813.715};
|
||||
std::vector<double> x(blockSize);
|
||||
std::vector<std::vector<double> > x_expected = {{63886256.67, 66154278, 180813.715},
|
||||
{-290820.58, 556792.09, 2562.61063},
|
||||
{-3, 1, 2}};
|
||||
|
||||
Opm::Accelerator::solve_transposed_3x3(A.data(), b.data(), x.data());
|
||||
for (unsigned testId = 0; testId < numTests; ++testId) {
|
||||
Opm::Accelerator::solve_transposed_3x3(A[testId].data(), b.data(), x.data());
|
||||
|
||||
for (unsigned i = 0; i < 3; ++i) {
|
||||
BOOST_CHECK_CLOSE(x[i], x_expected[i], 1e-6);
|
||||
for (unsigned i = 0; i < blockSize; ++i) {
|
||||
BOOST_CHECK_CLOSE(x[i], x_expected[testId][i], 1e-6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user