From 7a938faa540ddea0a17d28e2fe7b740d66bdf5eb Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Thu, 31 Dec 2020 13:15:51 +0100 Subject: [PATCH] Convert step-2 to a simplex test --- tests/simplex/step-02.cc | 102 ++ .../step-02.with_simplex_support=on.output | 1267 +++++++++++++++++ 2 files changed, 1369 insertions(+) create mode 100644 tests/simplex/step-02.cc create mode 100644 tests/simplex/step-02.with_simplex_support=on.output diff --git a/tests/simplex/step-02.cc b/tests/simplex/step-02.cc new file mode 100644 index 0000000000..32cf8295d4 --- /dev/null +++ b/tests/simplex/step-02.cc @@ -0,0 +1,102 @@ +// --------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------- + + +// Step-02 on a simplex mesh. Following incompatible modifications had to be +// made: +// - The function GridGenerator::hyper_shell() is only working for hypercube +// meshes. Use this function to create a temporary mesh and convert it to +// simplex mesh. +// - Local refinement is replaced by global refinement. + + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + +using namespace dealii; + +void make_grid(Triangulation<2> &triangulation) +{ + Triangulation<2> triangulation_temp; + + const Point<2> center(1, 0); + const double inner_radius = 0.5, outer_radius = 1.0; + GridGenerator::hyper_shell( + triangulation_temp, center, inner_radius, outer_radius, 5); + + GridGenerator::convert_hypercube_to_simplex_mesh(triangulation_temp, + triangulation); + + triangulation.refine_global(); // WARNING: no local refinement is performed +} + +void distribute_dofs(DoFHandler<2> &dof_handler) +{ + const Simplex::FE_P<2> finite_element(1); + dof_handler.distribute_dofs(finite_element); + + DynamicSparsityPattern dynamic_sparsity_pattern(dof_handler.n_dofs(), + dof_handler.n_dofs()); + + DoFTools::make_sparsity_pattern(dof_handler, dynamic_sparsity_pattern); + + SparsityPattern sparsity_pattern; + sparsity_pattern.copy_from(dynamic_sparsity_pattern); + + sparsity_pattern.print_svg(deallog.get_file_stream()); +} + +void renumber_dofs(DoFHandler<2> &dof_handler) +{ + DoFRenumbering::Cuthill_McKee(dof_handler); + + DynamicSparsityPattern dynamic_sparsity_pattern(dof_handler.n_dofs(), + dof_handler.n_dofs()); + DoFTools::make_sparsity_pattern(dof_handler, dynamic_sparsity_pattern); + + SparsityPattern sparsity_pattern; + sparsity_pattern.copy_from(dynamic_sparsity_pattern); + + sparsity_pattern.print_svg(deallog.get_file_stream()); +} + +int +main() +{ + initlog(); + + Triangulation<2> triangulation; + make_grid(triangulation); + + DoFHandler<2> dof_handler(triangulation); + + distribute_dofs(dof_handler); + renumber_dofs(dof_handler); +} diff --git a/tests/simplex/step-02.with_simplex_support=on.output b/tests/simplex/step-02.with_simplex_support=on.output new file mode 100644 index 0000000000..b96b2814be --- /dev/null +++ b/tests/simplex/step-02.with_simplex_support=on.output @@ -0,0 +1,1267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.39.5