]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid a couple of places where we explicitly use 'new'. 10802/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 6 Aug 2020 22:58:06 +0000 (16:58 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 6 Aug 2020 22:58:06 +0000 (16:58 -0600)
include/deal.II/lac/la_parallel_vector.templates.h

index 6efd9a5a7826b053358db8b630f587c0a14ccf9e..e916e86fcd406330379723b625aa7504e09a3424 100644 (file)
@@ -486,11 +486,8 @@ namespace LinearAlgebra
       const MPI_Comm  communicator)
     {
       // set up parallel partitioner with index sets and communicator
-      std::shared_ptr<const Utilities::MPI::Partitioner> new_partitioner(
-        new Utilities::MPI::Partitioner(locally_owned_indices,
-                                        ghost_indices,
-                                        communicator));
-      reinit(new_partitioner);
+      reinit(std::make_shared<Utilities::MPI::Partitioner>(
+        locally_owned_indices, ghost_indices, communicator));
     }
 
 
@@ -502,9 +499,9 @@ namespace LinearAlgebra
       const MPI_Comm  communicator)
     {
       // set up parallel partitioner with index sets and communicator
-      std::shared_ptr<const Utilities::MPI::Partitioner> new_partitioner(
-        new Utilities::MPI::Partitioner(locally_owned_indices, communicator));
-      reinit(new_partitioner);
+      reinit(
+        std::make_shared<Utilities::MPI::Partitioner>(locally_owned_indices,
+                                                      communicator));
     }
 
 
@@ -523,7 +520,7 @@ namespace LinearAlgebra
       resize_val(new_allocated_size);
 
       // initialize to zero
-      this->operator=(Number());
+      *this = Number();
 
 
       // do not reallocate import_data directly, but only upon request. It
@@ -540,7 +537,7 @@ namespace LinearAlgebra
 
     template <typename Number, typename MemorySpaceType>
     Vector<Number, MemorySpaceType>::Vector()
-      : partitioner(new Utilities::MPI::Partitioner())
+      : partitioner(std::make_shared<Utilities::MPI::Partitioner>())
       , allocated_size(0)
     {
       reinit(0);

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.