Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add allow_zero option to Triggers
  • Loading branch information
tjlaboss committed Mar 28, 2024
commit cc9e960b7b1d5bce0300d6f5ca159eda7ee6f3ef
1 change: 1 addition & 0 deletions include/openmc/tallies/trigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum class TriggerMetric {
struct Trigger {
TriggerMetric metric; //!< The type of uncertainty (e.g. std dev) measured
double threshold; //!< Uncertainty value below which trigger is satisfied
bool allow_zero; //!< Whether to allow zero tally bins to be ignored
int score_index; //!< Index of the relevant score in the tally's arrays
};

Expand Down
10 changes: 8 additions & 2 deletions src/tallies/tally.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,12 @@ void Tally::init_triggers(pugi::xml_node node)
"Must specify trigger threshold for tally {} in tally XML file", id_));
}

// Read whether to allow zero-tally bins to be ignored.
bool allow_zero = false;
if (check_for_node(trigger_node, "allow_zero")) {
allow_zero = get_node_value_bool(trigger_node, "allow_zero");
}

// Read the trigger scores.
vector<std::string> trigger_scores;
if (check_for_node(trigger_node, "scores")) {
Expand All @@ -702,7 +708,7 @@ void Tally::init_triggers(pugi::xml_node node)
if (score_str == "all") {
triggers_.reserve(triggers_.size() + this->scores_.size());
for (auto i_score = 0; i_score < this->scores_.size(); ++i_score) {
triggers_.push_back({metric, threshold, i_score});
triggers_.push_back({metric, threshold, allow_zero, i_score});
}
} else {
int i_score = 0;
Expand All @@ -716,7 +722,7 @@ void Tally::init_triggers(pugi::xml_node node)
"{} but it was listed in a trigger on that tally",
score_str, id_));
}
triggers_.push_back({metric, threshold, i_score});
triggers_.push_back({metric, threshold, allow_zero, i_score});
}
}
}
Expand Down