From 27453f51777e259093521cb13c197f56b5f949bd Mon Sep 17 00:00:00 2001 From: alberto sartori Date: Wed, 2 Mar 2016 15:33:44 +0100 Subject: [PATCH] Mapping Manifold Test 02 --- tests/fe/mapping_manifold_02.cc | 115 ++++++++++++++++++++++++++++ tests/fe/mapping_manifold_02.output | 0 2 files changed, 115 insertions(+) create mode 100644 tests/fe/mapping_manifold_02.cc create mode 100644 tests/fe/mapping_manifold_02.output diff --git a/tests/fe/mapping_manifold_02.cc b/tests/fe/mapping_manifold_02.cc new file mode 100644 index 0000000000..3102324b5d --- /dev/null +++ b/tests/fe/mapping_manifold_02.cc @@ -0,0 +1,115 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 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 at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// Check that the quadrature points obtained through transform_unit_to_real +// are the same of those given by FEValues + + +#include "../tests.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +template +void test() +{ + deallog << "dim=" << dim << ", spacedim=" << spacedim << std::endl; + + Triangulation triangulation; + + const Point<2> center (7,9); + const Point<2> origin (0,0); + const double inner_radius = 0.5, + outer_radius = 1.0; + GridGenerator::hyper_shell (triangulation, + center, inner_radius, outer_radius, + 10); + + + static const SphericalManifold manifold(center); + + triangulation.set_all_manifold_ids_on_boundary(0); + triangulation.set_manifold (0, manifold); + typename Triangulation::active_cell_iterator + cell = triangulation.begin_active(), + endc = triangulation.end(); + for (; cell!=endc; ++cell) + cell->set_all_manifold_ids (0); + + const QGauss quadrature(1); + + std::vector > q_points_from_quadrature = quadrature.get_points(); + + FE_Q fe(1); + + DoFHandler dof(tr); + dof.distribute_dofs(fe); + + + FEValues fe_values (fe, quadrature, + update_quadrature_points); + + + MappingManifold map_manifold; + + cell = triangulation.begin_active(); + + for (; cell!=endc; ++cell) + { + fe_values.reinit(cell); + std::vector > q_points_from_fe_values = fe_values.get_quadrature_points(); + for (unsigned int q=0; q pq = map_manifold.transform_unit_to_real_cell(cell,q_points[q]); + + AssertThrow(pq.distance(q_points_from_fe_values[q]) < 1e-10, + ExcInternalError()); + } + } + deallog << "OK" << std::endl; +} + + +int +main() +{ + std::ofstream logfile ("output"); + deallog.attach(logfile); + deallog.threshold_double(1.e-10); + + + test<1,1>(); + test<2,2>(); + test<3,3>(); + + test<1,2>(); + test<1,3>(); + test<2,3>(); + + return 0; +} + + + diff --git a/tests/fe/mapping_manifold_02.output b/tests/fe/mapping_manifold_02.output new file mode 100644 index 0000000000..e69de29bb2 -- 2.39.5