stardis-solver

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

commit 34a3152c88013b25186945e52a8678cb41bc5b7c
parent 6fbab3b9bd42d4985d38ced6813d46bf1f5decc1
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 29 May 2024 14:57:46 +0200

Updating the profile of the scene_get_medium function

This internal function takes an optional parameter which, if set, stores
the data used to retrieve the medium at the input position (the traced
radius, the target position and the hit found). This data is never
actually used. We therefore delete the associated data structure and
update the function profile to remove this optional parameter.

Diffstat:
Msrc/sdis_scene.c | 5++---
Msrc/sdis_scene_Xd.h | 29+----------------------------
Msrc/sdis_scene_c.h | 16----------------
Msrc/sdis_solve_camera.c | 2+-
Msrc/sdis_solve_probe_Xd.h | 4++--
5 files changed, 6 insertions(+), 50 deletions(-)

diff --git a/src/sdis_scene.c b/src/sdis_scene.c @@ -430,12 +430,11 @@ res_T scene_get_medium (struct sdis_scene* scn, const double pos[], - struct get_medium_info* info, struct sdis_medium** out_medium) { return scene_is_2d(scn) - ? scene_get_medium_2d(scn, pos, info, out_medium) - : scene_get_medium_3d(scn, pos, info, out_medium); + ? scene_get_medium_2d(scn, pos, out_medium) + : scene_get_medium_3d(scn, pos, out_medium); } res_T diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h @@ -1098,7 +1098,6 @@ static INLINE res_T XD(scene_get_medium) (struct sdis_scene* scn, const double pos[DIM], - struct get_medium_info* info, /* May be NULL */ struct sdis_medium** out_medium) { struct sdis_medium* medium = NULL; @@ -1178,32 +1177,6 @@ XD(scene_get_medium) interf = scene_get_interface(scn, hit.prim.prim_id); scene_get_enclosure_ids(scn, hit.prim.prim_id, enc_ids); - - if(cos_N_dir < 0) { - medium = interface_get_medium(interf, SDIS_FRONT); - enclosure = scene_get_enclosure(scn, enc_ids[0]); - } else { - medium = interface_get_medium(interf, SDIS_BACK); - enclosure = scene_get_enclosure(scn, enc_ids[1]); - } - - if(enclosure->medium_id == ENCLOSURE_MULTI_MEDIA) { - log_warn - (scn->dev, - "%s: invalid medium request at {%g, %g, %g}. " - "The position is located in an enclosure comprising several media.\n", - FUNC_NAME, P[0], P[1], DIM == 3 ? P[2] : 0); - res = RES_BAD_OP; - goto error; - } - - /* Register the get_medium_info */ - if(info) { - fX(set)(info->pos_tgt, attr.value); - fX(set)(info->ray_org, P); - fX(set)(info->ray_dir, dir); - info->XD(hit) = hit; - } break; } } @@ -1287,7 +1260,7 @@ XD(scene_get_medium_in_closed_boundaries) } } if(idir >= 2*DIM) { - res = XD(scene_get_medium)(scn, pos, NULL, &medium); + res = XD(scene_get_medium)(scn, pos, &medium); if(res != RES_OK) goto error; } diff --git a/src/sdis_scene_c.h b/src/sdis_scene_c.h @@ -48,21 +48,6 @@ struct hit_filter_data { static const struct hit_filter_data HIT_FILTER_DATA_NULL = HIT_FILTER_DATA_NULL__; -struct get_medium_info { - /* Targeted position */ - float pos_tgt[3]; - /* Ray trace to the targeted position in order to define the current medium */ - float ray_org[3]; - float ray_dir[3]; - /* Hit encouters along the ray and used to define the current medium */ - struct s2d_hit hit_2d; - struct s3d_hit hit_3d; -}; -#define GET_MEDIUM_INFO_NULL__ \ - {{0,0,0}, {0,0,0}, {0,0,0}, S2D_HIT_NULL__, S3D_HIT_NULL__} -static const struct get_medium_info GET_MEDIUM_INFO_NULL = - GET_MEDIUM_INFO_NULL__; - static INLINE void prim_prop_init(struct mem_allocator* allocator, struct prim_prop* prim) { @@ -247,7 +232,6 @@ extern LOCAL_SYM res_T scene_get_medium (struct sdis_scene* scene, const double position[], - struct get_medium_info* info, /* May be NULL */ struct sdis_medium** medium); /* This function assumes that the tested position lies into finite enclosure. diff --git a/src/sdis_solve_camera.c b/src/sdis_solve_camera.c @@ -537,7 +537,7 @@ sdis_solve_camera } /* Retrieve the medium in which the submitted position lies */ - res = scene_get_medium(scn, args->cam->position, NULL, &medium); + res = scene_get_medium(scn, args->cam->position, &medium); if(res != RES_OK) goto error; if(medium->type != SDIS_FLUID) { diff --git a/src/sdis_solve_probe_Xd.h b/src/sdis_solve_probe_Xd.h @@ -126,7 +126,7 @@ XD(solve_one_probe) *acc_time = ACCUM_NULL; /* Retrieve the medium in which the submitted position lies */ - res = scene_get_medium(scn, args->position, NULL, &medium); + res = scene_get_medium(scn, args->position, &medium); if(res != RES_OK) goto error; FOR_EACH(irealisation, 0, args->nrealisations) { @@ -256,7 +256,7 @@ XD(solve_probe) if(!per_thread_acc_time) { res = RES_MEM_ERR; goto error; } /* Retrieve the medium in which the submitted position lies */ - res = scene_get_medium(scn, args->position, NULL, &medium); + res = scene_get_medium(scn, args->position, &medium); if(res != RES_OK) goto error; /* Create the per thread green function */