From 3309a3c04667a7ec66dba9868ecf4dc0f2e09fa6 Mon Sep 17 00:00:00 2001 From: Sebastian Stark Date: Mon, 17 Dec 2018 13:51:07 +0200 Subject: [PATCH] Add codim 1 instantiations of make_hanging_node_constraints() --- doc/news/changes/minor/20200505SebastianStark | 3 + source/dofs/dof_tools_constraints.cc | 77 ++++--------------- source/dofs/dof_tools_constraints.inst.in | 38 +-------- tests/hp/hp_hanging_nodes_01.cc | 60 +++++++++------ tests/hp/hp_hanging_nodes_01.output | 31 ++++++++ 5 files changed, 90 insertions(+), 119 deletions(-) create mode 100644 doc/news/changes/minor/20200505SebastianStark diff --git a/doc/news/changes/minor/20200505SebastianStark b/doc/news/changes/minor/20200505SebastianStark new file mode 100644 index 0000000000..1e0bc8bdc6 --- /dev/null +++ b/doc/news/changes/minor/20200505SebastianStark @@ -0,0 +1,3 @@ +New: Codim one instantiations for make_hanging_node_constraints. +
+(Sebastian Stark, 2020/05/05) diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 6f3258f4ad..8f4b982564 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -546,91 +546,48 @@ namespace DoFTools } // namespace - template - void - make_hp_hanging_node_constraints(const dealii::DoFHandler<1> &, - AffineConstraints &) - { - // nothing to do for regular dof handlers in 1d - } - - - template - void - make_oldstyle_hanging_node_constraints(const dealii::DoFHandler<1> &, - AffineConstraints &, - std::integral_constant) - { - // nothing to do for regular dof handlers in 1d - } - - template + template void make_hp_hanging_node_constraints( - const dealii::hp::DoFHandler<1> & /*dof_handler*/, + const dealii::hp::DoFHandler<1, spacedim> & /*dof_handler*/, AffineConstraints & /*constraints*/) { - // we may have to compute constraints for vertices. gotta think about that - // a bit more - - // TODO[WB]: think about what to do here... + // nothing to do for dof handlers in 1d } - template + template void make_oldstyle_hanging_node_constraints( - const dealii::hp::DoFHandler<1> & /*dof_handler*/, + const dealii::hp::DoFHandler<1, spacedim> & /*dof_handler*/, AffineConstraints & /*constraints*/, std::integral_constant) { - // we may have to compute constraints for vertices. gotta think about that - // a bit more - - // TODO[WB]: think about what to do here... - } - - - template - void - make_hp_hanging_node_constraints(const dealii::DoFHandler<1, 2> &, - AffineConstraints &) - { - // nothing to do for regular dof handlers in 1d - } - - - template - void - make_oldstyle_hanging_node_constraints(const dealii::DoFHandler<1, 2> &, - AffineConstraints &, - std::integral_constant) - { - // nothing to do for regular dof handlers in 1d + // nothing to do for dof handlers in 1d } - template + template void - make_hp_hanging_node_constraints(const dealii::DoFHandler<1, 3> &, - AffineConstraints &) + make_hp_hanging_node_constraints( + const dealii::DoFHandler<1, spacedim> & /*dof_handler*/, + AffineConstraints & /*constraints*/) { - // nothing to do for regular dof handlers in 1d + // nothing to do for dof handlers in 1d } - template + template void - make_oldstyle_hanging_node_constraints(const dealii::DoFHandler<1, 3> &, - AffineConstraints &, - std::integral_constant) + make_oldstyle_hanging_node_constraints( + const dealii::DoFHandler<1, spacedim> & /*dof_handler*/, + AffineConstraints & /*constraints*/, + std::integral_constant) { - // nothing to do for regular dof handlers in 1d + // nothing to do for dof handlers in 1d } - - template void make_oldstyle_hanging_node_constraints( diff --git a/source/dofs/dof_tools_constraints.inst.in b/source/dofs/dof_tools_constraints.inst.in index 6f6966eb1e..0178308e24 100644 --- a/source/dofs/dof_tools_constraints.inst.in +++ b/source/dofs/dof_tools_constraints.inst.in @@ -13,42 +13,8 @@ // // --------------------------------------------------------------------- -// co-dim instantiations not for hp-DoFHandler -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) - { -#if deal_II_dimension < deal_II_space_dimension - template void DoFTools::make_hanging_node_constraints( - const DoFHandler &, - AffineConstraints &); - - template void DoFTools::make_hanging_node_constraints( - const DoFHandler &, - AffineConstraints &); - -# ifdef DEAL_II_WITH_COMPLEX_VALUES - template void DoFTools::make_hanging_node_constraints( - const DoFHandler &, - AffineConstraints> &); -# endif -#endif - } - for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) { - template void DoFTools::make_hanging_node_constraints( - const DH &, - AffineConstraints &); - - template void DoFTools::make_hanging_node_constraints( - const DH &, - AffineConstraints &); - -#ifdef DEAL_II_WITH_COMPLEX_VALUES - template void DoFTools::make_hanging_node_constraints( - const DH &, - AffineConstraints> &); -#endif - template void DoFTools::make_periodicity_constraints( const DH::face_iterator &, const DH::face_iterator &, @@ -139,6 +105,10 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS; S : REAL_AND_COMPLEX_SCALARS) { #if deal_II_dimension <= deal_II_space_dimension + template void DoFTools::make_hanging_node_constraints( + const DH &, + AffineConstraints &); + template void DoFTools::make_zero_boundary_constraints( const DH &, AffineConstraints &, diff --git a/tests/hp/hp_hanging_nodes_01.cc b/tests/hp/hp_hanging_nodes_01.cc index bb674bbb0e..27f2f11f7f 100644 --- a/tests/hp/hp_hanging_nodes_01.cc +++ b/tests/hp/hp_hanging_nodes_01.cc @@ -53,9 +53,9 @@ // method. It uses a triangulation with one refined element beside an // unrefined element to create the constraints for this configuration. -template +template int -generate_grid(Triangulation &tria) +generate_grid(Triangulation &tria) { Point p1, p2; std::vector sub_div; @@ -78,11 +78,11 @@ generate_grid(Triangulation &tria) -template +template void -test_constraints(hp::FECollection &fe_coll) +test_constraints(hp::FECollection &fe_coll) { - Triangulation tria; + Triangulation tria; // Setup a rectangular domain // where one cell is h-refined, @@ -96,11 +96,11 @@ test_constraints(hp::FECollection &fe_coll) // Now assign increasing // active_fe_indices to // the different cells. - hp::DoFHandler dof_handler(tria); - typename hp::DoFHandler::active_cell_iterator cell = dof_handler - .begin_active(), - endc = dof_handler.end(); - unsigned int fe_indx = 0; + hp::DoFHandler dof_handler(tria); + typename hp::DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); + unsigned int fe_indx = 0; for (; cell != endc; ++cell) { cell->set_active_fe_index(fe_indx); @@ -121,11 +121,11 @@ test_constraints(hp::FECollection &fe_coll) } -template +template void -test_constraints_old(FiniteElement &fe) +test_constraints_old(FiniteElement &fe) { - Triangulation tria; + Triangulation tria; // Setup a rectangular domain // where one cell is h-refined, @@ -139,7 +139,7 @@ test_constraints_old(FiniteElement &fe) // Now assign increasing // active_fe_indices to // the different cells. - DoFHandler dof_handler(tria); + DoFHandler dof_handler(tria); // Distribute DoFs; dof_handler.distribute_dofs(fe); @@ -154,17 +154,15 @@ test_constraints_old(FiniteElement &fe) constraint_matrix.print(deallog.get_file_stream()); } -int -main() +template +void +check() { - initlog(); - deallog.get_file_stream().precision(2); - - FE_Q<2> fe_1(1); - FE_Q<2> fe_2(2); - FE_Q<2> fe_3(QIterated<1>(QTrapez<1>(), 3)); + FE_Q fe_1(1); + FE_Q fe_2(2); + FE_Q fe_3(QIterated<1>(QTrapez<1>(), 3)); - hp::FECollection<2> fe_coll2; + hp::FECollection fe_coll2; fe_coll2.push_back(fe_3); fe_coll2.push_back(fe_2); fe_coll2.push_back(fe_2); @@ -172,9 +170,21 @@ main() fe_coll2.push_back(fe_2); fe_coll2.push_back(fe_3); - test_constraints<2>(fe_coll2); + test_constraints(fe_coll2); + + test_constraints_old(fe_1); +} + + + +int +main() +{ + initlog(); + deallog.get_file_stream().precision(2); - test_constraints_old<2>(fe_1); + check<2, 2>(); + check<2, 3>(); return 0; } diff --git a/tests/hp/hp_hanging_nodes_01.output b/tests/hp/hp_hanging_nodes_01.output index 7d91778d17..cbafe6a9d1 100644 --- a/tests/hp/hp_hanging_nodes_01.output +++ b/tests/hp/hp_hanging_nodes_01.output @@ -30,3 +30,34 @@ DEAL::DoFs: 48 DEAL::DoFs: 11 8 0: 0.50 8 2: 0.50 +DEAL::DoFs: 48 + 4 24: -0.33 + 4 1: 0.33 + 4 3: 1.0 + 25 24: -0.25 + 25 1: 0.12 + 25 3: 1.1 + 26 24: 0.19 + 26 1: -0.031 + 26 3: 0.84 + 38 24: -0.33 + 38 1: 0.33 + 38 3: 1.0 + 39 24: -0.25 + 39 1: 0.62 + 39 3: 0.63 + 40 18: 0.22 + 40 25: -0.11 + 40 28: 0.89 + 41 18: -0.11 + 41 25: 0.22 + 41 28: 0.89 + 36 18: 0.22 + 36 31: -0.11 + 36 33: 0.89 + 37 18: -0.11 + 37 31: 0.22 + 37 33: 0.89 +DEAL::DoFs: 11 + 8 0: 0.50 + 8 2: 0.50 -- 2.39.5