star-line

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

commit 8d423e40c0e6f2d1b200a9cb632014c43a9782f2
parent 90a512e2d9cd6b7b56f03574c40cfba31db4dee6
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 16 Mar 2026 09:27:24 +0100

sln-slab: add the spectral range as an input argument

This prepares for spectral integration, which will be one of the tool's
integration domains.

Diffstat:
Msrc/sln_slab.c | 22+++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/sln_slab.c b/src/sln_slab.c @@ -37,6 +37,8 @@ struct args { double thickness; /* Thickness of the slab [m] */ + double spectral_range[2]; /* [cm^-1]^2 */ + unsigned long nrealisations; /* Number of Monte Carlo realisations */ /* Miscellaneous */ @@ -45,7 +47,7 @@ struct args { int verbose; int quit; }; -#define ARGS_DEFAULT__ {NULL,NULL,NULL,1,10000,UINT_MAX,0,0,0} +#define ARGS_DEFAULT__ {NULL,NULL,NULL,1,{0,DBL_MAX},10000,UINT_MAX,0,0,0} static const struct args ARGS_DEFAULT = ARGS_DEFAULT__; struct cmd { @@ -73,7 +75,20 @@ usage(FILE* stream) { fprintf(stream, "usage: sln-slab [-hsv] [-n nrealisations] [-T thickness] [-t threads]\n" -" -a accel_struct -m molparams -l lines\n"); +" -S nu_min,nu_max -a accel_struct -m molparams -l lines\n"); +} + +static res_T +parse_spectral_range(const char* str, double spectral_range[2]) +{ + size_t len = 0; + res_T res = RES_OK; + ASSERT(str && spectral_range); + + res = cstr_to_list_double(str, ',', spectral_range, &len, 2); + if(res == RES_OK && len < 2) res = RES_BAD_ARG; + + return res; } static res_T @@ -86,7 +101,7 @@ args_init(struct args* args, int argc, char** argv) *args = ARGS_DEFAULT; - while((opt = getopt(argc, argv, "a:hl:m:n:sT:t:v")) != -1) { + while((opt = getopt(argc, argv, "a:hl:m:n:S:sT:t:v")) != -1) { switch(opt) { case 'a': args->tree = optarg; break; case 'h': @@ -96,6 +111,7 @@ args_init(struct args* args, int argc, char** argv) case 'l': args->lines = optarg; break; case 'm': args->molparams = optarg; break; case 'n': res = cstr_to_ulong(optarg, &args->nrealisations); break; + case 'S': res = parse_spectral_range(optarg, args->spectral_range); break; case 's': args->lines_in_shtr_format = 1; break; case 'T': res = cstr_to_double(optarg, &args->thickness);