@@ -1585,7 +1585,7 @@ public:
1585
1585
1586
1586
// Construct mapping from boundary_id -> (dirichlet_id, DirichletBoundary)
1587
1587
for (const auto & b_id : dirichlet -> b )
1588
- boundary_id_to_ordered_dirichlet_boundaries [b_id ].emplace (dirichlet_id , dirichlet );
1588
+ boundary_id_to_ordered_dirichlet_boundaries [b_id ].emplace (dirichlet_id , dirichlet . get () );
1589
1589
1590
1590
for (const auto & var : dirichlet -> variables )
1591
1591
{
@@ -5238,7 +5238,7 @@ void DofMap::constrain_p_dofs (unsigned int var,
5238
5238
#ifdef LIBMESH_ENABLE_DIRICHLET
5239
5239
void DofMap ::add_dirichlet_boundary (const DirichletBoundary & dirichlet_boundary )
5240
5240
{
5241
- _dirichlet_boundaries -> push_back (new DirichletBoundary (dirichlet_boundary ));
5241
+ _dirichlet_boundaries -> push_back (std :: make_unique < DirichletBoundary > (dirichlet_boundary ));
5242
5242
}
5243
5243
5244
5244
@@ -5250,8 +5250,9 @@ void DofMap::add_adjoint_dirichlet_boundary (const DirichletBoundary & dirichlet
5250
5250
for (unsigned int i = old_size ; i <= qoi_index ; ++ i )
5251
5251
_adjoint_dirichlet_boundaries .push_back (new DirichletBoundaries ());
5252
5252
5253
+ // Make copy of DirichletBoundary, owned by _adjoint_dirichlet_boundaries
5253
5254
_adjoint_dirichlet_boundaries [qoi_index ]-> push_back
5254
- (new DirichletBoundary (dirichlet_boundary ));
5255
+ (std :: make_unique < DirichletBoundary > (dirichlet_boundary ));
5255
5256
}
5256
5257
5257
5258
@@ -5287,14 +5288,13 @@ DofMap::get_adjoint_dirichlet_boundaries(unsigned int q)
5287
5288
void DofMap ::remove_dirichlet_boundary (const DirichletBoundary & boundary_to_remove )
5288
5289
{
5289
5290
// Find a boundary condition matching the one to be removed
5290
- auto lam = [& boundary_to_remove ](const DirichletBoundary * bdy )
5291
+ auto lam = [& boundary_to_remove ](const auto & bdy )
5291
5292
{return bdy -> b == boundary_to_remove .b && bdy -> variables == boundary_to_remove .variables ;};
5292
5293
5293
5294
auto it = std ::find_if (_dirichlet_boundaries -> begin (), _dirichlet_boundaries -> end (), lam );
5294
5295
5295
- // Delete it and remove it
5296
+ // Assert it was actually found and remove it from the vector
5296
5297
libmesh_assert (it != _dirichlet_boundaries -> end ());
5297
- delete * it ;
5298
5298
_dirichlet_boundaries -> erase (it );
5299
5299
}
5300
5300
@@ -5305,26 +5305,19 @@ void DofMap::remove_adjoint_dirichlet_boundary (const DirichletBoundary & bounda
5305
5305
libmesh_assert_greater (_adjoint_dirichlet_boundaries .size (),
5306
5306
qoi_index );
5307
5307
5308
- auto lam = [& boundary_to_remove ](const DirichletBoundary * bdy )
5308
+ auto lam = [& boundary_to_remove ](const auto & bdy )
5309
5309
{return bdy -> b == boundary_to_remove .b && bdy -> variables == boundary_to_remove .variables ;};
5310
5310
5311
5311
auto it = std ::find_if (_adjoint_dirichlet_boundaries [qoi_index ]-> begin (),
5312
5312
_adjoint_dirichlet_boundaries [qoi_index ]-> end (),
5313
5313
lam );
5314
5314
5315
- // Delete it and remove it
5315
+ // Assert it was actually found and remove it from the vector
5316
5316
libmesh_assert (it != _adjoint_dirichlet_boundaries [qoi_index ]-> end ());
5317
- delete * it ;
5318
5317
_adjoint_dirichlet_boundaries [qoi_index ]-> erase (it );
5319
5318
}
5320
5319
5321
5320
5322
- DirichletBoundaries ::~DirichletBoundaries ()
5323
- {
5324
- for (auto & item : * this )
5325
- delete item ;
5326
- }
5327
-
5328
5321
void DofMap ::check_dirichlet_bcid_consistency (const MeshBase & mesh ,
5329
5322
const DirichletBoundary & boundary ) const
5330
5323
{
0 commit comments