commit 46d3a21f10e9b7305dd8df20837f0e412c2a0ad0
parent bd06ecca27908f0e4c2c0d97e571c3a33d617ecb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 14 Feb 2022 15:51:02 +0100
Update the memory layout of a transition
Encode it on 64 bytes rather than 32 bytes because double precision is
required to match the accuracy of the stored data.
Diffstat:
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/src/shitran.h b/src/shitran.h
@@ -77,16 +77,16 @@ static const struct shitran_molecule SHITRAN_MOLECULE_NULL =
((Molecule)->id == SHITRAN_MOLECULE_NULL.id)
struct shitran_transition {
- float wavenumber; /* Central wavenumber in vacuum [cm^-1] */
- float intensity; /* Reference intensity [cm^-1/(molec.cm^2)] */
- float gamma_air; /* Air broadening half-width [cm^-1.atm^-1] */
- float gamma_self; /* Self broadening half-width [cm^-1.atm^-1] */
- float lower_state_energy; /* [cm^-1] */
- float n_air; /* Temperature-dependant exponent */
- float delta_air; /* Air-pressure wavenumber shift [cm^-1.atm^-1] */
-
- int16_t molecule_id;
- int16_t isotope_id_local;
+ double wavenumber; /* Central wavenumber in vacuum [cm^-1] */
+ double intensity; /* Reference intensity [cm^-1/(molec.cm^2)] */
+ double gamma_air; /* Air broadening half-width [cm^-1.atm^-1] */
+ double gamma_self; /* Self broadening half-width [cm^-1.atm^-1] */
+ double lower_state_energy; /* [cm^-1] */
+ double n_air; /* Temperature-dependant exponent */
+ double delta_air; /* Air-pressure wavenumber shift [cm^-1.atm^-1] */
+
+ int32_t molecule_id;
+ int32_t isotope_id_local; /* This index starts from 0 */
};
#define SHITRAN_TRANSITION_NULL__ {0,0,0,0,0,0,0,-1,-1}
static const struct shitran_transition SHITRAN_TRANSITION_NULL =
diff --git a/src/shitran_transitions.c b/src/shitran_transitions.c
@@ -115,22 +115,22 @@ parse_transition(struct shitran_transitions* transitions, struct txtrdr* txtrdr)
} (void)0
PARSE(&molecule_id, 2, int, "molecule identifier", 0,99,1,1);
- tr.molecule_id = (int16_t)molecule_id;
+ tr.molecule_id = (int32_t)molecule_id;
PARSE(&isotope_id_local, 1, int, "isotope local identifier", 0,9,1,1);
- tr.isotope_id_local = (int16_t)
+ tr.isotope_id_local = (int32_t)
(isotope_id_local == 0 ? 9 : (isotope_id_local - 1));
- PARSE(&tr.wavenumber, 12, float, "central wavenumber", 0,INF,0,1);
- PARSE(&tr.intensity, 10, float, "reference intensity", 0,INF,0,1);
+ PARSE(&tr.wavenumber, 12, double, "central wavenumber", 0,INF,0,1);
+ PARSE(&tr.intensity, 10, double, "reference intensity", 0,INF,0,1);
NEXT(10); /* Skip the Enstein coef */
- PARSE(&tr.gamma_air, 5, float, "air broadening half-width", 0,INF,0,1);
- PARSE(&tr.gamma_self, 5, float, "self broadening half-width", 0,INF,0,1);
- PARSE(&tr.lower_state_energy, 10, float, "lower state energy", 0,INF,0,1);
- PARSE(&tr.n_air, 4, float, "temperature-dependent exponent", 0,INF,0,1);
- PARSE(&tr.delta_air, 8, float, "air-pressure wavenumber shift", -INF,INF,1,1);
+ PARSE(&tr.gamma_air, 5, double, "air broadening half-width", 0,INF,0,1);
+ PARSE(&tr.gamma_self, 5, double, "self broadening half-width", 0,INF,0,1);
+ PARSE(&tr.lower_state_energy, 10, double, "lower state energy", 0,INF,0,1);
+ PARSE(&tr.n_air, 4, double, "temperature-dependent exponent", 0,INF,0,1);
+ PARSE(&tr.delta_air, 8, double, "air-pressure wavenumber shift", -INF,INF,1,1);
/* Skip the remaining values */