commit 1f74f76ba128ff6593160cf05132a4ebff9b17ce
parent ad4bda46abdd98d031a55816d999de6575044a29
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 25 Jan 2021 21:31:35 +0100
Fix the atrstm_fetch_radcoefs_svx_[voxel] functions
Input arguments were wrongly checked
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/atrstm_svx.c b/src/atrstm_svx.c
@@ -96,13 +96,14 @@ atrstm_fetch_radcoefs_svx
struct svx_voxel voxel = SVX_VOXEL_NULL;
res_T res = RES_OK;
- if(atrstm
+ if(!atrstm
|| !check_fetch_radcoefs_svx_args(atrstm, args, FUNC_NAME)
|| !radcoefs) {
res = RES_BAD_ARG;
goto error;
}
+ /* Retrieve the voxel into which the queried position lies */
SVX(tree_at(atrstm->octree, args->pos, NULL, NULL, &voxel));
if(SVX_VOXEL_NONE(&voxel)) {
log_warn(atrstm,
@@ -112,6 +113,7 @@ atrstm_fetch_radcoefs_svx
goto exit;
}
+ /* Retrieve the radiative coefficients of the voxel */
voxel_args = ATRSTM_FETCH_RADCOEFS_SVX_VOXEL_ARGS_DEFAULT;
voxel_args.voxel = voxel;
voxel_args.iband = args->iband;
@@ -119,7 +121,6 @@ atrstm_fetch_radcoefs_svx
voxel_args.radcoefs_mask = args->radcoefs_mask;
voxel_args.components_mask = args->components_mask;
voxel_args.operations_mask = args->operations_mask;
-
res = atrstm_fetch_radcoefs_svx_voxel(atrstm, &voxel_args, radcoefs);
if(res != RES_OK) goto error;
@@ -138,7 +139,7 @@ atrstm_fetch_radcoefs_svx_voxel
int cpnt, radcoef, op;
res_T res = RES_OK;
- if(atrstm
+ if(!atrstm
|| !check_fetch_radcoefs_svx_voxel_args(atrstm, args, FUNC_NAME)
|| !radcoefs) {
res = RES_BAD_ARG;
@@ -157,6 +158,7 @@ atrstm_fetch_radcoefs_svx_voxel
double k;
if((args->operations_mask & BIT(op)) == 0) continue;
+ /* Add component contribution to the current radiative coef */
k = vox_get(args->voxel.data, cpnt, radcoef, op);
radcoefs[radcoef][op] += k;
}