diff --git a/packet.cc b/packet.cc index 12d8a4768..822eb11c2 100644 --- a/packet.cc +++ b/packet.cc @@ -133,14 +133,10 @@ void packet_init(Packet *pkt) // Now place the pellets in the ejecta and decide at what time they will decay. - if (globals::npkts > MPKTS) { - printout("Too many packets. Abort.\n"); - std::abort(); - } - printout("Placing pellets...\n"); auto allpkts = std::ranges::iota_view{0, globals::npkts}; std::ranges::for_each(allpkts, [&, norm, e0](const int n) { + pkt[n] = Packet{}; const double targetval = rng_uniform() * norm; // first i such that en_cumulative[i] > targetval diff --git a/sn3d.cc b/sn3d.cc index d39cdc044..ea0945cfe 100644 --- a/sn3d.cc +++ b/sn3d.cc @@ -883,7 +883,7 @@ auto main(int argc, char *argv[]) -> int { } } - auto *const packets = static_cast(malloc(MPKTS * sizeof(Packet))); + auto *const packets = static_cast(malloc(globals::npkts * sizeof(Packet))); assert_always(packets != nullptr); @@ -965,7 +965,7 @@ auto main(int argc, char *argv[]) -> int { printout("Simulation propagates %g packets per process (total %g with nprocs %d)\n", 1. * globals::npkts, 1. * globals::npkts * globals::nprocs, globals::nprocs); - printout("[info] mem_usage: packets occupy %.3f MB\n", MPKTS * sizeof(Packet) / 1024. / 1024.); + printout("[info] mem_usage: packets occupy %.3f MB\n", globals::npkts * sizeof(Packet) / 1024. / 1024.); if (!globals::simulation_continued_from_saved) { std::remove("deposition.out");