From 7dd8dcb6400dbf28814a54ac7a970572ce51e278 Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Wed, 13 Jan 2021 11:01:15 -0700 Subject: [PATCH] simplex: hanging node tests --- tests/simplex/hanging_nodes_01.cc | 71 +++++++++++++++++++ ...ng_nodes_01.with_simplex_support=on.output | 3 + tests/simplex/hanging_nodes_02.cc | 67 +++++++++++++++++ ...ng_nodes_02.with_simplex_support=on.output | 5 ++ 4 files changed, 146 insertions(+) create mode 100644 tests/simplex/hanging_nodes_01.cc create mode 100644 tests/simplex/hanging_nodes_01.with_simplex_support=on.output create mode 100644 tests/simplex/hanging_nodes_02.cc create mode 100644 tests/simplex/hanging_nodes_02.with_simplex_support=on.output diff --git a/tests/simplex/hanging_nodes_01.cc b/tests/simplex/hanging_nodes_01.cc new file mode 100644 index 0000000000..753ecdf45e --- /dev/null +++ b/tests/simplex/hanging_nodes_01.cc @@ -0,0 +1,71 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2021 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. +// +// --------------------------------------------------------------------- + + + +// verify hanging node constraints on locally h-refined simplex mesh + +#include +#include + +#include +#include + +#include + +#include +#include + +#include "../tests.h" + + +template +void +test() +{ + // setup grid + Triangulation tria; + GridGenerator::subdivided_hyper_cube_with_simplices(tria, 1); + + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + +#if false + GridOut grid_out; + grid_out.write_vtk(tria, deallog.get_file_stream()); +#endif + + DoFHandler dofh(tria); + dofh.distribute_dofs(Simplex::FE_P(1)); + deallog << "ndofs: " << dofh.n_dofs() << std::endl; + + // hanging node constraints + AffineConstraints constraints; + // DoFTools::make_hanging_node_constraints(dofh, constraints); + constraints.print(deallog.get_file_stream()); + + deallog << "OK" << std::endl; +} + + +int +main() +{ + initlog(); + + deallog.push("2d"); + test<2>(); + deallog.pop(); +} diff --git a/tests/simplex/hanging_nodes_01.with_simplex_support=on.output b/tests/simplex/hanging_nodes_01.with_simplex_support=on.output new file mode 100644 index 0000000000..1f03256372 --- /dev/null +++ b/tests/simplex/hanging_nodes_01.with_simplex_support=on.output @@ -0,0 +1,3 @@ + +DEAL:2d::ndofs: 7 +DEAL:2d::OK diff --git a/tests/simplex/hanging_nodes_02.cc b/tests/simplex/hanging_nodes_02.cc new file mode 100644 index 0000000000..d3816830b1 --- /dev/null +++ b/tests/simplex/hanging_nodes_02.cc @@ -0,0 +1,67 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2021 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. +// +// --------------------------------------------------------------------- + + + +// verify hanging node constraints on locally p-refined simplex mesh + +#include +#include + +#include + +#include + +#include + +#include +#include + +#include "../tests.h" + + +template +void +test(const hp::FECollection &fes) +{ + // setup grid + Triangulation tria; + GridGenerator::subdivided_hyper_cube_with_simplices(tria, 1); + + DoFHandler dofh(tria); + dofh.begin_active()->set_active_fe_index(1); + + dofh.distribute_dofs(fes); + deallog << "ndofs: " << dofh.n_dofs() << std::endl; + + // hanging node constraints + AffineConstraints constraints; + // DoFTools::make_hanging_node_constraints(dofh, constraints); + constraints.print(deallog.get_file_stream()); + + deallog << "OK" << std::endl; +} + + +int +main() +{ + initlog(); + + deallog.push("2d"); + test<2>(hp::FECollection<2>(Simplex::FE_P<2>(1), Simplex::FE_P<2>(2))); + test<2>(hp::FECollection<2>(Simplex::FE_P<2>(2), Simplex::FE_P<2>(1))); + deallog.pop(); +} diff --git a/tests/simplex/hanging_nodes_02.with_simplex_support=on.output b/tests/simplex/hanging_nodes_02.with_simplex_support=on.output new file mode 100644 index 0000000000..b905ef0c4e --- /dev/null +++ b/tests/simplex/hanging_nodes_02.with_simplex_support=on.output @@ -0,0 +1,5 @@ + +DEAL:2d::ndofs: 7 +DEAL:2d::OK +DEAL:2d::ndofs: 7 +DEAL:2d::OK -- 2.39.5