]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use make_unique/shared in multigrid
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 10 Feb 2018 15:47:54 +0000 (16:47 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 15 Feb 2018 21:00:31 +0000 (22:00 +0100)
source/multigrid/mg_transfer_internal.cc

index 45f66cc8facd3f845610ecc7b62f2d2d212d1ad4..2015f4ba7db4be8bc19bfa153e22406165e94171 100644 (file)
@@ -305,8 +305,7 @@ namespace internal
         {
           // shift the local number of the copy indices according to the new
           // partitioner that we are going to use for the vector
-          const std::shared_ptr<const Utilities::MPI::Partitioner> &part
-            = ghosted_level_vector.get_partitioner();
+          const auto &part = ghosted_level_vector.get_partitioner();
           ghosted_dofs.add_indices(part->ghost_indices());
           for (unsigned int i=0; i<copy_indices_global_mine.size(); ++i)
             copy_indices_global_mine[i].second =
@@ -505,11 +504,9 @@ namespace internal
                 ExcInternalError());
         fe_name[template_starts+1] = '1';
       }
-      std::shared_ptr<FiniteElement<1> > fe_1d
-      (FETools::get_fe_by_name<1,1>(fe_name));
-      const FiniteElement<1> &fe = *fe_1d;
+      const std::unique_ptr<FiniteElement<1> > fe (FETools::get_fe_by_name<1,1>(fe_name));
 
-      setup_element_info(elem_info,fe,mg_dof);
+      setup_element_info(elem_info,*fe,mg_dof);
 
 
       // -------------- 2. Extract and match dof indices between child and parent
@@ -595,8 +592,8 @@ namespace internal
                     if (!owned_level_dofs.is_element(local_dof_indices[i]))
                       ghosted_level_dofs.push_back(local_dof_indices[i]);
 
-                  add_child_indices<dim>(c, fe.dofs_per_cell - fe.dofs_per_vertex,
-                                         fe.degree, elem_info.lexicographic_numbering,
+                  add_child_indices<dim>(c, fe->dofs_per_cell - fe->dofs_per_vertex,
+                                         fe->degree, elem_info.lexicographic_numbering,
                                          local_dof_indices,
                                          &next_indices[start_index]);
 
@@ -656,8 +653,8 @@ namespace internal
                   const std::size_t start_index = global_level_dof_indices_l0.size();
                   global_level_dof_indices_l0.resize(start_index+elem_info.n_child_cell_dofs,
                                                      numbers::invalid_dof_index);
-                  add_child_indices<dim>(0, fe.dofs_per_cell - fe.dofs_per_vertex,
-                                         fe.degree, elem_info.lexicographic_numbering,
+                  add_child_indices<dim>(0, fe->dofs_per_cell - fe->dofs_per_vertex,
+                                         fe->degree, elem_info.lexicographic_numbering,
                                          local_dof_indices,
                                          &global_level_dof_indices_l0[start_index]);
 
@@ -726,7 +723,7 @@ namespace internal
 
       // ---------------------- 3. compute weights to make restriction additive
 
-      const unsigned int n_child_dofs_1d = fe.degree + 1 + fe.dofs_per_cell - fe.dofs_per_vertex;
+      const unsigned int n_child_dofs_1d = fe->degree + 1 + fe->dofs_per_cell - fe->dofs_per_vertex;
 
       // get the valence of the individual components and compute the weights as
       // the inverse of the valence

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.