atrstm

Load and structure a combustion gas mixture
git clone git://git.meso-star.fr/atrstm.git
Log | Files | Refs | README | LICENSE

commit f299f0f58f7be49be7ba083e27c704a5a6731068
parent af768adc207d4571da9b14fe72db0c0b5edf09e4
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 22 Jan 2021 11:52:42 +0100

Add the atrstm_fetch_radcoefs_svx[_voxel] functions

Diffstat:
Mcmake/CMakeLists.txt | 7+++++--
Msrc/atrstm.h | 91+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Msrc/atrstm_radcoefs.c | 19+++++++++++++++----
Msrc/atrstm_setup_octrees.c | 52++++++++++++++++++++++++++--------------------------
Asrc/atrstm_svx.c | 171+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/atrstm_svx.h | 4++--
6 files changed, 306 insertions(+), 38 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -59,14 +59,17 @@ set(ATRSTM_FILES_SRC atrstm_partition.c atrstm_radcoefs.c atrstm_setup_octrees.c - atrstm_setup_uvm.c) + atrstm_setup_uvm.c + atrstm_svx.c) + set(ATRSTM_FILES_INC atrstm_c.h atrstm_cache.h atrstm_log.h atrstm_partition.h atrstm_radcoefs.h - atrstm_setup_octrees.h) + atrstm_setup_octrees.h + atrstm_svx.h) set(ATRSTM_FILES_INC_API atrstm.h) diff --git a/src/atrstm.h b/src/atrstm.h @@ -16,7 +16,10 @@ #ifndef ATRSTM_H #define ATRSTM_H +#include <star/svx.h> + #include <rsys/rsys.h> + #include <float.h> #include <limits.h> @@ -70,11 +73,17 @@ enum atrstm_component_flag { }; enum atrstm_svx_op { - ATRSTM_SVX_MIN, - ATRSTM_SVX_MAX, + ATRSTM_SVX_OP_MIN, + ATRSTM_SVX_OP_MAX, ATRSTM_SVX_OPS_COUNT__ }; +enum atrstm_svx_op_flag { + ATRSTM_SVX_OP_FLAG_MIN = BIT(ATRSTM_SVX_OP_MIN), + ATRSTM_SVX_OP_FLAG_MAX = BIT(ATRSTM_SVX_OP_MAX), + ATRSTM_SVX_OPS_MASK_ALL = ATRSTM_SVX_OP_FLAG_MIN | ATRSTM_SVX_OP_FLAG_MAX +}; + enum atrstm_spectral_type { ATRSTM_SPECTRAL_LW, /* Longwave */ ATRSTM_SPECTRAL_SW, /* Shortwave */ @@ -136,6 +145,7 @@ struct atrstm_fetch_radcoefs_args { double k_min[ATRSTM_RADCOEFS_COUNT__]; double k_max[ATRSTM_RADCOEFS_COUNT__]; }; + #define ATRSTM_FETCH_RADCOEFS_ARGS_DEFAULT__ { \ {0, 0, 0}, /* Position */ \ SIZE_MAX, /* Index of the spectral band */ \ @@ -143,7 +153,7 @@ struct atrstm_fetch_radcoefs_args { DBL_MAX, /* Wavelength */ \ \ ATRSTM_RADCOEFS_MASK_ALL, /* Mask of radiative properties to fetch */ \ - ATRSTM_CPNTS_MASK_ALL, /* Mask of comonent to handle */ \ + ATRSTM_CPNTS_MASK_ALL, /* Mask of component to handle */ \ \ /* For debug */ \ {-DBL_MAX,-DBL_MAX,-DBL_MAX}, /* Kmin */ \ @@ -152,6 +162,61 @@ struct atrstm_fetch_radcoefs_args { static const struct atrstm_fetch_radcoefs_args ATRSTM_FETCH_RADCOEFS_ARGS_DEFAULT = ATRSTM_FETCH_RADCOEFS_ARGS_DEFAULT__; +struct atrstm_fetch_radcoefs_svx_args { + double pos[3]; /* Position to query */ + size_t iband; /* Spectral band index. Not use in shortwave */ + size_t iquad; /* Quadrature point index. Not use in shortwave */ + + int radcoefs_mask; /* Combination of atrstm_radcoef_flag */ + int components_mask; /* Combination of atrstm_component_flag */ + int operations_mask; /* Combination of atrstm_svx_op_flag */ +}; + +#define ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT__ { \ + {0, 0, 0}, /* Position */ \ + SIZE_MAX, /* Index of the spectral band */ \ + SIZE_MAX, /* Index of the quadrature point */ \ + \ + ATRSTM_RADCOEFS_MASK_ALL, /* Mask of radiative properties to fetch */ \ + ATRSTM_CPNTS_MASK_ALL, /* Mask of component to handle */ \ + ATRSTM_SVX_OPS_MASK_ALL, /* Mask of operations to query */ \ +} +static const struct atrstm_fetch_radcoefs_svx_args +ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT = + ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT__; + +struct atrstm_fetch_radcoefs_svx_voxel_args { + struct svx_voxel voxel; /* Voxel to query */ + size_t iband; /* Spectral band index. Not use in shortwave */ + size_t iquad; /* Quadrature point index. Not use in shortwave */ + + int radcoefs_mask; /* Combination of atrstm_radcoef_flag */ + int components_mask; /* Combination of atrstm_component_flag */ + int operations_mask; /* Combination of atrstm_svx_op_flag */ +}; + +#define ATRSTM_FETCH_RADCOEFS_SVX_VOXEL_ARGS_DEFAULT__ { \ + SVX_VOXEL_NULL__, /* Voxel */ \ + SIZE_MAX, /* Index of the spectral band */ \ + SIZE_MAX, /* Index of the quadrature point */ \ + \ + ATRSTM_RADCOEFS_MASK_ALL, /* Mask of radiative properties to fetch */ \ + ATRSTM_CPNTS_MASK_ALL, /* Mask of component to handle */ \ + ATRSTM_SVX_OPS_MASK_ALL, /* Mask of operations to query */ \ +} +static const struct atrstm_fetch_radcoefs_svx_voxel_args +ATRSTM_FETCH_RADCOEFS_SVX_VOXEL_ARGS_DEFAULT = + ATRSTM_FETCH_RADCOEFS_SVX_VOXEL_ARGS_DEFAULT__; + +struct atrstm_dump_svx_octree_args { + size_t iband; /* Spectral band index. Not use in shortwave */ + size_t iquad; /* Quadrature point index. Not use in shortwave */ +}; + +#define ATRSTM_DUMP_SVX_OCTREE_ARGS_DEFAULT__ {SIZE_MAX, SIZE_MAX} +static const struct atrstm_dump_svx_octree_args +ATRSTM_DUMP_SVX_OCTREE_ARGS_DEFAULT = ATRSTM_DUMP_SVX_OCTREE_ARGS_DEFAULT__; + /* Forward declaration of extern data types */ struct logger; struct mem_allocator; @@ -187,7 +252,25 @@ ATRSTM_API res_T atrstm_fetch_radcoefs (const struct atrstm* atrstm, const struct atrstm_fetch_radcoefs_args* args, - double radcoefs[ATRSTM_RADCOEFS_COUNT__]); /* In m^-1 */ + double radcoefs[ATRSTM_RADCOEFS_COUNT__]);/*In m^-1*/ + +ATRSTM_API res_T +atrstm_fetch_radcoefs_svx + (const struct atrstm* atrstm, + const struct atrstm_fetch_radcoefs_svx_args* args, + double radcoefs[ATRSTM_RADCOEFS_COUNT__][ATRSTM_SVX_OPS_COUNT__]);/*In m^-1*/ + +ATRSTM_API res_T +atrstm_fetch_radcoefs_svx_voxel + (const struct atrstm* atrstm, + const struct atrstm_fetch_radcoefs_svx_voxel_args* args, + double radcoefs[ATRSTM_RADCOEFS_COUNT__][ATRSTM_SVX_OPS_COUNT__]);/*In m^-1*/ + +ATRSTM_API res_T +atrstm_dump_svx_octree + (const struct atrstm* atrstm, + const struct atrstm_dump_svx_octree_args* args, + FILE* stream); END_DECLS diff --git a/src/atrstm_radcoefs.c b/src/atrstm_radcoefs.c @@ -32,10 +32,11 @@ static INLINE int check_fetch_radcoefs_args (const struct atrstm* atrstm, - const struct atrstm_fetch_radcoefs_args* args) + const struct atrstm_fetch_radcoefs_args* args, + const char* func_name) { int i; - ASSERT(atrstm); + ASSERT(atrstm && args && func_name); if(!args || args->wavelength < atrstm->wlen_range[0] @@ -44,6 +45,14 @@ check_fetch_radcoefs_args || !(args->components_mask & ATRSTM_CPNTS_MASK_ALL)) return 0; + if(args->iband != ATRSTM_FETCH_RADCOEFS_ARGS_DEFAULT.iband + || args->iband != ATRSTM_FETCH_RADCOEFS_ARGS_DEFAULT.iquad + || atrstm->spectral_type != ATRSTM_SPECTRAL_SW) { + log_err(atrstm, "%s: only shortwave is currently supported.\n", + func_name); + return 0; + } + FOR_EACH(i, 0, ATRSTM_RADCOEFS_COUNT__) { if(args->k_min[i] > args->k_max[i]) return 0; } @@ -65,7 +74,9 @@ atrstm_fetch_radcoefs struct suvm_primitive prim = SUVM_PRIMITIVE_NULL; res_T res = RES_OK; - if(!atrstm || !check_fetch_radcoefs_args(atrstm, args) || !radcoefs) { + if(!atrstm + || !check_fetch_radcoefs_args(atrstm, args, FUNC_NAME) + || !radcoefs) { res = RES_BAD_ARG; goto error; } @@ -83,7 +94,7 @@ atrstm_fetch_radcoefs /* No primitive found */ if(SUVM_PRIMITIVE_NONE(&prim)) { log_warn(atrstm, - "%s: the position {%g, %g, %g} does not belongs to the semi-transparent " + "%s: the position {%g, %g, %g} does not belong to the semi-transparent " "medium.\n", FUNC_NAME, SPLIT3(args->pos)); goto exit; } diff --git a/src/atrstm_setup_octrees.c b/src/atrstm_setup_octrees.c @@ -115,12 +115,12 @@ voxel_commit_radcoefs_range if(kext[1] != (float)kext[1]) kext[1] = nextafterf((float)kext[1], FLT_MAX); /* Fetch the range of the voxel optical properties */ - vox_ka[0] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MIN); - vox_ka[1] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MAX); - vox_ks[0] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MIN); - vox_ks[1] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MAX); - vox_kext[0] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MIN); - vox_kext[1] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MAX); + vox_ka[0] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MIN); + vox_ka[1] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MAX); + vox_ks[0] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MIN); + vox_ks[1] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MAX); + vox_kext[0] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MIN); + vox_kext[1] = vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MAX); /* Update the range of the voxel optical properties */ vox_ka[0] = MMIN(vox_ka[0], (float)ka[0]); @@ -131,12 +131,12 @@ voxel_commit_radcoefs_range vox_kext[1] = MMAX(vox_kext[1], (float)kext[1]); /* Commit the upd to the voxel */ - vox_set(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MIN, vox_ka[0]); - vox_set(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MAX, vox_ka[1]); - vox_set(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MIN, vox_ks[0]); - vox_set(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MAX, vox_ks[1]); - vox_set(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MIN, vox_kext[0]); - vox_set(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MAX, vox_kext[1]); + vox_set(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MIN, vox_ka[0]); + vox_set(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MAX, vox_ka[1]); + vox_set(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MIN, vox_ks[0]); + vox_set(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MAX, vox_ks[1]); + vox_set(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MIN, vox_kext[0]); + vox_set(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MAX, vox_kext[1]); } static res_T @@ -429,19 +429,19 @@ voxels_merge_component FOR_EACH(ivox, 0, nvoxs) { const float* vox = voxels[ivox]; - ka[0] = MMIN(ka[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MIN)); - ka[1] = MMAX(ka[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MAX)); - ks[0] = MMIN(ks[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MIN)); - ks[1] = MMAX(ks[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MAX)); - kext[0] = MMIN(kext[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MIN)); - kext[1] = MMAX(kext[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MAX)); + ka[0] = MMIN(ka[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MIN)); + ka[1] = MMAX(ka[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MAX)); + ks[0] = MMIN(ks[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MIN)); + ks[1] = MMAX(ks[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MAX)); + kext[0] = MMIN(kext[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MIN)); + kext[1] = MMAX(kext[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MAX)); } - vox_set(dst, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MIN, ka[0]); - vox_set(dst, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_MAX, ka[1]); - vox_set(dst, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MIN, ks[0]); - vox_set(dst, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_MAX, ks[1]); - vox_set(dst, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MIN, kext[0]); - vox_set(dst, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MAX, kext[1]); + vox_set(dst, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MIN, ka[0]); + vox_set(dst, cpnt, ATRSTM_RADCOEF_Ka, ATRSTM_SVX_OP_MAX, ka[1]); + vox_set(dst, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MIN, ks[0]); + vox_set(dst, cpnt, ATRSTM_RADCOEF_Ks, ATRSTM_SVX_OP_MAX, ks[1]); + vox_set(dst, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MIN, kext[0]); + vox_set(dst, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MAX, kext[1]); } static void @@ -472,8 +472,8 @@ voxels_component_compute_kext_range /* Compute the Kext range of the submitted voxels */ FOR_EACH(ivox, 0, nvoxs) { const float* vox = voxels[ivox].data; - kext[0] = MMIN(kext[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MIN)); - kext[1] = MMAX(kext[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_MAX)); + kext[0] = MMIN(kext[0], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MIN)); + kext[1] = MMAX(kext[1], vox_get(vox, cpnt, ATRSTM_RADCOEF_Kext, ATRSTM_SVX_OP_MAX)); } } diff --git a/src/atrstm_svx.c b/src/atrstm_svx.c @@ -0,0 +1,171 @@ +/* Copyright (C) 2020 CNRS + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#include "atrstm.h" +#include "atrstm_c.h" +#include "atrstm_log.h" +#include "atrstm_svx.h" + +#include <star/svx.h> + +/******************************************************************************* + * Helper functions + ******************************************************************************/ +static INLINE int +check_fetch_radcoefs_svx_args + (const struct atrstm* atrstm, + const struct atrstm_fetch_radcoefs_svx_args* args, + const char* func_name) +{ + ASSERT(atrstm && args && func_name); + + if(!args + || !(args->radcoefs_mask & ATRSTM_RADCOEFS_MASK_ALL) + || !(args->components_mask & ATRSTM_CPNTS_MASK_ALL) + || !(args->operations_mask & ATRSTM_SVX_OPS_MASK_ALL)) + return 0; + + if(args->iband != ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT.iband /* Not use */ + || args->iquad != ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT.iquad /* Not use */ + || atrstm->spectral_type != ATRSTM_SPECTRAL_SW) { + log_err(atrstm, "%s: only shortwave is currently supported.\n", + func_name); + return 0; + } + + return 1; +} + +static INLINE int +check_fetch_radcoefs_svx_voxel_args + (const struct atrstm* atrstm, + const struct atrstm_fetch_radcoefs_svx_voxel_args* args, + const char* func_name) +{ + ASSERT(atrstm && args && func_name); + + if(!args + || SVX_VOXEL_NONE(&args->voxel) + || !(args->radcoefs_mask & ATRSTM_RADCOEFS_MASK_ALL) + || !(args->components_mask & ATRSTM_CPNTS_MASK_ALL) + || !(args->operations_mask & ATRSTM_SVX_OPS_MASK_ALL)) + return 0; + + if(args->iband != ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT.iband /* Not use */ + || args->iquad != ATRSTM_FETCH_RADCOEFS_SVX_ARGS_DEFAULT.iquad /* Not use */ + || atrstm->spectral_type != ATRSTM_SPECTRAL_SW) { + log_err(atrstm, "%s: only shortwave is currently supported.\n", + func_name); + return 0; + } + + return 1; +} + +static INLINE void +reset_radcoefs + (double radcoefs[ATRSTM_RADCOEFS_COUNT__][ATRSTM_SVX_OPS_COUNT__]) +{ + ASSERT(radcoefs); + memset(radcoefs, 0, + sizeof(double[ATRSTM_RADCOEFS_COUNT__][ATRSTM_SVX_OPS_COUNT__])); +} + +/******************************************************************************* + * Exported functions + ******************************************************************************/ +res_T +atrstm_fetch_radcoefs_svx + (const struct atrstm* atrstm, + const struct atrstm_fetch_radcoefs_svx_args* args, + double radcoefs[ATRSTM_RADCOEFS_COUNT__][ATRSTM_SVX_OPS_COUNT__]) /*In m^-1*/ +{ + struct atrstm_fetch_radcoefs_svx_voxel_args voxel_args; + struct svx_voxel voxel = SVX_VOXEL_NULL; + res_T res = RES_OK; + + if(atrstm + || !check_fetch_radcoefs_svx_args(atrstm, args, FUNC_NAME) + || !radcoefs) { + res = RES_BAD_ARG; + goto error; + } + + SVX(tree_at(atrstm->octree, args->pos, NULL, NULL, &voxel)); + if(SVX_VOXEL_NONE(&voxel)) { + log_warn(atrstm, + "%s: the position {%g, %g, %g} does not belong to the Star-VoXel structure.\n" + "medium.\n", FUNC_NAME, SPLIT3(args->pos)); + reset_radcoefs(radcoefs); + goto exit; + } + + voxel_args = ATRSTM_FETCH_RADCOEFS_SVX_VOXEL_ARGS_DEFAULT; + voxel_args.voxel = voxel; + voxel_args.iband = args->iband; + voxel_args.iquad = args->iquad; + 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; + +exit: + return res; +error: + goto exit; +} + +res_T +atrstm_fetch_radcoefs_svx_voxel + (const struct atrstm* atrstm, + const struct atrstm_fetch_radcoefs_svx_voxel_args* args, + double radcoefs[ATRSTM_RADCOEFS_COUNT__][ATRSTM_SVX_OPS_COUNT__]) /*In m^-1*/ +{ + int cpnt, radcoef, op; + res_T res = RES_OK; + + if(atrstm + || !check_fetch_radcoefs_svx_voxel_args(atrstm, args, FUNC_NAME) + || !radcoefs) { + res = RES_BAD_ARG; + goto error; + } + + reset_radcoefs(radcoefs); + + FOR_EACH(cpnt, 0, ATRSTM_CPNTS_COUNT__) { + if((args->components_mask & BIT(cpnt)) == 0) continue; + + FOR_EACH(radcoef, 0, ATRSTM_RADCOEFS_COUNT__) { + if((args->radcoefs_mask & BIT(radcoef)) == 0) continue; + + FOR_EACH(op, 0, ATRSTM_SVX_OPS_COUNT__) { + double k; + if((args->operations_mask & BIT(op)) == 0) continue; + + k = vox_get(args->voxel.data, cpnt, radcoef, op); + radcoefs[radcoef][op] += k; + } + } + } + +exit: + return res; +error: + goto exit; +} + diff --git a/src/atrstm_svx.h b/src/atrstm_svx.h @@ -82,8 +82,8 @@ vox_clear(float* vox) FOR_EACH(cpnt, 0, ATRSTM_CPNTS_COUNT__) { int prop; FOR_EACH(prop, 0, ATRSTM_RADCOEFS_COUNT__) { - vox_set(vox, cpnt, prop, ATRSTM_SVX_MIN, FLT_MAX); - vox_set(vox, cpnt, prop, ATRSTM_SVX_MAX,-FLT_MAX); + vox_set(vox, cpnt, prop, ATRSTM_SVX_OP_MIN, FLT_MAX); + vox_set(vox, cpnt, prop, ATRSTM_SVX_OP_MAX,-FLT_MAX); } } }