htgop

Optical properties of a gas mixture
git clone git://git.meso-star.fr/htgop.git
Log | Files | Refs | README | LICENSE

commit 88a648aaa3113853f03b3e5d5943905ef4b2535b
parent c8b3fac7a113e67a49b9e37f6c5e2e7cef137c09
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  3 Jun 2020 12:00:11 +0200

Remove hard coded <short|long>wave limits

Diffstat:
Msrc/htgop.c | 37+------------------------------------
Msrc/test_htgop_check_specints.h | 12+-----------
Msrc/test_htgop_load.c | 4----
3 files changed, 2 insertions(+), 51 deletions(-)

diff --git a/src/htgop.c b/src/htgop.c @@ -26,18 +26,6 @@ #include <math.h> -/* Boundaries of the long wave spectral data */ -#define LW_WAVELENGTH_MIN 1000.0 /* In nanometer */ -#define LW_WAVELENGTH_MAX 100000.0 /* In nanometer */ -#define LW_WAVENUMBER_MIN WLEN_TO_WNUM(LW_WAVELENGTH_MAX) /* In cm^-1 */ -#define LW_WAVENUMBER_MAX WLEN_TO_WNUM(LW_WAVELENGTH_MIN) /* In cm^-1 */ - -/* Boundaries of theshort wave spectral data */ -#define SW_WAVELENGTH_MIN 100.0 /* In nanometer */ -#define SW_WAVELENGTH_MAX 1200.0 /* In nanometer */ -#define SW_WAVENUMBER_MIN WLEN_TO_WNUM(SW_WAVELENGTH_MAX) /* In cm^-1 */ -#define SW_WAVENUMBER_MAX WLEN_TO_WNUM(SW_WAVELENGTH_MIN) /* In cm^-1 */ - /******************************************************************************* * Helper functions ******************************************************************************/ @@ -867,18 +855,6 @@ htgop_get_sw_spectral_intervals goto error; } - if(wnum_range[0] < SW_WAVENUMBER_MIN - || wnum_range[1] > SW_WAVENUMBER_MAX) { - log_err(htgop, - "%s: the range [%g, %g] is not strictly included " - "in the long wave interval [%g, %g].\n", - FUNC_NAME, - wnum_range[0], wnum_range[1], - SW_WAVENUMBER_MIN, SW_WAVENUMBER_MAX); - res = RES_BAD_ARG; - goto error; - } - wnums = darray_double_cdata_get(&htgop->sw_specints.wave_numbers); nwnums = darray_double_size_get(&htgop->sw_specints.wave_numbers); @@ -907,18 +883,6 @@ htgop_get_lw_spectral_intervals goto error; } - if(wnum_range[0] < LW_WAVENUMBER_MIN - || wnum_range[1] > LW_WAVENUMBER_MAX) { - log_err(htgop, - "%s: the range [%g, %g] is not strictly included " - "in the long wave interval [%g, %g].\n", - FUNC_NAME, - wnum_range[0], wnum_range[1], - LW_WAVENUMBER_MIN, LW_WAVENUMBER_MAX); - res = RES_BAD_ARG; - goto error; - } - wnums = darray_double_cdata_get(&htgop->lw_specints.wave_numbers); nwnums = darray_double_size_get(&htgop->lw_specints.wave_numbers); @@ -1036,6 +1000,7 @@ get_spectral_intervals /* Transform the upper wnum bound in spectral interval id */ specint_range[1] = specint_range[1] - 1; + ASSERT(specint_range[0] <= specint_range[1]); ASSERT(wnums[specint_range[0]+1] > wnum_range[0]); ASSERT(wnums[specint_range[1]+0] < wnum_range[1]); diff --git a/src/test_htgop_check_specints.h b/src/test_htgop_check_specints.h @@ -15,9 +15,7 @@ #include "htgop.h" -#if !defined(DOMAIN) \ - || !defined(DOMAIN_WAVELENGTH_MIN) \ - || !defined(DOMAIN_WAVELENGTH_MAX) +#if !defined(DOMAIN) #error "Missing the <DATA|DOMAIN> macro." #endif @@ -59,12 +57,6 @@ CONCAT(CONCAT(check_, DOMAIN), _specints) CHK(GET_SPECINTS(htgop, wnums, range) == RES_BAD_ARG); } wnums[0] = low; - wnums[1] = 1.e7/(DOMAIN_WAVELENGTH_MIN-1.0); - CHK(GET_SPECINTS(htgop, wnums, range) == RES_BAD_ARG); - wnums[0] = 1.e7/(DOMAIN_WAVELENGTH_MAX+1.0); - wnums[1] = upp; - CHK(GET_SPECINTS(htgop, wnums, range) == RES_BAD_ARG); - wnums[0] = low; wnums[1] = upp; CHK(GET_SPECINTS(htgop, wnums, range) == RES_OK); @@ -111,6 +103,4 @@ CONCAT(CONCAT(check_, DOMAIN), _specints) #undef GET_SPECINTS #undef GET_NSPECINTS #undef DOMAIN -#undef DOMAIN_WAVELENGTH_MIN -#undef DOMAIN_WAVELENGTH_MAX diff --git a/src/test_htgop_load.c b/src/test_htgop_load.c @@ -65,13 +65,9 @@ check_position_to_layer_id(const struct htgop* htgop) } #define DOMAIN sw -#define DOMAIN_WAVELENGTH_MIN 100.0 -#define DOMAIN_WAVELENGTH_MAX 1200.0 #include "test_htgop_check_specints.h" #define DOMAIN lw -#define DOMAIN_WAVELENGTH_MIN 1000.0 -#define DOMAIN_WAVELENGTH_MAX 100000.0 #include "test_htgop_check_specints.h" int