From 001fced289b834a27b463e43aae37c71465ef803 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sat, 10 Feb 2018 16:23:46 +0100 Subject: [PATCH] Use make_unique/shared in grid --- source/grid/tria.cc | 25 +++++++++++-------------- source/grid/tria_boundary.cc | 8 +++----- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/source/grid/tria.cc b/source/grid/tria.cc index 85a096152b..a4ea89f37a 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -1923,7 +1923,7 @@ namespace internal // reserve enough space triangulation.levels.push_back (std_cxx14::make_unique>()); - triangulation.faces.reset (new internal::Triangulation::TriaFaces); + triangulation.faces = std_cxx14::make_unique> (); 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>()); - triangulation.faces.reset (new internal::Triangulation::TriaFaces); + triangulation.faces = std_cxx14::make_unique> (); 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()); - vertex_to_manifold_id_map_1d - .reset (new std::map()); + vertex_to_boundary_id_map_1d = std_cxx14::make_unique> (); + vertex_to_manifold_id_map_1d = std_cxx14::make_unique> (); } // connect the any_change signal to the other top level signals @@ -9162,7 +9160,7 @@ copy_triangulation (const Triangulation &other_tria) smooth_grid = other_tria.smooth_grid; if (dim > 1) - faces.reset (new internal::Triangulation::TriaFaces(*other_tria.faces)); + faces = std_cxx14::make_unique> (*other_tria.faces); typename std::map, Triangulation > >::const_iterator @@ -9173,19 +9171,18 @@ copy_triangulation (const Triangulation &other_tria) levels.reserve (other_tria.levels.size()); for (unsigned int level=0; level>(*other_tria.levels[level])); + levels.push_back (std_cxx14::make_unique> + (*other_tria.levels[level])); number_cache = other_tria.number_cache; if (dim == 1) { - vertex_to_boundary_id_map_1d - .reset(new std::map - (*other_tria.vertex_to_boundary_id_map_1d)); + vertex_to_boundary_id_map_1d = std_cxx14::make_unique> + (*other_tria.vertex_to_boundary_id_map_1d); - vertex_to_manifold_id_map_1d - .reset(new std::map - (*other_tria.vertex_to_manifold_id_map_1d)); + vertex_to_manifold_id_map_1d = std_cxx14::make_unique> + (*other_tria.vertex_to_manifold_id_map_1d); } // inform those who are listening on other_tria of the copy operation diff --git a/source/grid/tria_boundary.cc b/source/grid/tria_boundary.cc index b3a017138e..82a64a2829 100644 --- a/source/grid/tria_boundary.cc +++ b/source/grid/tria_boundary.cc @@ -14,6 +14,7 @@ // --------------------------------------------------------------------- #include +#include #include #include #include @@ -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 > - quadrature (new QGaussLobatto<1>(n_intermediate_points+2)); - points[n_intermediate_points] = quadrature; - } + points[n_intermediate_points] = std_cxx14::make_unique > + (n_intermediate_points+2); } return points[n_intermediate_points]->get_points(); } -- 2.39.5