]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test case 13278/head
authorMartin Kronbichler <martin.kronbichler@it.uu.se>
Fri, 21 Jan 2022 16:24:14 +0000 (17:24 +0100)
committerMartin Kronbichler <martin.kronbichler@it.uu.se>
Fri, 21 Jan 2022 18:24:36 +0000 (19:24 +0100)
tests/mappings/mapping_q_points_real_to_unit_02.cc [new file with mode: 0644]
tests/mappings/mapping_q_points_real_to_unit_02.output [new file with mode: 0644]

diff --git a/tests/mappings/mapping_q_points_real_to_unit_02.cc b/tests/mappings/mapping_q_points_real_to_unit_02.cc
new file mode 100644 (file)
index 0000000..3438764
--- /dev/null
@@ -0,0 +1,75 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2020 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE.md at
+// the top level directory of deal.II.
+//
+// ---------------------------------------------------------------------
+
+
+// check MappingQ::transform_real_to_unit_points on MappingQ1 with a point
+// that would at some point return an invalid answer due to a wrongly computed
+// affine approximation, using a point extracted from
+// tests/particles/particle_handler_21.
+
+#include <deal.II/fe/mapping_q.h>
+
+#include <deal.II/grid/grid_generator.h>
+#include <deal.II/grid/tria.h>
+
+#include "../tests.h"
+
+
+template <int dim>
+void
+test()
+{
+  Triangulation<dim> tria;
+  GridGenerator::hyper_ball(tria, Point<dim>(), 1.0);
+  tria.refine_global(3);
+
+  // pick out a particular cell
+  const typename Triangulation<dim>::cell_iterator coarse_cell(&tria, 0, 5);
+  const auto cell = coarse_cell->child(0)->child(5)->child(7);
+
+  std::vector<Point<dim>> real_points{
+    Point<3>(-0.0489699, -0.859053, -0.0489699)};
+  std::vector<Point<dim>> unit_points(real_points.size());
+
+  for (unsigned int degree = 1; degree < 4; ++degree)
+    {
+      MappingQ<dim> mapping(degree);
+      mapping.transform_points_real_to_unit_cell(cell,
+                                                 real_points,
+                                                 unit_points);
+
+      deallog << "Transform on cell with center: " << cell->center(true)
+              << " with mapping degree " << degree << std::endl;
+      deallog << "Combined transform " << real_points[0] << " gives "
+              << unit_points[0] << std::endl;
+
+      deallog << "Classic transform  " << real_points[0] << " gives "
+              << mapping.transform_real_to_unit_cell(cell, real_points[0])
+              << std::endl;
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int
+main()
+{
+  initlog();
+  deallog << std::setprecision(10);
+
+  test<3>();
+}
diff --git a/tests/mappings/mapping_q_points_real_to_unit_02.output b/tests/mappings/mapping_q_points_real_to_unit_02.output
new file mode 100644 (file)
index 0000000..d61adad
--- /dev/null
@@ -0,0 +1,11 @@
+
+DEAL::Transform on cell with center: -0.08086235035 -0.8200448543 -0.08086235035 with mapping degree 1
+DEAL::Combined transform -0.04896990000 -0.8590530000 -0.04896990000 gives 0.7082205181 0.2510034894 0.7082205181
+DEAL::Classic transform  -0.04896990000 -0.8590530000 -0.04896990000 gives 0.7082205181 0.2510034894 0.7082205181
+DEAL::Transform on cell with center: -0.08086235035 -0.8200448543 -0.08086235035 with mapping degree 2
+DEAL::Combined transform -0.04896990000 -0.8590530000 -0.04896990000 gives 0.7082205181 0.2510034894 0.7082205181
+DEAL::Classic transform  -0.04896990000 -0.8590530000 -0.04896990000 gives 0.7082205181 0.2510034894 0.7082205181
+DEAL::Transform on cell with center: -0.08086235035 -0.8200448543 -0.08086235035 with mapping degree 3
+DEAL::Combined transform -0.04896990000 -0.8590530000 -0.04896990000 gives 0.7082205181 0.2510034894 0.7082205181
+DEAL::Classic transform  -0.04896990000 -0.8590530000 -0.04896990000 gives 0.7082205181 0.2510034894 0.7082205181
+DEAL::OK

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.