From: Marc Fehling Date: Wed, 24 May 2023 23:02:49 +0000 (-0600) Subject: Added test for identity constraints in h-adapted grids. X-Git-Tag: v9.5.0-rc1~195^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55b5e52c5484c304c59ba5b7a00dd82a159728ff;p=dealii.git Added test for identity constraints in h-adapted grids. --- diff --git a/tests/lac/identity_constraints_01.cc b/tests/lac/identity_constraints_01.cc new file mode 100644 index 0000000000..a6075703aa --- /dev/null +++ b/tests/lac/identity_constraints_01.cc @@ -0,0 +1,88 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2023 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 for identity constraints using different finite elements +// in h-refined grids with hanging nodes. +// +---+---+-------+ +// | | | | +// +---+---+ | +// | | | | +// +---+---+-------+ + + +#include +#include + +#include +#include + +#include + +#include + +#include "../tests.h" + +#include "../test_grids.h" + + +template +void +test(const FiniteElement &fe) +{ + Triangulation tria; + TestGrids::hyper_line(tria, 2); + tria.begin_active()->set_refine_flag(); + tria.execute_coarsening_and_refinement(); + + DoFHandler dofh(tria); + dofh.distribute_dofs(fe); + + AffineConstraints constraints; + DoFTools::make_hanging_node_constraints(dofh, constraints); + constraints.close(); + + deallog << fe.get_name() << ":"; + // print dof identities + for (const auto &line : constraints.get_lines()) + if ((line.entries.size() == 1) && (line.entries[0].second == 1.)) + deallog << " " << line.index << "=" << line.entries[0].first; + deallog << std::endl; + +#if false + constraints.print(deallog.get_file_stream()); +#endif +} + + +int +main() +{ + initlog(); + + { + constexpr int dim = 2; + + for (unsigned int degree = 1; degree <= 9; ++degree) + test(FE_Q(degree)); + } + + { + constexpr int dim = 3; + + for (unsigned int degree = 1; degree <= 9; ++degree) + test(FE_Q(degree)); + } +} diff --git a/tests/lac/identity_constraints_01.output b/tests/lac/identity_constraints_01.output new file mode 100644 index 0000000000..b6a54b8f82 --- /dev/null +++ b/tests/lac/identity_constraints_01.output @@ -0,0 +1,19 @@ + +DEAL::FE_Q<2>(1): +DEAL::FE_Q<2>(2): 18=4 +DEAL::FE_Q<2>(3): +DEAL::FE_Q<2>(4): 50=5 +DEAL::FE_Q<2>(5): +DEAL::FE_Q<2>(6): 98=6 +DEAL::FE_Q<2>(7): +DEAL::FE_Q<2>(8): 162=7 +DEAL::FE_Q<2>(9): +DEAL::FE_Q<3>(1): +DEAL::FE_Q<3>(2): 54=8 55=16 56=20 89=18 118=12 +DEAL::FE_Q<3>(3): +DEAL::FE_Q<3>(4): 250=9 251=33 252=48 449=39 628=21 +DEAL::FE_Q<3>(5): +DEAL::FE_Q<3>(6): 686=10 687=50 688=80 1273=60 1818=30 +DEAL::FE_Q<3>(7): +DEAL::FE_Q<3>(8): 1458=11 1459=67 1460=116 2753=81 3976=39 +DEAL::FE_Q<3>(9):