htrdr

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

commit 0eaaa9912628c0fb12b1fef09bf2ac4cf920a261
parent faae8986aecae1ca539f43362de29132bef3ff12
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 20 Feb 2020 16:04:08 +0100

Add support of the -O _cache_ option

Add the possibility to cache the sky data into a file.

Diffstat:
Mdoc/htrdr.1.txt.in | 34++++++++++++++++++----------------
Msrc/htrdr.c | 1+
Msrc/htrdr_args.c | 5++++-
Msrc/htrdr_args.h.in | 2++
4 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/doc/htrdr.1.txt.in b/doc/htrdr.1.txt.in @@ -24,7 +24,7 @@ htrdr - image renderer of cloudy atmospheres SYNOPSIS -------- [verse] -*htrdr* [_option_]... -a _atmosphere_ -m _mie_ +*htrdr* [_option_]... -a _atmosphere_ DESCRIPTION ----------- @@ -133,18 +133,6 @@ OPTIONS *-g* _ground_:: Path toward an OBJ file [2] representing the ground geometry. -*-G*:: - Pre-compute or use cached grids of the cloud properties built from the - _clouds_, the _atmosphere_ and the _mie_ files. If the corresponding grids - were generated in a previous run, reuse them as far as it is possible, i.e. - if the _clouds_, the _atmosphere_ and the _mie_ files were not updated. The - cached data are written in a hidden directory named *.htrdr* located in the - directory where *htrdr* is run. On platforms with an efficient hard-drive and - plenty of random access memory, this cache mechanism can significantly - speed-up the pre-computation step on _clouds_ data. Note that this option is - incompatible with a MPI execution and is thus forced to off if *htrdr* is run - through a process launcher. - *-h*:: List short help and exit. @@ -171,6 +159,19 @@ OPTIONS Path toward a *htmie*(5) file defining the optical properties of water droplets. +*-O* _cache_:: + File used to cache the sky data. If the _cache_ file does not exists, it is + created and filled with the sky data built from the _clouds_, the + _atmosphere_ and the _mie_ input files. This cached data can then be reused + in the next runs as long as the input files provided on the command are the + same of the ones used to setup the cache; leading to a significant speed-up + of the pre-processing step. If _cache_ contains data generated from input + files that are not the ones submitted on the command line, an error is + notified and the execution is stopped, avoiding the use of wrong cached data. + Note that when the cache is used, *htrdr* ignores the arguments used to + parametrise the structures partitioning the sky data, i.e. the *-T* and *-V* + options. + *-o* _output_:: File where *htrdr* writes its _output_ data. If not defined, write results to standard output. @@ -227,13 +228,14 @@ output in a regular PPM image [5]: $ htpp -o image.ppm output Move the sun by setting its azimuthal and elevation angles to *120* and *40* -degrees respectively. Use the *-G* option to enable the cache mechanism on -clouds data. Increase the image definition to *1280* by *720* and set the +degrees respectively. Use the *-O* option to enable the cache mechanism on +sky data. Increase the image definition to *1280* by *720* and set the number of samples per pixel component to *1024*. Write results on standard output and convert the resulting image in PPM before visualising it through the *feh*(1) image viewer: - $ htrdr -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R -c clouds.htcp -G \ + $ htrdr -D120,40 -a gas.txt -m Mie.nc -g mountains.obj -R -c clouds.htcp \ + -O my_cache \ -C pos=0,0,400:tgt=0,1,0:up=0,0,1 \ -i def=1280x720:spp=1024 | htpp | feh - diff --git a/src/htrdr.c b/src/htrdr.c @@ -464,6 +464,7 @@ htrdr_init htsky_args.htcp_filename = args->filename_les; htsky_args.htgop_filename = args->filename_gas; htsky_args.htmie_filename = args->filename_mie; + htsky_args.cache_filename = args->cache; htsky_args.grid_max_definition[0] = args->grid_max_definition[0]; htsky_args.grid_max_definition[1] = args->grid_max_definition[1]; htsky_args.grid_max_definition[2] = args->grid_max_definition[2]; diff --git a/src/htrdr_args.c b/src/htrdr_args.c @@ -84,6 +84,8 @@ print_help(const char* cmd) printf( " -m MIE file of Mie's data.\n"); printf( +" -O CACHE name of the cache file used to store/restore the sky data.\n"); + printf( " -o OUTPUT file where data are written. If not defined, data are\n" " written to standard output.\n"); printf( @@ -413,7 +415,7 @@ htrdr_args_init(struct htrdr_args* args, int argc, char** argv) } } - while((opt = getopt(argc, argv, "a:b:C:c:D:de:fg:hi:m:o:RrT:t:V:v")) != -1) { + while((opt = getopt(argc, argv, "a:b:C:c:D:de:fg:hi:m:O:o:RrT:t:V:v")) != -1) { switch(opt) { case 'a': args->filename_gas = optarg; break; case 'b': @@ -444,6 +446,7 @@ htrdr_args_init(struct htrdr_args* args, int argc, char** argv) (args, optarg, parse_image_parameter); break; case 'm': args->filename_mie = optarg; break; + case 'O': args->cache = optarg; break; case 'o': args->output = optarg; break; case 'r': args->repeat_clouds = 1; break; case 'R': args->repeat_ground = 1; break; diff --git a/src/htrdr_args.h.in b/src/htrdr_args.h.in @@ -26,6 +26,7 @@ struct htrdr_args { const char* filename_les; /* Path of the HTCP file */ const char* filename_mie; /* Path of the Mie properties */ const char* filename_obj; /* Path of the 3D geometry */ + const char* cache; const char* output; struct { @@ -68,6 +69,7 @@ struct htrdr_args { NULL, /* LES filename */ \ NULL, /* Mie filename */ \ NULL, /* Obj filename */ \ + NULL, /* Cache filename */ \ NULL, /* Output filename */ \ { \ {0, 0, 0}, /* plane position */ \