From: danshapero Date: Wed, 19 Apr 2017 14:48:39 +0000 (-0700) Subject: Replaced tria members with unique ptrs X-Git-Tag: v9.0.0-rc1~1664^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef3805b2d65d49efd43bb86f00d95034e3d365f8;p=dealii.git Replaced tria members with unique ptrs --- diff --git a/include/deal.II/grid/tria.h b/include/deal.II/grid/tria.h index f6326892cb..6a066f4b6b 100644 --- a/include/deal.II/grid/tria.h +++ b/include/deal.II/grid/tria.h @@ -3425,7 +3425,7 @@ private: * Array of pointers pointing to the objects storing the cell data on the * different levels. */ - std::vector*> levels; + std::vector > > levels; /** * Pointer to the faces of the triangulation. In 1d this contains nothing, diff --git a/source/grid/tria.cc b/source/grid/tria.cc index b1d2b525b1..1c86b45541 100644 --- a/source/grid/tria.cc +++ b/source/grid/tria.cc @@ -14,6 +14,7 @@ // --------------------------------------------------------------------- +#include #include #include #include @@ -1644,9 +1645,9 @@ namespace internal std::vector > lines_at_vertex (v.size()); // reserve enough space - triangulation.levels.push_back (new internal::Triangulation::TriaLevel); + triangulation.levels.push_back (std_cxx14::make_unique>()); triangulation.levels[0]->reserve_space (cells.size(), dim, spacedim); - triangulation.levels[0]->cells.reserve_space (0,cells.size()); + triangulation.levels[0]->cells.reserve_space (0, cells.size()); // make up cells typename Triangulation::raw_line_iterator @@ -1921,7 +1922,7 @@ namespace internal } // reserve enough space - triangulation.levels.push_back (new internal::Triangulation::TriaLevel); + triangulation.levels.push_back (std_cxx14::make_unique>()); triangulation.faces.reset (new internal::Triangulation::TriaFaces); triangulation.levels[0]->reserve_space (cells.size(), dim, spacedim); triangulation.faces->lines.reserve_space (0,needed_lines.size()); @@ -2289,7 +2290,7 @@ namespace internal // actually set up data structures // for the lines // reserve enough space - triangulation.levels.push_back (new internal::Triangulation::TriaLevel); + triangulation.levels.push_back (std_cxx14::make_unique>()); triangulation.faces.reset (new internal::Triangulation::TriaFaces); triangulation.levels[0]->reserve_space (cells.size(), dim, spacedim); triangulation.faces->lines.reserve_space (0,needed_lines.size()); @@ -4342,7 +4343,7 @@ namespace internal if (cell->refine_flag_set()) { triangulation.levels - .push_back (new internal::Triangulation::TriaLevel); + .push_back (std_cxx14::make_unique>()); break; } } @@ -4585,7 +4586,7 @@ namespace internal if (cell->used()) if (cell->refine_flag_set()) { - triangulation.levels.push_back (new internal::Triangulation::TriaLevel); + triangulation.levels.push_back (std_cxx14::make_unique>()); break; } } @@ -4947,7 +4948,7 @@ namespace internal if (cell->used()) if (cell->refine_flag_set()) { - triangulation.levels.push_back (new internal::Triangulation::TriaLevel); + triangulation.levels.push_back (std_cxx14::make_unique>()); break; } } @@ -9005,9 +9006,6 @@ Triangulation (Triangulation &&tria) vertex_to_boundary_id_map_1d(std::move(tria.vertex_to_boundary_id_map_1d)), vertex_to_manifold_id_map_1d(std::move(tria.vertex_to_manifold_id_map_1d)) { - for (unsigned int i=0; i(); } @@ -9031,9 +9029,6 @@ Triangulation::operator= (Triangulation &&tria) vertex_to_boundary_id_map_1d = std::move(tria.vertex_to_boundary_id_map_1d); vertex_to_manifold_id_map_1d = std::move(tria.vertex_to_manifold_id_map_1d); - for (unsigned int i=0; i(); return *this; @@ -9044,12 +9039,6 @@ Triangulation::operator= (Triangulation &&tria) template Triangulation::~Triangulation () { - for (unsigned int i=0; i &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; @@ -9752,7 +9739,7 @@ namespace { // clear user data of cells template - void clear_user_data (std::vector*> &levels) + void clear_user_data (std::vector>> &levels) { for (unsigned int level=0; levelcells.clear_user_data(); @@ -9792,7 +9779,7 @@ void Triangulation::clear_user_data () namespace { - void clear_user_flags_line (std::vector*> &levels, + void clear_user_flags_line (std::vector>> &levels, internal::Triangulation::TriaFaces<1> *) { for (unsigned int level=0; level - void clear_user_flags_line (std::vector*> &, + void clear_user_flags_line (std::vector>> &, internal::Triangulation::TriaFaces *faces) { faces->lines.clear_user_flags(); @@ -9818,13 +9805,13 @@ void Triangulation::clear_user_flags_line () namespace { - void clear_user_flags_quad (std::vector*> &, + void clear_user_flags_quad (std::vector>> &, internal::Triangulation::TriaFaces<1> *) { // nothing to do in 1d } - void clear_user_flags_quad (std::vector*> &levels, + void clear_user_flags_quad (std::vector>> &levels, internal::Triangulation::TriaFaces<2> *) { for (unsigned int level=0; level - void clear_user_flags_quad (std::vector*> &, + void clear_user_flags_quad (std::vector>> &, internal::Triangulation::TriaFaces *faces) { faces->quads.clear_user_flags(); @@ -9850,20 +9837,20 @@ void Triangulation::clear_user_flags_quad () namespace { - void clear_user_flags_hex (std::vector*> &, + void clear_user_flags_hex (std::vector>> &, internal::Triangulation::TriaFaces<1> *) { // nothing to do in 1d } - void clear_user_flags_hex (std::vector*> &, + void clear_user_flags_hex (std::vector>> &, internal::Triangulation::TriaFaces<2> *) { // nothing to do in 2d } - void clear_user_flags_hex (std::vector*> &levels, + void clear_user_flags_hex (std::vector>> &levels, internal::Triangulation::TriaFaces<3> *) { for (unsigned int level=0; level void Triangulation::clear_despite_subscriptions() { - // This is the former function - // clear without the assertion in - // the beginning. - for (unsigned int i=0; i