rnatm

Load and structure data describing an atmosphere
git clone git://git.meso-star.fr/rnatm.git
Log | Files | Refs | README | LICENSE

commit d07340157b5607ac908287bb18890388324883cf
parent 3e8b20486a297f30a9e4c017afe061c02ea94e82
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 28 Oct 2022 15:47:10 +0200

Add function rnatm_band_get_range

Diffstat:
Msrc/rnatm.c | 34++++++++++++++++++++++++++++++++++
Msrc/rnatm.h | 6++++++
2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/src/rnatm.c b/src/rnatm.c @@ -435,6 +435,40 @@ error: goto exit; } +res_T +rnatm_band_get_range + (const struct rnatm* rnatm, + const size_t iband, + double range[2]) /* In nm. Upper bound is exclusive */ +{ + struct sck_band band; + res_T res = RES_OK; + + if(!rnatm || !range) { + res = RES_BAD_ARG; + goto error; + } + + res = sck_get_band(rnatm->gas.ck, iband, &band); + if(res != RES_OK) goto error; + + /* Reject the band if it does not overlap the atmosphere spectral domain */ + if(band.lower/*Inclusive*/ > rnatm->spectral_range[1] + || band.upper/*Exclusive*/ <= rnatm->spectral_range[0]) { + return RES_BAD_ARG; + } + + /* TODO Should the range of the band be clamped to the atmospheric spectral + * domain? */ + range[0] = band.lower; + range[1] = band.upper; + +exit: + return res; +error: + goto exit; +} + /******************************************************************************* * Local functions ******************************************************************************/ diff --git a/src/rnatm.h b/src/rnatm.h @@ -291,6 +291,12 @@ rnatm_band_sample_quad_pt const size_t iband, /* Index of the band to sample */ size_t* iquad); +RNATM_API res_T +rnatm_band_get_range + (const struct rnatm* rnatm, + const size_t iband, /* Index of the band to query */ + double range[2]); /* In nm. Upper bound is exclusive */ + /* Writes a set of octrees following the VTK file format */ RNATM_API res_T rnatm_write_vtk_octrees