star-hitran

Load line-by-line data from the HITRAN database
git clone git://git.meso-star.fr/star-hitran.git
Log | Files | Refs | README | LICENSE

commit 98caaeed138abdd775a2b8cfc61532f07289cf9f
parent 42babffb9fe19f3d49a30794e1a3eca380e03fc0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  9 Feb 2022 09:16:19 +0100

Add the list of isotopes to the public molecule data structure

Diffstat:
Msrc/sht.h | 17+++++++++++++++--
Msrc/sht_isotope_metadata.c | 15+++------------
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/sht.h b/src/sht.h @@ -48,20 +48,33 @@ struct sht_create_args { static const struct sht_create_args SHT_CREATE_ARGS_DEFAULT = SHT_CREATE_ARGS_DEFAULT__; +struct sht_isotope { + double abundance; /* in ]0, 1] */ + double Q296K; /* Partition function at Tref = 296K */ + double molar_mass; /* In g */ + size_t molecule; /* Index of the molecule to which the isotope belongs */ + int gj; /* State independent degeneracy factor */ + int id; /* Unique identifier of the isotope */ +}; +#define SHT_ISOTOPOLOGUE_NULL__ {0,0,0,0,0,0} +static const struct sht_isotope SHT_ISOTOPOLOGUE_NULL = SHT_ISOTOPOLOGUE_NULL__; + struct sht_molecule { const char* name; size_t nisotopes; /* Number of isotopes */ + const struct sht_isotope* isotopes; int id; /* Unique identifier */ }; -#define SHT_MOLECULE_NULL__ {NULL, 0, -1} +#define SHT_MOLECULE_NULL__ {NULL, 0, NULL, -1} static const struct sht_molecule SHT_MOLECULE_NULL = SHT_MOLECULE_NULL__; #define SHT_MOLECULE_IS_NULL(Molecule) \ ( (Molecule)->name == SHT_MOLECULE_NULL.name \ && (Molecule)->nisotopes == SHT_MOLECULE_NULL.nisotopes \ + && (Molecule)->isotopes == SHT_MOLECULE_NULL.isotopes \ && (Molecule)->id == SHT_MOLECULE_NULL.id) -/* Forware declarations */ +/* Forward declarations */ struct sht; struct sht_isotope_metadata; diff --git a/src/sht_isotope_metadata.c b/src/sht_isotope_metadata.c @@ -48,20 +48,9 @@ struct param_desc { #define PARAM_DESC_NULL__ {NULL, NULL, 0, 0, 0, 0, 0} static const struct param_desc PARAM_DESC_NULL = PARAM_DESC_NULL__; -struct isotope { - double abundance; /* in ]0, 1] */ - double Q296K; /* Partition function at Tref = 296K */ - double molar_mass; /* In g */ - size_t molecule; /* Registered molecule to which the isotope belongs */ - int gj; /* State independent degeneracy factor */ - int id; /* Unique identifier of the isotope */ -}; -#define ISOTOPOLOGUE_NULL__ {0,0,0,0,0,0} -static const struct isotope ISOTOPOLOGUE_NULL = ISOTOPOLOGUE_NULL__; - /* Generate the dynamic array of isotopes */ #define DARRAY_NAME isotope -#define DARRAY_DATA struct isotope +#define DARRAY_DATA struct sht_isotope #include <rsys/dynamic_array.h> struct molecule { @@ -656,6 +645,8 @@ sht_isotope_metadata_get_molecule out_molecule->id = molecule->id; out_molecule->nisotopes = molecule->isotopes_range[1] - molecule->isotopes_range[0]; + out_molecule->isotopes = + darray_isotope_cdata_get(&metadata->isotopes) + molecule->isotopes_range[0]; exit: return res;