]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Test case
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 5 Apr 2020 11:43:59 +0000 (13:43 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sun, 5 Apr 2020 11:43:59 +0000 (13:43 +0200)
tests/mappings/mapping_fe_field_07.cc [new file with mode: 0644]
tests/mappings/mapping_fe_field_07.output [new file with mode: 0644]

diff --git a/tests/mappings/mapping_fe_field_07.cc b/tests/mappings/mapping_fe_field_07.cc
new file mode 100644 (file)
index 0000000..ef5826e
--- /dev/null
@@ -0,0 +1,85 @@
+// ---------------------------------------------------------------------
+//
+// 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 that MappingFEField is equivalent to MappingQGeneric on a curved
+// shell mesh
+
+#include <deal.II/base/geometry_info.h>
+#include <deal.II/base/quadrature_lib.h>
+
+#include <deal.II/dofs/dof_handler.h>
+
+#include <deal.II/fe/fe_q.h>
+#include <deal.II/fe/fe_system.h>
+#include <deal.II/fe/fe_values.h>
+#include <deal.II/fe/mapping_fe_field.h>
+#include <deal.II/fe/mapping_q_generic.h>
+
+#include <deal.II/grid/grid_generator.h>
+
+#include <deal.II/numerics/vector_tools.h>
+
+#include "../tests.h"
+
+template <int dim, int spacedim>
+void
+test()
+{
+  Triangulation<dim, spacedim> tria;
+  GridGenerator::hyper_shell(tria, Point<dim>(), 0.5, 1.);
+
+  tria.refine_global(2);
+
+  FESystem<dim, spacedim>   fe(FE_Q<dim, spacedim>(2), spacedim);
+  DoFHandler<dim, spacedim> dh(tria);
+
+  dh.distribute_dofs(fe);
+
+  deallog << "dim, spacedim: " << dim << ", " << spacedim << std::endl
+          << "cells: " << tria.n_active_cells() << ", dofs: " << dh.n_dofs()
+          << std::endl;
+
+  // Create a Mapping
+  Vector<double> map_vector(dh.n_dofs());
+  VectorTools::get_position_vector(dh, map_vector);
+  MappingFEField<dim, spacedim, Vector<double>, DoFHandler<dim>> mapping(
+    dh, map_vector);
+  MappingQGeneric<dim> mapping_ref(fe.degree);
+
+  QGauss<dim>   quad(1);
+  FEValues<dim> fe_values_ref(mapping_ref, fe, quad, update_quadrature_points);
+  FEValues<dim> fe_values(mapping, fe, quad, update_quadrature_points);
+
+  for (const auto &cell : tria.active_cell_iterators())
+    {
+      fe_values_ref.reinit(cell);
+      fe_values.reinit(cell);
+
+      if (fe_values_ref.quadrature_point(0).distance(
+            fe_values.quadrature_point(0)) > 1e-12)
+        deallog << "Mapped point should be "
+                << fe_values_ref.quadrature_point(0) << " and is "
+                << fe_values.quadrature_point(0) << std::endl;
+    }
+  deallog << "OK" << std::endl;
+}
+
+int
+main()
+{
+  initlog();
+  test<2, 2>();
+  test<3, 3>();
+}
diff --git a/tests/mappings/mapping_fe_field_07.output b/tests/mappings/mapping_fe_field_07.output
new file mode 100644 (file)
index 0000000..027dd0c
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::dim, spacedim: 2, 2
+DEAL::cells: 160, dofs: 1440
+DEAL::OK
+DEAL::dim, spacedim: 3, 3
+DEAL::cells: 384, dofs: 10422
+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.