commit 6219b46b707292484eb15ae7e46294749a1bb388
parent 4b94f91b0cb61228e7ab2bdf7482710a9d6b77eb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 28 Nov 2022 18:41:36 +0100
Save the range of bands in the main rnatm structure
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/rnatm_c.h b/src/rnatm_c.h
@@ -249,6 +249,8 @@ struct rnatm {
/* Spectral range to consider (in nanometers). Limits are inclusive */
double spectral_range[2];
+ /* Ids of the bands covered by the spectral range. Limits are inclusive */
+ size_t ibands[2];
double optical_thickness; /* Threshold used during octree building */
unsigned nthreads;
diff --git a/src/rnatm_properties.c b/src/rnatm_properties.c
@@ -874,7 +874,6 @@ error:
static res_T
setup_spectral_range(struct rnatm* atm, const struct rnatm_create_args* args)
{
- size_t bands[2];
size_t iband, nbands;
size_t offset;
size_t i;
@@ -886,11 +885,11 @@ setup_spectral_range(struct rnatm* atm, const struct rnatm_create_args* args)
atm->spectral_range[1] = args->spectral_range[1];
/* Find the bands overlapped by the input spectral range */
- res = find_band_range(atm, atm->spectral_range, bands);
+ res = find_band_range(atm, atm->spectral_range, atm->ibands);
if(res != RES_OK) goto error;
/* Allocate the list of bands to be taken into account */
- nbands = bands[1] - bands[0] + 1;
+ nbands = atm->ibands[1] - atm->ibands[0] + 1;
res = darray_band_resize(&atm->bands, nbands);
if(res != RES_OK) {
log_err(atm,
@@ -902,7 +901,7 @@ setup_spectral_range(struct rnatm* atm, const struct rnatm_create_args* args)
/* Register the bands */
i = 0;
offset = 0;
- FOR_EACH(iband, bands[0], bands[1]+1) {
+ FOR_EACH(iband, atm->ibands[0], atm->ibands[1]+1) {
struct band* band = NULL;
struct sck_band sck_band;