mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-16 01:21:56 -06:00
Fix bug in test.
Also add (inactive) second test.
This commit is contained in:
parent
c5a19b250b
commit
8b99d6394d
@ -29,25 +29,54 @@
|
|||||||
|
|
||||||
#include <opm/core/tof/AnisotropicEikonal.hpp>
|
#include <opm/core/tof/AnisotropicEikonal.hpp>
|
||||||
#include <opm/core/grid/GridManager.hpp>
|
#include <opm/core/grid/GridManager.hpp>
|
||||||
|
#include <opm/core/grid.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
using namespace Opm;
|
using namespace Opm;
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(cartesian_2d)
|
BOOST_AUTO_TEST_CASE(cartesian_2d_a)
|
||||||
{
|
{
|
||||||
const GridManager gm(2, 2);
|
const GridManager gm(2, 2);
|
||||||
const UnstructuredGrid& grid = *gm.c_grid();
|
const UnstructuredGrid& grid = *gm.c_grid();
|
||||||
AnisotropicEikonal2d ae(grid);
|
AnisotropicEikonal2d ae(grid);
|
||||||
|
|
||||||
const std::vector<double> metric = {
|
const std::vector<double> metric = {
|
||||||
|
1, 0, 0, 1,
|
||||||
1, 0, 0, 1,
|
1, 0, 0, 1,
|
||||||
1, 0, 0, 1,
|
1, 0, 0, 1,
|
||||||
1, 0, 0, 1
|
1, 0, 0, 1
|
||||||
};
|
};
|
||||||
|
BOOST_REQUIRE_EQUAL(metric.size(), grid.number_of_cells*grid.dimensions*grid.dimensions);
|
||||||
const std::vector<int> start = { 0 };
|
const std::vector<int> start = { 0 };
|
||||||
std::vector<double> sol;
|
std::vector<double> sol;
|
||||||
ae.solve(metric.data(), start, sol);
|
ae.solve(metric.data(), start, sol);
|
||||||
BOOST_REQUIRE(!sol.empty());
|
BOOST_REQUIRE(!sol.empty());
|
||||||
|
BOOST_CHECK_EQUAL(sol.size(), grid.number_of_cells);
|
||||||
std::vector<double> truth = { 0, 1, 1, std::sqrt(2) };
|
std::vector<double> truth = { 0, 1, 1, std::sqrt(2) };
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(sol.begin(), sol.end(), truth.begin(), truth.end());
|
BOOST_CHECK_EQUAL_COLLECTIONS(sol.begin(), sol.end(), truth.begin(), truth.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// BOOST_AUTO_TEST_CASE(cartesian_2d_b)
|
||||||
|
// {
|
||||||
|
// const GridManager gm(3, 2, 1.0, 2.0);
|
||||||
|
// const UnstructuredGrid& grid = *gm.c_grid();
|
||||||
|
// AnisotropicEikonal2d ae(grid);
|
||||||
|
|
||||||
|
// const std::vector<double> metric = {
|
||||||
|
// 1, 0, 0, 1,
|
||||||
|
// 1, 0, 0, 1,
|
||||||
|
// 1, 0, 0, 1,
|
||||||
|
// 1, 0, 0, 1,
|
||||||
|
// 1, 0, 0, 1,
|
||||||
|
// 1, 0, 0, 1
|
||||||
|
// };
|
||||||
|
// BOOST_REQUIRE_EQUAL(metric.size(), grid.number_of_cells*grid.dimensions*grid.dimensions);
|
||||||
|
// const std::vector<int> start = { 0 };
|
||||||
|
// std::vector<double> sol;
|
||||||
|
// ae.solve(metric.data(), start, sol);
|
||||||
|
// BOOST_REQUIRE(!sol.empty());
|
||||||
|
// BOOST_CHECK_EQUAL(sol.size(), grid.number_of_cells);
|
||||||
|
// std::vector<double> truth = { 0, 1, 2, 2, std::sqrt(5), std::sqrt(8) };
|
||||||
|
// BOOST_CHECK_EQUAL_COLLECTIONS(sol.begin(), sol.end(), truth.begin(), truth.end());
|
||||||
|
// }
|
||||||
|
Loading…
Reference in New Issue
Block a user