]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add codim 1 instantiations of make_hanging_node_constraints() 10034/head
authorSebastian Stark <stark.sebastian@gmx.de>
Mon, 17 Dec 2018 11:51:07 +0000 (13:51 +0200)
committerSebastian Stark <stark.sebastian@gmx.de>
Wed, 6 May 2020 18:12:08 +0000 (20:12 +0200)
doc/news/changes/minor/20200505SebastianStark [new file with mode: 0644]
source/dofs/dof_tools_constraints.cc
source/dofs/dof_tools_constraints.inst.in
tests/hp/hp_hanging_nodes_01.cc
tests/hp/hp_hanging_nodes_01.output

diff --git a/doc/news/changes/minor/20200505SebastianStark b/doc/news/changes/minor/20200505SebastianStark
new file mode 100644 (file)
index 0000000..1e0bc8b
--- /dev/null
@@ -0,0 +1,3 @@
+New: Codim one instantiations for make_hanging_node_constraints.
+<br>
+(Sebastian Stark, 2020/05/05)
index 6f3258f4adec0fef0d24a9a26f3531ea1081d9b9..8f4b982564eac2ecbf7beb1cd2815949c52517c0 100644 (file)
@@ -546,91 +546,48 @@ namespace DoFTools
     } // namespace
 
 
-    template <typename number>
-    void
-    make_hp_hanging_node_constraints(const dealii::DoFHandler<1> &,
-                                     AffineConstraints<number> &)
-    {
-      // nothing to do for regular dof handlers in 1d
-    }
-
-
-    template <typename number>
-    void
-    make_oldstyle_hanging_node_constraints(const dealii::DoFHandler<1> &,
-                                           AffineConstraints<number> &,
-                                           std::integral_constant<int, 1>)
-    {
-      // nothing to do for regular dof handlers in 1d
-    }
-
 
-    template <typename number>
+    template <typename number, int spacedim>
     void
     make_hp_hanging_node_constraints(
-      const dealii::hp::DoFHandler<1> & /*dof_handler*/,
+      const dealii::hp::DoFHandler<1, spacedim> & /*dof_handler*/,
       AffineConstraints<number> & /*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 <typename number>
+    template <typename number, int spacedim>
     void
     make_oldstyle_hanging_node_constraints(
-      const dealii::hp::DoFHandler<1> & /*dof_handler*/,
+      const dealii::hp::DoFHandler<1, spacedim> & /*dof_handler*/,
       AffineConstraints<number> & /*constraints*/,
       std::integral_constant<int, 1>)
     {
-      // we may have to compute constraints for vertices. gotta think about that
-      // a bit more
-
-      // TODO[WB]: think about what to do here...
-    }
-
-
-    template <typename number>
-    void
-    make_hp_hanging_node_constraints(const dealii::DoFHandler<1, 2> &,
-                                     AffineConstraints<number> &)
-    {
-      // nothing to do for regular dof handlers in 1d
-    }
-
-
-    template <typename number>
-    void
-    make_oldstyle_hanging_node_constraints(const dealii::DoFHandler<1, 2> &,
-                                           AffineConstraints<number> &,
-                                           std::integral_constant<int, 1>)
-    {
-      // nothing to do for regular dof handlers in 1d
+      // nothing to do for dof handlers in 1d
     }
 
 
-    template <typename number>
+    template <typename number, int spacedim>
     void
-    make_hp_hanging_node_constraints(const dealii::DoFHandler<1, 3> &,
-                                     AffineConstraints<number> &)
+    make_hp_hanging_node_constraints(
+      const dealii::DoFHandler<1, spacedim> & /*dof_handler*/,
+      AffineConstraints<number> & /*constraints*/)
     {
-      // nothing to do for regular dof handlers in 1d
+      // nothing to do for dof handlers in 1d
     }
 
 
-    template <typename number>
+    template <typename number, int spacedim>
     void
-    make_oldstyle_hanging_node_constraints(const dealii::DoFHandler<1, 3> &,
-                                           AffineConstraints<number> &,
-                                           std::integral_constant<int, 1>)
+    make_oldstyle_hanging_node_constraints(
+      const dealii::DoFHandler<1, spacedim> & /*dof_handler*/,
+      AffineConstraints<number> & /*constraints*/,
+      std::integral_constant<int, 1>)
     {
-      // nothing to do for regular dof handlers in 1d
+      // nothing to do for dof handlers in 1d
     }
 
-
-
     template <typename DoFHandlerType, typename number>
     void
     make_oldstyle_hanging_node_constraints(
index 6f6966eb1e600f3bc938e9328fdf4c046cc9f21d..0178308e247038c89d80168e086f537a6b71740a 100644 (file)
 //
 // ---------------------------------------------------------------------
 
-// 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<deal_II_dimension, deal_II_space_dimension> &,
-      AffineConstraints<double> &);
-
-    template void DoFTools::make_hanging_node_constraints(
-      const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-      AffineConstraints<float> &);
-
-#  ifdef DEAL_II_WITH_COMPLEX_VALUES
-    template void DoFTools::make_hanging_node_constraints(
-      const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
-      AffineConstraints<std::complex<double>> &);
-#  endif
-#endif
-  }
-
 for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
   {
-    template void DoFTools::make_hanging_node_constraints(
-      const DH<deal_II_dimension, deal_II_dimension> &,
-      AffineConstraints<double> &);
-
-    template void DoFTools::make_hanging_node_constraints(
-      const DH<deal_II_dimension, deal_II_dimension> &,
-      AffineConstraints<float> &);
-
-#ifdef DEAL_II_WITH_COMPLEX_VALUES
-    template void DoFTools::make_hanging_node_constraints(
-      const DH<deal_II_dimension, deal_II_dimension> &,
-      AffineConstraints<std::complex<double>> &);
-#endif
-
     template void DoFTools::make_periodicity_constraints(
       const DH<deal_II_dimension>::face_iterator &,
       const DH<deal_II_dimension>::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<deal_II_dimension, deal_II_space_dimension> &,
+      AffineConstraints<S> &);
+
     template void DoFTools::make_zero_boundary_constraints(
       const DH<deal_II_dimension, deal_II_space_dimension> &,
       AffineConstraints<S> &,
index bb674bbb0ebd4efe0a2c1c641b7f233e72a5ed3d..27f2f11f7f68b17a083ac1eef2b48c7256b844d2 100644 (file)
@@ -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 <int dim>
+template <int dim, int spacedim>
 int
-generate_grid(Triangulation<dim> &tria)
+generate_grid(Triangulation<dim, spacedim> &tria)
 {
   Point<dim>                p1, p2;
   std::vector<unsigned int> sub_div;
@@ -78,11 +78,11 @@ generate_grid(Triangulation<dim> &tria)
 
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-test_constraints(hp::FECollection<dim> &fe_coll)
+test_constraints(hp::FECollection<dim, spacedim> &fe_coll)
 {
-  Triangulation<dim> tria;
+  Triangulation<dim, spacedim> tria;
 
   // Setup a rectangular domain
   // where one cell is h-refined,
@@ -96,11 +96,11 @@ test_constraints(hp::FECollection<dim> &fe_coll)
   // Now assign increasing
   // active_fe_indices to
   // the different cells.
-  hp::DoFHandler<dim>                                dof_handler(tria);
-  typename hp::DoFHandler<dim>::active_cell_iterator cell = dof_handler
-                                                              .begin_active(),
-                                                     endc = dof_handler.end();
-  unsigned int fe_indx                                    = 0;
+  hp::DoFHandler<dim, spacedim> dof_handler(tria);
+  typename hp::DoFHandler<dim, spacedim>::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<dim> &fe_coll)
 }
 
 
-template <int dim>
+template <int dim, int spacedim>
 void
-test_constraints_old(FiniteElement<dim> &fe)
+test_constraints_old(FiniteElement<dim, spacedim> &fe)
 {
-  Triangulation<dim> tria;
+  Triangulation<dim, spacedim> tria;
 
   // Setup a rectangular domain
   // where one cell is h-refined,
@@ -139,7 +139,7 @@ test_constraints_old(FiniteElement<dim> &fe)
   // Now assign increasing
   // active_fe_indices to
   // the different cells.
-  DoFHandler<dim> dof_handler(tria);
+  DoFHandler<dim, spacedim> dof_handler(tria);
 
   // Distribute DoFs;
   dof_handler.distribute_dofs(fe);
@@ -154,17 +154,15 @@ test_constraints_old(FiniteElement<dim> &fe)
   constraint_matrix.print(deallog.get_file_stream());
 }
 
-int
-main()
+template <int dim, int spacedim>
+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<dim, spacedim> fe_1(1);
+  FE_Q<dim, spacedim> fe_2(2);
+  FE_Q<dim, spacedim> fe_3(QIterated<1>(QTrapez<1>(), 3));
 
-  hp::FECollection<2> fe_coll2;
+  hp::FECollection<dim, spacedim> 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<dim, spacedim>(fe_coll2);
+
+  test_constraints_old<dim, spacedim>(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;
 }
index 7d91778d17c912802bbd690a4fd322968a1539f1..cbafe6a9d1785c3f4c3e462ddc68a6e13d337c8c 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.