diff --git a/include/openmc/volume_calc.h b/include/openmc/volume_calc.h index 74331de877..33d10209ef 100644 --- a/include/openmc/volume_calc.h +++ b/include/openmc/volume_calc.h @@ -56,7 +56,7 @@ public: int domain_type_; //!< Type of domain (cell, material, etc.) size_t n_samples_; //!< Number of samples to use double threshold_ {-1.0}; //!< Error threshold for domain volumes - ThresholdType trigger_type_; + ThresholdType trigger_type_ {ThresholdType::NONE}; Position lower_left_; //!< Lower-left position of bounding box Position upper_right_; //!< Upper-right position of bounding box std::vector domain_ids_; //!< IDs of domains to find volumes of diff --git a/src/volume_calc.cpp b/src/volume_calc.cpp index 21d9c3cb08..23bb08f822 100644 --- a/src/volume_calc.cpp +++ b/src/volume_calc.cpp @@ -320,10 +320,6 @@ std::vector VolumeCalculation::execute() const result.nuclides.push_back(j); result.atoms.push_back(mean); result.uncertainty.push_back(stdev); - } else { - result.nuclides.push_back(j); - result.atoms.push_back(0.0); - result.uncertainty.push_back(0.0); } } } @@ -358,21 +354,23 @@ void VolumeCalculation::to_hdf5(const std::string& filename, write_attribute(file_id, "samples", n_samples_); write_attribute(file_id, "lower_left", lower_left_); write_attribute(file_id, "upper_right", upper_right_); - if (threshold_ != -1.0) { + // Write trigger info + if (trigger_type_ != ThresholdType::NONE) { + write_attribute(file_id, "iterations", results[0].iterations); write_attribute(file_id, "threshold", threshold_); - + std::string trigger_str; switch(trigger_type_) { case ThresholdType::VARIANCE: - write_attribute(file_id, "trigger_type", "variance"); + trigger_str = "variance"; break; case ThresholdType::STD_DEV: - write_attribute(file_id, "trigger_type", "std_dev"); + trigger_str = "std_dev"; break; case ThresholdType::REL_ERR: - write_attribute(file_id, "trigger_type", "rel_err"); + trigger_str = "rel_err"; break; } - + write_attribute(file_id, "trigger_type", trigger_str); } if (domain_type_ == FILTER_CELL) { diff --git a/tests/regression_tests/volume_calc/results_true.dat b/tests/regression_tests/volume_calc/results_true.dat index 4fe3b4b6ef..466139cd68 100644 --- a/tests/regression_tests/volume_calc/results_true.dat +++ b/tests/regression_tests/volume_calc/results_true.dat @@ -2,22 +2,15 @@ Volume calculation 0 Domain 1: 31.47+/-0.07 cm^3 Domain 2: 2.093+/-0.031 cm^3 Domain 3: 2.049+/-0.031 cm^3 - Cell Nuclide Atoms -0 1 H1 0.0+/-0 -1 1 O16 0.0+/-0 -2 1 B10 0.0+/-0 -3 1 U235 (3.482+/-0.008)e+23 -4 1 Mo99 (3.482+/-0.008)e+22 -5 2 H1 (1.400+/-0.021)e+23 -6 2 O16 (7.00+/-0.10)e+22 -7 2 B10 (7.00+/-0.10)e+18 -8 2 U235 0.0+/-0 -9 2 Mo99 0.0+/-0 -10 3 H1 (1.370+/-0.021)e+23 -11 3 O16 (6.85+/-0.10)e+22 -12 3 B10 (6.85+/-0.10)e+18 -13 3 U235 0.0+/-0 -14 3 Mo99 0.0+/-0 + Cell Nuclide Atoms +0 1 U235 (3.482+/-0.008)e+23 +1 1 Mo99 (3.482+/-0.008)e+22 +2 2 H1 (1.400+/-0.021)e+23 +3 2 O16 (7.00+/-0.10)e+22 +4 2 B10 (7.00+/-0.10)e+18 +5 3 H1 (1.370+/-0.021)e+23 +6 3 O16 (6.85+/-0.10)e+22 +7 3 B10 (6.85+/-0.10)e+18 Volume calculation 1 Domain 1: 4.14+/-0.04 cm^3 Domain 2: 31.47+/-0.07 cm^3 @@ -25,13 +18,8 @@ Domain 2: 31.47+/-0.07 cm^3 0 1 H1 (2.770+/-0.029)e+23 1 1 O16 (1.385+/-0.014)e+23 2 1 B10 (1.385+/-0.014)e+19 -3 1 U235 0.0+/-0 -4 1 Mo99 0.0+/-0 -5 2 H1 0.0+/-0 -6 2 O16 0.0+/-0 -7 2 B10 0.0+/-0 -8 2 U235 (3.482+/-0.008)e+23 -9 2 Mo99 (3.482+/-0.008)e+22 +3 2 U235 (3.482+/-0.008)e+23 +4 2 Mo99 (3.482+/-0.008)e+22 Volume calculation 2 Domain 0: 35.61+/-0.07 cm^3 Universe Nuclide Atoms @@ -40,23 +28,3 @@ Domain 0: 35.61+/-0.07 cm^3 2 0 B10 (1.385+/-0.014)e+19 3 0 U235 (3.482+/-0.008)e+23 4 0 Mo99 (3.482+/-0.008)e+22 -Volume calculation 3 -Domain 1: 31.35476+/-0.00010 cm^3 -Domain 2: 2.09147+/-0.00005 cm^3 -Domain 3: 2.110402+/-0.000033 cm^3 - Cell Nuclide Atoms -0 1 H1 0.0+/-0 -1 1 O16 0.0+/-0 -2 1 B10 0.0+/-0 -3 1 U235 (3.474110+/-0.000011)e+23 -4 1 Mo99 (3.474110+/-0.000011)e+22 -5 2 H1 (1.398833+/-0.000031)e+23 -6 2 O16 (6.99416+/-0.00015)e+22 -7 2 B10 (6.99416+/-0.00015)e+18 -8 2 U235 0.0+/-0 -9 2 Mo99 0.0+/-0 -10 3 H1 (1.401947+/-0.000022)e+23 -11 3 O16 (7.00974+/-0.00011)e+22 -12 3 B10 (7.00974+/-0.00011)e+18 -13 3 U235 0.0+/-0 -14 3 Mo99 0.0+/-0