From: Martin Kronbichler Date: Sun, 5 Apr 2020 11:43:59 +0000 (+0200) Subject: Test case X-Git-Tag: v9.2.0-rc1~283^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bd56a889d3cd86e9743d7cd174c7c73fe20188d;p=dealii.git Test case --- diff --git a/tests/mappings/mapping_fe_field_07.cc b/tests/mappings/mapping_fe_field_07.cc new file mode 100644 index 0000000000..ef5826ebf4 --- /dev/null +++ b/tests/mappings/mapping_fe_field_07.cc @@ -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 +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include "../tests.h" + +template +void +test() +{ + Triangulation tria; + GridGenerator::hyper_shell(tria, Point(), 0.5, 1.); + + tria.refine_global(2); + + FESystem fe(FE_Q(2), spacedim); + DoFHandler 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 map_vector(dh.n_dofs()); + VectorTools::get_position_vector(dh, map_vector); + MappingFEField, DoFHandler> mapping( + dh, map_vector); + MappingQGeneric mapping_ref(fe.degree); + + QGauss quad(1); + FEValues fe_values_ref(mapping_ref, fe, quad, update_quadrature_points); + FEValues 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 index 0000000000..027dd0cdbc --- /dev/null +++ b/tests/mappings/mapping_fe_field_07.output @@ -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