:
smooth_grid(smooth_grid),
anisotropic_refinement(false),
- check_for_distorted_cells(check_for_distorted_cells),
- vertex_to_boundary_id_map_1d (0),
- vertex_to_manifold_id_map_1d (0)
+ check_for_distorted_cells(check_for_distorted_cells)
{
if (dim == 1)
{
vertex_to_boundary_id_map_1d
- = new std::map<unsigned int, types::boundary_id>();
+ .reset (new std::map<unsigned int, types::boundary_id>());
vertex_to_manifold_id_map_1d
- = new std::map<unsigned int, types::manifold_id>();
+ .reset (new std::map<unsigned int, types::manifold_id>());
}
// connect the any_change signal to the other top level signals
// is an error!
:
Subscriptor(),
- check_for_distorted_cells(other.check_for_distorted_cells),
- vertex_to_boundary_id_map_1d (0),
- vertex_to_manifold_id_map_1d (0)
+ check_for_distorted_cells(other.check_for_distorted_cells)
{
Assert (false, ExcMessage ("You are not allowed to call this constructor "
"because copying Triangulation objects is not "
anisotropic_refinement(tria.anisotropic_refinement),
check_for_distorted_cells(tria.check_for_distorted_cells),
number_cache(tria.number_cache),
- vertex_to_boundary_id_map_1d(tria.vertex_to_boundary_id_map_1d),
- vertex_to_manifold_id_map_1d(tria.vertex_to_manifold_id_map_1d)
+ 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<tria.levels.size(); ++i)
tria.levels[i] = nullptr;
tria.number_cache = internal::Triangulation::NumberCache<dim>();
-
- tria.vertex_to_boundary_id_map_1d = nullptr;
- tria.vertex_to_manifold_id_map_1d = nullptr;
}
#endif
}
levels.clear ();
- // the vertex_to_boundary_id_map_1d field
- // should be unused except in 1d
+ // the vertex_to_boundary_id_map_1d field should be unused except in
+ // 1d. double check this here, as destruction is a good place to
+ // ensure that what we've done over the course of the lifetime of
+ // this object makes sense
Assert ((dim == 1)
||
(vertex_to_boundary_id_map_1d == 0),
ExcInternalError());
- if (vertex_to_boundary_id_map_1d)
- {
- delete vertex_to_boundary_id_map_1d;
- vertex_to_boundary_id_map_1d = 0;
- }
- // the vertex_to_manifold_id_map_1d field
- // should be unused except in 1d
+ // the vertex_to_manifold_id_map_1d field should be also unused
+ // except in 1d. check this as well
Assert ((dim == 1)
||
(vertex_to_manifold_id_map_1d == 0),
ExcInternalError());
- if (vertex_to_manifold_id_map_1d)
- {
- delete vertex_to_manifold_id_map_1d;
- vertex_to_manifold_id_map_1d = 0;
- }
}
if (dim == 1)
{
- delete vertex_to_boundary_id_map_1d;
vertex_to_boundary_id_map_1d
- = (new std::map<unsigned int, types::boundary_id>
- (*old_tria.vertex_to_boundary_id_map_1d));
+ .reset(new std::map<unsigned int, types::boundary_id>
+ (*old_tria.vertex_to_boundary_id_map_1d));
- delete vertex_to_manifold_id_map_1d;
vertex_to_manifold_id_map_1d
- = (new std::map<unsigned int, types::manifold_id>
- (*old_tria.vertex_to_manifold_id_map_1d));
+ .reset(new std::map<unsigned int, types::manifold_id>
+ (*old_tria.vertex_to_manifold_id_map_1d));
}
// inform those who are listening on old_tria of the copy operation