commit 76e203c3d369f44f9fb15b35d209fb4b912cf8ed
parent 46285200a49daf56c2bb1dc33600034ab15aee0c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Tue, 17 Sep 2019 15:20:04 +0200
Add the `discard_large_angles' option
Diffstat:
5 files changed, 161 insertions(+), 104 deletions(-)
diff --git a/src/sschiff.h b/src/sschiff.h
@@ -149,6 +149,7 @@ sschiff_integrate
const size_t scattering_angles_count, /* # scattering angles. Must be >= 3 */
const size_t sampled_geometries_count, /* # geometries to sample */
const size_t sampled_directions_count, /* # directions to sample per geometry */
+ const int discard_wide_angles, /* Avoid analytic model for wide angles */
struct sschiff_estimator** estimator);
SSCHIFF_API res_T
diff --git a/src/sschiff_estimator.c b/src/sschiff_estimator.c
@@ -116,6 +116,7 @@ struct sschiff_estimator {
size_t nrealisations; /* # realisation used by MC estimations */
int no_phase_function; /* Set to 1 when no phase function is computed */
+ int discard_large_angles; /* Avoid analytic model for wide angles */
struct sschiff_device* dev;
ref_T ref;
@@ -789,7 +790,54 @@ compute_differential_cross_section_cumulative_term
}
static res_T
-compute_phase_function
+compute_small_scattering_angles_properties
+ (struct sschiff_device* dev,
+ struct solver_context* ctx,
+ const size_t iwlen,
+ const size_t nangles,
+ struct sschiff_estimator* estimator)
+{
+ double rcp_scattering_cross_section;
+ double rcp_sqr_scattering_cross_section;
+ struct sschiff_state scattering_cross_section;
+ size_t ilimit_angle;
+ size_t iangle;
+ ASSERT(dev && estimator && iwlen < sa_size(estimator->wavelengths) && ctx);
+ (void)nangles;
+
+ /* Fetch the limit angle and precompute some values */
+ ilimit_angle = estimator->limit_angles[iwlen]-1;
+
+ get_mc_value
+ (&estimator->accums[iwlen].scattering_cross_section,
+ estimator->nrealisations,
+ &scattering_cross_section);
+
+ /* Compute the [cumulative] phase function for small angles */
+ rcp_scattering_cross_section = 1.0/scattering_cross_section.E;
+ rcp_sqr_scattering_cross_section =
+ rcp_scattering_cross_section * rcp_scattering_cross_section;
+
+ FOR_EACH(iangle, 0, ilimit_angle+1) {
+ struct mc_data mc_data;
+
+ mc_data = estimator->accums[iwlen].differential_cross_section[iangle];
+ mc_data.weight *= rcp_scattering_cross_section;
+ mc_data.sqr_weight *= rcp_sqr_scattering_cross_section;
+ get_mc_value(&mc_data, estimator->nrealisations,
+ &estimator->phase_functions[iwlen].values[iangle]);
+
+ mc_data = estimator->accums[iwlen].differential_cross_section_cumulative[iangle];
+ mc_data.weight *= rcp_scattering_cross_section;
+ mc_data.sqr_weight *= rcp_sqr_scattering_cross_section;
+ get_mc_value(&mc_data, estimator->nrealisations,
+ &estimator->phase_functions[iwlen].cumulative[iangle]);
+ }
+ return RES_OK;
+}
+
+static res_T
+compute_large_scattering_angles_properties
(struct sschiff_device* dev,
struct solver_context* ctx,
const size_t iwlen,
@@ -803,7 +851,6 @@ compute_phase_function
double coef_limit;
double n, r; /* Connector values */
double rcp_scattering_cross_section;
- double rcp_sqr_scattering_cross_section;
struct sschiff_state scattering_cross_section;
struct sschiff_state limit_differential_cross_section;
struct sschiff_state limit_differential_cross_section_cumulative;
@@ -850,7 +897,6 @@ compute_phase_function
"angles. The phase function is thus not computed.\n"
"Wavelength = %g micron\n",
estimator->wavelengths[iwlen]);
-
goto error;
}
@@ -906,31 +952,8 @@ compute_phase_function
limit_differential_cross_section_cumulative.E + 2*PI*r*(coef-coef_limit);
}
- /* Check the post condition of the cumulative differential cross section */
- /*ASSERT(eq_eps
- (estimator->accums[iwlen].differential_cross_section_cumulative[nangles-1].weight,
- scattering_cross_section.E, 1.e-3));*/
-
- /* Compute the [cumulative] phase function for small angles */
- rcp_scattering_cross_section = 1.0/scattering_cross_section.E;
- rcp_sqr_scattering_cross_section =
- rcp_scattering_cross_section * rcp_scattering_cross_section;
- FOR_EACH(iangle, 0, ilimit_angle+1) {
- struct mc_data mc_data;
-
- mc_data = estimator->accums[iwlen].differential_cross_section[iangle];
- mc_data.weight *= rcp_scattering_cross_section;
- mc_data.sqr_weight *= rcp_sqr_scattering_cross_section;
- get_mc_value(&mc_data, estimator->nrealisations,
- &estimator->phase_functions[iwlen].values[iangle]);
-
- mc_data = estimator->accums[iwlen].differential_cross_section_cumulative[iangle];
- mc_data.weight *= rcp_scattering_cross_section;
- mc_data.sqr_weight *= rcp_sqr_scattering_cross_section;
- get_mc_value(&mc_data, estimator->nrealisations,
- &estimator->phase_functions[iwlen].cumulative[iangle]);
- }
/* Compute the [cumulative] phase function for wide angles */
+ rcp_scattering_cross_section = 1.0/scattering_cross_section.E;
FOR_EACH(iangle, ilimit_angle + 1, nangles) {
estimator->phase_functions[iwlen].values[iangle].E =
estimator->accums[iwlen].differential_cross_section[iangle].weight
@@ -951,7 +974,7 @@ compute_phase_function
exit:
return res;
error:
- FOR_EACH(iangle, 0, nangles) {
+ FOR_EACH(iangle, ilimit_angle+1, nangles) {
estimator->phase_functions[iwlen].values[iangle].E = -1;
estimator->phase_functions[iwlen].values[iangle].V = -1;
estimator->phase_functions[iwlen].values[iangle].SE = -1;
@@ -962,6 +985,31 @@ error:
goto exit;
}
+static res_T
+compute_scattering_angles_properties
+ (struct sschiff_device* dev,
+ struct solver_context* ctx,
+ const size_t iwlen,
+ const size_t nangles,
+ struct sschiff_estimator* estimator)
+{
+ res_T res = RES_OK;
+
+ res = compute_small_scattering_angles_properties
+ (dev, ctx, iwlen, nangles, estimator);
+ if(res != RES_OK) goto error;
+
+ if(!estimator->discard_large_angles) {
+ res = compute_large_scattering_angles_properties
+ (dev, ctx, iwlen, nangles, estimator);
+ if(res != RES_OK) goto error;
+ }
+
+exit:
+ return res;
+error:
+ goto exit;
+}
static res_T
inverse_cumulative_phase_function
@@ -990,6 +1038,12 @@ inverse_cumulative_phase_function
iangle = (size_t)(found - cumulative_small_angles);
upper = cumulative_small_angles[iangle];
lower = cumulative_small_angles[iangle-1];
+
+ /* Use the cumulative bounds to linearly interpolate the angles */
+ u = (cumulative - lower) / (upper - lower);
+ *theta = u*estimator->angles[iangle] + (1.0 - u)*estimator->angles[iangle-1];
+ } else if(estimator->discard_large_angles) {
+ *theta = -1;
} else {
/* Look for the cumulative in the wide angles cumulative */
struct sschiff_state cumul;
@@ -1016,12 +1070,11 @@ inverse_cumulative_phase_function
} else {
lower = estimator->phase_functions[iwlen].cumulative[iangle-1].E;
}
+ /* Use the cumulative bounds to linearly interpolate the angles */
+ u = (cumulative - lower) / (upper - lower);
+ *theta = u*estimator->angles[iangle] + (1.0 - u)*estimator->angles[iangle-1];
}
- /* Use the cumulative bounds to linearly interpolate the angles */
- u = (cumulative - lower) / (upper - lower);
- *theta = u*estimator->angles[iangle] + (1.0 - u)*estimator->angles[iangle-1];
-
return RES_OK;
}
@@ -1253,6 +1306,7 @@ estimator_create
const size_t nwavelengths,
sschiff_scattering_angles_distribution_T angles_distrib,
const size_t nangles,
+ const int discard_large_angles,
struct sschiff_estimator** out_estimator)
{
struct sschiff_estimator* estimator = NULL;
@@ -1273,6 +1327,7 @@ estimator_create
ref_init(&estimator->ref);
SSCHIFF(device_ref_get(dev));
estimator->dev = dev;
+ estimator->discard_large_angles = discard_large_angles;
#define RESIZE(Array, Count, ErrMsg) { \
if(!sa_add(Array, Count)) { \
@@ -1438,6 +1493,7 @@ sschiff_integrate
const size_t nangles,
const size_t ngeoms,
const size_t ndirs,
+ const int discard_large_angles,
struct sschiff_estimator** out_estimator)
{
struct integrator_context* ctxs = NULL;
@@ -1458,7 +1514,7 @@ sschiff_integrate
/* Create the Schiff estimator */
res = estimator_create(dev, distrib, wavelengths, nwavelengths,
- angles_distrib, nangles, &estimator);
+ angles_distrib, nangles, discard_large_angles, &estimator);
if(res != RES_OK) goto error;
estimator->nrealisations = ngeoms;
@@ -1580,7 +1636,7 @@ sschiff_integrate
const int ithread = omp_get_thread_num();
if(estimator->limit_angles[iwlen] == INVALID_LIMIT_ANGLE) continue;
/* Do not handle phase function errors */
- compute_phase_function
+ compute_scattering_angles_properties
(dev, &solver_ctxs[ithread], (size_t)iwlen, nangles, estimator);
}
diff --git a/src/test_sschiff_estimator_cylinder.c b/src/test_sschiff_estimator_cylinder.c
@@ -454,7 +454,7 @@ main(int argc, char** argv)
time_current(&t0);
CHECK(sschiff_integrate(dev, rng, &distrib, &wavelength, 1,
- sschiff_uniform_scattering_angles, nscatt_angles, ngeoms, ndirs,
+ sschiff_uniform_scattering_angles, nscatt_angles, ngeoms, ndirs, 0,
&estimator), RES_OK);
time_current(&t1);
time_sub(&t0, &t1, &t0);
diff --git a/src/test_sschiff_estimator_rhodo.c b/src/test_sschiff_estimator_rhodo.c
@@ -2644,7 +2644,7 @@ main(int argc, char** argv)
distrib.context = &sampler_ctx;
CHECK(sschiff_integrate(dev, rng, &distrib, &wavelength, 1,
- sschiff_uniform_scattering_angles, nscatt_angles, ngeoms, ndirs,
+ sschiff_uniform_scattering_angles, nscatt_angles, ngeoms, ndirs, 0,
&estimator), RES_OK);
CHECK(sschiff_estimator_get_cross_section
diff --git a/src/test_sschiff_estimator_sphere.c b/src/test_sschiff_estimator_sphere.c
@@ -124,7 +124,7 @@ check_schiff_estimation
time_current(&t0);
CHECK(sschiff_integrate(dev, rng, &distrib, &wavelength, 1,
- sschiff_uniform_scattering_angles, nscatt_angles, ngeoms, ndirs, &estimator), RES_OK);
+ sschiff_uniform_scattering_angles, nscatt_angles, ngeoms, ndirs, 0, &estimator), RES_OK);
time_current(&t1);
time_sub(&t0, &t1, &t0);
time_dump(&t0, TIME_MIN|TIME_SEC|TIME_MSEC, NULL, buf, sizeof(buf));
@@ -218,75 +218,75 @@ main(int argc, char** argv)
distrib.sample = sample_sphere;
distrib.context = &sampler_ctx;
- CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, NULL), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
- CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, NULL), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 0, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, NULL, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, NULL, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, NULL, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, NULL, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, NULL, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(NULL, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
+ CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 1, NULL, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 1,
- sschiff_uniform_scattering_angles, 1, 1, 1, &estimator), RES_BAD_ARG);
+ sschiff_uniform_scattering_angles, 1, 1, 1, 0, &estimator), RES_BAD_ARG);
CHECK(sschiff_integrate(dev, rng, &distrib, &wlen, 1,
- sschiff_uniform_scattering_angles, 10, 1000, 1, &estimator), RES_OK);
+ sschiff_uniform_scattering_angles, 10, 1000, 1, 0, &estimator), RES_OK);
CHECK(sschiff_estimator_get_wavelengths(NULL, NULL, NULL), RES_BAD_ARG);
CHECK(sschiff_estimator_get_wavelengths(estimator, NULL, NULL), RES_OK);/*Useless*/
@@ -339,7 +339,7 @@ main(int argc, char** argv)
wlens[0] = 0.2, wlens[1] = 0.6, wlens[2] = 0.4;
CHECK(sschiff_integrate(dev, rng, &distrib, wlens, 3,
- sschiff_uniform_scattering_angles, 10, 1000, 1, &estimator), RES_BAD_ARG);
+ sschiff_uniform_scattering_angles, 10, 1000, 1, 0, &estimator), RES_BAD_ARG);
sampler_ctx.relative_real_refractive_index = 1.1;
check_schiff_estimation(dev, rng, &sampler_ctx, results_n_r_1_1,