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 5cb88639c883a945cd7347c8b68c9d9b978455db
parent 7844b76f13d04988ea81bff4d3614f932ecd0b51
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri,  5 May 2017 15:33:00 +0200

Remove -H option (output per-reciever hits).

Diffstat:
Msrc/solstice.c | 1-
Msrc/solstice.h | 1-
Msrc/solstice_args.c | 3+--
Msrc/solstice_args.h.in | 2--
Msrc/solstice_solve.c | 35+----------------------------------
Msrc/test_solstice_args.c | 21---------------------
6 files changed, 2 insertions(+), 61 deletions(-)

diff --git a/src/solstice.c b/src/solstice.c @@ -615,7 +615,6 @@ solstice_init } solstice->nexperiments = args->nexperiments; - solstice->output_hits = args->output_hits; solstice->dump_format = args->dump_format; solstice->dump_split_mode = args->dump_split_mode; solstice->dump_paths = args->dump_paths; diff --git a/src/solstice.h b/src/solstice.h @@ -120,7 +120,6 @@ struct solstice { size_t nexperiments; /* # MC experiments */ FILE* output; /* Output stream */ - int output_hits; /* Output per receiver hits */ int dump_paths; struct mem_allocator* allocator; diff --git a/src/solstice_args.c b/src/solstice_args.c @@ -492,13 +492,12 @@ 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:p:qR:r:t:")) != -1) { + while((opt = getopt(argc, argv, "D:fg:hn:o:p:qR:r:t:")) != -1) { switch(opt) { case 'D': /* Sun directions */ res = parse_sun_dir_list(optarg, args); break; case 'f': args->force_overwriting = 1; break; - case 'H': args->output_hits = 1; break; case 'h': /* Print short help and exit */ print_help(argv[0]); solstice_args_release(args); diff --git a/src/solstice_args.h.in b/src/solstice_args.h.in @@ -78,7 +78,6 @@ struct solstice_args { int force_overwriting; int dump_paths; /* Dump radiative paths */ int rendering; - int output_hits; /* Output the per receiver hits */ int quiet; int quit; /* Quit the application */ }; @@ -121,7 +120,6 @@ static const struct solstice_args SOLSTICE_ARGS_NULL = SOLSTICE_ARGS_NULL__; 0, /* Force overwriting */ \ 0, /* Dump radiative paths */ \ 0, /* Rendering */ \ - 0, /* Output hits */ \ 0, /* Quiet */ \ 0 /* Quit */ \ } diff --git a/src/solstice_solve.c b/src/solstice_solve.c @@ -467,11 +467,8 @@ write_paths(struct solstice* solstice, struct ssol_estimator* estimator) res_T solstice_solve(struct solstice* solstice) { - char buf[1024]; struct ssol_estimator* estimator = NULL; struct ssp_rng* rng = NULL; - FILE* bin_stream = NULL; - size_t sz; res_T res = RES_OK; ASSERT(solstice); @@ -481,18 +478,9 @@ solstice_solve(struct solstice* solstice) goto error; } - if(solstice->output_hits) { - bin_stream = tmpfile(); - if(!bin_stream) { - fprintf(stderr, "Could not create the temporary output binary stream.\n"); - res = RES_IO_ERR; - goto error; - } - } res = ssol_solve(solstice->scene, rng, solstice->nexperiments, - solstice->dump_paths ? &solstice->path_tracker : NULL, bin_stream, - &estimator); + solstice->dump_paths ? &solstice->path_tracker : NULL, NULL, &estimator); if(res != RES_OK) { fprintf(stderr, "Error in integrating the solar flux.\n"); goto error; @@ -503,30 +491,9 @@ solstice_solve(struct solstice* solstice) } else { write_mc_global(solstice, estimator); write_per_receiver_mc_primitive(solstice, estimator); - - if(solstice->output_hits) { - sz = (size_t)ftell(bin_stream); - rewind(bin_stream); - - while(sz) { - const size_t read_sz = MMIN(sz, sizeof(buf)); - if(fread(buf, 1, read_sz, bin_stream) != read_sz) { - fprintf(stderr, "Could not read the output binary stream.\n"); - res = RES_IO_ERR; - goto error; - } - if(fwrite(buf, 1, read_sz, solstice->output) != read_sz) { - fprintf(stderr, "Could not write the output binary stream.\n"); - res = RES_IO_ERR; - goto error; - } - sz -= read_sz; - } - } } exit: - if(bin_stream) fclose(bin_stream); if(estimator) SSOL(estimator_ref_put(estimator)); if(rng) SSP(rng_ref_put(rng)); return res; diff --git a/src/test_solstice_args.c b/src/test_solstice_args.c @@ -391,26 +391,6 @@ test_threads_count(void) } static void -test_output_hits(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.output_hits, SOLSTICE_ARGS_DEFAULT.output_hits); - CHECK(args.output_hits, 0); - solstice_args_release(&args); - cmd_delete(cmd); - - cmd = cmd_create(0, "test", "-D", "0,90", "-H", NULL); - CHECK(solstice_args_init(&args, cmd_size(cmd), cmd), RES_OK); - CHECK(args.output_hits, 1); - solstice_args_release(&args); - cmd_delete(cmd); -} - -static void test_output(void) { struct solstice_args args = SOLSTICE_ARGS_NULL; @@ -678,7 +658,6 @@ main(int argc, char** argv) test_sun_dirs(); test_realisations_count(); test_threads_count(); - test_output_hits(); test_output(); test_quiet(); test_receivers();