stardis-solver

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

commit d6f2e64f78e01381df6241e70594cabe69bee1d4
parent ab90717ccb684c83a240a4617e4ecbd2371f8169
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue, 14 May 2019 15:33:44 +0200

Small adjustment of the scene_get_medium function

If it is impossible de retrieve the current medium due to the rejection
criteria, return a RES_BAD_OP instead of a RES_BAD_ARG. This avoid to
stop the simulation and give some possibility to handle this specific
case.

Diffstat:
Msrc/sdis_heat_path_boundary_Xd.h | 3+++
Msrc/sdis_heat_path_conductive_Xd.h | 1+
Msrc/sdis_scene_Xd.h | 2+-
3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/sdis_heat_path_boundary_Xd.h b/src/sdis_heat_path_boundary_Xd.h @@ -247,6 +247,7 @@ XD(select_reinjection_dir) if(SXD_HIT_NONE(&hit0)) { XD(move_pos)(dX(set)(tmp, rwalk->vtx.P), dir0, (float)delta); res = scene_get_medium_in_closed_boundaries(scn, tmp, &mdm0); + if(res == RES_BAD_OP) { mdm0 = NULL; res = RES_OK; } if(res != RES_OK) goto error; } else { interf = scene_get_interface(scn, hit0.prim.prim_id); @@ -258,6 +259,7 @@ XD(select_reinjection_dir) if(SXD_HIT_NONE(&hit1)) { XD(move_pos)(dX(set)(tmp, rwalk->vtx.P), dir1, (float)delta); res = scene_get_medium_in_closed_boundaries(scn, tmp, &mdm1); + if(res == RES_BAD_OP) { mdm1 = NULL; res = RES_OK; } if(res != RES_OK) goto error; } else { interf = scene_get_interface(scn, hit1.prim.prim_id); @@ -407,6 +409,7 @@ XD(select_reinjection_dir_and_check_validity) XD(move_pos)(dX(set)(pos, rwalk->vtx.P), reinject_dir, reinject_dst); res = scene_get_medium_in_closed_boundaries (scn, pos, &reinject_mdm); + if(res == RES_BAD_OP) { reinject_mdm = NULL; res = RES_OK; } if(res != RES_OK) goto error; *is_valid = reinject_mdm == mdm; diff --git a/src/sdis_heat_path_conductive_Xd.h b/src/sdis_heat_path_conductive_Xd.h @@ -144,6 +144,7 @@ XD(sample_next_step_robust) if(hit0->distance > delta) { XD(move_pos)(dX(set)(pos_next, pos), dir0, delta); res = scene_get_medium_in_closed_boundaries(scn, pos_next, &mdm); + if(res == RES_BAD_OP) { mdm = NULL; res = RES_OK; } if(res != RES_OK) goto error; } else { struct sdis_interface* interf; diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h @@ -1127,7 +1127,7 @@ XD(scene_get_medium) } if(iprim >= nprims) { - res = RES_BAD_ARG; + res = RES_BAD_OP; goto error; }