From 067b347a4b5014061716a5944fd10a11925e041d Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 10 Feb 2018 15:23:19 +0100 Subject: [PATCH] Use make_unique/shared in hp --- include/deal.II/hp/q_collection.h | 6 ++---- source/hp/dof_handler.cc | 9 +++++---- source/hp/fe_collection.cc | 3 +-- source/hp/fe_values.cc | 10 +++++----- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/include/deal.II/hp/q_collection.h b/include/deal.II/hp/q_collection.h index ddcc5db25a..85e888eb9f 100644 --- a/include/deal.II/hp/q_collection.h +++ b/include/deal.II/hp/q_collection.h @@ -175,8 +175,7 @@ namespace hp inline QCollection::QCollection (const Quadrature &quadrature) { - quadratures - .push_back (std::shared_ptr >(new Quadrature(quadrature))); + quadratures.push_back (std::make_shared >(quadrature)); } @@ -196,8 +195,7 @@ namespace hp void QCollection::push_back (const Quadrature &new_quadrature) { - quadratures - .push_back (std::shared_ptr >(new Quadrature(new_quadrature))); + quadratures.push_back (std::make_shared >(new_quadrature)); } } // namespace hp diff --git a/source/hp/dof_handler.cc b/source/hp/dof_handler.cc index c3e1074d44..67376b6ba5 100644 --- a/source/hp/dof_handler.cc +++ b/source/hp/dof_handler.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -104,7 +105,7 @@ namespace internal } if (dim > 1) - dof_handler.faces.reset (new internal::hp::DoFIndicesOnFaces); + dof_handler.faces = std_cxx14::make_unique> (); } } @@ -966,11 +967,11 @@ namespace hp { // decide whether we need a sequential or a parallel shared/distributed policy if (dynamic_cast*> (&*this->tria) != nullptr) - policy.reset (new internal::DoFHandler::Policy::ParallelShared >(*this)); + policy = std_cxx14::make_unique >> (*this); else if (dynamic_cast*> (&*this->tria) != nullptr) - policy.reset (new internal::DoFHandler::Policy::ParallelDistributed >(*this)); + policy = std_cxx14::make_unique >> (*this); else - policy.reset (new internal::DoFHandler::Policy::Sequential >(*this)); + policy = std_cxx14::make_unique >> (*this); create_active_fe_table (); diff --git a/source/hp/fe_collection.cc b/source/hp/fe_collection.cc index 031ae75fd9..85ae95f08d 100644 --- a/source/hp/fe_collection.cc +++ b/source/hp/fe_collection.cc @@ -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 >(new_fe.clone())); + finite_elements.push_back (new_fe.clone()); } diff --git a/source/hp/fe_values.cc b/source/hp/fe_values.cc index 7967520b7f..a8a78facf8 100644 --- a/source/hp/fe_values.cc +++ b/source/hp/fe_values.cc @@ -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 - (new FEValuesType ((*mapping_collection)[mapping_index], - (*fe_collection)[fe_index], - q_collection[q_index], - update_flags)); + std::make_shared + ((*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); -- 2.39.5