commit 15eab01084012d7c9ca042601f61ecbeb04fa1b0
parent 656873e0a0f346c4da7be3b183870eacfa429dcb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Sat, 21 Sep 2019 15:01:16 +0200
Relax the constraint on the min num of angles
Previously, the minimum number of scattering angles was 3 without
apparent reasons while now it is set to 2, i.e. scattering can be purely
forward/backward.
Diffstat:
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/sschiff_estimator.c b/src/sschiff_estimator.c
@@ -1130,7 +1130,7 @@ integrator_context_init
{
size_t iwlen;
res_T res = RES_OK;
- ASSERT(ctx && s3d && rng && nwavelengths && nangles >= 3);
+ ASSERT(ctx && s3d && rng && nwavelengths && nangles >= 2);
memset(ctx, 0, sizeof(struct integrator_context));
@@ -1421,11 +1421,11 @@ estimator_create
res = RES_BAD_ARG;
goto error;
}
- if(eq_eps(*angle, PI, 1.e-6)) {
+ /* if(eq_eps(*angle, PI, 1.e-6)) {
log_error(dev, "Invalid limit scattering angle `%g'.\n", *angle);
res = RES_BAD_ARG;
goto error;
- }
+ }*/
/* Define the index of the first "wide scattering angle" */
estimator->limit_angles[i] = (size_t)(angle - estimator->angles);
ASSERT(estimator->limit_angles[i] < nangles);
@@ -1510,7 +1510,7 @@ sschiff_integrate
ATOMIC res = (ATOMIC)RES_OK;
if(!dev || !rng || !distrib || !wavelengths || !nwavelengths
- || !angles_distrib || nangles < 3 || !ngeoms || !ndirs || !out_estimator
+ || !angles_distrib || nangles < 2 || !ngeoms || !ndirs || !out_estimator
|| !check_distribution(distrib)) {
return RES_BAD_ARG;
}
diff --git a/src/test_sschiff_estimator_sphere.c b/src/test_sschiff_estimator_sphere.c
@@ -288,8 +288,6 @@ main(int argc, char** argv)
CHK(sschiff_integrate(dev, rng, &distrib, &wlen, 1,
sschiff_uniform_scattering_angles, 1, 1, 1, 0, &estimator) == RES_BAD_ARG);
CHK(sschiff_integrate(dev, rng, &distrib, &wlen, 1,
- sschiff_uniform_scattering_angles, 2, 1, 1, 0, &estimator) == RES_BAD_ARG);
- CHK(sschiff_integrate(dev, rng, &distrib, &wlen, 1,
sschiff_uniform_scattering_angles, 10, 1000, 1, 0, &estimator) == RES_OK);
CHK(sschiff_estimator_get_wavelengths(NULL, NULL, NULL) == RES_BAD_ARG);
@@ -345,6 +343,10 @@ main(int argc, char** argv)
CHK(sschiff_integrate(dev, rng, &distrib, wlens, 3,
sschiff_uniform_scattering_angles, 10, 1000, 1, 0, &estimator) == RES_BAD_ARG);
+ CHK(sschiff_integrate(dev, rng, &distrib, &wlen, 1,
+ sschiff_uniform_scattering_angles, 2, 1, 1, 1, &estimator) == RES_OK);
+ CHK(sschiff_estimator_ref_put(estimator) == RES_OK);
+
sampler_ctx.relative_real_refractive_index = 1.1;
check_schiff_estimation(dev, rng, &sampler_ctx, results_n_r_1_1,
sizeof(results_n_r_1_1)/sizeof(struct result));