From 4c8c2698a551cdedd1fae2f4f3ecc9275b3e10e2 Mon Sep 17 00:00:00 2001 From: Luke Shingles Date: Mon, 9 Sep 2024 10:36:57 +0100 Subject: [PATCH] Make cont_index positive --- atomic.h | 2 +- input.cc | 7 +++---- sn3d.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/atomic.h b/atomic.h index b48497e97..8e0483fe2 100644 --- a/atomic.h +++ b/atomic.h @@ -417,7 +417,7 @@ inline void set_nuptrans(const int element, const int ion, const int level, cons [[nodiscard]] inline auto get_emtype_continuum(const int element, const int ion, const int level, const int upperionlevel) -> int { const int phixstargetindex = get_phixtargetindex(element, ion, level, upperionlevel); - return globals::elements[element].ions[ion].levels[level].cont_index - phixstargetindex; + return globals::elements[element].ions[ion].levels[level].cont_index + phixstargetindex; } // Returns the energy of (element,ion,level). diff --git a/input.cc b/input.cc index dcc5a4967..78aba3e23 100644 --- a/input.cc +++ b/input.cc @@ -866,7 +866,7 @@ void read_phixs_data() { read_phixs_file(1, tmpallphixs); } - int cont_index = -1; + int cont_index = 0; ptrdiff_t nbftables = 0; for (int element = 0; element < get_nelements(); element++) { const int nions = get_nions(element); @@ -874,9 +874,8 @@ void read_phixs_data() { const int nlevels = get_nlevels(element, ion); for (int level = 0; level < nlevels; level++) { const int nphixstargets = get_nphixstargets(element, ion, level); - globals::elements[element].ions[ion].levels[level].cont_index = - (nphixstargets > 0) ? cont_index : std::numeric_limits::max(); - cont_index -= nphixstargets; + globals::elements[element].ions[ion].levels[level].cont_index = (nphixstargets > 0) ? cont_index : -1; + cont_index += nphixstargets; if (nphixstargets > 0) { nbftables++; } diff --git a/sn3d.h b/sn3d.h index 6dfb7cce6..458e501c9 100644 --- a/sn3d.h +++ b/sn3d.h @@ -216,7 +216,7 @@ inline void gsl_error_handler_printout(const char *reason, const char *file, int [[nodiscard]] inline auto get_bflutindex(const int tempindex, const int element, const int ion, const int level, const int phixstargetindex) -> int { - const int contindex = -1 - globals::elements[element].ions[ion].levels[level].cont_index + phixstargetindex; + const int contindex = globals::elements[element].ions[ion].levels[level].cont_index + phixstargetindex; const int bflutindex = (tempindex * globals::nbfcontinua) + contindex; assert_testmodeonly(bflutindex >= 0);