]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use make_unique/shared in hp
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Sat, 10 Feb 2018 14:23:19 +0000 (15:23 +0100)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Thu, 15 Feb 2018 21:00:31 +0000 (22:00 +0100)
include/deal.II/hp/q_collection.h
source/hp/dof_handler.cc
source/hp/fe_collection.cc
source/hp/fe_values.cc

index ddcc5db25a87c706359c8f40e7feff2f3b713ed5..85e888eb9f0f0ce87300c24f0d200d63d34d8f39 100644 (file)
@@ -175,8 +175,7 @@ namespace hp
   inline
   QCollection<dim>::QCollection (const Quadrature<dim> &quadrature)
   {
-    quadratures
-    .push_back (std::shared_ptr<const Quadrature<dim> >(new Quadrature<dim>(quadrature)));
+    quadratures.push_back (std::make_shared<const Quadrature<dim> >(quadrature));
   }
 
 
@@ -196,8 +195,7 @@ namespace hp
   void
   QCollection<dim>::push_back (const Quadrature<dim> &new_quadrature)
   {
-    quadratures
-    .push_back (std::shared_ptr<const Quadrature<dim> >(new Quadrature<dim>(new_quadrature)));
+    quadratures.push_back (std::make_shared<const Quadrature<dim> >(new_quadrature));
   }
 
 } // namespace hp
index c3e1074d446f484f7c5481a4b9bce8247ee7b43e..67376b6ba524ef9cf5b1a25783d66e7ac096cd6c 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <deal.II/base/memory_consumption.h>
 #include <deal.II/base/geometry_info.h>
+#include <deal.II/base/std_cxx14/memory.h>
 #include <deal.II/base/thread_management.h>
 #include <deal.II/hp/dof_handler.h>
 #include <deal.II/hp/dof_level.h>
@@ -104,7 +105,7 @@ namespace internal
               }
 
             if (dim > 1)
-              dof_handler.faces.reset (new internal::hp::DoFIndicesOnFaces<dim>);
+              dof_handler.faces = std_cxx14::make_unique<internal::hp::DoFIndicesOnFaces<dim>> ();
           }
         }
 
@@ -966,11 +967,11 @@ namespace hp
   {
     // decide whether we need a sequential or a parallel shared/distributed policy
     if (dynamic_cast<const parallel::shared::Triangulation< dim, spacedim>*> (&*this->tria) != nullptr)
-      policy.reset (new internal::DoFHandler::Policy::ParallelShared<DoFHandler<dim,spacedim> >(*this));
+      policy = std_cxx14::make_unique<internal::DoFHandler::Policy::ParallelShared<DoFHandler<dim,spacedim> >> (*this);
     else if (dynamic_cast<const parallel::distributed::Triangulation< dim, spacedim >*> (&*this->tria) != nullptr)
-      policy.reset (new internal::DoFHandler::Policy::ParallelDistributed<DoFHandler<dim,spacedim> >(*this));
+      policy = std_cxx14::make_unique<internal::DoFHandler::Policy::ParallelDistributed<DoFHandler<dim,spacedim> >> (*this);
     else
-      policy.reset (new internal::DoFHandler::Policy::Sequential<DoFHandler<dim,spacedim> >(*this));
+      policy = std_cxx14::make_unique<internal::DoFHandler::Policy::Sequential<DoFHandler<dim,spacedim> >> (*this);
 
     create_active_fe_table ();
 
index 031ae75fd9682672031aa96b1297cfc8c6e6d40a..85ae95f08d242c5e31e3ca3d90faa7b232124251 100644 (file)
@@ -122,8 +122,7 @@ namespace hp
               ExcMessage ("All elements inside a collection need to have the "
                           "same number of vector components!"));
 
-    finite_elements
-    .push_back (std::shared_ptr<const FiniteElement<dim,spacedim> >(new_fe.clone()));
+    finite_elements.push_back (new_fe.clone());
   }
 
 
index 7967520b7fb69e16b2a2407de9496ea946d72d7a..a8a78facf8c5845e9840986855b6719336745559 100644 (file)
@@ -94,11 +94,11 @@ namespace internal
       if (fe_values_table(present_fe_values_index).get() == nullptr)
         fe_values_table(present_fe_values_index)
           =
-            std::shared_ptr<FEValuesType>
-            (new FEValuesType ((*mapping_collection)[mapping_index],
-                               (*fe_collection)[fe_index],
-                               q_collection[q_index],
-                               update_flags));
+            std::make_shared<FEValuesType>
+            ((*mapping_collection)[mapping_index],
+             (*fe_collection)[fe_index],
+             q_collection[q_index],
+             update_flags);
 
       // now there definitely is one!
       return *fe_values_table(present_fe_values_index);

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.