commit 430ae867b63ad4aaaf3535edd76d6e6359fb4992
parent 103e9e700a02cb3993467b07ee786b118905b7c5
Author: Eduardo Fontana Lazzari <edufonlaz@gmail.com>
Date: Wed, 9 Jul 2025 10:57:09 +0200
Add nthreads and samples to sphor struct
The nthreads and samples fields are now part of the sphor struct, as
they are required during calls to the run function. Although these
variables originally belong to the sphor_create_args struct, we
intentionally limit the use of that struct to the sphor_create function.
By consolidating all necessary runtime information within the sphor
struct, the code becomes clearer and less ambiguous during subsequent
computation steps.
Diffstat:
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/sphor.c b/src/sphor.c
@@ -99,6 +99,8 @@ sphor_create
ref_init(&sphor->ref);
sphor->verbose = args->verbose;
sphor->allocator = allocator;
+ sphor->nthreads = args->nthreads;
+ sphor->samples = args->samples;
if (NULL == args->logger) {
sphor->logger = LOGGER_DEFAULT;
} else {
diff --git a/src/sphor_c.h b/src/sphor_c.h
@@ -63,6 +63,12 @@ struct sphor {
struct s3d_scene_view* scene_view;
struct darray_source_view source_views;
+ /* Monte Carlo variables */
+ unsigned nthreads; /* hint: number of threads; defaults to all available
+ threads in the computer */
+ size_t samples; /* number of realisations used during the Monte Carlo
+ integrating algorithm */
+
/* Log */
struct logger* logger;
int verbose;