]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Relax test output for an ill-posed problem. 5569/head
authorDavid Wells <wellsd2@rpi.edu>
Sun, 3 Dec 2017 02:56:49 +0000 (21:56 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Sun, 3 Dec 2017 02:56:49 +0000 (21:56 -0500)
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
tests/grid/project_to_object_01.output

index 33d3f64f3b347ad04a920b147de7a23a6d4f7c4f..08c1515647e6b00ec76cb0321f6657ad5ce4bb1a 100644 (file)
@@ -21,6 +21,8 @@
 #include <deal.II/grid/manifold_lib.h>
 #include <deal.II/grid/tria.h>
 
+#include <deal.II/fe/mapping_q_generic.h>
+
 #include <array>
 #include <cmath>
 
@@ -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());
       }
   }
 
index eae6bfe41e627b5e85ef7ebaa9a31e2908fb020b..19e6f3c6986877f264191c69545fb21925c1b776 100644 (file)
@@ -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::=====================================================

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.