From: Luca Heltai Date: Mon, 23 Apr 2018 15:39:43 +0000 (+0200) Subject: Test for min/max diameter and FEFieldFunction. X-Git-Tag: v9.0.0-rc1~68^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b20a8d775a1d3cccac6509feae1ed5fb9c4cdfe;p=dealii.git Test for min/max diameter and FEFieldFunction. This test fails because of #6294. --- diff --git a/tests/grid/grid_tools_min_max_diameter_02.cc b/tests/grid/grid_tools_min_max_diameter_02.cc new file mode 100644 index 0000000000..8dd263bad8 --- /dev/null +++ b/tests/grid/grid_tools_min_max_diameter_02.cc @@ -0,0 +1,88 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 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. +// +// --------------------------------------------------------------------- + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#define PRECISION 2 + +template +void test(const unsigned int degree) +{ + deallog << "dim = " << dim << ", spacedim = " << spacedim << std::endl; + deallog << "degree = " << degree << std::endl; + + Triangulation tria; + GridGenerator::hyper_cube(tria, 0., 1.); + tria.refine_global (1); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + + FE_Q fe(degree); + FESystem fe_sys(fe, spacedim); + + DoFHandler dof_sys(tria); + dof_sys.distribute_dofs(fe_sys); + + Vector euler; + euler.reinit(dof_sys.n_dofs()); + const ComponentMask mask(spacedim, true); + + VectorTools::get_position_vector(dof_sys, euler, mask); + + MappingFEField map_fe(dof_sys, euler, mask); + + // Make the grid bigger by a factor two. + euler *= 2.0; + + deallog << "Min diameter : " << GridTools::minimal_cell_diameter(tria) << std::endl + << "Max diameter : " << GridTools::maximal_cell_diameter(tria) << std::endl + << "Min mapped diameter : " << GridTools::minimal_cell_diameter(tria,map_fe) << std::endl + << "Max mapped diameter : " << GridTools::maximal_cell_diameter(tria,map_fe) << std::endl; +} + +int main() +{ + initlog(); + + for (unsigned int d=1; d<4; ++d) + { + test<2,2>(d); + test<2,3>(d); + test<3,3>(d); + } +} diff --git a/tests/grid/grid_tools_min_max_diameter_02.output b/tests/grid/grid_tools_min_max_diameter_02.output new file mode 100644 index 0000000000..102920769f --- /dev/null +++ b/tests/grid/grid_tools_min_max_diameter_02.output @@ -0,0 +1,55 @@ + +DEAL::dim = 2, spacedim = 2 +DEAL::degree = 1 +DEAL::Min diameter : 0.353553 +DEAL::Max diameter : 0.707107 +DEAL::Min mapped diameter : 0.707107 +DEAL::Max mapped diameter : 1.41421 +DEAL::dim = 2, spacedim = 3 +DEAL::degree = 1 +DEAL::Min diameter : 0.353553 +DEAL::Max diameter : 0.707107 +DEAL::Min mapped diameter : 0.707107 +DEAL::Max mapped diameter : 1.41421 +DEAL::dim = 3, spacedim = 3 +DEAL::degree = 1 +DEAL::Min diameter : 0.433013 +DEAL::Max diameter : 0.866025 +DEAL::Min mapped diameter : 0.866025 +DEAL::Max mapped diameter : 1.73205 +DEAL::dim = 2, spacedim = 2 +DEAL::degree = 2 +DEAL::Min diameter : 0.353553 +DEAL::Max diameter : 0.707107 +DEAL::Min mapped diameter : 0.707107 +DEAL::Max mapped diameter : 1.41421 +DEAL::dim = 2, spacedim = 3 +DEAL::degree = 2 +DEAL::Min diameter : 0.353553 +DEAL::Max diameter : 0.707107 +DEAL::Min mapped diameter : 0.707107 +DEAL::Max mapped diameter : 1.41421 +DEAL::dim = 3, spacedim = 3 +DEAL::degree = 2 +DEAL::Min diameter : 0.433013 +DEAL::Max diameter : 0.866025 +DEAL::Min mapped diameter : 0.866025 +DEAL::Max mapped diameter : 1.73205 +DEAL::dim = 2, spacedim = 2 +DEAL::degree = 3 +DEAL::Min diameter : 0.353553 +DEAL::Max diameter : 0.707107 +DEAL::Min mapped diameter : 0.707107 +DEAL::Max mapped diameter : 1.41421 +DEAL::dim = 2, spacedim = 3 +DEAL::degree = 3 +DEAL::Min diameter : 0.353553 +DEAL::Max diameter : 0.707107 +DEAL::Min mapped diameter : 0.707107 +DEAL::Max mapped diameter : 1.41421 +DEAL::dim = 3, spacedim = 3 +DEAL::degree = 3 +DEAL::Min diameter : 0.433013 +DEAL::Max diameter : 0.866025 +DEAL::Min mapped diameter : 0.866025 +DEAL::Max mapped diameter : 1.73205