solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

commit dc035dcd2672eaff6ed2b7752117eae18995a495
parent 8bbff23c16f3e8d291574471acc31c0f5b4a7fe1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 16 Mar 2017 15:40:08 +0100

Add the '-p' CLI option

Enable the dump radiative paths mode.

Diffstat:
Mdoc/cli | 1+
Msrc/solstice_args.c | 5++++-
Msrc/solstice_args.h.in | 2++
Msrc/solstice_solve.c | 2+-
Msrc/test_solstice_args.c | 24++++++++++++++++++++++++
5 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/doc/cli b/doc/cli @@ -6,6 +6,7 @@ solstice -h # Short help and exit -g <dump> # Switch in dump geometry -o OUTPUT # defaulting to stdout if not defined + -p # Switch in dump paths mode -q # don't print a message if no INPUT is submitted -n INTEGER # Realisations count -r <rendering> # Switch in rendering mode diff --git a/src/solstice_args.c b/src/solstice_args.c @@ -59,6 +59,8 @@ print_help(const char* program) " -o OUTPUT write results to OUTPUT. If not defined, write results to\n" " standard output.\n"); printf( +" -p switch in dump radiative paths mode.\n"); + printf( " -q do not print the helper message when no FILE is submitted.\n"); printf( " -R RECEIVERS define the file from which the list of receivers are read.\n"); @@ -469,7 +471,7 @@ solstice_args_init(struct solstice_args* args, const int argc, char** argv) *args = SOLSTICE_ARGS_DEFAULT; optind = 0; - while((opt = getopt(argc, argv, "D:fg:Hhn:o:qR:r:t:")) != -1) { + while((opt = getopt(argc, argv, "D:fg:Hhn:o:pqR:r:t:")) != -1) { switch(opt) { case 'D': res = parse_sun_dir_list(optarg, args); @@ -487,6 +489,7 @@ solstice_args_init(struct solstice_args* args, const int argc, char** argv) break; case 'g': res = parse_dump_options(optarg, args); break; case 'o': args->output_filename = optarg; break; + case 'p': args->dump_paths = 1; break; case 'q': args->quiet = 1; break; case 'R': args->receivers_filename = optarg; break; case 'r': res = parse_rendering_options(optarg, args); break; diff --git a/src/solstice_args.h.in b/src/solstice_args.h.in @@ -71,6 +71,7 @@ struct solstice_args { enum solstice_args_dump_split_mode dump_split_mode; int force_overwriting; + int dump_paths; int rendering; int output_hits; /* Output the per receiver hits */ int quiet; @@ -110,6 +111,7 @@ static const struct solstice_args SOLSTICE_ARGS_NULL = SOLSTICE_ARGS_NULL__; SOLSTICE_ARGS_DUMP_SPLIT_NONE, /* Dump split mode */ \ \ 0, /* Force overwriting */ \ + 0, /* Dump radiative paths */ \ 0, /* Rendering */ \ 0, /* Output hits */ \ 0, /* Quiet */ \ diff --git a/src/solstice_solve.c b/src/solstice_solve.c @@ -299,7 +299,7 @@ solstice_solve(struct solstice* solstice) } } - res = ssol_solve(solstice->scene, rng, solstice->nrealisations, + res = ssol_solve(solstice->scene, rng, solstice->nrealisations, 0, bin_stream, &estimator); if(res != RES_OK) { fprintf(stderr, "Error in integrating the solar flux.\n"); diff --git a/src/test_solstice_args.c b/src/test_solstice_args.c @@ -567,6 +567,29 @@ test_dump(void) cmd_delete(cmd); } +static void +test_dump_paths(void) +{ + struct solstice_args args = SOLSTICE_ARGS_NULL; + char** cmd = NULL; + + cmd = cmd_create(0, "test", "-D", "0,90", NULL); + CHECK(solstice_args_init(&args, cmd_size(cmd), cmd), RES_OK); + CHECK(args.dump_paths, 0); + solstice_args_release(&args); + cmd_delete(cmd); + + cmd = cmd_create(0, "test", "-D", "0,90", "-p", NULL); + CHECK(solstice_args_init(&args, cmd_size(cmd), cmd), RES_OK); + CHECK(args.dump_paths, 1); + solstice_args_release(&args); + cmd_delete(cmd); + + cmd = cmd_create(0, "test", "-p", NULL); + CHECK(solstice_args_init(&args, cmd_size(cmd), cmd), RES_BAD_ARG); + cmd_delete(cmd); +} + int main(int argc, char** argv) { @@ -581,6 +604,7 @@ main(int argc, char** argv) test_receivers(); test_input(); test_dump(); + test_dump_paths(); CHECK(mem_allocated_size(), 0); return 0; }