From 19c9f3464cd7d9afa953b0fb03939d1b33d9fd41 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Wed, 26 Feb 2020 16:23:53 -0600 Subject: [PATCH 1/2] Reordering data members s.t. they match initialization. --- include/openmc/mgxs.h | 2 +- include/openmc/tallies/tally_scoring.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/openmc/mgxs.h b/include/openmc/mgxs.h index 8d8ca4d8e6..e178bf5b14 100644 --- a/include/openmc/mgxs.h +++ b/include/openmc/mgxs.h @@ -40,8 +40,8 @@ class Mgxs { xt::xtensor kTs; // temperature in eV (k * T) AngleDistributionType scatter_format; // flag for if this is legendre, histogram, or tabular - int num_delayed_groups; // number of delayed neutron groups int num_groups; // number of energy groups + int num_delayed_groups; // number of delayed neutron groups std::vector xs; // Cross section data // MGXS Incoming Flux Angular grid information bool is_isotropic; // used to skip search for angle indices if isotropic diff --git a/include/openmc/tallies/tally_scoring.h b/include/openmc/tallies/tally_scoring.h index 224a9ef149..0a76025dbe 100644 --- a/include/openmc/tallies/tally_scoring.h +++ b/include/openmc/tallies/tally_scoring.h @@ -39,15 +39,18 @@ public: FilterBinIter& operator++(); - int index_ {1}; - double weight_ {1.}; - - std::vector& filter_matches_; - private: void compute_index_weight(); + // Data members const Tally& tally_; + +public: + + int index_ {1}; + double weight_ {1.}; + + std::vector& filter_matches_; }; //============================================================================== From d9a135f2344f626db5d898569efb831f4d4416fc Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 28 Feb 2020 10:50:10 -0600 Subject: [PATCH 2/2] Change initialization order instead of declaration order for FilterBinIter. --- include/openmc/tallies/tally_scoring.h | 13 +++++-------- src/tallies/tally_scoring.cpp | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/openmc/tallies/tally_scoring.h b/include/openmc/tallies/tally_scoring.h index 0a76025dbe..224a9ef149 100644 --- a/include/openmc/tallies/tally_scoring.h +++ b/include/openmc/tallies/tally_scoring.h @@ -39,18 +39,15 @@ public: FilterBinIter& operator++(); + int index_ {1}; + double weight_ {1.}; + + std::vector& filter_matches_; + private: void compute_index_weight(); - // Data members const Tally& tally_; - -public: - - int index_ {1}; - double weight_ {1.}; - - std::vector& filter_matches_; }; //============================================================================== diff --git a/src/tallies/tally_scoring.cpp b/src/tallies/tally_scoring.cpp index 81f6c504eb..e0cd5d095c 100644 --- a/src/tallies/tally_scoring.cpp +++ b/src/tallies/tally_scoring.cpp @@ -27,7 +27,7 @@ namespace openmc { //============================================================================== FilterBinIter::FilterBinIter(const Tally& tally, Particle* p) - : tally_{tally}, filter_matches_{p->filter_matches_} + : filter_matches_{p->filter_matches_}, tally_{tally} { // Find all valid bins in each relevant filter if they have not already been // found for this event. @@ -57,7 +57,7 @@ FilterBinIter::FilterBinIter(const Tally& tally, Particle* p) FilterBinIter::FilterBinIter(const Tally& tally, bool end, std::vector* particle_filter_matches) - : tally_{tally}, filter_matches_{*particle_filter_matches} + : filter_matches_{*particle_filter_matches}, tally_{tally} { // Handle the special case for an iterator that points to the end. if (end) {