From 1300ca2678ad3f0bfc37822c68d2800317a6f9e7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Sep 2019 08:48:27 -0500 Subject: [PATCH] Teach load_state_point about internal tallies When reading in tally data from a statepoint file, a check is performed on the "internal" attribute of the tally group. If the attribute doesn't exist (previous statepoint files), then it is assumed that the tally is writeable / not internal. Otherwise, the internal attribute is read from the dataset. If the tally is determined to be internal, the value of tally.writeable_ is set to false and no tally data is read --- src/state_point.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/state_point.cpp b/src/state_point.cpp index 8c1780c820..a550748a54 100644 --- a/src/state_point.cpp +++ b/src/state_point.cpp @@ -433,11 +433,23 @@ void load_state_point() // Read sum, sum_sq, and N for each bin std::string name = "tally " + std::to_string(tally->id_); hid_t tally_group = open_group(tallies_group, name.c_str()); - auto& results = tally->results_; - read_tally_results(tally_group, results.shape()[0], - results.shape()[1], results.data()); - read_dataset(tally_group, "n_realizations", tally->n_realizations_); - close_group(tally_group); + + int internal; + if (attribute_exists(tally_group, "internal")) { + read_attribute(tally_group, "internal", internal); + } else { + internal = 0; + } + if (internal) { + tally->writeable_ = false; + } else { + + auto& results = tally->results_; + read_tally_results(tally_group, results.shape()[0], + results.shape()[1], results.data()); + read_dataset(tally_group, "n_realizations", tally->n_realizations_); + close_group(tally_group); + } } close_group(tallies_group); @@ -705,6 +717,7 @@ void write_tally_results_nr(hid_t file_id) for (const auto& t : model::tallies) { // Skip any tallies that are not active if (!t->active_) continue; + if (!t->writeable_) continue; if (mpi::master && !object_exists(file_id, "tallies_present")) { write_attribute(file_id, "tallies_present", 1);