diff --git a/src/structure.cpp b/src/structure.cpp index f19429e41..4307d73fb 100644 --- a/src/structure.cpp +++ b/src/structure.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include "meep.hpp" #include "meep_internals.hpp" @@ -112,13 +113,13 @@ void structure::choose_chunkdivision(const grid_volume &thegv, int desired_num_c a = gv.a; dt = Courant / a; - binary_partition *my_bp = NULL; - if (!bp) my_bp = meep::choose_chunkdivision(gv, v, desired_num_chunks, s); + std::unique_ptr my_bp; + if (!bp) my_bp.reset(meep::choose_chunkdivision(gv, v, desired_num_chunks, s)); // create the chunks: std::vector chunk_volumes; std::vector ids; - split_by_binarytree(gv, chunk_volumes, ids, (!bp) ? my_bp : bp); + split_by_binarytree(gv, chunk_volumes, ids, (!bp) ? my_bp.get() : bp); // initialize effort volumes num_effort_volumes = 1;