Fix bug in test.

Also add (inactive) second test.
This commit is contained in:
Atgeirr Flø Rasmussen 2014-12-01 11:10:16 +01:00
parent c5a19b250b
commit 8b99d6394d

View File

@ -29,25 +29,54 @@
#include <opm/core/tof/AnisotropicEikonal.hpp>
#include <opm/core/grid/GridManager.hpp>
#include <opm/core/grid.h>
#include <cmath>
using namespace Opm;
BOOST_AUTO_TEST_CASE(cartesian_2d)
BOOST_AUTO_TEST_CASE(cartesian_2d_a)
{
const GridManager gm(2, 2);
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
};
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, 1, std::sqrt(2) };
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());
// }