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

index 85a096152bcb285c99b32c1e2b40a46cacd07086..a4ea89f37aba07b0d4f5117c9175df74d48a11a3 100644 (file)
@@ -1923,7 +1923,7 @@ namespace internal
 
         // reserve enough space
         triangulation.levels.push_back (std_cxx14::make_unique<internal::Triangulation::TriaLevel<dim>>());
-        triangulation.faces.reset (new internal::Triangulation::TriaFaces<dim>);
+        triangulation.faces = std_cxx14::make_unique<internal::Triangulation::TriaFaces<dim>> ();
         triangulation.levels[0]->reserve_space (cells.size(), dim, spacedim);
         triangulation.faces->lines.reserve_space (0,needed_lines.size());
         triangulation.levels[0]->cells.reserve_space (0,cells.size());
@@ -2291,7 +2291,7 @@ namespace internal
         // for the lines
         // reserve enough space
         triangulation.levels.push_back (std_cxx14::make_unique<internal::Triangulation::TriaLevel<dim>>());
-        triangulation.faces.reset (new internal::Triangulation::TriaFaces<dim>);
+        triangulation.faces = std_cxx14::make_unique<internal::Triangulation::TriaFaces<dim>> ();
         triangulation.levels[0]->reserve_space (cells.size(), dim, spacedim);
         triangulation.faces->lines.reserve_space (0,needed_lines.size());
 
@@ -8814,10 +8814,8 @@ Triangulation (const MeshSmoothing smooth_grid,
 {
   if (dim == 1)
     {
-      vertex_to_boundary_id_map_1d
-      .reset (new std::map<unsigned int, types::boundary_id>());
-      vertex_to_manifold_id_map_1d
-      .reset (new std::map<unsigned int, types::manifold_id>());
+      vertex_to_boundary_id_map_1d = std_cxx14::make_unique<std::map<unsigned int, types::boundary_id>> ();
+      vertex_to_manifold_id_map_1d = std_cxx14::make_unique<std::map<unsigned int, types::manifold_id>> ();
     }
 
   // connect the any_change signal to the other top level signals
@@ -9162,7 +9160,7 @@ copy_triangulation (const Triangulation<dim, spacedim> &other_tria)
   smooth_grid            = other_tria.smooth_grid;
 
   if (dim > 1)
-    faces.reset (new internal::Triangulation::TriaFaces<dim>(*other_tria.faces));
+    faces = std_cxx14::make_unique<internal::Triangulation::TriaFaces<dim>> (*other_tria.faces);
 
   typename std::map<types::manifold_id,
            SmartPointer<const Manifold<dim,spacedim>, Triangulation<dim, spacedim> > >::const_iterator
@@ -9173,19 +9171,18 @@ copy_triangulation (const Triangulation<dim, spacedim> &other_tria)
 
   levels.reserve (other_tria.levels.size());
   for (unsigned int level=0; level<other_tria.levels.size(); ++level)
-    levels.push_back (std_cxx14::make_unique<internal::Triangulation::TriaLevel<dim>>(*other_tria.levels[level]));
+    levels.push_back (std_cxx14::make_unique<internal::Triangulation::TriaLevel<dim>>
+                      (*other_tria.levels[level]));
 
   number_cache = other_tria.number_cache;
 
   if (dim == 1)
     {
-      vertex_to_boundary_id_map_1d
-      .reset(new std::map<unsigned int, types::boundary_id>
-             (*other_tria.vertex_to_boundary_id_map_1d));
+      vertex_to_boundary_id_map_1d = std_cxx14::make_unique<std::map<unsigned int, types::boundary_id>>
+                                     (*other_tria.vertex_to_boundary_id_map_1d);
 
-      vertex_to_manifold_id_map_1d
-      .reset(new std::map<unsigned int, types::manifold_id>
-             (*other_tria.vertex_to_manifold_id_map_1d));
+      vertex_to_manifold_id_map_1d = std_cxx14::make_unique<std::map<unsigned int, types::manifold_id>>
+                                     (*other_tria.vertex_to_manifold_id_map_1d);
     }
 
   // inform those who are listening on other_tria of the copy operation
index b3a017138e11fe292527590c82538bac9d5889f9..82a64a2829208b2a41da885633ae74bd16bd066b 100644 (file)
@@ -14,6 +14,7 @@
 // ---------------------------------------------------------------------
 
 #include <deal.II/base/tensor.h>
+#include <deal.II/base/std_cxx14/memory.h>
 #include <deal.II/grid/tria_boundary.h>
 #include <deal.II/grid/tria.h>
 #include <deal.II/grid/tria_iterator.h>
@@ -166,11 +167,8 @@ get_line_support_points (const unsigned int n_intermediate_points) const
 
       // another thread might have created points in the meantime
       if (points[n_intermediate_points].get() == nullptr)
-        {
-          std::shared_ptr<QGaussLobatto<1> >
-          quadrature (new QGaussLobatto<1>(n_intermediate_points+2));
-          points[n_intermediate_points] = quadrature;
-        }
+        points[n_intermediate_points] = std_cxx14::make_unique<QGaussLobatto<1> >
+                                        (n_intermediate_points+2);
     }
   return points[n_intermediate_points]->get_points();
 }

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.