Use more 0-based indexing for tallies

This commit is contained in:
Sterling Harper 2019-02-11 15:34:55 -05:00
parent 743db3c02e
commit 8b3be55f0e
9 changed files with 77 additions and 102 deletions

View file

@ -299,7 +299,7 @@ write_tallies()
// Loop over each tally.
for (auto i_tally = 0; i_tally < model::tallies.size(); ++i_tally) {
const auto& tally {*model::tallies[i_tally]};
auto results = tally_results(i_tally+1);
auto results = tally_results(i_tally);
// TODO: get this directly from the tally object when it's been translated
int32_t n_realizations;
auto err = openmc_tally_get_n_realizations(i_tally+1, &n_realizations);

View file

@ -546,7 +546,7 @@ void calculate_work()
#ifdef OPENMC_MPI
void broadcast_results() {
// Broadcast tally results so that each process has access to results
for (int i = 1; i <= n_tallies; ++i) {
for (int i = 0; i < n_tallies; ++i) {
// Create a new datatype that consists of all values for a given filter
// bin and then use that to broadcast. This is done to minimize the
// chance of the 'count' argument of MPI_BCAST exceeding 2**31

View file

@ -249,10 +249,11 @@ void write_tally_results_nr(hid_t file_id)
write_dataset(file_id, "global_tallies", gt);
}
for (int i = 1; i <= n_tallies; ++i) {
for (int i = 0; i < n_tallies; ++i) {
// Skip any tallies that are not active
bool active;
openmc_tally_get_active(i, &active);
// TODO: off-by-one
openmc_tally_get_active(i+1, &active);
if (!active) continue;
if (mpi::master && !object_exists(file_id, "tallies_present")) {
@ -270,7 +271,8 @@ void write_tally_results_nr(hid_t file_id)
if (mpi::master) {
// Open group for tally
int id;
openmc_tally_get_id(i, &id);
// TODO: off-by-one
openmc_tally_get_id(i+1, &id);
std::string groupname {"tally " + std::to_string(id)};
hid_t tally_group = open_group(tallies_group, groupname.c_str());

View file

@ -110,8 +110,7 @@ void
apply_derivative_to_score(Particle* p, int i_tally, int i_nuclide,
double atom_density, int score_bin, double* score)
{
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
if (*score == 0) return;

View file

@ -152,7 +152,7 @@ contains
! Accumulate results for each tally
do i = 1, active_tallies_size()
call tallies(active_tallies_data(i)) % obj % accumulate()
call tallies(active_tallies_data(i)+1) % obj % accumulate()
end do
end subroutine accumulate_tallies

View file

@ -233,12 +233,12 @@ Tally::set_filters(const int32_t filter_indices[], int n)
if (i_filt < 0 || i_filt >= model::tally_filters.size())
throw std::out_of_range("Index in tally filter array out of bounds.");
//TODO: off-by-one on each index
// Keep track of indices for special filters.
const auto* filt = model::tally_filters[i_filt].get();
if (dynamic_cast<const EnergyoutFilter*>(filt)) {
energyout_filter_ = i + 1;
energyout_filter_ = i;
} else if (dynamic_cast<const DelayedGroupFilter*>(filt)) {
delayedgroup_filter_ = i + 1;
delayedgroup_filter_ = i;
}
}
@ -274,7 +274,6 @@ Tally::set_scores(std::vector<std::string> scores)
// Check for the presence of certain restrictive filters.
bool energyout_present = energyout_filter_ != C_NONE;
//bool delayedgroup_present = false;
bool legendre_present = false;
bool cell_present = false;
bool cellfrom_present = false;
@ -531,7 +530,8 @@ adaptor_type<3> tally_results(int idx)
// Get pointer to tally results
double* results;
std::array<std::size_t, 3> shape;
openmc_tally_results(idx, &results, shape.data());
// TODO: off-by-one
openmc_tally_results(idx+1, &results, shape.data());
// Adapt array into xtensor with no ownership
std::size_t size {shape[0] * shape[1] * shape[2]};
@ -541,10 +541,11 @@ adaptor_type<3> tally_results(int idx)
#ifdef OPENMC_MPI
void reduce_tally_results()
{
for (int i = 1; i <= n_tallies; ++i) {
for (int i = 0; i < n_tallies; ++i) {
// Skip any tallies that are not active
bool active;
openmc_tally_get_active(i, &active);
// TODO: off-by-one
openmc_tally_get_active(i+1, &active);
if (!active) continue;
// Get view of accumulated tally values
@ -605,33 +606,32 @@ setup_active_tallies_c()
model::active_meshsurf_tallies.clear();
model::active_surface_tallies.clear();
//TODO: off-by-one all through here
for (auto i = 0; i < model::tallies.size(); ++i) {
const auto& tally {*model::tallies[i]};
if (tally.active_) {
model::active_tallies.push_back(i + 1);
model::active_tallies.push_back(i);
switch (tally.type_) {
case TALLY_VOLUME:
switch (tally.estimator_) {
case ESTIMATOR_ANALOG:
model::active_analog_tallies.push_back(i + 1);
model::active_analog_tallies.push_back(i);
break;
case ESTIMATOR_TRACKLENGTH:
model::active_tracklength_tallies.push_back(i + 1);
model::active_tracklength_tallies.push_back(i);
break;
case ESTIMATOR_COLLISION:
model::active_collision_tallies.push_back(i + 1);
model::active_collision_tallies.push_back(i);
}
break;
case TALLY_MESH_SURFACE:
model::active_meshsurf_tallies.push_back(i + 1);
model::active_meshsurf_tallies.push_back(i);
break;
case TALLY_SURFACE:
model::active_surface_tallies.push_back(i + 1);
model::active_surface_tallies.push_back(i);
}
}
}
@ -916,9 +916,6 @@ extern "C" {
int tally_get_energyout_filter_c(Tally* tally)
{return tally->energyout_filter_;}
int tally_get_delayedgroup_filter_c(Tally* tally)
{return tally->delayedgroup_filter_;}
void tally_set_scores(Tally* tally, pugi::xml_node* node)
{tally->set_scores(*node);}

View file

@ -130,7 +130,6 @@ module tally_header
procedure :: n_nuclide_bins => tally_get_n_nuclide_bins
procedure :: nuclide_bins => tally_get_nuclide_bins
procedure :: energyout_filter => tally_get_energyout_filter
procedure :: delayedgroup_filter => tally_get_delayedgroup_filter
procedure :: deriv => tally_get_deriv
procedure :: set_deriv => tally_set_deriv
end type TallyObject
@ -506,19 +505,6 @@ contains
filt = tally_get_energyout_filter_c(this % ptr)
end function
function tally_get_delayedgroup_filter(this) result(filt)
class(TallyObject) :: this
integer(C_INT) :: filt
interface
function tally_get_delayedgroup_filter_c(tally) result(filt) bind(C)
import C_PTR, C_INT
type(C_PTR), value :: tally
integer(C_INT) :: filt
end function
end interface
filt = tally_get_delayedgroup_filter_c(this % ptr)
end function
function tally_get_deriv(this) result(deriv)
class(TallyObject) :: this
integer(C_INT) :: deriv

View file

@ -146,9 +146,8 @@ void
score_fission_delayed_dg(int i_tally, int d_bin, double score, int score_index)
{
// Save the original delayed group bin
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
auto i_filt = tally.filters(tally.delayedgroup_filter_-1);
const Tally& tally {*model::tallies[i_tally]};
auto i_filt = tally.filters(tally.delayedgroup_filter_);
auto& dg_match {simulation::filter_matches[i_filt]};
auto i_bin = dg_match.i_bin_;
auto original_bin = dg_match.bins_[i_bin-1];
@ -182,10 +181,9 @@ score_fission_delayed_dg(int i_tally, int d_bin, double score, int score_index)
void
score_fission_eout(Particle* p, int i_tally, int i_score, int score_bin)
{
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
auto results = tally_results(i_tally);
auto i_eout_filt = tally.filters()[tally.energyout_filter_-1];
auto i_eout_filt = tally.filters()[tally.energyout_filter_];
auto i_bin = simulation::filter_matches[i_eout_filt].i_bin_;
auto bin_energyout = simulation::filter_matches[i_eout_filt].bins_[i_bin-1];
@ -268,7 +266,7 @@ score_fission_eout(Particle* p, int i_tally, int i_score, int score_bin)
} else if (score_bin == SCORE_DELAYED_NU_FISSION && g != 0) {
// Get the index of the delayed group filter
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
// If the delayed group filter is present, tally to corresponding delayed
// group bin if it exists
@ -330,8 +328,7 @@ void
score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
int i_nuclide, double atom_density, double flux)
{
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
auto results = tally_results(i_tally);
// Get the pre-collision energy of the particle.
@ -520,7 +517,7 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
if (simulation::material_xs.absorption == 0) continue;
if (tally.estimator_ == ESTIMATOR_ANALOG) {
if (settings::survival_biasing || p->fission) {
if (tally.energyout_filter_ > 0) {
if (tally.energyout_filter_ != C_NONE) {
// Fission has multiple outgoing neutrons so this helper function
// is used to handle scoring the multiple filter bins.
score_fission_eout(p, i_tally, score_index, score_bin);
@ -563,7 +560,7 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
if (simulation::material_xs.absorption == 0) continue;
if (tally.estimator_ == ESTIMATOR_ANALOG) {
if (settings::survival_biasing || p->fission) {
if (tally.energyout_filter_ > 0) {
if (tally.energyout_filter_ != C_NONE) {
// Fission has multiple outgoing neutrons so this helper function
// is used to handle scoring the multiple filter bins.
score_fission_eout(p, i_tally, score_index, score_bin);
@ -625,7 +622,7 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
if (simulation::material_xs.absorption == 0) continue;
if (tally.estimator_ == ESTIMATOR_ANALOG) {
if (settings::survival_biasing || p->fission) {
if (tally.energyout_filter_ > 0) {
if (tally.energyout_filter_ != C_NONE) {
// Fission has multiple outgoing neutrons so this helper function
// is used to handle scoring the multiple filter bins.
score_fission_eout(p, i_tally, score_index, score_bin);
@ -638,8 +635,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
// delayed-nu-fission
if (simulation::micro_xs[p->event_nuclide-1].absorption > 0
&& data::nuclides[p->event_nuclide-1]->fissionable_) {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -676,8 +673,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
// score. Loop over the neutrons produced from fission and check which
// ones are delayed. If a delayed neutron is encountered, add its
// contribution to the fission bank to the score.
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -699,8 +696,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
}
} else {
if (i_nuclide >= 0) {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -723,8 +720,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
* atom_density * flux;
}
} else {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -776,8 +773,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
if (simulation::micro_xs[p->event_nuclide-1].absorption > 0
&& nuc.fissionable_) {
const auto& rxn {*nuc.fission_rx_[0]};
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -836,8 +833,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
const auto& rxn {*nuc.fission_rx_[0]};
auto rate = rxn.products_[g].decay_rate_;
score += simulation::keff * bank.wgt * rate * flux;
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -858,8 +855,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
const auto& nuc {*data::nuclides[i_nuclide]};
if (!nuc.fissionable_) continue;
const auto& rxn {*nuc.fission_rx_[0]};
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -890,8 +887,8 @@ score_general_ce(Particle* p, int i_tally, int start_index, int filter_index,
}
}
} else {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1238,8 +1235,7 @@ void
score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
int i_nuclide, double atom_density, double flux)
{
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
auto results = tally_results(i_tally);
//TODO: off-by-one throughout on p->material
@ -1503,7 +1499,7 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
case SCORE_NU_FISSION:
if (tally.estimator_ == ESTIMATOR_ANALOG) {
if (settings::survival_biasing || p->fission) {
if (tally.energyout_filter_ > 0) {
if (tally.energyout_filter_ != C_NONE) {
// Fission has multiple outgoing neutrons so this helper function
// is used to handle scoring the multiple filter bins.
score_fission_eout(p, i_tally, score_index, score_bin);
@ -1553,7 +1549,7 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
case SCORE_PROMPT_NU_FISSION:
if (tally.estimator_ == ESTIMATOR_ANALOG) {
if (settings::survival_biasing || p->fission) {
if (tally.energyout_filter_ > 0) {
if (tally.energyout_filter_ != C_NONE) {
// Fission has multiple outgoing neutrons so this helper function
// is used to handle scoring the multiple filter bins.
score_fission_eout(p, i_tally, score_index, score_bin);
@ -1607,7 +1603,7 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
case SCORE_DELAYED_NU_FISSION:
if (tally.estimator_ == ESTIMATOR_ANALOG) {
if (settings::survival_biasing || p->fission) {
if (tally.energyout_filter_ > 0) {
if (tally.energyout_filter_ != C_NONE) {
// Fission has multiple outgoing neutrons so this helper function
// is used to handle scoring the multiple filter bins.
score_fission_eout(p, i_tally, score_index, score_bin);
@ -1619,8 +1615,8 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
// calculate fraction of absorptions that would have resulted in
// delayed-nu-fission
if (get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g) > 0) {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1669,8 +1665,8 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
// score. Loop over the neutrons produced from fission and check which
// ones are delayed. If a delayed neutron is encountered, add its
// contribution to the fission bank to the score.
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1701,8 +1697,8 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
}
}
} else {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1741,8 +1737,8 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
// calculate fraction of absorptions that would have resulted in
// delayed-nu-fission
if (get_macro_xs(p->material, MG_GET_XS_ABSORPTION, p_g) > 0) {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1821,8 +1817,8 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
* get_macro_xs(p->material, MG_GET_XS_DECAY_RATE, p_g,
nullptr, nullptr, &g);
}
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1837,11 +1833,11 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
}
}
}
if (tally.delayedgroup_filter_ > 0) continue;
if (tally.delayedgroup_filter_ != C_NONE) continue;
}
} else {
if (tally.delayedgroup_filter_ > 0) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_-1];
if (tally.delayedgroup_filter_ != C_NONE) {
auto i_dg_filt = tally.filters()[tally.delayedgroup_filter_];
const DelayedGroupFilter& filt
{*dynamic_cast<DelayedGroupFilter*>(
model::tally_filters[i_dg_filt].get())};
@ -1943,8 +1939,7 @@ score_general_mg(Particle* p, int i_tally, int start_index, int filter_index,
void
score_all_nuclides(Particle* p, int i_tally, double flux, int filter_index)
{
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
const Material& material {*model::materials[p->material-1]};
// Score all individual nuclide reaction rates.
@ -1984,8 +1979,7 @@ extern "C" void
score_analog_tally_ce(Particle* p)
{
for (auto i_tally : model::active_analog_tallies) {
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
// Initialize an iterator over valid filter bin combinations. If there are
// no valid combinations, use a continue statement to ensure we skip the
@ -2049,8 +2043,7 @@ extern "C" void
score_analog_tally_mg(Particle* p)
{
for (auto i_tally : model::active_analog_tallies) {
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
// Initialize an iterator over valid filter bin combinations. If there are
// no valid combinations, use a continue statement to ensure we skip the
@ -2109,8 +2102,7 @@ score_tracklength_tally(Particle* p, double distance)
double flux = p->wgt * distance;
for (auto i_tally : model::active_tracklength_tallies) {
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
// Initialize an iterator over valid filter bin combinations. If there are
// no valid combinations, use a continue statement to ensure we skip the
@ -2191,8 +2183,7 @@ score_collision_tally(Particle* p)
}
for (auto i_tally : model::active_collision_tallies) {
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
// Initialize an iterator over valid filter bin combinations. If there are
// no valid combinations, use a continue statement to ensure we skip the
@ -2258,8 +2249,7 @@ score_surface_tally_inner(Particle* p, const std::vector<int>& tallies)
double flux = p->wgt;
for (auto i_tally : tallies) {
//TODO: off-by-one
const Tally& tally {*model::tallies[i_tally-1]};
const Tally& tally {*model::tallies[i_tally]};
auto results = tally_results(i_tally);
// Initialize an iterator over valid filter bin combinations. If there are

View file

@ -30,7 +30,8 @@ static std::pair<double, double>
get_tally_uncertainty(int i_tally, int score_index, int filter_index)
{
int n;
int err = openmc_tally_get_n_realizations(i_tally, &n);
//TODO: off-by-one
int err = openmc_tally_get_n_realizations(i_tally+1, &n);
auto results = tally_results(i_tally);
auto sum = results(filter_index, score_index, RESULT_SUM);
@ -54,13 +55,13 @@ void
check_tally_triggers(double& ratio, int& tally_id, int& score)
{
ratio = 0.;
//TODO: off-by-one
for (auto i_tally = 1; i_tally < model::tallies.size()+1; ++i_tally) {
const Tally& t {*model::tallies[i_tally-1]};
for (auto i_tally = 0; i_tally < model::tallies.size(); ++i_tally) {
const Tally& t {*model::tallies[i_tally]};
// Ignore tallies with less than two realizations.
int n_reals;
int err = openmc_tally_get_n_realizations(i_tally, &n_reals);
//TODO: off-by-one
int err = openmc_tally_get_n_realizations(i_tally+1, &n_reals);
if (n_reals < 2) continue;
for (const auto& trigger : t.triggers_) {