star-schiff

Library for estimating radiative properties
git clone git://git.meso-star.com/star-schiff.git
Log | Files | Refs | README | LICENSE

commit c19650d0f759cb715ea84ec37e809ab824cfd143
parent 77edf63c29c2e419a4c2181c0bd667d22fbc1c7b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 25 Nov 2015 12:12:25 +0100

Fix the management of errors in the Schiff integration

The ATOMIC api was wrongly used.

Diffstat:
Msrc/sschiff_estimator.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/sschiff_estimator.c b/src/sschiff_estimator.c @@ -564,7 +564,7 @@ sschiff_integrate struct ssp_rng** rngs = NULL; struct ssp_rng_proxy* rng_proxy = NULL; size_t i; - res_T res = RES_OK; + ATOMIC res = (ATOMIC)RES_OK; (void)nangles; if(!dev || !rng || !distrib || !wavelengths || !nwavelengths || !nangles @@ -622,7 +622,7 @@ sschiff_integrate memset(mc_accums, 0, sizeof(struct mc_accum*)*dev->nthreads); memset(rngs, 0, sizeof(struct ssp_rng*)*dev->nthreads); memset(scenes, 0, sizeof(struct s3d_scene*)*dev->nthreads); - memset(shapes, 0, sizeof(struct s3d_shapes*)*dev->nthreads); + memset(shapes, 0, sizeof(struct s3d_shape*)*dev->nthreads); /* Create the per thread data structures */ FOR_EACH(i, 0, dev->nthreads) { @@ -683,7 +683,7 @@ sschiff_integrate struct sschiff_material material = SSCHIFF_NULL_MATERIAL; size_t iwavelength; const int ithread = omp_get_thread_num(); - res_T res_local; + ATOMIC res_local; if(ATOMIC_GET(&res) != RES_OK) continue; @@ -692,7 +692,7 @@ sschiff_integrate (rngs[ithread], &material, shapes[ithread], distrib->context); if(res_local != RES_OK) { log_error(dev, "Error in sampling a Schiff geometry.\n"); - ATOMIC_SET(&res, &res_local); + ATOMIC_SET(&res, res_local); continue; } /* Fetch the per wavelength material properties */ @@ -708,7 +708,7 @@ sschiff_integrate res_local = radiative_properties(dev, rngs[ithread], (int)i, wlengths, nwavelengths, ndirs, scenes[ithread], mtls[ithread], mc_accums[ithread], accums[ithread]); - if(res != RES_OK) ATOMIC_SET(&res, &res_local); + if(res != RES_OK) ATOMIC_SET(&res, res_local); S3D(scene_end_session(scenes[ithread])); } @@ -756,7 +756,7 @@ exit: sa_release(scenes); } if(out_estimator) *out_estimator = estimator; - return res; + return (res_T)res; error: if(estimator) { SSCHIFF(estimator_ref_put(estimator));