htsky

Load and structure a vertically stratified atmosphere
git clone git://git.meso-star.fr/htsky.git
Log | Files | Refs | README | LICENSE

commit 9876de810e8ddc9c0ceb862b482763b902ce105e
parent be88d89dd938aaa2e56afd7f18577ec0a0aad77d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 17 Mar 2020 18:13:37 +0100

Log infos about used bands and overall number of acceleration structures

Diffstat:
Msrc/htsky.c | 52++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/src/htsky.c b/src/htsky.c @@ -352,7 +352,7 @@ setup_cache_stream struct stat htmie_statbuf2; int cache_version; int is_long_wave; - double bands_range[2]; + size_t bands_range[2]; /* Read the cache header */ #define READ(Var, N) { \ @@ -430,6 +430,53 @@ error: } static void +print_spectral_info(const struct htsky* sky) +{ + struct htgop_spectral_interval band_low, band_upp; + size_t iband_low, iband_upp; + size_t nbands; + size_t i; + size_t naccels = 0; + ASSERT(sky); + + nbands = htsky_get_spectral_bands_count(sky); + + iband_low = htsky_get_spectral_band_id(sky, 0); + iband_upp = htsky_get_spectral_band_id(sky, nbands-1); + + /* Retrieve the spectral interval boundaries */ + if(htsky_is_long_wave(sky)) { + HTGOP(get_lw_spectral_interval(sky->htgop, iband_low, &band_low)); + HTGOP(get_lw_spectral_interval(sky->htgop, iband_upp, &band_upp)); + } else { + HTGOP(get_sw_spectral_interval(sky->htgop, iband_low, &band_low)); + HTGOP(get_sw_spectral_interval(sky->htgop, iband_upp, &band_upp)); + } + + log_info(sky, "Wavelengths interval [%g, %g] in nanometers over %lu %s.\n", + wavenumber_to_wavelength(band_low.wave_numbers[1]), + wavenumber_to_wavelength(band_upp.wave_numbers[0]), + (unsigned long)nbands, + nbands > 1 ? "bands" : "band"); + + /* Compute the overall number of sky acceleration structures to build */ + FOR_EACH(i, 0, nbands) { + struct htgop_spectral_interval band; + const size_t iband = htsky_get_spectral_band_id(sky, i); + + if(htsky_is_long_wave(sky)) { + HTGOP(get_lw_spectral_interval(sky->htgop, iband, &band)); + } else { + HTGOP(get_sw_spectral_interval(sky->htgop, iband, &band)); + } + naccels += band.quadrature_length; + } + + log_info(sky, "Number of clouds partitionning structures: %lu\n", + (unsigned long)naccels); +} + +static void release_sky(ref_T* ref) { struct htsky* sky; @@ -539,7 +586,6 @@ htsky_create args->htgop_filename); goto error; } - /* If the long wave range is degenerated use the default wavelength range, * i.e. the short wave wavelengths of the CIE XYZ color space */ if(args->wlen_lw_range[0] > args->wlen_lw_range[1]) { @@ -554,6 +600,8 @@ htsky_create sky->is_long_wave = 1; } + print_spectral_info(sky); + /* Setup the atmopshere */ time_current(&t0); res = atmosphere_setup(sky, args->optical_thickness);