commit d2423b32130fb803a9ffd0f01d52913f33e7e4b9
parent bebeed909f40c20d2a06ebdb5630b834db6605b7
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 11 Jul 2018 16:17:23 +0200
Add accessor to the sun spectral bands
Diffstat:
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/htrdr_sky.c b/src/htrdr_sky.c
@@ -636,7 +636,7 @@ htrdr_sky_fetch_svx_voxel_property
ASSERT(sky && prop && wavelength>=0 && voxel);
ASSERT(comp_mask & HTRDR_ALL_COMPONENTS);
ASSERT((unsigned)prop < HTRDR_SVX_OPS_COUNT__);
- (void)sky, (void)wavelength;
+ (void)sky, (void)wavelength, (void)prop;
if(comp_mask != HTRDR_ALL_COMPONENTS) {
FATAL("Unsupported sky component\n");
diff --git a/src/htrdr_sun.c b/src/htrdr_sun.c
@@ -221,3 +221,25 @@ htrdr_sun_is_dir_in_solar_cone(const struct htrdr_sun* sun, const double dir[3])
return dot >= sun->cos_half_angle;
}
+size_t
+htrdr_sun_get_spectral_bands_count(const struct htrdr_sun* sun)
+{
+ ASSERT(sun);
+ return darray_double_size_get(&sun->radiances_sw);
+}
+
+void
+htrdr_sun_get_spectral_band_bounds
+ (const struct htrdr_sun* sun,
+ const size_t ispectral_band,
+ double bounds[2])
+{
+ const double* wnums;
+ ASSERT(sun && ispectral_band < htrdr_sun_get_spectral_bands_count(sun));
+ ASSERT(ispectral_band + 1 < darray_double_size_get(&sun->wavenumbers_sw));
+ wnums = darray_double_cdata_get(&sun->wavenumbers_sw);
+ bounds[0] = wavenumber_to_wavelength(wnums[ispectral_band+0]);
+ bounds[1] = wavenumber_to_wavelength(wnums[ispectral_band+1]);
+ ASSERT(bounds[0] <= bounds[1]);
+}
+
diff --git a/src/htrdr_sun.h b/src/htrdr_sun.h
@@ -63,4 +63,14 @@ htrdr_sun_is_dir_in_solar_cone
(const struct htrdr_sun* sun,
const double dir[3]);
+extern LOCAL_SYM size_t
+htrdr_sun_get_spectral_bands_count
+ (const struct htrdr_sun* sun);
+
+extern LOCAL_SYM void
+htrdr_sun_get_spectral_band_bounds
+ (const struct htrdr_sun* sun,
+ const size_t ispectral_band,
+ double bounds[2]); /* Lower and upper wavelength in nanometer */
+
#endif /* HTRDR_SUN_H */