diff --git a/src/enrichment_calculator.cc b/src/enrichment_calculator.cc index 81efa78..45b98f2 100644 --- a/src/enrichment_calculator.cc +++ b/src/enrichment_calculator.cc @@ -39,7 +39,7 @@ EnrichmentCalculator::EnrichmentCalculator( feed_qty(0.), product_qty(0.), max_swu(max_swu), use_downblending(use_downblending), - isotopes(IsotopesNucID_vector()) { + isotopes(IsotopesNucID()) { if (feed_qty==1e299 && product_qty==1e299 && max_swu==1e299) { // TODO think about whether one or two of these variables have to be // defined. Additionally, add an exception that should be thrown. @@ -59,7 +59,7 @@ EnrichmentCalculator::EnrichmentCalculator(const EnrichmentCalculator& e) : target_tails_assay(e.target_tails_assay), target_feed_qty(e.target_feed_qty), target_product_qty(e.target_product_qty), max_swu(e.max_swu), - use_downblending(e.use_downblending), isotopes(IsotopesNucID_vector()), + use_downblending(e.use_downblending), isotopes(IsotopesNucID()), gamma_235(e.gamma_235) { CalculateGammaAlphaStar_(); BuildMatchedAbundanceRatioCascade(); @@ -91,7 +91,6 @@ EnrichmentCalculator& EnrichmentCalculator::operator= ( use_downblending = e.use_downblending; - //IsotopesNucID(isotopes); gamma_235 = e.gamma_235; CalculateGammaAlphaStar_(); diff --git a/src/miso_enrich.h b/src/miso_enrich.h index e0542fa..da8ae54 100644 --- a/src/miso_enrich.h +++ b/src/miso_enrich.h @@ -79,8 +79,7 @@ class FeedConverter : public cyclus::Converter { double feed_used = e.FeedUsed(); cyclus::toolkit::MatQuery mq(m); - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); std::set nucs(isotopes.begin(), isotopes.end()); double feed_uranium_frac = mq.atom_frac(nucs); diff --git a/src/miso_helper.cc b/src/miso_helper.cc index 7933764..412a7a2 100644 --- a/src/miso_helper.cc +++ b/src/miso_helper.cc @@ -13,8 +13,7 @@ namespace misotest { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CompareCompMap(cyclus::CompMap cm1, cyclus::CompMap cm2) { - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); std::vector::iterator it; // The following for-loop has been added to ensure that the all of the // uranium keys are present in both compmaps, else the comparison fails. @@ -97,15 +96,7 @@ cyclus::Material::Ptr mat_natU() { } // namespace misotest // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void IsotopesNucID(std::vector& isotopes) { - isotopes = {232, 233, 234, 235, 236, 238}; - for (int i = 0; i < isotopes.size(); i++) { - isotopes[i] = (92*1000 + isotopes[i]) * 10000; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -std::vector IsotopesNucID_vector() { +const std::vector IsotopesNucID() { int iso[6] = {232, 233, 234, 235, 236, 238}; std::vector isotopes(iso, iso + sizeof(iso)/sizeof(int)); for (int& i : isotopes) { @@ -128,8 +119,7 @@ int IsotopeToNucID(int isotope) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int NucIDToIsotope(int nuc_id) { - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); std::vector::iterator it; it = std::find(isotopes.begin(), isotopes.end(), nuc_id); @@ -207,8 +197,7 @@ double MIsoAssay(cyclus::CompMap compmap) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - double MIsoFrac(cyclus::CompMap compmap, int isotope) { - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); double isotope_assay = 0; double uranium_atom_frac = 0; @@ -234,10 +223,9 @@ double MIsoFrac(cyclus::CompMap compmap, int isotope) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - std::map CalculateSeparationFactor(double gamma_235) { - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); std::map separation_factors; - + // We consider U-238 to be the key component hence the mass differences // are calculated with respect to this isotope. for (int i : isotopes) { diff --git a/src/miso_helper.h b/src/miso_helper.h index 40b20fc..cc9c262 100644 --- a/src/miso_helper.h +++ b/src/miso_helper.h @@ -24,8 +24,7 @@ const double kEpsDouble = 1e-5; const double kEpsCompMap = 1e-5; const int kIterMax = 200; -std::vector IsotopesNucID_vector(); -void IsotopesNucID(std::vector& isotopes); +const std::vector IsotopesNucID(); int IsotopeToNucID(int isotope); int NucIDToIsotope(int nuc_id); int ResBufIdx( diff --git a/src/miso_helper_tests.cc b/src/miso_helper_tests.cc index 0060aad..4d5ae69 100644 --- a/src/miso_helper_tests.cc +++ b/src/miso_helper_tests.cc @@ -25,8 +25,7 @@ TEST(MIsoHelperTest, ChooseCorrectResBuf) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TEST(MIsoHelperTest, NucIDConversion) { - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); for (int i : isotopes) { int isotope = NucIDToIsotope(i); @@ -72,8 +71,7 @@ TEST(MIsoHelperTest, SeparationFactor) { std::map separation_factor = CalculateSeparationFactor( gamma_235); - std::vector isotopes; - IsotopesNucID(isotopes); + std::vector isotopes(IsotopesNucID()); std::map expected; expected[922320000] = 2.2; expected[922330000] = 2.0;