From 4c27166e74ade52ce70360f83179a215adc5733d Mon Sep 17 00:00:00 2001 From: gforney Date: Tue, 19 Mar 2024 13:58:18 -0400 Subject: [PATCH] smokeview source: add option to skip particles when drawing --- Source/smokeview/IOpart.c | 18 +++++++++--------- Source/smokeview/glui_bounds.cpp | 11 ++++++++++- Source/smokeview/glui_bounds.h | 1 + Source/smokeview/readsmv.c | 7 +++++++ Source/smokeview/smokeviewvars.h | 2 +- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Source/smokeview/IOpart.c b/Source/smokeview/IOpart.c index f14539ce24..6f4672e6c1 100644 --- a/Source/smokeview/IOpart.c +++ b/Source/smokeview/IOpart.c @@ -292,7 +292,7 @@ void DrawPart(const partdata *parti){ glBegin(GL_POINTS); if(show_default == 1){ glColor4fv(datacopy->partclassbase->rgb); - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ if(vis[j] == 1){ glVertex3f(xplts[sx[j]], yplts[sy[j]], zplts[sz[j]]); } @@ -302,7 +302,7 @@ void DrawPart(const partdata *parti){ float *rvals; rvals = datacopy->rvals+itype*datacopy->npoints; - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ if(vis[j] == 1){ int colorj; float rval; @@ -321,7 +321,7 @@ void DrawPart(const partdata *parti){ // *** draw particles using smokeview object if(datacopy->partclassbase->vis_type == PART_SMV_DEVICE){ - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ float *colorptr; if(vis[j] != 1)continue; @@ -382,7 +382,7 @@ void DrawPart(const partdata *parti){ glBegin(GL_LINES); if(show_default == 1){ glColor4fv(datacopy->partclassbase->rgb); - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ if(vis[j] == 1){ if(flag == 1){ dx = dxv[j]; @@ -396,7 +396,7 @@ void DrawPart(const partdata *parti){ } else{ color = datacopy->irvals + itype*datacopy->npoints; - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ if(vis[j] == 1){ glColor4fv(rgb_full[color[j]]); if(flag == 1){ @@ -416,7 +416,7 @@ void DrawPart(const partdata *parti){ glBegin(GL_POINTS); if(show_default == 1){ glColor4fv(datacopy->partclassbase->rgb); - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ float zoffset; float xx, yy, zz; int loc; @@ -431,7 +431,7 @@ void DrawPart(const partdata *parti){ } else{ color = datacopy->irvals + itype*datacopy->npoints; - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ if(vis[j] == 1){ glColor4fv(rgb_full[color[j]]); glVertex3f(xplts[sx[j]], yplts[sy[j]], zplts[sz[j]]); @@ -495,7 +495,7 @@ void DrawPart(const partdata *parti){ glColor4fv(colorptr); glLineWidth(streaklinewidth); - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ int tagval; tagval = datacopy->tags[j]; @@ -523,7 +523,7 @@ void DrawPart(const partdata *parti){ // draw the streak line - for(j = 0;j < datacopy->npoints;j++){ + for(j = 0;j < datacopy->npoints;j+=partskip){ int tagval; tagval = datacopy->tags[j]; diff --git a/Source/smokeview/glui_bounds.cpp b/Source/smokeview/glui_bounds.cpp index afa7049a74..9c3654e774 100644 --- a/Source/smokeview/glui_bounds.cpp +++ b/Source/smokeview/glui_bounds.cpp @@ -2626,6 +2626,7 @@ GLUI_Panel *PANEL_slice_plot2dd = NULL;; GLUI_Panel *PANEL_slice_plot2de = NULL;; GLUI_Panel *PANEL_slice_plot2df = NULL;; +GLUI_Spinner *SPINNER_partskip = NULL; GLUI_Spinner *SPINNER_sliceval_ndigits = NULL; GLUI_Spinner *SPINNER_n_part_threads = NULL; GLUI_Spinner *SPINNER_iso_outline_ioffset = NULL; @@ -4833,14 +4834,16 @@ extern "C" void GLUIBoundsSetup(int main_window){ PANEL_partread=glui_bounds->add_panel_to_panel(ROLLOUT_particle_settings,_("Particle loading")); CHECKBOX_partfast = glui_bounds->add_checkbox_to_panel(PANEL_partread, _("Fast loading"), &partfast, PARTFAST, PartBoundCB); CHECKBOX_use_partload_threads = glui_bounds->add_checkbox_to_panel(PANEL_partread, _("Parallel loading"), &use_partload_threads); - SPINNER_n_part_threads = glui_bounds->add_spinner_to_panel(PANEL_partread, _("Files loaded at once"), GLUI_SPINNER_INT, &n_partload_threads); + SPINNER_n_part_threads = glui_bounds->add_spinner_to_panel(PANEL_partread, _("Files loaded at once:"), GLUI_SPINNER_INT, &n_partload_threads); if(npartinfo>1){ SPINNER_n_part_threads->set_int_limits(1,MIN(npartinfo,MAX_THREADS)); } else{ SPINNER_n_part_threads->set_int_limits(1,1); } + SPINNER_partskip = glui_bounds->add_spinner_to_panel(PANEL_partread, _("Particle draw skip:"), GLUI_SPINNER_INT, &partskip, PARTSKIP, PartBoundCB); PartBoundCB(PARTFAST); + PartBoundCB(PARTSKIP); } PartBoundCB(FILETYPE_INDEX); @@ -5988,6 +5991,12 @@ void PartBoundCB(int var){ } updatemenu=1; break; + case PARTSKIP: + if(partskip < 1){ + partskip = 1; + if(SPINNER_partskip!=NULL)SPINNER_partskip->set_float_val(partskip); + } + break; case TRACERS: case PARTFAST: if(npartinfo<=1){ diff --git a/Source/smokeview/glui_bounds.h b/Source/smokeview/glui_bounds.h index fba2de973a..7a525a1826 100644 --- a/Source/smokeview/glui_bounds.h +++ b/Source/smokeview/glui_bounds.h @@ -48,6 +48,7 @@ #define HIDEPATCHSURFACE 25 #define DATA_transparent 26 #define SET_GLOBAL_BOUNDS 27 +#define PARTSKIP 28 #define UNLOAD_QDATA 203 #define SET_TIME 204 #define TBOUNDS 205 diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index fa50860afe..48da507064 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -13916,6 +13916,11 @@ int ReadIni2(char *inifile, int localfile){ ONEORZERO(show_tracers_always); continue; } + if(MatchINI(buffer, "PARTSKIP") == 1){ + fgets(buffer, 255, stream); + sscanf(buffer, "%i", &partskip); + partskip = MAX(partskip, 1); + } if(MatchINI(buffer, "PART5COLOR") == 1){ for(i = 0; ivis_type); } } + fprintf(fileout, "PARTSKIP\n"); + fprintf(fileout, " %i\n", partskip); if(npropinfo>0){ fprintf(fileout, "PROPINDEX\n"); diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 5218db1f26..eab97b12b4 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -1976,7 +1976,7 @@ SVEXTERN float start_xyz0[3]; SVEXTERN int SVDECL(glui_move_mode,-1); SVEXTERN float SVDECL(timeoffset,0.0); -SVEXTERN int npartpoints, npartframes; +SVEXTERN int npartpoints, npartframes, SVDECL(partskip,1); SVEXTERN float xslicemid, yslicemid, zslicemid; SVEXTERN float delx; SVEXTERN float delz;