ensure we allocate differential tally space up front in event mode

This commit is contained in:
Gavin Ridley 2021-04-23 10:30:07 -04:00
parent af6d182440
commit 959bec57ae

View file

@ -3,6 +3,7 @@
#include "openmc/geometry.h"
#include "openmc/nuclide.h"
#include "openmc/photon.h"
#include "openmc/settings.h"
#include "openmc/tallies/derivative.h"
#include "openmc/tallies/filter.h"
#include "openmc/tallies/tally.h"
@ -18,8 +19,10 @@ ParticleData::ParticleData()
zero_delayed_bank();
// Every particle starts with no accumulated flux derivative.
if (!model::active_tallies.empty()) {
// Every particle starts with no accumulated flux derivative. Note that in
// event mode, we construct the particle once up front, so have to run this
// even if the current batch is inactive.
if (!model::active_tallies.empty() || settings::event_based) {
flux_derivs_.resize(model::tally_derivs.size());
zero_flux_derivs();
}