atrstm

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

commit fcb825b1c37a6372f04e513140b8622b19b2b358
parent dd0cdda823b4cfd81f2fe8704b48ca7034e1ce6d
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 14 Jan 2021 14:22:15 +0100

Invoke the "build octree" process on AtrSTM creation

Diffstat:
Msrc/atrstm.c | 11+++++++++++
Msrc/atrstm_build_octrees.c | 7+++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/src/atrstm.c b/src/atrstm.c @@ -14,6 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "atrstm.h" +#include "atrstm_build_octrees.h" #include "atrstm_c.h" #include "atrstm_log.h" @@ -53,6 +54,7 @@ release_atrstm(ref_T* ref) struct atrstm* atrstm; ASSERT(ref); atrstm = CONTAINER_OF(ref, struct atrstm, ref); + octrees_clean(atrstm); if(atrstm->atrtp) ATRTP(ref_put(atrstm->atrtp)); if(atrstm->atrri) ATRRI(ref_put(atrstm->atrri)); if(atrstm->suvm) SUVM(device_ref_put(atrstm->suvm)); @@ -72,6 +74,7 @@ atrstm_create const struct atrstm_args* args, struct atrstm** out_atrstm) { + struct build_octrees_args build_octree_args = BUILD_OCTREES_ARGS_NULL; struct atrstm* atrstm = NULL; struct mem_allocator* allocator = NULL; int nthreads_max; @@ -160,6 +163,14 @@ atrstm_create (atrstm->logger, atrstm->allocator, atrstm->verbose, &atrstm->svx); if(res != RES_OK) goto error; + /* Build the octree */ + build_octree_args.grid_max_definition[0] = args->grid_max_definition[0]; + build_octree_args.grid_max_definition[1] = args->grid_max_definition[1]; + build_octree_args.grid_max_definition[2] = args->grid_max_definition[2]; + build_octree_args.optical_thickness_threshold = args->optical_thickness; + res = build_octrees(atrstm, &build_octree_args); + if(res != RES_OK) goto error; + exit: if(out_atrstm) *out_atrstm = atrstm; return res; diff --git a/src/atrstm_build_octrees.c b/src/atrstm_build_octrees.c @@ -620,3 +620,10 @@ exit: error: goto exit; } + +void +octrees_clean(struct atrstm* atrstm) +{ + ASSERT(atrstm); + if(atrstm->octree) SVX(tree_ref_put(atrstm->octree)); +}