commit 34b22b666290127b9dc6745360c822678a97f2a2
parent 0a245b626cec7aa9277617b88af35b536a1d9aa1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 8 Dec 2022 17:00:08 +0100
core: update htrdr_ran_wlen_discrete_create_args
Update the profile of the functor returning a wavelength and its
corresponding radiance.
Diffstat:
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/core/htrdr_ran_wlen_discrete.c b/src/core/htrdr_ran_wlen_discrete.c
@@ -89,7 +89,7 @@ setup_per_wlen_radiance
/* Store the discrete values */
FOR_EACH(iwlen, 0, args->nwavelengths) {
- args->get(iwlen, wlens+iwlen, radia+iwlen, args->context);
+ args->get(args->context, iwlen, wlens+iwlen, radia+iwlen);
if(iwlen > 0 && wlens[iwlen] <= wlens[iwlen-1]) {
htrdr_log_err(ran->htrdr,
@@ -149,8 +149,8 @@ setup_distribution
double w1, L1;
double area;
- args->get(iw0, &w0, &L0, args->context);
- args->get(iw1, &w1, &L1, args->context);
+ args->get(args->context, iw0, &w0, &L0);
+ args->get(args->context, iw1, &w1, &L1);
ASSERT(w0 < w1);
area = (L0 + L1) * (w1-w0) * 0.5;
@@ -159,6 +159,8 @@ setup_distribution
sum += area;
}
+ htrdr_log(ran->htrdr, "Discrete radiance integral = %g W/m²/sr\n", sum);
+
/* Normalize the probabilities and setup the cumulative */
FOR_EACH(iband, 0, ran->nbands) {
proba[iband] /= sum;
diff --git a/src/core/htrdr_ran_wlen_discrete.h b/src/core/htrdr_ran_wlen_discrete.h
@@ -23,10 +23,10 @@
struct htrdr_ran_wlen_discrete_create_args {
void (*get)
- (const size_t i,
+ (void* ctx,
+ const size_t i,
double* wlen, /* In nanometer */
- double* radiance, /* In W/m²/sr/m */
- void* ctx);
+ double* radiance); /* In W/m²/sr/m */
size_t nwavelengths;
void* context; /* User defined data */
};