@@ -242,7 +242,7 @@ void DifferentiableSystem::add_dot_var_dirichlet_bcs( unsigned int var_idx,
242
242
// We need to cache the DBCs to be added so that we add them
243
243
// after looping over the existing DBCs. Otherwise, we're polluting
244
244
// the thing we're looping over.
245
- std ::vector < DirichletBoundary * > new_dbcs ;
245
+ std ::vector < DirichletBoundary > new_dbcs ;
246
246
247
247
for (const auto & dbc : * all_dbcs )
248
248
{
@@ -278,29 +278,15 @@ void DifferentiableSystem::add_dot_var_dirichlet_bcs( unsigned int var_idx,
278
278
libmesh_error_msg ("Could not find valid boundary function!" );
279
279
280
280
libmesh_error_msg_if (is_time_evolving_bc , "Cannot currently support time-dependent Dirichlet BC for dot variables!" );
281
+ libmesh_error_msg_if (!dbc -> f , "Expected valid DirichletBoundary function" );
281
282
282
-
283
- DirichletBoundary * new_dbc ;
284
-
285
- if (dbc -> f )
286
- {
287
- ZeroFunction < Number > zf ;
288
-
289
- new_dbc = new DirichletBoundary (dbc -> b , vars_to_add , zf );
290
- }
291
- else
292
- libmesh_error ();
293
-
294
- new_dbcs .push_back (new_dbc );
283
+ new_dbcs .emplace_back (dbc -> b , vars_to_add , ZeroFunction < Number > ());
295
284
}
296
285
}
297
286
298
- // Let the DofMap make its own deep copy of the DirichletBC objects and delete our copy.
287
+ // Let the DofMap make its own deep copy of the DirichletBC objects
299
288
for (const auto & dbc : new_dbcs )
300
- {
301
- this -> get_dof_map ().add_dirichlet_boundary (* dbc );
302
- delete dbc ;
303
- }
289
+ this -> get_dof_map ().add_dirichlet_boundary (dbc );
304
290
305
291
} // if (all_dbcs)
306
292
}
0 commit comments