htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit 41843e344a6ca9e130afc951dedbee9cef131d4d
parent 53a84d4af6adff72eb52cb6bfd433b8e295f425b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 17 Mar 2020 17:47:43 +0100

Add the -l option that enables long wave rendering

Diffstat:
Msrc/htrdr.c | 2++
Msrc/htrdr_args.c | 39++++++++++++++++++++++++++++++++++++---
Msrc/htrdr_args.h.in | 5++++-
3 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/src/htrdr.c b/src/htrdr.c @@ -549,6 +549,8 @@ htrdr_init htsky_args.nthreads = htrdr->nthreads; htsky_args.repeat_clouds = args->repeat_clouds; htsky_args.verbose = htrdr->mpi_rank == 0 ? args->verbose : 0; + htsky_args.wlen_lw_range[0] = args->wlen_lw_range[0]; + htsky_args.wlen_lw_range[1] = args->wlen_lw_range[1]; res = htsky_create(&htrdr->logger, htrdr->allocator, &htsky_args, &htrdr->sky); if(res != RES_OK) goto error; diff --git a/src/htrdr_args.c b/src/htrdr_args.c @@ -34,8 +34,8 @@ print_help(const char* cmd) ASSERT(cmd); printf("Usage: %s [OPION]... -a ATMOSPHERE\n", cmd); printf( -"Render an image in the visible part of the spectrum, for scenes composed of an\n" -"atmospheric gaz mixture, clouds and a ground.\n\n"); +"Render an image for scenes composed of an atmospheric gas mixture, clouds\n" +"and a ground.\n\n"); printf( " -a ATMOSPHERE gas optical properties of the atmosphere.\n"); printf( @@ -59,6 +59,11 @@ print_help(const char* cmd) printf( " -i <image> define the image to compute.\n"); printf( +" -l WLEN_MIN,WLEN_MAX\n" +" enable long wave rendering for the wavelengths included in\n" +" [WLEN_MIN, WLEN_MAX], in nanometers. By default, the\n" +" rendering is performed for the visible part of the spectrum.\n"); + printf( " -R infinitely repeat the ground along the X and Y axis.\n"); printf( " -r infinitely repeat the clouds along the X and Y axis.\n"); @@ -354,6 +359,31 @@ error: goto exit; } +static res_T +parse_lw_range(struct htrdr_args* args, const char* str) +{ + double range[2]; + size_t len; + res_T res = RES_OK; + ASSERT(args && str); + + res = cstr_to_list_double(str, ',', range, &len, 2); + if(res == RES_OK && len != 2) res = RES_BAD_ARG; + if(res == RES_OK && range[0] > range[1]) res = RES_BAD_ARG; + if(res != RES_OK) { + fprintf(stderr, "Invalid long wave range `%s'.\n", str); + goto error; + } + + args->wlen_lw_range[0] = range[0]; + args->wlen_lw_range[1] = range[1]; + +exit: + return res; +error: + goto exit; +} + /******************************************************************************* * Local functions ******************************************************************************/ @@ -378,7 +408,7 @@ htrdr_args_init(struct htrdr_args* args, int argc, char** argv) } } - while((opt = getopt(argc, argv, "a:C:c:D:dfg:hi:M:m:O:o:RrT:t:V:v")) != -1) { + while((opt = getopt(argc, argv, "a:C:c:D:dfg:hi:l:M:m:O:o:RrT:t:V:v")) != -1) { switch(opt) { case 'a': args->filename_gas = optarg; break; case 'C': @@ -399,6 +429,9 @@ htrdr_args_init(struct htrdr_args* args, int argc, char** argv) res = parse_multiple_parameters (args, optarg, parse_image_parameter); break; + case 'l': + res = parse_lw_range(args, optarg); + break; case 'M': args->filename_mtl = optarg; break; case 'm': args->filename_mie = optarg; break; case 'O': args->cache = optarg; break; diff --git a/src/htrdr_args.h.in b/src/htrdr_args.h.in @@ -18,10 +18,10 @@ #include "htrdr_ground.h" +#include <float.h> #include <limits.h> #include <rsys/rsys.h> - struct htrdr_args { const char* filename_gas; /* Path of the gas file */ const char* filename_les; /* Path of the HTCP file */ @@ -55,6 +55,8 @@ struct htrdr_args { double optical_thickness; /* Threshold used during octree building */ unsigned grid_max_definition[3]; /* Maximum definition of the grid */ + double wlen_lw_range[2]; /* Long Wave range to handle in nm */ + unsigned nthreads; /* Hint on the number of threads to use */ int force_overwriting; int dump_vtk; /* Dump the loaded cloud properties in a VTK file */ @@ -90,6 +92,7 @@ struct htrdr_args { 90, /* Sun elevation */ \ @HTRDR_ARGS_DEFAULT_OPTICAL_THICKNESS_THRESHOLD@, /* Optical thickness */ \ {UINT_MAX, UINT_MAX, UINT_MAX}, /* Maximum definition of the grid */ \ + {DBL_MAX, -DBL_MAX}, /* Long wave range. Degenerated <=> short wave */ \ (unsigned)~0, /* #threads */ \ 0, /* Force overwriting */ \ 0, /* dump VTK */ \