star-uvm

Spatial structuring of unstructured volumetric meshes
git clone git://git.meso-star.fr/star-uvm.git
Log | Files | Refs | README | LICENSE

commit 72af64630300e75b52271b1e691a8d19556c6ca0
parent ca3057d87598661d13365de8b3c6ba36e684075a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu,  7 Jan 2021 09:21:23 +0100

Add a progress message during voxelization

Diffstat:
Msrc/suvm_voxelize_sth.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/suvm_voxelize_sth.c b/src/suvm_voxelize_sth.c @@ -209,6 +209,7 @@ voxelize_suvm_volume double vxl_sz[3]; size_t iprim; size_t nprims; + int progress = 0; res_T res = RES_OK; ASSERT(vol && def && def[0] && def[1] && def[2] && vxls); @@ -229,6 +230,7 @@ voxelize_suvm_volume size_t ivxl_upp[3]; size_t ivxl[3]; size_t i = 0; + int pcent; CHK(suvm_volume_get_primitive(vol, iprim, &prim) == RES_OK); CHK(suvm_primitive_setup_polyhedron(&prim, &poly) == RES_OK); @@ -266,8 +268,16 @@ voxelize_suvm_volume } } } + pcent = (int)((double)iprim * 100 / (double)nprims + 0.5/*round*/); + if(pcent > progress) { + progress = pcent; + fprintf(stdout, "Voxelizing: %3d%%\r", progress); + fflush(stdout); + } } + printf("Voxelizing: %3d%%\n", progress); + exit: return res; error: @@ -369,9 +379,6 @@ main(int argc, char** argv) } /* Voxelize the volume */ - if(args.verbose) { - printf("Voxelizing the volume\n"); - } time_current(&t0); res = voxelize_suvm_volume(vol, args.def, vxls); if(res != RES_OK) goto error;