From f68d4cb6f82444d2f1f4b7e106d4c13bbcd00873 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 2 Dec 2017 21:56:49 -0500 Subject: [PATCH] Relax test output for an ill-posed problem. There is not a unique solution to this particular projection so, sure enough, different setups create different answers. Get around this by instead verifying that the result of the projection is on the right cell and also on the manifold. --- tests/grid/project_to_object_01.cc | 15 +++++++++------ tests/grid/project_to_object_01.output | 16 ---------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/tests/grid/project_to_object_01.cc b/tests/grid/project_to_object_01.cc index 33d3f64f3b..08c1515647 100644 --- a/tests/grid/project_to_object_01.cc +++ b/tests/grid/project_to_object_01.cc @@ -21,6 +21,8 @@ #include #include +#include + #include #include @@ -211,19 +213,20 @@ int main() << std::endl << "minimizers. The output here has been eyeballed as decent." << std::endl; + + MappingQGeneric<2, 3> mapping(6); for (auto cell : triangulation.active_cell_iterators()) { const Point<3> projected_point = GridTools::project_to_object(cell, trial_point); - deallog << projected_point[0] - << ", " - << projected_point[1] - << ", " - << projected_point[2] - << std::endl; + // Ensure that the point we found is both on the manifold and (up to + // error in the polynomial approximation of the mapping) on the cell. Assert((torus_manifold.push_forward(torus_manifold.pull_back(projected_point)) - projected_point).norm() < 1e-14, ExcInternalError()); + const Point<2> unit_point = mapping.transform_real_to_unit_cell(cell, projected_point); + Assert(GeometryInfo<2>::is_inside_unit_cell(unit_point, 1.0e-5), + ExcInternalError()); } } diff --git a/tests/grid/project_to_object_01.output b/tests/grid/project_to_object_01.output index eae6bfe41e..19e6f3c698 100644 --- a/tests/grid/project_to_object_01.output +++ b/tests/grid/project_to_object_01.output @@ -48,22 +48,6 @@ DEAL::projected point: 2.00000 0.00000 DEAL::actual vertex: 2.00000 0.00000 DEAL::Test for robustness by projecting points with nonunique DEAL::minimizers. The output here has been eyeballed as decent. -DEAL::0.768956, 1.00000, 1.84627 -DEAL::1.00000, 1.22465e-16, 0.00000 -DEAL::3.00000, 0.00000, 0.00000 -DEAL::2.00000, 1.00000, 0.00000 -DEAL::-1.84627, 1.00000, 0.768956 -DEAL::6.12323e-17, 1.22465e-16, 1.00000 -DEAL::1.83697e-16, 0.00000, 3.00000 -DEAL::1.22465e-16, 1.00000, 2.00000 -DEAL::-2.00000, 1.00000, 2.44929e-16 -DEAL::-1.00000, 1.22465e-16, 1.22465e-16 -DEAL::-3.00000, 0.00000, 3.67394e-16 -DEAL::-2.00000, 1.00000, 2.44929e-16 -DEAL::1.84627, 1.00000, -0.768956 -DEAL::-1.83697e-16, 1.22465e-16, -1.00000 -DEAL::-5.51091e-16, 0.00000, -3.00000 -DEAL::-3.67394e-16, 1.00000, -2.00000 DEAL::===================================================== DEAL::Number of global refinements: 4 DEAL::===================================================== -- 2.39.5