solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit f003cdb4bd6c99a69d2b09cad65b21f7e5692e52
parent e9adb229f742c042362ec93703a81867cfe9bde6
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri,  8 Sep 2017 14:23:52 +0200

Use extinction for mediums (including atmosphere) instead of absorption.

Diffstat:
Msrc/ssol.h | 14+++++++-------
Msrc/ssol_atmosphere.c | 24++++++++++++------------
Msrc/ssol_atmosphere_c.h | 2+-
Msrc/ssol_draw_pt.c | 10+++++-----
Msrc/ssol_estimator.c | 2+-
Msrc/ssol_estimator_c.h | 2+-
Msrc/ssol_material.c | 15++++++++-------
Msrc/ssol_solver.c | 31+++++++++++++++----------------
Msrc/test_ssol_atmosphere.c | 32++++++++++++++++----------------
Msrc/test_ssol_material.c | 14+++++++-------
Msrc/test_ssol_scene.c | 10+++++-----
Msrc/test_ssol_solver1.c | 24++++++++++++------------
Msrc/test_ssol_utils.h | 2+-
13 files changed, 91 insertions(+), 91 deletions(-)

diff --git a/src/ssol.h b/src/ssol.h @@ -259,7 +259,7 @@ struct ssol_data { static const struct ssol_data SSOL_DATA_NULL = SSOL_DATA_NULL__; struct ssol_medium { - struct ssol_data absorption; + struct ssol_data extinction; struct ssol_data refractive_index; }; #define SSOL_MEDIUM_VACUUM__ {{SSOL_DATA_REAL, {0}}, {SSOL_DATA_REAL, {1}}} @@ -372,7 +372,7 @@ struct ssol_mc_global { struct ssol_mc_result absorbed_by_receivers; /* In W */ struct ssol_mc_result shadowed; /* In W */ struct ssol_mc_result missing; /* In W */ - struct ssol_mc_result absorbed_by_atmosphere; /* In W */ + struct ssol_mc_result extinguished_by_atmosphere; /* In W */ struct ssol_mc_result other_absorbed; /* In W */ }; #define SSOL_MC_GLOBAL_NULL__ { \ @@ -1052,7 +1052,7 @@ ssol_sun_set_buie_param /******************************************************************************* * Atmosphere API - Describe an atmosphere model. ******************************************************************************/ -/* The atmosphere describes absorption along the light paths */ +/* The atmosphere describes extinction along the light paths */ SSOL_API res_T ssol_atmosphere_create (struct ssol_device* dev, @@ -1067,9 +1067,9 @@ ssol_atmosphere_ref_put (struct ssol_atmosphere* atmosphere); SSOL_API res_T -ssol_atmosphere_set_absorption +ssol_atmosphere_set_extinction (struct ssol_atmosphere* atmosphere, - struct ssol_data* absorption); + struct ssol_data* extinction); /******************************************************************************* * Estimator API - Describe the state of a simulation. @@ -1242,7 +1242,7 @@ static FINLINE struct ssol_medium* ssol_medium_clear(struct ssol_medium* medium) { ASSERT(medium); - ssol_data_clear(&medium->absorption); + ssol_data_clear(&medium->extinction); ssol_data_clear(&medium->refractive_index); return medium; } @@ -1251,7 +1251,7 @@ static FINLINE struct ssol_medium* ssol_medium_copy(struct ssol_medium* dst, const struct ssol_medium* src) { ASSERT(dst && src); - ssol_data_copy(&dst->absorption, &src->absorption); + ssol_data_copy(&dst->extinction, &src->extinction); ssol_data_copy(&dst->refractive_index, &src->refractive_index); return dst; } diff --git a/src/ssol_atmosphere.c b/src/ssol_atmosphere.c @@ -33,25 +33,25 @@ atmosphere_release(ref_T* ref) ASSERT(ref); dev = atmosphere->dev; ASSERT(dev && dev->allocator); - ssol_data_clear(&atmosphere->absorption); + ssol_data_clear(&atmosphere->extinction); MEM_RM(dev->allocator, atmosphere); SSOL(device_ref_put(dev)); } static INLINE int -check_absorption(const struct ssol_data* absorption) +check_extinction(const struct ssol_data* extinction) { - if(!absorption) return 0; + if(!extinction) return 0; - /* Check absorptivity in [0, INF) */ - switch(absorption->type) { + /* Check extinction in [0, INF) */ + switch(extinction->type) { case SSOL_DATA_REAL: - if(absorption->value.real < 0 || absorption->value.real > 1) + if(extinction->value.real < 0 || extinction->value.real > 1) return 0; break; case SSOL_DATA_SPECTRUM: - if(!absorption->value.spectrum - || !spectrum_check_data(absorption->value.spectrum, 0, 1)) + if(!extinction->value.spectrum + || !spectrum_check_data(extinction->value.spectrum, 0, 1)) return 0; break; default: FATAL("Unreachable code\n"); break; @@ -115,13 +115,13 @@ ssol_atmosphere_ref_put } res_T -ssol_atmosphere_set_absorption +ssol_atmosphere_set_extinction (struct ssol_atmosphere* atmosphere, - struct ssol_data* absorption) + struct ssol_data* extinction) { - if(!atmosphere || !absorption || !check_absorption(absorption)) + if(!atmosphere || !extinction || !check_extinction(extinction)) return RES_BAD_ARG; - ssol_data_copy(&atmosphere->absorption, absorption); + ssol_data_copy(&atmosphere->extinction, extinction); return RES_OK; } diff --git a/src/ssol_atmosphere_c.h b/src/ssol_atmosphere_c.h @@ -23,7 +23,7 @@ struct ssol_scene; struct ssol_atmosphere { struct ssol_scene* scene_attachment; - struct ssol_data absorption; + struct ssol_data extinction; struct ssol_device* dev; ref_T ref; diff --git a/src/ssol_draw_pt.c b/src/ssol_draw_pt.c @@ -173,11 +173,11 @@ Li(struct ssol_scene* scn, wl = ranst_sun_wl_get(ctx->ran_wl, ctx->rng); if(scn->atmosphere) { - ssol_data_copy(&medium.absorption, &scn->atmosphere->absorption); + ssol_data_copy(&medium.extinction, &scn->atmosphere->extinction); } for(;;) { - double absorption; + double extinction; S3D(scene_view_trace_ray (view, ray_org, ray_dir, ray_range, &ray_data, &hit)); @@ -186,9 +186,9 @@ Li(struct ssol_scene* scn, break; } - absorption = ssol_data_get_value(&medium.absorption, wl); - if(absorption > 0) { - throughput *= exp(-absorption * hit.distance); + extinction = ssol_data_get_value(&medium.extinction, wl); + if(extinction > 0) { + throughput *= exp(-extinction * hit.distance); if(throughput <= 0) break; } diff --git a/src/ssol_estimator.c b/src/ssol_estimator.c @@ -125,7 +125,7 @@ ssol_estimator_get_mc_global SETUP_MC_RESULT(absorbed_by_receivers); SETUP_MC_RESULT(shadowed); SETUP_MC_RESULT(missing); - SETUP_MC_RESULT(absorbed_by_atmosphere); + SETUP_MC_RESULT(extinguished_by_atmosphere); SETUP_MC_RESULT(other_absorbed); #undef SETUP_MC_RESULT return RES_OK; diff --git a/src/ssol_estimator_c.h b/src/ssol_estimator_c.h @@ -542,7 +542,7 @@ struct ssol_estimator { struct mc_data absorbed_by_receivers; struct mc_data shadowed; struct mc_data missing; - struct mc_data absorbed_by_atmosphere; + struct mc_data extinguished_by_atmosphere; struct mc_data other_absorbed; struct htable_receiver mc_receivers; /* Per receiver MC */ diff --git a/src/ssol_material.c b/src/ssol_material.c @@ -243,8 +243,9 @@ setup_thin_dielectric_bsdf eta_i = ssol_data_get_value(&mtl->out_medium.refractive_index, wavelength); eta_t = ssol_data_get_value (&mtl->data.thin_dielectric.slab_medium.refractive_index, wavelength); + /* Here extinction is absorption only */ absorption = ssol_data_get_value - (&mtl->data.thin_dielectric.slab_medium.absorption, wavelength); + (&mtl->data.thin_dielectric.slab_medium.extinction, wavelength); thickness = mtl->data.thin_dielectric.thickness; /* Setup the BxDF */ @@ -300,15 +301,15 @@ check_medium(const struct ssol_medium* medium) { if(!medium) return 0; - /* Check absorption in [0, INF) */ - switch(medium->absorption.type) { + /* Check extinction in [0, INF) */ + switch(medium->extinction.type) { case SSOL_DATA_REAL: - if(medium->absorption.value.real < 0) + if(medium->extinction.value.real < 0) return 0; break; case SSOL_DATA_SPECTRUM: - if(!medium->absorption.value.spectrum - || !spectrum_check_data(medium->absorption.value.spectrum, 0, DBL_MAX)) + if(!medium->extinction.value.spectrum + || !spectrum_check_data(medium->extinction.value.spectrum, 0, DBL_MAX)) return 0; break; default: FATAL("Unreachable code\n"); break; @@ -727,5 +728,5 @@ media_ceq(const struct ssol_medium* a, const struct ssol_medium* b) { ASSERT(a && b); return ssol_data_ceq(&a->refractive_index, &b->refractive_index) - && ssol_data_ceq(&a->absorption, &b->absorption); + && ssol_data_ceq(&a->extinction, &b->extinction); } diff --git a/src/ssol_solver.c b/src/ssol_solver.c @@ -56,7 +56,7 @@ struct thread_context { struct mc_data absorbed_by_receivers; struct mc_data shadowed; struct mc_data missing; - struct mc_data absorbed_by_atmosphere; + struct mc_data extinguished_by_atmosphere; struct mc_data other_absorbed; struct htable_receiver mc_rcvs; struct htable_sampled mc_samps; @@ -110,7 +110,7 @@ thread_context_copy dst->absorbed_by_receivers = src->absorbed_by_receivers; dst->shadowed = src->shadowed; dst->missing = src->missing; - dst->absorbed_by_atmosphere = src->absorbed_by_atmosphere; + dst->extinguished_by_atmosphere = src->extinguished_by_atmosphere; dst->other_absorbed = src->other_absorbed; res = htable_receiver_copy(&dst->mc_rcvs, &src->mc_rcvs); if(res != RES_OK) return res; @@ -307,7 +307,6 @@ point_init w0 = scn->sun->dni * sampled_area_proxy * cos_ratio; pt->cos_factor = surface_sun_cos; } - pt->energy_loss = w0; pt->initial_flux = w0; pt->prev_outgoing_flux = w0; @@ -806,7 +805,7 @@ trace_radiative_path * to handle the points that start from a virtual material */ f3_set_d3(org, pt.pos); f3_set_d3(dir, pt.dir); - hit.distance = 0; /* first loop has no atmospheric absorption */ + hit.distance = 0; /* first loop has no atmospheric extinction */ for(;;) { /* Here we go for the radiative random walk */ const int in_atm = media_ceq(&in_medium, &scn->air); @@ -816,12 +815,12 @@ trace_radiative_path struct ray_data ray_data = RAY_DATA_NULL; double trans = 1; - /* Compute medium absorption along the incoming segment. */ + /* Compute medium extinction along the incoming segment. */ if(hit.distance > 0) { - const double kabs = ssol_data_get_value(&in_medium.absorption, pt.wl); - ASSERT(0 <= kabs && kabs <= 1); - if(kabs > 0) { - trans = exp(-kabs * hit.distance); + const double k_ext = ssol_data_get_value(&in_medium.extinction, pt.wl); + ASSERT(0 <= k_ext && k_ext <= 1); + if(k_ext > 0) { + trans = exp(-k_ext * hit.distance); } } pt.incoming_flux = pt.prev_outgoing_flux * trans; @@ -898,13 +897,13 @@ trace_radiative_path } } - /* Don't change prev_outgoing weigths nor record segment absorption until + /* Don't change prev_outgoing weigths nor record segment extinction until * a non-virtual material is hit or this segment is the last one. * This is because propagation is restarted from the same origin until * a non-virtual material is hit or no further hit can be found. */ if(last_segment || !hit_virtual) { if(in_atm) { - ACCUM_WEIGHT(thread_ctx->absorbed_by_atmosphere, + ACCUM_WEIGHT(thread_ctx->extinguished_by_atmosphere, pt.prev_outgoing_flux - pt.incoming_flux); } else { ACCUM_WEIGHT(thread_ctx->other_absorbed, @@ -934,11 +933,11 @@ trace_radiative_path ssol_medium_copy(&in_medium, &out_medium); } - /* Register the remaining flux as missing */ ACCUM_WEIGHT(thread_ctx->missing, pt.outgoing_flux); pt.energy_loss -= pt.outgoing_flux; + if(tracker) { path.type = hit_a_receiver ? SSOL_PATH_SUCCESS : SSOL_PATH_MISSING; } @@ -997,7 +996,7 @@ cancel_mc /* Cancel global MC estimations */ mc_data_cancel(&thread_ctx->cos_factor, irealisation); - mc_data_cancel(&thread_ctx->absorbed_by_atmosphere, irealisation); + mc_data_cancel(&thread_ctx->extinguished_by_atmosphere, irealisation); mc_data_cancel(&thread_ctx->absorbed_by_receivers, irealisation); mc_data_cancel(&thread_ctx->other_absorbed, irealisation); mc_data_cancel(&thread_ctx->missing, irealisation); @@ -1100,9 +1099,9 @@ ssol_solve /* init air properties */ if(scn->atmosphere) - ssol_data_copy(&scn->air.absorption, &scn->atmosphere->absorption); + ssol_data_copy(&scn->air.extinction, &scn->atmosphere->extinction); else - ssol_data_copy(&scn->air.absorption, &SSOL_MEDIUM_VACUUM.absorption); + ssol_data_copy(&scn->air.extinction, &SSOL_MEDIUM_VACUUM.extinction); /* Create data structures shared by all threads */ res = scene_create_s3d_views(scn, &view_rt, &view_samp, &sampled_area, @@ -1184,7 +1183,7 @@ ssol_solve ACCUM_WEIGHT(absorbed_by_receivers); ACCUM_WEIGHT(shadowed); ACCUM_WEIGHT(missing); - ACCUM_WEIGHT(absorbed_by_atmosphere); + ACCUM_WEIGHT(extinguished_by_atmosphere); ACCUM_WEIGHT(other_absorbed); estimator->realisation_count += thread_ctx->realisation_count; #undef ACCUM_WEIGHT diff --git a/src/test_ssol_atmosphere.c b/src/test_ssol_atmosphere.c @@ -32,7 +32,7 @@ main(int argc, char** argv) { struct mem_allocator allocator; struct ssol_device* dev; - struct ssol_data absorption, absorption2; + struct ssol_data extinction, extinction2; struct ssol_atmosphere* atm; struct ssol_spectrum* spectrum; (void) argc, (void) argv; @@ -42,11 +42,11 @@ main(int argc, char** argv) CHECK(ssol_device_create (NULL, &allocator, SSOL_NTHREADS_DEFAULT, 0, &dev), RES_OK); - absorption2.type = SSOL_DATA_SPECTRUM; + extinction2.type = SSOL_DATA_SPECTRUM; CHECK(ssol_spectrum_create(dev, &spectrum), RES_OK); CHECK(ssol_spectrum_setup(spectrum, get_wlen, 2, NULL), RES_OK); - absorption2.type = SSOL_DATA_SPECTRUM; - absorption2.value.spectrum = spectrum; + extinction2.type = SSOL_DATA_SPECTRUM; + extinction2.value.spectrum = spectrum; CHECK(ssol_atmosphere_create(NULL, &atm), RES_BAD_ARG); CHECK(ssol_atmosphere_create(dev, NULL), RES_BAD_ARG); @@ -58,21 +58,21 @@ main(int argc, char** argv) CHECK(ssol_atmosphere_ref_put(NULL), RES_BAD_ARG); CHECK(ssol_atmosphere_ref_put(atm), RES_OK); - absorption.type = SSOL_DATA_REAL; - absorption.value.real = 0.1; - CHECK(ssol_atmosphere_set_absorption(NULL, &absorption), RES_BAD_ARG); - CHECK(ssol_atmosphere_set_absorption(atm, NULL), RES_BAD_ARG); - CHECK(ssol_atmosphere_set_absorption(atm, &absorption), RES_OK); - CHECK(ssol_atmosphere_set_absorption(atm, &absorption), RES_OK); - CHECK(ssol_atmosphere_set_absorption(atm, &absorption2), RES_OK); + extinction.type = SSOL_DATA_REAL; + extinction.value.real = 0.1; + CHECK(ssol_atmosphere_set_extinction(NULL, &extinction), RES_BAD_ARG); + CHECK(ssol_atmosphere_set_extinction(atm, NULL), RES_BAD_ARG); + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_OK); + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_OK); + CHECK(ssol_atmosphere_set_extinction(atm, &extinction2), RES_OK); - /* absorption values out of range */ - absorption.value.real = 2; - CHECK(ssol_atmosphere_set_absorption(atm, &absorption), RES_BAD_ARG); + /* extinction values out of range */ + extinction.value.real = 2; + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_BAD_ARG); CHECK(ssol_spectrum_setup(spectrum, get_wlen, 3, NULL), RES_OK); - CHECK(ssol_atmosphere_set_absorption(atm, &absorption2), RES_BAD_ARG); + CHECK(ssol_atmosphere_set_extinction(atm, &extinction2), RES_BAD_ARG); - CHECK(ssol_spectrum_ref_put(absorption2.value.spectrum), RES_OK); + CHECK(ssol_spectrum_ref_put(extinction2.value.spectrum), RES_OK); CHECK(ssol_device_ref_put(dev), RES_OK); CHECK(ssol_atmosphere_ref_put(atm), RES_OK); diff --git a/src/test_ssol_material.c b/src/test_ssol_material.c @@ -162,17 +162,17 @@ test_thin_dielectric(struct ssol_device* dev) CHECK(ssol_thin_dielectric_setup(mtl, &shader, &mdm0, &mdm1, 1), RES_BAD_ARG); shader.normal = get_shader_normal; - ssol_data_set_real(&mdm0.absorption, -1); + ssol_data_set_real(&mdm0.extinction, -1); CHECK(ssol_thin_dielectric_setup(mtl, &shader, &mdm0, &mdm1, 1), RES_BAD_ARG); - ssol_data_copy(&mdm0.absorption, &SSOL_MEDIUM_VACUUM.absorption); + ssol_data_copy(&mdm0.extinction, &SSOL_MEDIUM_VACUUM.extinction); ssol_data_set_real(&mdm0.refractive_index, 0); CHECK(ssol_thin_dielectric_setup(mtl, &shader, &mdm0, &mdm1, 1), RES_BAD_ARG); ssol_data_copy(&mdm0.refractive_index, &SSOL_MEDIUM_VACUUM.refractive_index); - ssol_data_set_real(&mdm1.absorption, -1); + ssol_data_set_real(&mdm1.extinction, -1); CHECK(ssol_thin_dielectric_setup(mtl, &shader, &mdm0, &mdm1, 1), RES_BAD_ARG); - ssol_data_copy(&mdm1.absorption, &SSOL_MEDIUM_VACUUM.absorption); + ssol_data_copy(&mdm1.extinction, &SSOL_MEDIUM_VACUUM.extinction); ssol_data_set_real(&mdm1.refractive_index, 0); CHECK(ssol_thin_dielectric_setup(mtl, &shader, &mdm0, &mdm1, 1), RES_BAD_ARG); @@ -229,11 +229,11 @@ test_dielectric(struct ssol_device* dev) CHECK(ssol_dielectric_setup(NULL, &dielectric, &mdm0, &mdm1), RES_BAD_ARG); ssol_data_copy(&mdm1.refractive_index, &SSOL_MEDIUM_VACUUM.refractive_index); - ssol_data_set_real(&mdm0.absorption, -1); + ssol_data_set_real(&mdm0.extinction, -1); CHECK(ssol_dielectric_setup(NULL, &dielectric, &mdm0, &mdm1), RES_BAD_ARG); - ssol_data_copy(&mdm0.absorption, &SSOL_MEDIUM_VACUUM.refractive_index); + ssol_data_copy(&mdm0.extinction, &SSOL_MEDIUM_VACUUM.refractive_index); - ssol_data_set_real(&mdm1.absorption, -1); + ssol_data_set_real(&mdm1.extinction, -1); CHECK(ssol_dielectric_setup(NULL, &dielectric, &mdm0, &mdm1), RES_BAD_ARG); ssol_data_copy(&mdm1.refractive_index, &SSOL_MEDIUM_VACUUM.refractive_index); diff --git a/src/test_ssol_scene.c b/src/test_ssol_scene.c @@ -78,7 +78,7 @@ main(int argc, char** argv) struct ssol_scene* scene2; struct ssol_atmosphere* atm; struct ssol_atmosphere* atm2; - struct ssol_data absorption; + struct ssol_data extinction; struct ssol_vertex_data vdata; struct scene_ctx ctx; struct desc desc; @@ -169,11 +169,11 @@ main(int argc, char** argv) CHECK(ssol_scene_detach_sun(scene2, sun), RES_OK); CHECK(ssol_atmosphere_create(dev, &atm), RES_OK); - absorption.type = SSOL_DATA_REAL; - absorption.value.real = 0.1; - CHECK(ssol_atmosphere_set_absorption(atm, &absorption), RES_OK); + extinction.type = SSOL_DATA_REAL; + extinction.value.real = 0.1; + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_OK); CHECK(ssol_atmosphere_create(dev, &atm2), RES_OK); - CHECK(ssol_atmosphere_set_absorption(atm2, &absorption), RES_OK); + CHECK(ssol_atmosphere_set_extinction(atm2, &extinction), RES_OK); CHECK(ssol_scene_attach_atmosphere(NULL, atm), RES_BAD_ARG); CHECK(ssol_scene_attach_atmosphere(scene, NULL), RES_BAD_ARG); diff --git a/src/test_ssol_solver1.c b/src/test_ssol_solver1.c @@ -67,7 +67,7 @@ main(int argc, char** argv) struct ssol_sun* sun_mono; struct ssol_spectrum* spectrum; struct ssol_spectrum* abs_spectrum; - struct ssol_data abs_data; + struct ssol_data extinction; struct ssol_atmosphere* atm; struct ssol_estimator* estimator; struct ssol_mc_sampled sampled; @@ -104,7 +104,7 @@ main(int argc, char** argv) mem_init_proxy_allocator(&allocator, &mem_default_allocator); CHECK(ssol_device_create - (NULL, &allocator, SSOL_NTHREADS_DEFAULT, 0, &dev), RES_OK); + (NULL, &allocator, (SSOL_NTHREADS_DEFAULT,1), 0, &dev), RES_OK); CHECK(ssp_rng_create(&allocator, &ssp_rng_threefry, &rng), RES_OK); @@ -349,11 +349,11 @@ main(int argc, char** argv) CHECK(eq_eps(mc_rcv.incoming_flux.SE, std, 1e-4), 1); CHECK(ssol_estimator_ref_put(estimator), RES_OK); - /* Check atmosphere model; with no absorption result is unchanged */ + /* Check atmosphere model; with no extinction result is unchanged */ CHECK(ssol_atmosphere_create(dev, &atm), RES_OK); - abs_data.type = SSOL_DATA_REAL; - abs_data.value.real = 0; - CHECK(ssol_atmosphere_set_absorption(atm, &abs_data), RES_OK); + extinction.type = SSOL_DATA_REAL; + extinction.value.real = 0; + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_OK); CHECK(ssol_scene_attach_atmosphere(scene, atm), RES_OK); CHECK(ssol_solve(scene, rng, N__, NULL, &estimator), RES_OK); @@ -392,11 +392,11 @@ main(int argc, char** argv) CHECK(ssol_scene_attach_instance(scene, heliostat2), RES_OK); #define KA 0.03 - abs_data.value.real = KA; + extinction.value.real = KA; CHECK(ssol_spectrum_create(dev, &abs_spectrum), RES_OK); CHECK(ssol_spectrum_setup(abs_spectrum, get_wlen, 3, &desc), RES_OK); CHECK(ssol_atmosphere_create(dev, &atm), RES_OK); - CHECK(ssol_atmosphere_set_absorption(atm, &abs_data), RES_OK); + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_OK); CHECK(ssol_scene_attach_atmosphere(scene, atm), RES_OK); CHECK(ssol_instance_set_receiver(target, SSOL_FRONT, 1), RES_OK); @@ -411,7 +411,7 @@ main(int argc, char** argv) CHECK(eq_eps(mc_global.shadowed.E, 0, 1e-4), 1); CHECK(eq_eps( mc_global.missing.E + mc_global.shadowed.E + mc_global.absorbed_by_receivers.E - + mc_global.absorbed_by_atmosphere.E + mc_global.other_absorbed.E, + + mc_global.extinguished_by_atmosphere.E + mc_global.other_absorbed.E, m, 1e-4), 1); CHECK(eq_eps(mc_global.cos_factor.E, COS, 1e-4), 1); @@ -483,9 +483,9 @@ main(int argc, char** argv) desc.count = 3; CHECK(ssol_spectrum_setup(abs_spectrum, get_wlen, 3, &desc), RES_OK); CHECK(ssol_spectrum_setup(abs_spectrum, get_wlen, 2, &desc), RES_OK); - abs_data.type = SSOL_DATA_SPECTRUM; - abs_data.value.spectrum = abs_spectrum; - CHECK(ssol_atmosphere_set_absorption(atm, &abs_data), RES_OK); + extinction.type = SSOL_DATA_SPECTRUM; + extinction.value.spectrum = abs_spectrum; + CHECK(ssol_atmosphere_set_extinction(atm, &extinction), RES_OK); CHECK(ssol_solve(scene, rng, N__, NULL, &estimator), RES_OK); CHECK(ssol_estimator_get_realisation_count(estimator, &count), RES_OK); diff --git a/src/test_ssol_utils.h b/src/test_ssol_utils.h @@ -36,7 +36,7 @@ check_memory_allocator(struct mem_allocator* allocator) printf("Receivers = %g +/- %g; ", \ (Mc).absorbed_by_receivers.E, (Mc).absorbed_by_receivers.SE); \ printf("Atmosphere = %g +/- %g; ", \ - (Mc).absorbed_by_atmosphere.E, (Mc).absorbed_by_atmosphere.SE); \ + (Mc).extinguished_by_atmosphere.E, (Mc).extinguished_by_atmosphere.SE); \ printf("Other absorbed = %g +/- %g; ", \ (Mc).other_absorbed.E, (Mc).other_absorbed.SE); \ printf("Cos = %g +/- %g\n", (Mc).cos_factor.E, (Mc).cos_factor.SE); \