stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

commit 97c701db99d277ff604d5b76a740fb2475324ff1
parent 10af0bbb17ab30e267ddfbdd394c03479a705c36
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 15 Jan 2019 10:38:51 +0100

Small refactoring the solver

Diffstat:
Msrc/sdis_solve_Xd.h | 37+++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)

diff --git a/src/sdis_solve_Xd.h b/src/sdis_solve_Xd.h @@ -119,6 +119,17 @@ setup_estimator_flux sqrt(estimator->fluxes[name].V / (double)estimator->nrealisations); } +static INLINE double +sample_time + (const double time_range[2], + struct ssp_rng* rng) +{ + ASSERT(time_range && time_range[0] >= 0 && time_range[1] >= time_range[0]); + ASSERT(rng); + if(time_range[0] == time_range[1]) return time_range[0]; + return ssp_rng_uniform_double(rng, time_range[0], time_range[1]); +} + #endif /* SDIS_SOLVE_XD_H */ #else @@ -233,20 +244,6 @@ XD(radiative_temperature) /******************************************************************************* * Helper functions ******************************************************************************/ -#ifndef SAMPLE_TIME_DEFINED -static INLINE double -sample_time - (const double time_range[2], - struct ssp_rng* rng) -{ - ASSERT(time_range && time_range[0] >= 0 && time_range[1] >= time_range[0] - && rng); - if(time_range[0] == time_range[1]) return time_range[0]; - return ssp_rng_uniform_double(rng, time_range[0], time_range[1]); -} -#define SAMPLE_TIME_DEFINED -#endif - static INLINE void XD(boundary_get_indices)(const unsigned iprim, unsigned ids[DIM], void* context) { @@ -365,7 +362,6 @@ XD(trace_radiative_path) const double fp_to_meter, const struct rwalk_context* ctx, struct XD(rwalk)* rwalk, - const int outside, struct ssp_rng* rng, struct XD(temperature)* T) { @@ -466,6 +462,8 @@ XD(trace_radiative_path) /* To ease the setting of models, the external enclosure is allowed to be * incoherent regarding media. * Here a radiative path is allowed to join 2 different fluids. */ + const int outside = scene_is_outside + (scn, rwalk->hit_side, rwalk->hit.prim.prim_id); if(outside && chk_mdm->type == SDIS_FLUID) { rwalk->mdm = chk_mdm; } else { @@ -503,7 +501,6 @@ XD(radiative_temperature) * assumed to be extruded to the infinty along the Z dimension. */ float N[3] = {0, 0, 0}; float dir[3] = {0, 0, 0}; - int outside; res_T res = RES_OK; ASSERT(scn && fp_to_meter > 0 && ctx && rwalk && rng && T); @@ -521,10 +518,7 @@ XD(radiative_temperature) ssp_ran_hemisphere_cos_float(rng, N, dir, NULL); /* Launch the radiative random walk */ - outside = - scene_is_outside(scn, rwalk->hit_side, rwalk->hit.prim.prim_id); - res = XD(trace_radiative_path)(scn, dir, fp_to_meter, ctx, rwalk, outside, - rng, T); + res = XD(trace_radiative_path)(scn, dir, fp_to_meter, ctx, rwalk, rng, T); if(res != RES_OK) goto error; exit: @@ -1824,8 +1818,7 @@ XD(ray_realisation) f3_set_d3(dir, direction); - res = XD(trace_radiative_path)(scn, dir, fp_to_meter, &ctx, &rwalk, 0, rng, - &T); + res = XD(trace_radiative_path)(scn, dir, fp_to_meter, &ctx, &rwalk, rng, &T); if(res != RES_OK) goto error; if(!T.done) {