atrstm

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

commit 08c2a914e1d5d1298fb91dc4cb828efa98cbc553
parent e8496c11f2f2f13bd419a4125e21c176502010c8
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 20 Jan 2021 15:05:51 +0100

Add a progress message during voxelization

Diffstat:
Msrc/atrstm_setup_octrees.c | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/atrstm_setup_octrees.c b/src/atrstm_setup_octrees.c @@ -264,6 +264,8 @@ voxelize_volumetric_mesh double vol_upp[3]; double vxsz[3]; uint64_t ipart; + int progress = 0; + ATOMIC nparts_voxelized = 0; ATOMIC res = RES_OK; ASSERT(atrstm && pools); @@ -289,6 +291,9 @@ voxelize_volumetric_mesh nparts_adjusted = round_up_pow2(nparts_adjusted); nparts_adjusted = nparts_adjusted*nparts_adjusted*nparts_adjusted; + #define LOG_MSG "Voxelizing the volumetric mesh: %3d%%\r" + log_info(atrstm, LOG_MSG, 0); + /* Iterate over the partition according to their Morton order and voxelize * the primitives that intersect it */ omp_set_num_threads((int)atrstm->nthreads); @@ -301,6 +306,8 @@ voxelize_volumetric_mesh uint32_t part_ids[3]; const int ithread = omp_get_thread_num(); struct part* part = NULL; + int pcent; + size_t n; res_T res_local = RES_OK; /* Handle error */ @@ -348,8 +355,21 @@ voxelize_volumetric_mesh continue; } pool_commit_partition(pool, part); + + /* Update progress message */ + n = (size_t)ATOMIC_INCR(&nparts_voxelized); + pcent = (int)((n * 100) / (nparts[0]*nparts[1]*nparts[2])); + + #pragma omp critical + if(pcent > progress) { + progress = pcent; + log_info(atrstm, LOG_MSG, pcent); + } } + if(res != RES_OK) goto error; + log_info(atrstm, LOG_MSG"\n", 100); + exit: darray_prims_list_release(&prims_list); return (res_T)res;