star-line

Structure for accelerating line importance sampling
git clone git://git.meso-star.fr/star-line.git
Log | Files | Refs | README | LICENSE

commit ac3a2834ec23e6a92285221e51b32fc48bf26afe
parent 5c7df6fda666cc3a086cc0f23bbaa24a7f296e6f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  4 Feb 2026 16:11:23 +0100

Implement accessors to the mixture data

Diffstat:
Msrc/sln.h | 6+++---
Msrc/sln_mixture.c | 28++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/sln.h b/src/sln.h @@ -200,19 +200,19 @@ SLN_API res_T sln_mixture_ref_put (struct sln_mixture* mixture); -SLN_API unsigned +SLN_API int sln_mixture_get_molecule_count (const struct sln_mixture* mixture); SLN_API enum shtr_molecule_id sln_mixture_get_molecule_id (const struct sln_mixture* mixture, - const unsigned index); + const int index); SLN_API res_T sln_mixture_get_molecule (const struct sln_mixture* mixture, - const unsigned index, + const int index, struct sln_molecule* molecule); /******************************************************************************* diff --git a/src/sln_mixture.c b/src/sln_mixture.c @@ -477,3 +477,31 @@ sln_mixture_ref_put(struct sln_mixture* mixture) ref_put(&mixture->ref, release_mixture); return RES_OK; } + +int +sln_mixture_get_molecule_count(const struct sln_mixture* mixture) +{ + ASSERT(mixture); + return mixture->nmolecules; +} + +enum shtr_molecule_id +sln_mixture_get_molecule_id(const struct sln_mixture* mixture, const int index) +{ + ASSERT(mixture && 0 <= index && index < mixture->nmolecules); + return mixture->molecules[index].id; +} + +res_T +sln_mixture_get_molecule + (const struct sln_mixture* mixture, + const int index, + struct sln_molecule* molecule) +{ + if(!mixture || index < 0 || index >= mixture->nmolecules || !molecule) { + return RES_BAD_ARG; + } + + *molecule = mixture->molecules[index].param; + return RES_OK; +}