]> https://gitweb.dealii.org/ - dealii.git/commitdiff
cell_weight: assign FEs to DoFHandler early in step-75.
authorMarc Fehling <mafehling.git@gmail.com>
Sat, 12 Mar 2022 03:18:49 +0000 (20:18 -0700)
committerMarc Fehling <mafehling.git@gmail.com>
Sat, 12 Mar 2022 03:28:05 +0000 (20:28 -0700)
examples/step-75/step-75.cc

index 0847e66ebe4ebc788e8591871c70952592afcea5..d59ee52a607acc58f6e74a93dc0b38a8b962c79c 100644 (file)
@@ -1047,9 +1047,12 @@ namespace Step75
   // remove one cell in every cell from the negative direction, but remove one
   // from the positive x-direction.
   //
-  // In the end, we supply the number of initial refinements that corresponds to
-  // the supplied minimal grid refinement level. Further, we set the initial
-  // active FE indices accordingly.
+  // On the coarse grid, we set the initial active FE indices and distribute the
+  // degrees of freedom once. We do that in order to assign the hp::FECollection
+  // to the DoFHandler, so that all cells know how many DoFs they are going to
+  // have. This step is mandatory for the weighted load balancing algorithm,
+  // which will be called implicitly in
+  // parallel::distributed::Triangulation::refine_global().
   template <int dim>
   void LaplaceProblem<dim>::initialize_grid()
   {
@@ -1077,12 +1080,14 @@ namespace Step75
     GridGenerator::subdivided_hyper_L(
       triangulation, repetitions, bottom_left, top_right, cells_to_remove);
 
-    triangulation.refine_global(prm.min_h_level);
-
     const unsigned int min_fe_index = prm.min_p_degree - 1;
     for (const auto &cell : dof_handler.active_cell_iterators())
       if (cell->is_locally_owned())
         cell->set_active_fe_index(min_fe_index);
+
+    dof_handler.distribute_dofs(fe_collection);
+
+    triangulation.refine_global(prm.min_h_level);
   }
 
 

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.