commit e9adb229f742c042362ec93703a81867cfe9bde6
parent 1279167055add1abd7e5db64f229a019d9cb923d
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Thu, 14 Sep 2017 16:22:06 +0200
Add a new type for paths in error when dumping paths for display.
Diffstat:
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/ssol.h b/src/ssol.h
@@ -68,8 +68,9 @@ enum ssol_side_flag {
enum ssol_path_type {
SSOL_PATH_MISSING, /* The path misses the receivers */
- SSOL_PATH_SHADOW, /* The path is occluded before the sampled geometry */
- SSOL_PATH_SUCCESS /* The path contributes to at least one receiver */
+ SSOL_PATH_SHADOW, /* The path is occluded before the sampled geometry */
+ SSOL_PATH_SUCCESS, /* The path contributes to at least one receiver */
+ SSOL_PATH_ERROR /* The path was canceled due to a path-related error */
};
enum ssol_material_type {
diff --git a/src/ssol_solver.c b/src/ssol_solver.c
@@ -951,16 +951,22 @@ trace_radiative_path
/* Check conservation of energy at the realisation level */
ASSERT((double)depth*DBL_EPSILON*pt.initial_flux >= fabs(pt.energy_loss));
+exit:
if(tracker) {
- res = path_register_and_clear(&thread_ctx->paths, &path);
- if(res != RES_OK) goto error;
+ res_T tmp_res = path_register_and_clear(&thread_ctx->paths, &path);
+ if(tmp_res != RES_OK && res == RES_OK) {
+ res = tmp_res;
+ goto error;
+ }
}
-exit:
ssol_medium_clear(&in_medium);
ssol_medium_clear(&out_medium);
if(tracker) path_release(&path);
return res;
error:
+ if (tracker) {
+ path.type = SSOL_PATH_ERROR;
+ }
goto exit;
}