star-gs

Literate program for a geometric sensitivity calculation
git clone git://git.meso-star.fr/star-gs.git
Log | Files | Refs | README | LICENSE

commit 09700c832b27ed9779b982a3a1e274efc3824cf1
parent 50aef149568be0cf7583097bea7bf08a7c61e0a4
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 29 Apr 2021 21:30:46 +0200

Add the number of realisations as an input parameter

Diffstat:
Msrc/sgs.c | 1+
Msrc/sgs_args.c | 10+++++++++-
Msrc/sgs_args.h | 2++
Msrc/sgs_c.h | 5+++++
4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/sgs.c b/src/sgs.c @@ -50,6 +50,7 @@ sgs_create goto error; } sgs->allocator = allocator; + sgs->nrealisations = (size_t)sgs->nrealisations; sgs->nthreads = args->nthreads; sgs->verbose = args->verbose; sgs->dump_geometry = args->dump_geometry; diff --git a/src/sgs_args.c b/src/sgs_args.c @@ -61,6 +61,10 @@ print_help(void) printf( " -h display this help and exit.\n"); printf( +" -n nrealisations\n" +" number of realisations (default: %li).\n", + SGS_ARGS_DEFAULT.nrealisations); + printf( " -p <step-params:...>\n" " define an axis aligned box whose +Z face is replaced\n" " by a step along the X axis. Available step parameters\n" @@ -285,7 +289,7 @@ sgs_args_init(struct sgs_args* args, int argc, char** argv) *args = SGS_ARGS_DEFAULT; - while((opt = getopt(argc, argv, "b:dhp:s:t:v")) != -1) { + while((opt = getopt(argc, argv, "b:dhn:p:s:t:v")) != -1) { switch(opt) { case 'b': args->geom.type = SGS_GEOMETRY_BOX; @@ -299,6 +303,10 @@ sgs_args_init(struct sgs_args* args, int argc, char** argv) sgs_args_release(args); args->quit = 1; break; + case 'n': + res = cstr_to_long(optarg, &args->nrealisations); + if(res == RES_OK && args->nrealisations <= 0) res = RES_BAD_ARG; + break; case 'p': args->geom.type = SGS_GEOMETRY_STEP; args->geom.args.step = SGS_GEOMETRY_STEP_ARGS_DEFAULT; diff --git a/src/sgs_args.h b/src/sgs_args.h @@ -41,6 +41,7 @@ static const struct sgs_args_geometry SGS_ARGS_GEOMETRY_DEFAULT = struct sgs_args { struct sgs_args_geometry geom; /* The scene geometry */ + long nrealisations; /* Miscellaneous parameters */ unsigned nthreads; @@ -51,6 +52,7 @@ struct sgs_args { #define SGS_ARGS_DEFAULT__ { \ SGS_ARGS_GEOMETRY_DEFAULT__, /* Scene geometry */ \ + 10000, /* #realisations */ \ \ UINT_MAX, /* #threads */ \ 0, /* Dump geometry */ \ diff --git a/src/sgs_c.h b/src/sgs_c.h @@ -26,6 +26,7 @@ struct sgs { struct s3d_device* s3d; struct sgs_geometry* geom; + size_t nrealisations; /* #realisations */ unsigned int nthreads; /* #threads */ @@ -40,4 +41,8 @@ extern LOCAL_SYM void setup_logger (struct sgs* sgs); +extern LOCAL_SYM res_T +compute_4v_s + (struct sgs* sgs); + #endif /* SGS_C_H */