Skip to content

Commit

Permalink
Merge pull request firemodels#1843 from gforney/partskip
Browse files Browse the repository at this point in the history
smokeview source: add option to skip particles when drawing
  • Loading branch information
gforney authored Mar 19, 2024
2 parents d5e9e21 + 4c27166 commit e26df59
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
18 changes: 9 additions & 9 deletions Source/smokeview/IOpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]]);
}
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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){
Expand All @@ -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;
Expand All @@ -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]]);
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
11 changes: 10 additions & 1 deletion Source/smokeview/glui_bounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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){
Expand Down
1 change: 1 addition & 0 deletions Source/smokeview/glui_bounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions Source/smokeview/readsmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; i<npart5prop; i++){
partpropdata *propi;
Expand Down Expand Up @@ -16277,6 +16282,8 @@ void WriteIniLocal(FILE *fileout){
fprintf(fileout, " %i\n", partclassj->vis_type);
}
}
fprintf(fileout, "PARTSKIP\n");
fprintf(fileout, " %i\n", partskip);

if(npropinfo>0){
fprintf(fileout, "PROPINDEX\n");
Expand Down
2 changes: 1 addition & 1 deletion Source/smokeview/smokeviewvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e26df59

Please sign in to comment.