From 1be1a99c830ac5823da4c0f49f2f5d9f952df3e3 Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 2 Jun 2022 21:50:06 -0400 Subject: [PATCH 01/41] smokeview source: process all csv files --- Source/smokeview/readsmv.c | 106 +++---------------------------- Source/smokeview/smokeviewdefs.h | 5 -- Source/smokeview/structures.h | 1 + 3 files changed, 11 insertions(+), 101 deletions(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 13d1307b66..9cb4eb636b 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -6545,7 +6545,6 @@ int ReadSMV(bufferstreamdata *stream){ continue; } if(Match(buffer,"CSVF") == 1){ - int nfiles; char *file_ptr,*type_ptr; char buffer2[256]; @@ -6556,25 +6555,7 @@ int ReadSMV(bufferstreamdata *stream){ FGETS(buffer2,255,stream); TrimBack(buffer2); file_ptr=TrimFront(buffer2); - nfiles=1; - if(strcmp(type_ptr,"hrr")==0){ - if(FILE_EXISTS_CASEDIR(file_ptr)==NO)nfiles=0; - } - else if(strcmp(type_ptr,"devc")==0){ - if(FILE_EXISTS_CASEDIR(file_ptr)==NO)nfiles=0; - } - else if(strcmp(type_ptr,"ext")==0){ - if(strchr(file_ptr,'*')==NULL){ - if(FILE_EXISTS_CASEDIR(file_ptr)==NO)nfiles=0; - } - else{ - nfiles = GetFileListSize(".",file_ptr); - } - } - else{ - nfiles=0; - } - ncsvinfo+=nfiles; + if(FILE_EXISTS_CASEDIR(file_ptr)==YES)ncsvinfo++; continue; } if(Match(buffer, "CGEOM")==1){ @@ -7291,7 +7272,6 @@ int ReadSMV(bufferstreamdata *stream){ if(Match(buffer,"CSVF") == 1){ csvdata *csvi; char *type_ptr, *file_ptr; - int nfiles=1; char buffer2[256]; if(FGETS(buffer,255,stream)==NULL){ @@ -7305,84 +7285,18 @@ int ReadSMV(bufferstreamdata *stream){ } TrimBack(buffer2); file_ptr=TrimFront(buffer2); - nfiles=1; - if(strcmp(type_ptr,"hrr")==0){ - if(FILE_EXISTS_CASEDIR(file_ptr)==NO)nfiles=0; - } - else if(strcmp(type_ptr,"devc")==0){ - if(FILE_EXISTS_CASEDIR(file_ptr)==NO)nfiles=0; - } - else if(strcmp(type_ptr,"ext")==0){ - if(strchr(file_ptr,'*')==NULL){ - if(FILE_EXISTS_CASEDIR(file_ptr)==NO)nfiles=0; - } - else{ - nfiles = GetFileListSize(".",file_ptr); - } - } - else{ - nfiles=0; - } - if(nfiles==0)continue; + if(FILE_EXISTS_CASEDIR(file_ptr) == NO)continue; csvi = csvinfo + ncsvinfo; csvi->loaded=0; csvi->display=0; - if(strcmp(type_ptr,"hrr")==0){ - if(FILE_EXISTS_CASEDIR(file_ptr)==YES){ - csvi->type=CSVTYPE_HRR; - NewMemory((void **)&csvi->file,strlen(file_ptr)+1); - strcpy(csvi->file,file_ptr); - } - else{ - nfiles=0; - } - } - else if(strcmp(type_ptr,"devc")==0){ - if(FILE_EXISTS_CASEDIR(file_ptr)==YES){ - csvi->type=CSVTYPE_DEVC; - NewMemory((void **)&csvi->file,strlen(file_ptr)+1); - strcpy(csvi->file,file_ptr); - } - else{ - nfiles=0; - } - } - else if(strcmp(type_ptr,"ext")==0){ - if(strchr(file_ptr,'*')==NULL){ - if(FILE_EXISTS_CASEDIR(file_ptr)==YES){ - csvi->type=CSVTYPE_EXT; - NewMemory((void **)&csvi->file,strlen(file_ptr)+1); - strcpy(csvi->file,file_ptr); - } - else{ - nfiles=0; - } - } - else{ - filelistdata *filelist; - int nfilelist; - - nfilelist = GetFileListSize(".",file_ptr); - nfiles= MakeFileList(".",file_ptr,nfilelist,NO,&filelist); - for(i=0;iloaded=0; - csvi->display=0; - csvi->type=CSVTYPE_EXT; - NewMemory((void **)&csvi->file,strlen(filelist[i].file)+1); - strcpy(csvi->file,filelist[i].file); - } - FreeFileList(filelist,&nfilelist); - } - } - else{ - nfiles=0; - } + NewMemory((void **)&csvi->file, strlen(file_ptr) + 1); + strcpy(csvi->file, file_ptr); + strcpy(csvi->c_type, type_ptr); - ncsvinfo+=nfiles; + ncsvinfo++; continue; } /* @@ -9041,7 +8955,7 @@ int ReadSMV(bufferstreamdata *stream){ csvdata *csvi; csvi = csvinfo + i; - if(csvi->type==CSVTYPE_EXT){ + if(strcmp(csvi->c_type, "ext") == 0){ nexp_devices[i] = GetNDevices(csvi->file); ndeviceinfo_exp += nexp_devices[i]; } @@ -9061,7 +8975,7 @@ int ReadSMV(bufferstreamdata *stream){ csvdata *csvi; csvi = csvinfo + i; - if(csvi->type==CSVTYPE_EXT){ + if(strcmp(csvi->c_type, "ext") == 0){ ReadDeviceHeader(csvi->file,devicecopy2,nexp_devices[i]); devicecopy2 += nexp_devices[i]; } @@ -10704,8 +10618,8 @@ typedef struct { csvdata *csvi; csvi = csvinfo + i; - if(csvi->type==CSVTYPE_DEVC)ReadDeviceData(csvi->file,CSV_FDS,LOAD); - if(csvi->type==CSVTYPE_EXT)ReadDeviceData(csvi->file,CSV_EXP,LOAD); + if(strcmp(csvi->c_type, "devc")==0)ReadDeviceData(csvi->file,CSV_FDS,LOAD); + if(strcmp(csvi->c_type, "ext") == 0)ReadDeviceData(csvi->file,CSV_EXP,LOAD); } SetupDeviceData(); #ifdef pp_PLOT2D_NEW diff --git a/Source/smokeview/smokeviewdefs.h b/Source/smokeview/smokeviewdefs.h index a0155dd1fb..d087ea0d8b 100644 --- a/Source/smokeview/smokeviewdefs.h +++ b/Source/smokeview/smokeviewdefs.h @@ -487,11 +487,6 @@ EXTERNCPP void _Sniff_Errors(const char *whereat, const char *file, int line); #define CSV_CFAST 1 #define CSV_EXP 2 -#define CSVTYPE_HRR 1 -#define CSVTYPE_DEVC 2 -#define CSVTYPE_EXT 3 -#define CSVTYPE_NULL 0 - #define TEPS 0.00 #define PART_POINTS 1 diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index dd256d996b..84231a6e5e 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -39,6 +39,7 @@ typedef struct _csvdata { char *file; int loaded, display; int type; + char c_type[32]; } csvdata; /* -------------------------- vertdata ------------------------------------ */ From 9319dbd34a36a0f49262186aacd7d79f14350bbe Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 2 Jun 2022 21:55:23 -0400 Subject: [PATCH 02/41] smokeview souce: stop drawing current value --- Source/smokeview/IOplot2d.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index ffc1622deb..42d5de2864 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -195,26 +195,19 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ } if(label != NULL){ float p2_color[3]; - char label2[64], c_zcur[32]; char c_zmin[32], c_zmax[32]; Float2String(c_zmin, zmin, ndigits, force_fixedpoint); Float2String(c_zmax, zmax, ndigits, force_fixedpoint); - Float2String(c_zcur, z_cur, ndigits, force_fixedpoint); - strcpy(label2, label); - strcat(label2, "/"); - strcat(label2, c_zcur); p2_color[0] = (float)plot_color[0]/255.0; p2_color[1] = (float)plot_color[1]/255.0; p2_color[2] = (float)plot_color[2]/255.0; if(axis_side == AXIS_LEFT){ - Output3Text(p2_color, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label2); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmin, c_zmin); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax , c_zmax); } else{ - Output3TextRight(p2_color, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label2, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmin, c_zmin, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax , c_zmax, pad_length); } From 7bc9643df48f14b737dcf60f3b2add700582b9ba Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 2 Jun 2022 22:02:54 -0400 Subject: [PATCH 03/41] smokeview source: remove unused variables --- Source/smokeview/IOplot2d.c | 5 ----- Source/smokeview/readsmv.c | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 42d5de2864..1838636a46 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -194,15 +194,10 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ SNIFF_ERRORS("after DrawGenCurve 4"); } if(label != NULL){ - float p2_color[3]; char c_zmin[32], c_zmax[32]; Float2String(c_zmin, zmin, ndigits, force_fixedpoint); Float2String(c_zmax, zmax, ndigits, force_fixedpoint); - - p2_color[0] = (float)plot_color[0]/255.0; - p2_color[1] = (float)plot_color[1]/255.0; - p2_color[2] = (float)plot_color[2]/255.0; if(axis_side == AXIS_LEFT){ Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmin, c_zmin); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax , c_zmax); diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 9cb4eb636b..4af2b1bba4 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -6545,12 +6545,11 @@ int ReadSMV(bufferstreamdata *stream){ continue; } if(Match(buffer,"CSVF") == 1){ - char *file_ptr,*type_ptr; + char *file_ptr; char buffer2[256]; FGETS(buffer,255,stream); TrimBack(buffer); - type_ptr=TrimFront(buffer); FGETS(buffer2,255,stream); TrimBack(buffer2); From 6750a5d5094f5dc2822db19883b6695ea3493eba Mon Sep 17 00:00:00 2001 From: gforney Date: Mon, 13 Jun 2022 21:28:00 -0400 Subject: [PATCH 04/41] smokeview source: change some 'csv' variable names to make the code clearer --- Source/smokeview/readsmv.c | 48 ++++++++++++++++---------------- Source/smokeview/smokeviewvars.h | 4 +-- Source/smokeview/structures.h | 7 +++-- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 4af2b1bba4..6cc8d36e22 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -6165,16 +6165,16 @@ int ReadSMV(bufferstreamdata *stream){ ntotal_blockages=0; - if(ncsvinfo>0){ - csvdata *csvi; + if(ncsvfileinfo>0){ + csvfiledata *csvi; - for(i=0;ifile); } - FREEMEMORY(csvinfo); + FREEMEMORY(csvfileinfo); } - ncsvinfo=0; + ncsvfileinfo=0; if(ngeominfo>0){ for(i=0;i0&&nmeshes>0)nisos_per_mesh = MAX(nisoinfo / nmeshes,1); - if(ncsvinfo > 0){ - NewMemory((void **)&csvinfo,ncsvinfo*sizeof(csvdata)); - ncsvinfo=0; + if(ncsvfileinfo > 0){ + NewMemory((void **)&csvfileinfo,ncsvfileinfo*sizeof(csvfiledata)); + ncsvfileinfo=0; } if(ngeominfo>0){ NewMemory((void **)&geominfo,ngeominfo*sizeof(geomdata)); @@ -7269,7 +7269,7 @@ int ReadSMV(bufferstreamdata *stream){ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ if(Match(buffer,"CSVF") == 1){ - csvdata *csvi; + csvfiledata *csvi; char *type_ptr, *file_ptr; char buffer2[256]; @@ -7286,7 +7286,7 @@ int ReadSMV(bufferstreamdata *stream){ file_ptr=TrimFront(buffer2); if(FILE_EXISTS_CASEDIR(file_ptr) == NO)continue; - csvi = csvinfo + ncsvinfo; + csvi = csvfileinfo + ncsvfileinfo; csvi->loaded=0; csvi->display=0; @@ -7295,7 +7295,7 @@ int ReadSMV(bufferstreamdata *stream){ strcpy(csvi->file, file_ptr); strcpy(csvi->c_type, type_ptr); - ncsvinfo++; + ncsvfileinfo++; continue; } /* @@ -8945,15 +8945,15 @@ int ReadSMV(bufferstreamdata *stream){ // look for DEVICE entries in "experimental" spread sheet files - if(ncsvinfo>0){ + if(ncsvfileinfo>0){ int *nexp_devices=NULL; devicedata *devicecopy2; - NewMemory((void **)&nexp_devices,ncsvinfo*sizeof(int)); - for(i=0;ic_type, "ext") == 0){ nexp_devices[i] = GetNDevices(csvi->file); ndeviceinfo_exp += nexp_devices[i]; @@ -8970,10 +8970,10 @@ int ReadSMV(bufferstreamdata *stream){ devicecopy2 = deviceinfo+ndeviceinfo; ndeviceinfo+=ndeviceinfo_exp; - for(i=0;ic_type, "ext") == 0){ ReadDeviceHeader(csvi->file,devicecopy2,nexp_devices[i]); devicecopy2 += nexp_devices[i]; @@ -10613,10 +10613,10 @@ typedef struct { if(hrr_csv_filename!=NULL)ReadHRR(LOAD); ReadDeviceData(NULL,CSV_FDS,UNLOAD); ReadDeviceData(NULL,CSV_EXP,UNLOAD); - for(i=0;ic_type, "devc")==0)ReadDeviceData(csvi->file,CSV_FDS,LOAD); if(strcmp(csvi->c_type, "ext") == 0)ReadDeviceData(csvi->file,CSV_EXP,LOAD); } diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 3c16244bef..f3dc93304e 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -898,8 +898,8 @@ SVEXTERN int SVDECL(qradi_col, -1), SVDECL(chirad_col, -1), SVDECL(nhrrhcinfo, 0 SVEXTERN int SVDECL(have_mlr, 0); SVEXTERN int SVDECL(hoc_hrr, 0); SVEXTERN int SVDECL(update_avg, 0); -SVEXTERN int SVDECL(ncsvinfo,0); -SVEXTERN csvdata SVDECL(*csvinfo,NULL); +SVEXTERN int SVDECL(ncsvfileinfo,0); +SVEXTERN csvfiledata SVDECL(*csvfileinfo,NULL); SVEXTERN int smoke_render_option; SVEXTERN float fnear, ffar; SVEXTERN float partfacedir[3]; diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 84231a6e5e..5d4af25e27 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -33,14 +33,15 @@ typedef struct _procdata { int rollout_id; } procdata; #endif -/* -------------------------- csvdata ------------------------------------ */ -typedef struct _csvdata { +/* -------------------------- _csvfiledata ------------------------------------ */ + +typedef struct _csvfiledata { char *file; int loaded, display; int type; char c_type[32]; -} csvdata; +} csvfiledata; /* -------------------------- vertdata ------------------------------------ */ From 045892891e54e88f310244d666b5c3bd06f428af Mon Sep 17 00:00:00 2001 From: gforney Date: Tue, 14 Jun 2022 21:58:29 -0400 Subject: [PATCH 05/41] smokeview source: fix to parsing csv files when 1 or more ',' occur at tthe beginning of a line --- Source/shared/string_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/shared/string_util.c b/Source/shared/string_util.c index 6acb9151e0..c07d37146a 100644 --- a/Source/shared/string_util.c +++ b/Source/shared/string_util.c @@ -110,7 +110,7 @@ void ParseCSV(char *buffer, char **tokens, int *ntokens){ if(inside_quote==0&&buffer[i]==',')buffer[i]=0; } tokens[nt++]=buffer; - for(i=1;i Date: Tue, 14 Jun 2022 22:31:09 -0400 Subject: [PATCH 06/41] smokeview source: preliminary code to generalize 2d plot selection --- Source/smokeview/glui_objects.cpp | 25 ++++- Source/smokeview/options.h | 1 + Source/smokeview/readsmv.c | 163 +++++++++++++++++++++++++++++- Source/smokeview/smokeheaders.h | 3 + Source/smokeview/smokeviewvars.h | 3 + Source/smokeview/structures.h | 15 ++- 6 files changed, 205 insertions(+), 5 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index baa320ae3d..cda7dd22ab 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -44,6 +44,9 @@ #define GENPLOT_SET_POS 116 #define GENPLOT_SELECT_DEVICE_CLICK 117 #define GENPLOT_SELECT_HRR_CLICK 118 +#ifdef pp_PLOT2D_GEN +#define GENPLOT_SELECT_CSV_FILE 119 +#endif #define PLOT2D_DEV 0 #define PLOT2D_HRR 1 @@ -116,6 +119,9 @@ GLUI_Checkbox *CHECKBOX_vis_hrr_plot=NULL; GLUI_EditText *EDIT_filter=NULL; +#ifdef pp_PLOT2D_GEN +GLUI_Listbox *LIST_csvfile = NULL; +#endif #ifdef pp_PLOT2D_NEW GLUI_Listbox *LIST_devID1 = NULL; GLUI_Listbox *LIST_devunit1 = NULL; @@ -786,6 +792,10 @@ void GenPlotCB(int var){ int index; curvedata *curve; +#ifdef pp_PLOT2D_GEN + case GENPLOT_SELECT_CSV_FILE: + break; +#endif case GENPLOT_SELECT_DEVICE_CLICK: GenPlotCB(GENPLOT_SELECT_DEVICE); index = LIST_devID1->get_int_val(); @@ -1472,6 +1482,17 @@ extern "C" void GluiDeviceSetup(int main_window){ PANEL_plot5 = glui_device->add_panel_to_panel(ROLLOUT_plotgeneral, "", 0); PANEL_add_curve = glui_device->add_panel_to_panel(PANEL_plot5, "add/remove curves"); +#ifdef pp_PLOT2D_GEN + if(ncsvfileinfo > 0){ + LIST_csvfile = glui_device->add_listbox_to_panel(PANEL_plot9, "csv file type:", &glui_csv_type, GENPLOT_SELECT_CSV_FILE, GenPlotCB); + for(i = 0; i < ncsvfileinfo; i++){ + csvfiledata *csvfi; + + csvfi = csvfileinfo + i; + LIST_csvfile->add_item(i, csvfi->c_type); + } + } +#else if(ndevicetypes > 0){ PANEL_plotgeneral_device = glui_device->add_panel_to_panel(PANEL_add_curve, "", false); PANEL_plotdevice_select = glui_device->add_panel_to_panel(PANEL_plotgeneral_device, "", false); @@ -1516,9 +1537,9 @@ extern "C" void GluiDeviceSetup(int main_window){ LIST_hrrunit1->add_item(i, hrrunits[i]->label.unit); } GenPlotCB(GENPLOT_SELECT_HRR); - glui_device->add_button_to_panel(PANEL_plotgeneral_hrr, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); - } +#endif + glui_device->add_button_to_panel(PANEL_add_curve, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); if(nplot2dinfo==0){ if(PANEL_add_curve!=NULL)PANEL_add_curve->disable(); if(PANEL_plot_position!=NULL)PANEL_plot_position->disable(); diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index dd8e746836..d410f25f2b 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -17,6 +17,7 @@ //*** options: all platforms +//#define pp_PLOT2D_GEN // general 2d plot #define pp_PLOT2D_NEW // allow multiple curves on a device 2d plot #define pp_PLOT2D_OVERLAP // allow scene to overlap 2d plot region #define pp_PART_MULTI // load particles in parallel diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 6cc8d36e22..0e61d23518 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -148,6 +148,157 @@ void UpdateHoc(void){ } } +/* ------------------ ReadCSV ------------------------ */ +#ifdef pp_PLOT2D_GEN +void ReadCSV(csvfiledata *csvfi, int flag){ + FILE *stream; + int nrows, ncols; + int nunits, nlabels; + char buffer[LENBUFFER], buffer_labels[LENBUFFER], buffer_units[LENBUFFER]; + char **labels, **units; + float *vals; + int *valids; + int i; + + for(i=0; incsvinfo; i++){ + csvdata *ci; + + ci = csvfi->csvinfo + i; + FREEMEMORY(ci->vals); + FREEMEMORY(ci->vals_orig); + } + FREEMEMORY(csvfi->csvinfo); + if(flag == UNLOAD)return; + + stream = fopen(csvfi->file, "r"); + if(stream == NULL)return; + + GetRowCols(stream, &nrows, &ncols); + csvfi->ncsvinfo = ncols; + + // allocate memory + + NewMemory((void **)&(csvfi->csvinfo), csvfi->ncsvinfo*sizeof(csvdata)); + NewMemory((void **)&labels, csvfi->ncsvinfo*sizeof(char *)); + NewMemory((void **)&units, csvfi->ncsvinfo*sizeof(char *)); + NewMemory((void **)&vals, csvfi->ncsvinfo*sizeof(float)); + NewMemory((void **)&valids, csvfi->ncsvinfo*sizeof(int)); + + // initialize each column + for(i=0; incsvinfo; i++){ + csvdata *ci; + + ci = csvfi->csvinfo + i; + ci->nvals = nrows-2; + NewMemory((void **)&ci->vals, ci->nvals*sizeof(csvdata)); + NewMemory((void **)&ci->vals_orig, ci->nvals*sizeof(csvdata)); + } + CheckMemory; + + // setup labels and units + + fgets(buffer_units, LENBUFFER, stream); + TrimBack(buffer_units); + ParseCSV(buffer_units, units, &nunits); + + fgets(buffer_labels, LENBUFFER, stream); + TrimBack(buffer_labels); + ParseCSV(buffer_labels, labels, &nlabels); + CheckMemory; + + for(i=0; incsvinfo; i++){ + csvdata *ci; + + ci = csvfi->csvinfo + i; + TrimBack(labels[i]); + TrimBack(units[i]); + SetLabels(&(ci->label), labels[i], labels[i], units[i]); + } + CheckMemory; + + // find Time column index + + csvfi->time = NULL; + for(i=0; incsvinfo; i++){ + csvdata *ci; + + ci = csvfi->csvinfo + i; + if(strcmp(ci->label.shortlabel, "Time") == 0){ + csvfi->time = ci; + break; + } + } + + for(i = 0; i < csvfi->ncsvinfo; i++){ + csvdata *ci; + float valmin, valmax; + int j; + + ci = csvfi->csvinfo + i; + ci->valmin = 1.0; + ci->valmax = 0.0; + } + // read in data + int irow; + irow = 0; + while(!feof(stream)){ + if(fgets(buffer, LENBUFFER, stream) == NULL)break; + TrimBack(buffer); + if(strlen(buffer) == 0)break; + int nvals; + FParseCSV(buffer, vals, valids, ncols, &nvals); + if(nvals < ncols)break; + for(i=0; incsvinfo; i++){ + csvdata *ci; + + ci = csvfi->csvinfo + i; + ci->vals[irow] = 0.0; + if(valids[i] == 1){ + ci->vals[irow] = vals[i]; + if(ci->valmin > ci->valmax){ + ci->valmin = vals[i]; + ci->valmax = vals[i]; + } + else{ + ci->valmin = MIN(ci->valmin, vals[i]); + ci->valmax = MAX(ci->valmax, vals[i]); + } + } + } + irow++; + if(irow >= nrows)break; + } + CheckMemory; + + //copy vals into vals_orig + for(i=0; incsvinfo; i++){ + csvdata *ci; + + ci = csvfi->csvinfo + i; + memcpy(ci->vals_orig, ci->vals, ci->nvals*sizeof(float)); + } + + CheckMemory; + FREEMEMORY(units); + FREEMEMORY(labels); + FREEMEMORY(vals); + FREEMEMORY(valids); + fclose(stream); +} + +/* ------------------ ReadAllCSV ------------------------ */ + +void ReadAllCSV(int flag){ + int i; + + for(i=0; iloaded=0; - csvi->display=0; + csvi->loaded = 0; + csvi->display = 0; +#ifdef pp_PLOT2D_GEN + csvi->time = NULL; + csvi->ncsvinfo = 0; + csvi->csvinfo = NULL; +#endif NewMemory((void **)&csvi->file, strlen(file_ptr) + 1); strcpy(csvi->file, file_ptr); @@ -10621,6 +10777,9 @@ typedef struct { if(strcmp(csvi->c_type, "ext") == 0)ReadDeviceData(csvi->file,CSV_EXP,LOAD); } SetupDeviceData(); +#ifdef pp_PLOT2D_GEN + ReadAllCSV(LOAD); +#endif #ifdef pp_PLOT2D_NEW SetupPlot2DUnitData(); #endif diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 2e763287ba..85839fff8a 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -14,6 +14,9 @@ EXTERNCPP int HaveGenDev(void); EXTERNCPP int HaveGenHrr(void); EXTERNCPP void ShowPlot2D(void); #endif +#ifdef pp_PLOT2D_GEN +EXTERNCPP void ReadAllCSV(int flag); +#endif EXTERNCPP void TimeAveragePlot2DData(float *times, float *vals, float *vals_avg, int nvals); diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index f3dc93304e..fa715f980c 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -1529,6 +1529,9 @@ SVEXTERN int SVDECL(ndeviceinfo,0),nvdeviceinfo,ndeviceinfo_exp; SVEXTERN float max_dev_vel; SVEXTERN int SVDECL(last_prop_display,-1); SVEXTERN int SVDECL(devicetypes_index,0); +#ifdef pp_PLOT2D_GEN +SVEXTERN int SVDECL(glui_csv_type, 0); +#endif #ifdef pp_PLOT2D_NEW SVEXTERN int SVDECL(deviceunits_index, 0); SVEXTERN int SVDECL(plot2d_dialogs_defined, 0); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 5d4af25e27..97820fcce7 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -34,12 +34,25 @@ typedef struct _procdata { } procdata; #endif +/* -------------------------- csvdata ------------------------------------ */ +#ifdef pp_PLOT2D_GEN +typedef struct _csvdata{ + flowlabels label; + float val, *vals, *vals_orig; + float valmin, valmax; + int nvals; +} csvdata; +#endif + /* -------------------------- _csvfiledata ------------------------------------ */ typedef struct _csvfiledata { char *file; +#ifdef pp_PLOT2D_GEN + csvdata *csvinfo, *time; + int ncsvinfo; +#endif int loaded, display; - int type; char c_type[32]; } csvfiledata; From 0e1e3cd82b01698ab366c1b3f9422750aea4d471 Mon Sep 17 00:00:00 2001 From: gforney Date: Tue, 14 Jun 2022 22:38:33 -0400 Subject: [PATCH 07/41] smokeview source: remove unused variables --- Source/smokeview/readsmv.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 0e61d23518..2ec9d4b78d 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -231,8 +231,6 @@ void ReadCSV(csvfiledata *csvfi, int flag){ for(i = 0; i < csvfi->ncsvinfo; i++){ csvdata *ci; - float valmin, valmax; - int j; ci = csvfi->csvinfo + i; ci->valmin = 1.0; @@ -292,8 +290,6 @@ void ReadAllCSV(int flag){ int i; for(i=0; i Date: Wed, 15 Jun 2022 19:39:39 -0400 Subject: [PATCH 08/41] smokeview source: interim update to general 2d plot dialog box --- Source/smokeview/glui_objects.cpp | 154 +++++++++++++++++++++++++++++- Source/smokeview/readsmv.c | 40 +++++++- Source/smokeview/smokeviewvars.h | 2 + Source/smokeview/structures.h | 1 + 4 files changed, 191 insertions(+), 6 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index cda7dd22ab..fd8c94a900 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -46,6 +46,8 @@ #define GENPLOT_SELECT_HRR_CLICK 118 #ifdef pp_PLOT2D_GEN #define GENPLOT_SELECT_CSV_FILE 119 +#define GENPLOT_CSV_TYPE 120 +#define GENPLOT_SELECT_CSV_CLICK 121 #endif #define PLOT2D_DEV 0 @@ -121,6 +123,8 @@ GLUI_EditText *EDIT_filter=NULL; #ifdef pp_PLOT2D_GEN GLUI_Listbox *LIST_csvfile = NULL; +GLUI_Listbox *LIST_csvID = NULL; +GLUI_Listbox *LIST_csvunits = NULL; #endif #ifdef pp_PLOT2D_NEW GLUI_Listbox *LIST_devID1 = NULL; @@ -134,6 +138,10 @@ GLUI_Listbox *LIST_devicetypes = NULL; GLUI_Listbox *LIST_open=NULL; GLUI_Listbox *LIST_hrrdata=NULL; +#ifdef pp_PLOT2D_GEN +GLUI_Panel *PANEL_csv = NULL; +GLUI_Panel *PANEL_csv2 = NULL; +#endif #ifdef pp_PLOT2D_NEW GLUI_Panel *PANEL_curve_color = NULL; GLUI_Panel *PANEL_curve_bounds = NULL; @@ -147,13 +155,14 @@ GLUI_Panel *PANEL_add_curve = NULL; GLUI_Panel *PANEL_plot5 = NULL; GLUI_Panel *PANEL_plots = NULL; GLUI_Panel *PANEL_plot8 = NULL; +#ifndef pp_PLOT2D_GEN GLUI_Panel *PANEL_plot9 = NULL; GLUI_Panel *PANEL_plot10 = NULL; - GLUI_Panel *PANEL_plotdevice_select = NULL; GLUI_Panel *PANEL_plotgeneral_device = NULL; GLUI_Panel *PANEL_plotgeneral_hrr = NULL; GLUI_Panel *PANEL_plotgeneral_plot = NULL; +#endif GLUI_Panel *PANEL_plot_position = NULL; #endif GLUI_Panel *PANEL_hrr_min = NULL; @@ -784,6 +793,133 @@ extern "C" void ShowPlot2D(void){ } } +#ifdef pp_PLOT2D_GEN +/* ------------------ FilterList ------------------------ */ + +void FilterList(void){ + int i; + char label[256]; + + char unit_label[256]; + int unit_id; + + for(i=0; idelete_item(i); + } + { + csvfiledata *csvfi; + + csvfi = csvfileinfo + glui_csv_type; + unit_id = LIST_csvunits->get_int_val(); + strcpy(unit_label, "all"); + if(unit_id >= 0){ + csvdata *csvunit; + + csvunit = csvfi->csvinfo + unit_id; + if(csvunit->dimensionless == 0){ + strcpy(unit_label, csvunit->label.unit); + } + else{ + strcpy(unit_label, "dimensionless"); + } + } + for(i = 0; i < csvfi->ncsvinfo; i++){ + csvdata *csvi; + + csvi = csvfi->csvinfo + i; + if(csvi == csvfi->time)continue; + if(strcmp(unit_label, "all") == 0){ + LIST_csvID->add_item(i, csvi->label.shortlabel); + continue; + } + if(csvi->dimensionless == 1 && strcmp(unit_label, "dimensionless")==0){ + LIST_csvID->add_item(i, csvi->label.shortlabel); + continue; + } + if(csvi->dimensionless == 0 && strcmp(unit_label, csvi->label.unit) == 0){ + LIST_csvID->add_item(i, csvi->label.shortlabel); + continue; + } + } + } +} + +/* ------------------ UpdateCvsList ------------------------ */ + +void UpdateCvsList(void){ + int i; + char label[256]; + + for(i=0; idelete_item(i); + } + { + csvfiledata *csvfi; + + csvfi = csvfileinfo + glui_csv_type; + for(i = 0; i < csvfi->ncsvinfo; i++){ + csvdata *csvi; + + csvi = csvfi->csvinfo + i; + if(csvi == csvfi->time)continue; + LIST_csvID->add_item(i, csvi->label.shortlabel); + } + strcpy(label, "add/remove "); + strcat(label, csvfi->c_type); + strcat(label, " data"); + LIST_csvID->set_name(label); + } + + for(i=0; idelete_item(i); + } + { + csvfiledata *csvfi; + + csvfi = csvfileinfo + glui_csv_type; + for(i = 0; i < csvfi->ncsvinfo; i++){ + csvdata *csvi; + int dup_unit, j; + + dup_unit = 0; + csvi = csvfi->csvinfo + i; + if(csvi == csvfi->time)continue; + for(j=0; jcsvinfo + j; + if(csvj == csvfi->time)continue; + if(csvi->dimensionless==0){ + if(strcmp(csvi->label.unit, csvj->label.unit) == 0){ + dup_unit = 1; + break; + } + } + else{ + if(csvj->dimensionless==1){ + dup_unit = 1; + break; + } + } + } + if(dup_unit == 0){ + if(csvi->dimensionless==0){ + LIST_csvunits->add_item(i, csvi->label.unit); + } + else{ + LIST_csvunits->add_item(i, "dimensionless"); + } + } + } + strcpy(label, "add/remove "); + strcat(label, csvfi->c_type); + strcat(label, " data"); + LIST_csvID->set_name(label); + LIST_csvunits->set_int_val(-1); + } +} +#endif + /* ------------------ GenPlotCB ------------------------ */ void GenPlotCB(int var){ @@ -793,7 +929,13 @@ void GenPlotCB(int var){ curvedata *curve; #ifdef pp_PLOT2D_GEN + case GENPLOT_SELECT_CSV_CLICK: + break; case GENPLOT_SELECT_CSV_FILE: + UpdateCvsList(); + break; + case GENPLOT_CSV_TYPE: + FilterList(); break; #endif case GENPLOT_SELECT_DEVICE_CLICK: @@ -1484,13 +1626,21 @@ extern "C" void GluiDeviceSetup(int main_window){ #ifdef pp_PLOT2D_GEN if(ncsvfileinfo > 0){ - LIST_csvfile = glui_device->add_listbox_to_panel(PANEL_plot9, "csv file type:", &glui_csv_type, GENPLOT_SELECT_CSV_FILE, GenPlotCB); + PANEL_csv = glui_device->add_panel_to_panel(PANEL_add_curve, "", 0); + LIST_csvfile = glui_device->add_listbox_to_panel(PANEL_csv, "curve type:", &glui_csv_type, GENPLOT_SELECT_CSV_FILE, GenPlotCB); for(i = 0; i < ncsvfileinfo; i++){ csvfiledata *csvfi; csvfi = csvfileinfo + i; LIST_csvfile->add_item(i, csvfi->c_type); } + PANEL_csv2 = glui_device->add_panel_to_panel(PANEL_add_curve, "", 0); + LIST_csvID = glui_device->add_listbox_to_panel(PANEL_csv2, "add/remove csv file data:", &icsv_cols, GENPLOT_SELECT_CSV_CLICK, GenPlotCB); + glui_device->add_column_to_panel(PANEL_csv2, false); + LIST_csvunits = glui_device->add_listbox_to_panel(PANEL_csv2, "", &icsv_units, GENPLOT_CSV_TYPE, GenPlotCB); + LIST_csvunits->add_item(-1, "all"); + GenPlotCB(GENPLOT_SELECT_CSV_FILE); + GenPlotCB(GENPLOT_CSV_TYPE); } #else if(ndevicetypes > 0){ diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 2ec9d4b78d..774ea505c2 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -148,13 +148,35 @@ void UpdateHoc(void){ } } -/* ------------------ ReadCSV ------------------------ */ #ifdef pp_PLOT2D_GEN + +/* ------------------ ReadCSV ------------------------ */ + +int IsDimensionless(char *unit){ +// unit is dimensionless if unit is NULL, unit is blank or +// the same characters occur before and after the first slash '/' + char *slash, *tok1, *tok2; + char unit2[64]; + + if(unit==NULL || strlen(unit)==0)return 1; + strcpy(unit2, unit); + slash = strchr(unit2, '/'); + if(slash == NULL)return 0; + tok1 = unit2; + tok2 = slash+1; + slash[0]=0; + if(strcmp(tok1, tok2)==0)return 1; + return 0; +} + +/* ------------------ ReadCSV ------------------------ */ + void ReadCSV(csvfiledata *csvfi, int flag){ FILE *stream; int nrows, ncols; int nunits, nlabels; char buffer[LENBUFFER], buffer_labels[LENBUFFER], buffer_units[LENBUFFER]; + char *buffptr; char **labels, **units; float *vals; int *valids; @@ -206,13 +228,23 @@ void ReadCSV(csvfiledata *csvfi, int flag){ ParseCSV(buffer_labels, labels, &nlabels); CheckMemory; + plot2d_max_columns = MAX(plot2d_max_columns, csvfi->ncsvinfo); for(i=0; incsvinfo; i++){ csvdata *ci; + char label[64]; + char *unit; ci = csvfi->csvinfo + i; TrimBack(labels[i]); - TrimBack(units[i]); - SetLabels(&(ci->label), labels[i], labels[i], units[i]); + strcpy(label, labels[i]); + buffptr = TrimFrontBack(label); + if(strcmp(buffptr, "null") == 0){ + sprintf(label, "%s%03i", csvfi->c_type, i + 1); + } + + unit = TrimFrontBack(units[i]); + ci->dimensionless = IsDimensionless(unit); + SetLabels(&(ci->label), label, label, unit); } CheckMemory; @@ -223,7 +255,7 @@ void ReadCSV(csvfiledata *csvfi, int flag){ csvdata *ci; ci = csvfi->csvinfo + i; - if(strcmp(ci->label.shortlabel, "Time") == 0){ + if(strcmp(ci->label.shortlabel, "Time") == 0 || strcmp(ci->label.shortlabel, "Simulation Time") == 0){ csvfi->time = ci; break; } diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index fa715f980c..5dffdfad3b 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -1531,6 +1531,8 @@ SVEXTERN int SVDECL(last_prop_display,-1); SVEXTERN int SVDECL(devicetypes_index,0); #ifdef pp_PLOT2D_GEN SVEXTERN int SVDECL(glui_csv_type, 0); +SVEXTERN int SVDECL(icsv_cols, 0), SVDECL(icsv_units, 0); +SVEXTERN int SVDECL(plot2d_max_columns, 0); #endif #ifdef pp_PLOT2D_NEW SVEXTERN int SVDECL(deviceunits_index, 0); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 97820fcce7..a0a776693d 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -41,6 +41,7 @@ typedef struct _csvdata{ float val, *vals, *vals_orig; float valmin, valmax; int nvals; + int dimensionless; } csvdata; #endif From ff46f94091ba97cf9ff1acc41dae6de331a27b5e Mon Sep 17 00:00:00 2001 From: gforney Date: Wed, 15 Jun 2022 19:42:42 -0400 Subject: [PATCH 09/41] smokeview source: remove unused variable --- Source/smokeview/glui_objects.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index fd8c94a900..f7e993849e 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -798,7 +798,6 @@ extern "C" void ShowPlot2D(void){ void FilterList(void){ int i; - char label[256]; char unit_label[256]; int unit_id; From d1189abbc90cec01fda13c69d44e541aa5954471 Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 16 Jun 2022 21:31:14 -0400 Subject: [PATCH 10/41] smokeview source: preliminary working version of general 2d plots --- Source/smokeview/IOplot2d.c | 220 ++++++++++++++++++++++++++---- Source/smokeview/glui_objects.cpp | 165 ++++++++++++++++------ Source/smokeview/readsmv.c | 10 +- Source/smokeview/smokeheaders.h | 2 + Source/smokeview/structures.h | 12 +- 5 files changed, 335 insertions(+), 74 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 1838636a46..d30df4d191 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -20,7 +20,7 @@ int GenDevShow(void){ if(plot2di->show == 1){ int j; - for(j = 0; j < plot2di->ncurve_indexes; j++){ + for(j = 0; j < plot2di->ncurves; j++){ if(plot2di->curve[j].indexshow == 1){ int j; - for(j = 0; j < plot2di->ncurve_indexes; j++){ + for(j = 0; j < plot2di->ncurves; j++){ if(plot2di->curve[j].index>=ndeviceinfo)return 1; } } @@ -53,7 +53,7 @@ int GenHrrShow(void){ int HaveGenDev(void){ int i; - for(i = 0; incurve_indexes; i++){ + for(i = 0; incurves; i++){ if(glui_plot2dinfo->curve[i].indexncurve_indexes; i++){ + for(i = 0; incurves; i++){ if(glui_plot2dinfo->curve[i].index>=ndeviceinfo)return 1; } return 0; @@ -85,6 +85,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ int *plot_color, use_plot_factors, show_title; char *title; + SNIFF_ERRORS("after DrawGenCurve 1 - beginning"); xyz0 = plot2di->xyz; plot_color = curve->color; linewidth_arg = curve->linewidth; @@ -125,6 +126,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ glTranslatef(-xmin, 0.0, -zmin); glColor3ub((unsigned char)plot_color[0], (unsigned char)plot_color[1], (unsigned char)plot_color[2] ); glLineWidth(linewidth_arg); + SNIFF_ERRORS("after DrawGenCurve 1 - before"); glBegin(GL_LINES); if(use_plot_factors == 1){ for(i = 0; i < n - 1; i++){ @@ -139,7 +141,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ } } glEnd(); - SNIFF_ERRORS("after DrawGenCurve 1"); + SNIFF_ERRORS("after DrawGenCurve 1 - after"); if(option == PLOT_ALL){ glColor3fv(foregroundcolor); glLineWidth(plot2d_line_width); @@ -221,9 +223,67 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ SNIFF_ERRORS("after DrawGenCurve end"); } + +#ifdef pp_PLOT2D_GEN +/* ------------------ GetPlotUnit ------------------------ */ + +char *GetPlotUnit(plot2ddata *plot2di, int i){ + csvfiledata *csvfi; + csvdata *csvi; + int fcurve_index, curve_index; + char *unit; + + curve_index = plot2di->curve[i].index; + fcurve_index = plot2di->curve[i].f_index; + csvfi = csvfileinfo + fcurve_index; + csvi = csvfi->csvinfo + curve_index; + unit = csvi->label.unit; + return unit; +} + +/* ------------------ GetPlotShortLabel ------------------------ */ + +char *GetPlotShortLabel(plot2ddata *plot2di, int i){ + csvfiledata *csvfi; + csvdata *csvi; + int fcurve_index, curve_index; + char *shortlabel; + + curve_index = plot2di->curve[i].index; + fcurve_index = plot2di->curve[i].f_index; + csvfi = csvfileinfo + fcurve_index; + csvi = csvfi->csvinfo + curve_index; + shortlabel = csvi->label.shortlabel; + return shortlabel; +} + +/* ------------------ GetCSVVal ------------------------ */ + +float GetCSVVal(float t, float *times, float *vals, int nvals){ + int beg, mid, end; + float val_beg, val_mid, val_end; + + if(ttimes[nvals-1])return vals[nvals-1]; + beg = 0; + end = nvals-1; + mid = (beg+end)/2; + while(end-beg>1){ + mid = (beg+end)/2; + if(tncurve_indexes; i++){ - int curve_index; + void UpdateCurveBounds(plot2ddata*plot2di, int flag); +#ifdef pp_PLOT2D_GEN + if(plot2di->bounds_defined==0)UpdateCurveBounds(plot2di, 1); +#endif + for(i = 0; incurves; i++){ char *unit; +#ifdef pp_PLOT2D_GEN + unit = GetPlotUnit(plot2di, i); +#else + int curve_index; curve_index = plot2di->curve[i].index; if(curve_index < ndeviceinfo){ unit = deviceinfo[curve_index].unit; @@ -244,6 +311,7 @@ void DrawGenPlot(plot2ddata * plot2di){ else{ unit = hrrinfo[curve_index - ndeviceinfo].label.unit; } +#endif if(unit==NULL||strlen(unit)==0)continue; if(axis_right_unit == NULL){ axis_right_unit = unit; @@ -254,10 +322,14 @@ void DrawGenPlot(plot2ddata * plot2di){ break; } } - for(i = 0; i < plot2di->ncurve_indexes; i++){ - int curve_index; + for(i = 0; i < plot2di->ncurves; i++){ char *unit, *label; +#ifdef pp_PLOT2D_GEN + unit = GetPlotUnit(plot2di, i); + label = GetPlotShortLabel(plot2di, i); +#else + int curve_index; curve_index = plot2di->curve[i].index; if(curve_index < ndeviceinfo){ unit = deviceinfo[curve_index].unit; @@ -266,7 +338,8 @@ void DrawGenPlot(plot2ddata * plot2di){ else{ unit = hrrinfo[curve_index - ndeviceinfo].label.unit; label = hrrinfo[curve_index - ndeviceinfo].label.shortlabel; - } + } +#endif if(unit == NULL || strlen(unit) == 0)continue; if(axis_right_unit != NULL && strcmp(axis_right_unit, unit) == 0){ unit_right_index = i; @@ -278,22 +351,32 @@ void DrawGenPlot(plot2ddata * plot2di){ continue; } } - for(i = 0; i < plot2di->ncurve_indexes; i++){ + for(i = 0; i < plot2di->ncurves; i++){ +#ifndef pp_PLOT2D_GEN int curve_index; +#endif float valmin, valmax; char *unit; curvedata *curve; +#ifdef pp_PLOT2D_GEN + curve = plot2di->curve+i; +#else curve_index = plot2di->curve[i].index; curve = plot2di->curve + curve_index; +#endif valmin = curve->valmin; valmax = curve->valmax; +#ifdef pp_PLOT2D_GEN + unit = GetPlotUnit(plot2di, i); +#else if(curve_index < ndeviceinfo){ unit = deviceinfo[curve_index].unit; } else{ unit = hrrinfo[curve_index - ndeviceinfo].label.unit; } +#endif if(axis_right_unit!=NULL&&strcmp(unit, axis_right_unit) == 0){ if(axis_right_min>axis_right_max){ axis_right_min = valmin; @@ -315,7 +398,7 @@ void DrawGenPlot(plot2ddata * plot2di){ } } } - for(i = 0; incurve_indexes; i++){ + for(i = 0; incurves; i++){ int curve_index; float highlight_time, highlight_val; int valid; @@ -326,6 +409,9 @@ void DrawGenPlot(plot2ddata * plot2di){ curvedata *curve; if(axis_right_unit == NULL)break; +#ifdef pp_PLOT2D_GEN + unit = GetPlotUnit(plot2di, i); +#else curve_index = plot2di->curve[i].index; curve = plot2di->curve + curve_index; if(curve_index < ndeviceinfo){ @@ -334,6 +420,7 @@ void DrawGenPlot(plot2ddata * plot2di){ else{ unit = hrrinfo[curve_index - ndeviceinfo].label.unit; } +#endif if(unit==NULL)continue; unit_display = NULL; if(strcmp(unit, axis_right_unit) == 0){ @@ -357,8 +444,23 @@ void DrawGenPlot(plot2ddata * plot2di){ option = PLOT_ALL; } else{ - option = PLOT_ONLY_DATA; + option = PLOT_ONLY_DATA; + } +#ifdef pp_PLOT2D_GEN + csvfiledata *csvfi; + csvdata *csvi; + + curve = plot2di->curve + i; + csvfi = csvfileinfo + curve->f_index; + csvi = csvfi->csvinfo + curve->index; + if(global_times != NULL){ + highlight_time = global_times[itimes]; + highlight_val = GetCSVVal(global_times[itimes], csvfi->time->vals, csvi->vals, csvi->nvals); } + DrawGenCurve(option, plot2di, curve, plot2d_size_factor, csvfi->time->vals, csvi->vals, csvi->nvals, + highlight_time, highlight_val, valmin, valmax, + csvi->label.shortlabel, position, side, unit_display, pad_length); +#else if(curve_index < ndeviceinfo){ devicedata *devi; @@ -392,6 +494,7 @@ void DrawGenPlot(plot2ddata * plot2di){ hrri->label.shortlabel, position, side, unit_display, pad_length); } } +#endif } } @@ -475,7 +578,73 @@ void SetupPlot2DUnitData(void){ /* ------------------ UpdateCurveBounds ------------------------ */ -void UpdateCurveBounds(plot2ddata * plot2di, int option){ +#ifdef pp_PLOT2D_GEN +void UpdateCurveBounds(plot2ddata *plot2di, int option){ + int i; + + if(option==1){ + for(i = 0; icurve+i; + curve->color[0] = 0; + curve->color[1] = 0; + curve->color[2] = 0; + curve->linewidth = 1.0; + curve->factors[0] = 1.0; + curve->factors[1] = 0.0; + curve->use_factors = 0; + } + } + + for(i=0; i< ncsvfileinfo; i++){ + int j; + csvfiledata *csvfi; + + csvfi = csvfileinfo + i; + for(j=0; jncsvinfo; j++){ + csvdata *csvi; + float valmin, valmax; + int k; + + csvi = csvfi->csvinfo + j; + valmin = csvi->vals[0]; + valmax = valmin; + for(k=1; knvals; k++){ + valmin = MIN(valmin, csvi->vals[k]); + valmax = MAX(valmax, csvi->vals[k]); + } + csvi->valmin = valmin; + csvi->valmax = valmax; + } + } + + if(plot2di->ncurves == 0){ + plot2di->bounds_defined = 0; + } + else{ + plot2di->bounds_defined = 1; + } + for(i = 0; incurves; i++){ + int j; + curvedata *curve; + csvfiledata *csvfi; + csvdata *csvi; + + curve = plot2di->curve+i; + csvfi = csvfileinfo + curve->f_index; + csvi = csvfi->csvinfo + curve->index; + curve->valmin = csvi->valmin; + curve->valmax = csvi->valmax; + curve->usermin = csvi->valmin; + curve->usermax = csvi->valmax; + curve->use_usermin = 0; + curve->use_usermax = 0; + } +} +#else +void UpdateCurveBounds(plot2ddata *plot2di, int option){ int i; for(i = 0; i < ndeviceinfo; i++){ @@ -493,7 +662,7 @@ void UpdateCurveBounds(plot2ddata * plot2di, int option){ curve->factors[0] = 1.0; curve->factors[1] = 0.0; curve->use_factors = 0; - } + } if(devi->nvals > 0){ float valmin, valmax; @@ -502,15 +671,15 @@ void UpdateCurveBounds(plot2ddata * plot2di, int option){ for(j = 1; j < devi->nvals; j++){ valmin = MIN(valmin, devi->vals[j]); valmax = MAX(valmax, devi->vals[j]); - } + } curve->valmin = valmin; curve->valmax = valmax; curve->usermin = valmin; curve->usermax = valmax; curve->use_usermin = 0; curve->use_usermax = 0; - } } + } for(i = 0; i < nhrrinfo; i++){ hrrdata *hrri; int j; @@ -526,7 +695,7 @@ void UpdateCurveBounds(plot2ddata * plot2di, int option){ curve->factors[0] = 1.0; curve->factors[1] = 0.0; curve->use_factors = 0; - } + } if(hrri->nvals > 0){ float valmin, valmax; @@ -535,23 +704,24 @@ void UpdateCurveBounds(plot2ddata * plot2di, int option){ for(j = 1; j < hrri->nvals; j++){ valmin = MIN(valmin, hrri->vals[j]); valmax = MAX(valmax, hrri->vals[j]); - } + } curve->valmin = valmin; curve->valmax = valmax; curve->usermin = valmin; curve->usermax = valmax; curve->use_usermin = 0; curve->use_usermax = 0; - } } } +} +#endif /* ------------------ InitPlot2D ------------------------ */ -void InitPlot2D(plot2ddata * plot2di, int plot_index){ +void InitPlot2D(plot2ddata *plot2di, int plot_index){ if(ndeviceinfo == 0 && nhrrinfo == 0)return; - plot2di->ncurve_indexes = 0; - plot2di->ncurve_indexes_ini = 0; + plot2di->ncurves = 0; + plot2di->ncurves_ini = 0; plot2di->show = 0; plot2di->show_title = 0; plot2di->xyz[0] = xbar0FDS; @@ -560,7 +730,9 @@ void InitPlot2D(plot2ddata * plot2di, int plot_index){ plot2di->plot_index = plot_index; sprintf(plot2di->plot_label, "plot %i", plot_index); plot2di->curve_index = 0; +#ifndef pp_PLOT2D_GEN NewMemory((void **)&(plot2di->curve), (ndeviceinfo + nhrrinfo) * sizeof(curvedata)); +#endif UpdateCurveBounds(plot2di, 1); } diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index fd8c94a900..7f1f3b896d 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -34,8 +34,6 @@ #define GENPLOT_REM_ALLCURVES 106 #define GENPLOT_SELECT_PLOT 107 #define GENPLOT_SELECT_CURVE 108 -#define GENPLOT_SELECT_DEVICE 109 -#define GENPLOT_SELECT_HRR 110 #define GENPLOT_DEV_TYPE 111 #define GENPLOT_HRR_TYPE 112 #define GENPLOT_SHOW_PLOT 113 @@ -403,31 +401,43 @@ void RemoveCurve(plot2ddata *plot2di, int index){ if(index < 0){ int i; - for(i = 0; i < plot2di->ncurve_indexes; i++){ +#ifdef pp_PLOT2D_GEN + for(i = 0; i < PLOT2D_MAX_CURVES; i++){ + LIST_plotcurves->delete_item(i); + } +#else + for(i = 0; i < plot2di->ncurves; i++){ curvedata *curve; - curve = plot2di->curve+i; + curve = plot2di->curve + i; LIST_plotcurves->delete_item(curve->index); } - plot2di->ncurve_indexes = 0; +#endif + plot2di->ncurves = 0; LIST_plotcurves->set_int_val(-1); - } + } else{ int i, ii; LIST_plotcurves->delete_item(index); ii = 0; - for(i = 0; i < plot2di->ncurve_indexes; i++){ + for(i = 0; i < plot2di->ncurves; i++){ curvedata *curve; curve = plot2di->curve+i; if(curve->index == index)continue; - if(i != ii)plot2di->curve[ii].index = plot2di->curve[i].index; + if(i != ii){ +#ifdef pp_PLOT2D_GEN + memcpy(plot2di->curve + ii, plot2di->curve + i, sizeof(curvedata)); +#else + plot2di->curve[ii].index = plot2di->curve[i].index; +#endif + } ii++; } - (plot2di->ncurve_indexes)--; - if(plot2di->ncurve_indexes > 0){ + (plot2di->ncurves)--; + if(plot2di->ncurves > 0){ LIST_plotcurves->set_int_val(plot2di->curve[0].index); } else{ @@ -436,22 +446,71 @@ void RemoveCurve(plot2ddata *plot2di, int index){ } } +#ifdef pp_PLOT2D_GEN +/* ------------------ InCSVPlot ------------------------ */ + +int InCSVPlot(plot2ddata *plot2di, char *c_type, int index){ + int i; + + for(i = 0; i < plot2di->ncurves; i++){ + if(plot2di->curve[i].index != index)continue; + if(strcmp(plot2di->curve[i].c_type, c_type)!=0)continue; + return 1; + } + return 0; +} +#endif + /* ------------------ InPlot ------------------------ */ int InPlot(plot2ddata *plot2di, int type, int index){ int i, offset = 0; if(type == PLOT2D_HRR)offset = ndeviceinfo; - for(i = 0; i < plot2di->ncurve_indexes; i++){ + for(i = 0; i < plot2di->ncurves; i++){ if(plot2di->curve[i].index == index + offset)return 1; } return 0; } - /* ------------------ AddCurve ------------------------ */ +#ifdef pp_PLOT2D_GEN +/* ------------------ AddCSVCurve ------------------------ */ + +void AddCSVCurve(plot2ddata *plot2di, int index, int force){ + int have_plot, nplots; + csvfiledata *csvfi; + csvdata *csvi; + char *c_type; + + csvfi = csvfileinfo + glui_csv_type; + csvi = csvfi->csvinfo + index; + c_type = csvfi->c_type; + + have_plot = 0; + if(force == 0)have_plot = InCSVPlot(plot2di, c_type, index); + nplots = plot2di->ncurves; + if(have_plot == 0 && nplotscurve[nplots].index = index; + plot2di->curve[nplots].f_index = glui_csv_type; + strcpy(plot2di->curve[nplots].c_type, c_type); + nplots++; + plot2di->ncurves = nplots; + strcpy(label, c_type); + strcat(label, "/"); + strcat(label, csvi->label.shortlabel); + + LIST_plotcurves->add_item(nplots, label); + LIST_plotcurves->set_int_val(nplots); + } +} +#endif + +/* ------------------ AddCurve ------------------------ */ void AddCurve(plot2ddata *plot2di, int type, int force){ - int have_index, nindex; + int have_index; int offset = 0, index; if(type == PLOT2D_HRR){ @@ -468,10 +527,8 @@ void AddCurve(plot2ddata *plot2di, int type, int force){ if(have_index == 0){ char label[255]; - nindex = plot2di->ncurve_indexes; - plot2di->curve[nindex].index = offset + index; - nindex++; - plot2di->ncurve_indexes = nindex; + plot2di->curve[plot2di->ncurves].index = offset + index; + (plot2di->ncurves)++; if(type == PLOT2D_DEV){ strcpy(label, "dev/"); strcat(label, deviceinfo[index].labelptr); @@ -487,12 +544,20 @@ void AddCurve(plot2ddata *plot2di, int type, int force){ /* ------------------ MakeCurveList ------------------------ */ -void GenPlotCB(int var); void MakeCurveList(plot2ddata *plot2di, int option){ int i; if(option == 1)LIST_plotcurves->add_item(-1, ""); - for(i = 0; i < plot2di->ncurve_indexes_ini; i++){ +#ifdef pp_PLOT2D_GEN + for(i = 0; i < plot2di->ncurves_ini; i++){ + int curv_index; + + curv_index = plot2di->curve[i].index_ini; + AddCSVCurve(plot2di, curv_index, 1); + GenPlotCB(GENPLOT_SELECT_CURVE); + } +#else + for(i = 0; i < plot2di->ncurves_ini; i++){ int curv_index; curv_index = plot2di->curve[i].index_ini; @@ -506,29 +571,36 @@ void MakeCurveList(plot2ddata *plot2di, int option){ } GenPlotCB(GENPLOT_SELECT_CURVE); } +#endif } /* ------------------ Plot2D2Glui ------------------------ */ void Plot2D2Glui(int index){ +#ifndef pp_PLOT2D_GEN + curvedata *curve_save, *curve_from, *curve_to; +#endif + if(index >= nplot2dinfo)return; RemoveCurve(glui_plot2dinfo, -1); - curvedata *curve_save, *curve_from, *curve_to; +#ifdef pp_PLOT2D_GEN + memcpy(glui_plot2dinfo, plot2dinfo + index, sizeof(plot2ddata)); +#else curve_save = glui_plot2dinfo->curve; memcpy(glui_plot2dinfo, plot2dinfo + index, sizeof(plot2ddata)); glui_plot2dinfo->curve = curve_save; - curve_from = plot2dinfo[index].curve; curve_to = glui_plot2dinfo->curve; - memcpy(curve_to, curve_from, (ndeviceinfo+nhrrinfo)*sizeof(curvedata)); + memcpy(curve_to, curve_from, (ndeviceinfo + nhrrinfo) * sizeof(curvedata)); +#endif int i; - for(i=0;incurve_indexes; i++){ + for(i=0;incurves; i++){ glui_plot2dinfo->curve[i].index_ini = glui_plot2dinfo->curve[i].index; } - glui_plot2dinfo->ncurve_indexes_ini = glui_plot2dinfo->ncurve_indexes; - glui_plot2dinfo->ncurve_indexes = 0; + glui_plot2dinfo->ncurves_ini = glui_plot2dinfo->ncurves; + glui_plot2dinfo->ncurves = 0; MakeCurveList(glui_plot2dinfo, 0); SPINNER_genplot_x->set_float_val(glui_plot2dinfo->xyz[0]); SPINNER_genplot_y->set_float_val(glui_plot2dinfo->xyz[1]); @@ -546,7 +618,6 @@ void Plot2D2Glui(int index){ CHECKBOX_show_genplot->set_int_val(glui_plot2dinfo->show); EDIT_plot_label->set_text(glui_plot2dinfo->plot_label); CHECKBOX_show_title->set_int_val(glui_plot2dinfo->show_title); - void UpdateCurveControls(void); UpdateCurveControls(); } @@ -613,14 +684,20 @@ void RemovePlot(int i){ void Glui2Plot2D(int index){ if(plot2dinfo != NULL){ +#ifndef pp_PLOT2D_GEN curvedata *curve_save; +#endif plot2ddata *plot2di; plot2di = plot2dinfo + index; +#ifdef pp_PLOT2D_GEN + memcpy(plot2di, glui_plot2dinfo, sizeof(plot2ddata)); +#else curve_save = plot2di->curve; memcpy(plot2di, glui_plot2dinfo, sizeof(plot2ddata)); plot2di->curve = curve_save; memcpy(curve_save, glui_plot2dinfo->curve, (ndeviceinfo + nhrrinfo) * sizeof(curvedata)); +#endif } } @@ -741,9 +818,11 @@ void UpdateCurveControls(void){ SPINNER_genplot_green->set_int_val(glui_curve.color[1]); SPINNER_genplot_blue->set_int_val(glui_curve.color[2]); SPINNER_genplot_linewidth->set_float_val(glui_curve.linewidth); +#ifndef pp_PLOT2D_GEN SPINNER_genplot_factor1->set_float_val(glui_curve.factors[0]); SPINNER_genplot_factor2->set_float_val(glui_curve.factors[1]); CHECKBOX_genplot_use_factors->set_int_val(glui_curve.use_factors); +#endif CHECKBOX_genplot_use_usermin->set_int_val(glui_curve.use_usermin); SPINNER_genplot_usermin->set_float_val(glui_curve.usermin); CHECKBOX_genplot_use_usermax->set_int_val(glui_curve.use_usermax); @@ -765,13 +844,13 @@ void EnableDisablePlot2D(void){ PANEL_plot_title->enable(); PANEL_add_curve->enable(); - if(glui_plot2dinfo->ncurve_indexes == 0){ + if(glui_plot2dinfo->ncurves == 0){ PANEL_curve_properties->disable(); } else{ PANEL_curve_properties->enable(); } - if(glui_plot2dinfo->ncurve_indexes > 0 && glui_plot2dinfo->curve_index < ndeviceinfo){ + if(glui_plot2dinfo->ncurves > 0 && glui_plot2dinfo->curve_index < ndeviceinfo){ BUTTON_plot_position->enable(); } else{ @@ -930,6 +1009,9 @@ void GenPlotCB(int var){ #ifdef pp_PLOT2D_GEN case GENPLOT_SELECT_CSV_CLICK: + AddCSVCurve(glui_plot2dinfo, LIST_csvID->get_int_val(), 0); + Glui2Plot2D(iplot2dinfo); + EnableDisablePlot2D(); break; case GENPLOT_SELECT_CSV_FILE: UpdateCvsList(); @@ -939,7 +1021,6 @@ void GenPlotCB(int var){ break; #endif case GENPLOT_SELECT_DEVICE_CLICK: - GenPlotCB(GENPLOT_SELECT_DEVICE); index = LIST_devID1->get_int_val(); if(InPlot(glui_plot2dinfo, PLOT2D_DEV, index) == 0){ if(glui_plot2dinfo->show == 0){ @@ -955,7 +1036,6 @@ void GenPlotCB(int var){ } break; case GENPLOT_SELECT_HRR_CLICK: - GenPlotCB(GENPLOT_SELECT_HRR); index = LIST_hrr1->get_int_val(); if(InPlot(glui_plot2dinfo, PLOT2D_HRR, index) == 0){ if(glui_plot2dinfo->show == 0){ @@ -970,24 +1050,18 @@ void GenPlotCB(int var){ GenPlotCB(GENPLOT_REM_CURVE); } break; - case GENPLOT_SELECT_DEVICE: - break; case GENPLOT_HRR_TYPE: UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); - GenPlotCB(GENPLOT_SELECT_HRR); break; case GENPLOT_DEV_TYPE: UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - GenPlotCB(GENPLOT_SELECT_DEVICE); - break; - case GENPLOT_SELECT_HRR: break; case GENPLOT_ADD_DEVCURVE: AddCurve(glui_plot2dinfo, PLOT2D_DEV, 0); GenPlotCB(GENPLOT_SELECT_CURVE); Glui2Plot2D(iplot2dinfo); if(PANEL_curve_properties!=NULL)PANEL_curve_properties->enable(); - if(glui_plot2dinfo->ncurve_indexes > 0 && glui_plot2dinfo->curve_indexenable(); + if(glui_plot2dinfo->ncurves > 0 && glui_plot2dinfo->curve_indexenable(); UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); if(glui_plot2dinfo->show==1){ GenPlotCB(GENPLOT_SHOW_PLOT); @@ -1075,10 +1149,10 @@ void GenPlotCB(int var){ strcat(label, " curve properties"); PANEL_curve_properties->set_name(label); } +#ifndef pp_PLOT2D_GEN UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); - GenPlotCB(GENPLOT_SELECT_DEVICE); - GenPlotCB(GENPLOT_SELECT_HRR); +#endif break; case GENPLOT_ADD_PLOT: AddPlot(); @@ -1094,8 +1168,6 @@ void GenPlotCB(int var){ UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); GenPlotCB(GENPLOT_SELECT_PLOT); - GenPlotCB(GENPLOT_SELECT_DEVICE); - GenPlotCB(GENPLOT_SELECT_HRR); break; case GENPLOT_REM_PLOT: RemovePlot(iplot2dinfo); @@ -1663,7 +1735,6 @@ extern "C" void GluiDeviceSetup(int main_window){ LIST_devunit1->add_item(i, deviceunits[i]->unit); } GenPlotCB(GENPLOT_DEV_TYPE); - GenPlotCB(GENPLOT_SELECT_DEVICE); } if(nhrrinfo > 0){ PANEL_plotgeneral_hrr = glui_device->add_panel_to_panel(PANEL_add_curve, "", false); @@ -1686,7 +1757,6 @@ extern "C" void GluiDeviceSetup(int main_window){ for(i = 0; i < nhrrunits; i++){ LIST_hrrunit1->add_item(i, hrrunits[i]->label.unit); } - GenPlotCB(GENPLOT_SELECT_HRR); } #endif glui_device->add_button_to_panel(PANEL_add_curve, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); @@ -1696,12 +1766,15 @@ extern "C" void GluiDeviceSetup(int main_window){ if(PANEL_plot_title!=NULL)PANEL_plot_title->disable(); } if(nplot2dinfo > 0){ - if(glui_plot2dinfo->ncurve_indexes == 0 || glui_plot2dinfo->curve_index>=ndeviceinfo)BUTTON_plot_position->disable(); + if(glui_plot2dinfo->ncurves == 0 || glui_plot2dinfo->curve_index>=ndeviceinfo)BUTTON_plot_position->disable(); } PANEL_curve_properties = glui_device->add_panel_to_panel(PANEL_plot5, "curve properties"); - if(nplot2dinfo > 0 && glui_plot2dinfo->ncurve_indexes == 0)PANEL_curve_properties->disable(); + if(nplot2dinfo > 0 && glui_plot2dinfo->ncurves == 0)PANEL_curve_properties->disable(); LIST_plotcurves = glui_device->add_listbox_to_panel(PANEL_curve_properties, "select:", &glui_plot2dinfo->curve_index, GENPLOT_SELECT_CURVE, GenPlotCB); +#ifdef pp_PLOT2D_GEN + LIST_plotcurves->add_item(-1, ""); +#endif RemoveCurve(glui_plot2dinfo, -1); MakeCurveList(glui_plot2dinfo, 1); @@ -1728,10 +1801,12 @@ extern "C" void GluiDeviceSetup(int main_window){ glui_device->add_column_to_panel(PANEL_curve_usermax, false); CHECKBOX_genplot_use_usermax = glui_device->add_checkbox_to_panel(PANEL_curve_usermax, "use", &(glui_curve.use_usermax), GENPLOT_XYZ, GenPlotCB); +#ifndef pp_PLOT2D_GEN PANEL_modify_curve = glui_device->add_panel_to_panel(PANEL_curve_properties, "modify curve"); SPINNER_genplot_factor1 = glui_device->add_spinner_to_panel(PANEL_modify_curve, "M", GLUI_SPINNER_FLOAT,glui_curve.factors, GENPLOT_XYZ, GenPlotCB); SPINNER_genplot_factor2 = glui_device->add_spinner_to_panel(PANEL_modify_curve, "B", GLUI_SPINNER_FLOAT, glui_curve.factors+1, GENPLOT_XYZ, GenPlotCB); CHECKBOX_genplot_use_factors = glui_device->add_checkbox_to_panel(PANEL_modify_curve, "M*curve+B", &(glui_curve.use_factors), GENPLOT_XYZ, GenPlotCB); +#endif if(nplot2dini>0){ nplot2dinfo = nplot2dini; diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 774ea505c2..91aba00332 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -11553,11 +11553,13 @@ int ReadIni2(char *inifile, int localfile){ TrimBack(buffer); labelptr = TrimFront(buffer); strcpy(plot2di->plot_label, labelptr); +#ifndef pp_PLOT2D_GEN NewMemory((void **)&(plot2di->curve), (ndeviceinfo+nhrrinfo) * sizeof(curvedata)); +#endif fgets(buffer, 255, stream); - sscanf(buffer, " %f %f %f %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurve_indexes); - for(j=0; jncurve_indexes; j++){ + sscanf(buffer, " %f %f %f %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurves); + for(j=0; jncurves; j++){ int color[3]; float linewidth1; float curve_factors[2]; @@ -14960,8 +14962,8 @@ void WriteIniLocal(FILE *fileout){ plot2di = plot2dinfo + i; fprintf(fileout, " %s\n", plot2di->plot_label); - fprintf(fileout, " %f %f %f %i %i %i\n", plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, plot2di->ncurve_indexes); - for(j = 0; j < plot2di->ncurve_indexes; j++){ + fprintf(fileout, " %f %f %f %i %i %i\n", plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, plot2di->ncurves); + for(j = 0; j < plot2di->ncurves; j++){ int *color; float linewidth1, *curve_factors; int curve_use_factors; diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 85839fff8a..6dfbc751ce 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -6,6 +6,8 @@ #endif #ifdef pp_PLOT2D_NEW +EXTERNCPP void GenPlotCB(int var); +EXTERNCPP void UpdateCurveControls(void); EXTERNCPP int GenDevShow(void); EXTERNCPP int GenHrrShow(void); EXTERNCPP void InitPlot2D(plot2ddata *plot2di, int plot_index); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index a0a776693d..2f1ab06a4c 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -1013,6 +1013,10 @@ typedef struct _hrrdata { #ifdef pp_PLOT2D_NEW typedef struct _curvedata{ +#ifdef pp_PLOT2D_GEN + char c_type[64]; + int f_index; +#endif int index, index_ini, use_usermin, use_usermax, use_factors, color[3]; float valmin, valmax, usermin, usermax; float linewidth; @@ -1021,12 +1025,18 @@ typedef struct _curvedata{ /* -------------------------- plot2ddata ------------------------------------ */ +#define PLOT2D_MAX_CURVES 50 typedef struct _plot2ddata{ char plot_label[350]; - int ncurve_indexes, ncurve_indexes_ini; + int ncurves, ncurves_ini; int curve_index, plot_index; int show, show_title; +#ifdef pp_PLOT2D_GEN + curvedata curve[PLOT2D_MAX_CURVES]; + int bounds_defined; +#else curvedata *curve; +#endif float xyz[3]; } plot2ddata; #endif From 8aeef247f59b774a1b03b108ff177a26c619a5e6 Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 16 Jun 2022 21:37:53 -0400 Subject: [PATCH 11/41] smokeview source: rrermove unused variables --- Source/smokeview/IOplot2d.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index d30df4d191..b89db2bdf0 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -261,7 +261,6 @@ char *GetPlotShortLabel(plot2ddata *plot2di, int i){ float GetCSVVal(float t, float *times, float *vals, int nvals){ int beg, mid, end; - float val_beg, val_mid, val_end; if(ttimes[nvals-1])return vals[nvals-1]; @@ -399,9 +398,7 @@ void DrawGenPlot(plot2ddata *plot2di){ } } for(i = 0; incurves; i++){ - int curve_index; float highlight_time, highlight_val; - int valid; char *unit; float valmin, valmax; int option, position, side; @@ -584,7 +581,6 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){ if(option==1){ for(i = 0; icurve+i; @@ -627,7 +623,6 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){ plot2di->bounds_defined = 1; } for(i = 0; incurves; i++){ - int j; curvedata *curve; csvfiledata *csvfi; csvdata *csvi; From a6f882167391d248d934c80b0fff7acc0d8a7435 Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 16 Jun 2022 22:05:42 -0400 Subject: [PATCH 12/41] smokeview source: remove unused variables --- Source/smokeview/IOplot2d.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index b89db2bdf0..9a189b06c0 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -76,7 +76,7 @@ int HaveGenHrr(void){ #define AXIS_NONE 2 void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_factor, float *x, float *z, int n, float x_cur, float z_cur, float zmin, float zmax, - char *label, int position, int axis_side, char *unit, float pad_length){ + int axis_side, char *unit, float pad_length){ float xmin, xmax, dx, dz; float xscale = 1.0, zscale = 1.0; int i, ndigits = 3; @@ -195,7 +195,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ } SNIFF_ERRORS("after DrawGenCurve 4"); } - if(label != NULL){ + { char c_zmin[32], c_zmax[32]; Float2String(c_zmin, zmin, ndigits, force_fixedpoint); @@ -212,10 +212,10 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ } if(unit!=NULL){ if(axis_side == AXIS_LEFT){ - Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)(position+1)) * dfont, unit); + Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing)*dfont, unit); } else{ - Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)(position+1)) * dfont, unit, pad_length); + Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing)*dfont, unit, pad_length); } } } @@ -455,8 +455,7 @@ void DrawGenPlot(plot2ddata *plot2di){ highlight_val = GetCSVVal(global_times[itimes], csvfi->time->vals, csvi->vals, csvi->nvals); } DrawGenCurve(option, plot2di, curve, plot2d_size_factor, csvfi->time->vals, csvi->vals, csvi->nvals, - highlight_time, highlight_val, valmin, valmax, - csvi->label.shortlabel, position, side, unit_display, pad_length); + highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); #else if(curve_index < ndeviceinfo){ devicedata *devi; @@ -468,8 +467,7 @@ void DrawGenPlot(plot2ddata *plot2di){ } if(devi->nvals>0){ DrawGenCurve(option, plot2di, curve, plot2d_size_factor, devi->times, devi->vals, devi->nvals, - highlight_time, highlight_val, valmin, valmax, - devi->deviceID, position, side, unit_display, pad_length); + highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); } } else{ @@ -487,8 +485,7 @@ void DrawGenPlot(plot2ddata *plot2di){ } if(hrri->nvals > 0){ DrawGenCurve(option, plot2di, curve, plot2d_size_factor, hrrinfo->vals, hrri->vals, hrri->nvals, - highlight_time, highlight_val, valmin, valmax, - hrri->label.shortlabel, position, side, unit_display, pad_length); + highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); } } #endif From 82cd1680a44059e58f48c3b5f960e28af81fbbae Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 16 Jun 2022 22:18:39 -0400 Subject: [PATCH 13/41] smokeview source: implement curve removal for general 2d plots --- Source/smokeview/glui_objects.cpp | 33 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index c7c3369316..39aedd5bf3 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -489,20 +489,25 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ have_plot = 0; if(force == 0)have_plot = InCSVPlot(plot2di, c_type, index); nplots = plot2di->ncurves; - if(have_plot == 0 && nplotscurve[nplots].index = index; - plot2di->curve[nplots].f_index = glui_csv_type; - strcpy(plot2di->curve[nplots].c_type, c_type); - nplots++; - plot2di->ncurves = nplots; - strcpy(label, c_type); - strcat(label, "/"); - strcat(label, csvi->label.shortlabel); - - LIST_plotcurves->add_item(nplots, label); - LIST_plotcurves->set_int_val(nplots); + if(have_plot == 1){ + GenPlotCB(GENPLOT_REM_CURVE); + } + else{ + if(nplots < PLOT2D_MAX_CURVES){ + char label[255]; + + plot2di->curve[nplots].index = index; + plot2di->curve[nplots].f_index = glui_csv_type; + strcpy(plot2di->curve[nplots].c_type, c_type); + nplots++; + plot2di->ncurves = nplots; + strcpy(label, c_type); + strcat(label, "/"); + strcat(label, csvi->label.shortlabel); + + LIST_plotcurves->add_item(nplots, label); + LIST_plotcurves->set_int_val(nplots); + } } } #endif From 3fa13f59f3e93bfa9223071b7f9490d7f7479799 Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 16 Jun 2022 22:51:34 -0400 Subject: [PATCH 14/41] smokeview source: remove pp_PLOT2D_GEN directive --- Source/smokeview/IOplot2d.c | 167 ------------------------------ Source/smokeview/glui_objects.cpp | 162 +++-------------------------- Source/smokeview/options.h | 3 +- Source/smokeview/readsmv.c | 12 +-- Source/smokeview/smokeheaders.h | 2 - Source/smokeview/smokeviewvars.h | 4 +- Source/smokeview/structures.h | 10 -- 7 files changed, 17 insertions(+), 343 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 9a189b06c0..7afe0783ab 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -223,8 +223,6 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ SNIFF_ERRORS("after DrawGenCurve end"); } - -#ifdef pp_PLOT2D_GEN /* ------------------ GetPlotUnit ------------------------ */ char *GetPlotUnit(plot2ddata *plot2di, int i){ @@ -278,7 +276,6 @@ float GetCSVVal(float t, float *times, float *vals, int nvals){ } return vals[mid]; } -#endif /* ------------------ DrawGenPlot ------------------------ */ @@ -293,24 +290,11 @@ void DrawGenPlot(plot2ddata *plot2di){ float pad_length = 0.0; void UpdateCurveBounds(plot2ddata*plot2di, int flag); -#ifdef pp_PLOT2D_GEN if(plot2di->bounds_defined==0)UpdateCurveBounds(plot2di, 1); -#endif for(i = 0; incurves; i++){ char *unit; -#ifdef pp_PLOT2D_GEN unit = GetPlotUnit(plot2di, i); -#else - int curve_index; - curve_index = plot2di->curve[i].index; - if(curve_index < ndeviceinfo){ - unit = deviceinfo[curve_index].unit; - } - else{ - unit = hrrinfo[curve_index - ndeviceinfo].label.unit; - } -#endif if(unit==NULL||strlen(unit)==0)continue; if(axis_right_unit == NULL){ axis_right_unit = unit; @@ -324,21 +308,8 @@ void DrawGenPlot(plot2ddata *plot2di){ for(i = 0; i < plot2di->ncurves; i++){ char *unit, *label; -#ifdef pp_PLOT2D_GEN unit = GetPlotUnit(plot2di, i); label = GetPlotShortLabel(plot2di, i); -#else - int curve_index; - curve_index = plot2di->curve[i].index; - if(curve_index < ndeviceinfo){ - unit = deviceinfo[curve_index].unit; - label = deviceinfo[curve_index].quantity; - } - else{ - unit = hrrinfo[curve_index - ndeviceinfo].label.unit; - label = hrrinfo[curve_index - ndeviceinfo].label.shortlabel; - } -#endif if(unit == NULL || strlen(unit) == 0)continue; if(axis_right_unit != NULL && strcmp(axis_right_unit, unit) == 0){ unit_right_index = i; @@ -351,31 +322,14 @@ void DrawGenPlot(plot2ddata *plot2di){ } } for(i = 0; i < plot2di->ncurves; i++){ -#ifndef pp_PLOT2D_GEN - int curve_index; -#endif float valmin, valmax; char *unit; curvedata *curve; -#ifdef pp_PLOT2D_GEN curve = plot2di->curve+i; -#else - curve_index = plot2di->curve[i].index; - curve = plot2di->curve + curve_index; -#endif valmin = curve->valmin; valmax = curve->valmax; -#ifdef pp_PLOT2D_GEN unit = GetPlotUnit(plot2di, i); -#else - if(curve_index < ndeviceinfo){ - unit = deviceinfo[curve_index].unit; - } - else{ - unit = hrrinfo[curve_index - ndeviceinfo].label.unit; - } -#endif if(axis_right_unit!=NULL&&strcmp(unit, axis_right_unit) == 0){ if(axis_right_min>axis_right_max){ axis_right_min = valmin; @@ -406,18 +360,7 @@ void DrawGenPlot(plot2ddata *plot2di){ curvedata *curve; if(axis_right_unit == NULL)break; -#ifdef pp_PLOT2D_GEN unit = GetPlotUnit(plot2di, i); -#else - curve_index = plot2di->curve[i].index; - curve = plot2di->curve + curve_index; - if(curve_index < ndeviceinfo){ - unit = deviceinfo[curve_index].unit; - } - else{ - unit = hrrinfo[curve_index - ndeviceinfo].label.unit; - } -#endif if(unit==NULL)continue; unit_display = NULL; if(strcmp(unit, axis_right_unit) == 0){ @@ -443,7 +386,6 @@ void DrawGenPlot(plot2ddata *plot2di){ else{ option = PLOT_ONLY_DATA; } -#ifdef pp_PLOT2D_GEN csvfiledata *csvfi; csvdata *csvi; @@ -456,39 +398,6 @@ void DrawGenPlot(plot2ddata *plot2di){ } DrawGenCurve(option, plot2di, curve, plot2d_size_factor, csvfi->time->vals, csvi->vals, csvi->nvals, highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); -#else - if(curve_index < ndeviceinfo){ - devicedata *devi; - - devi = deviceinfo + curve_index; - if(global_times!=NULL){ - highlight_time = global_times[itimes]; - highlight_val = GetDeviceVal(global_times[itimes], devi, &valid); - } - if(devi->nvals>0){ - DrawGenCurve(option, plot2di, curve, plot2d_size_factor, devi->times, devi->vals, devi->nvals, - highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); - } - } - else{ - hrrdata *hrri; - - hrri = hrrinfo + curve_index - ndeviceinfo; - if(global_times != NULL){ - int itime; - - highlight_time = global_times[itimes]; - itime = GetInterval(highlight_time, hrrinfo->vals, hrrinfo->nvals); - itime = CLAMP(itime, 0, hrrinfo->nvals - 1); - - highlight_val = hrri->vals[itime]; - } - if(hrri->nvals > 0){ - DrawGenCurve(option, plot2di, curve, plot2d_size_factor, hrrinfo->vals, hrri->vals, hrri->nvals, - highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); - } - } -#endif } } @@ -572,7 +481,6 @@ void SetupPlot2DUnitData(void){ /* ------------------ UpdateCurveBounds ------------------------ */ -#ifdef pp_PLOT2D_GEN void UpdateCurveBounds(plot2ddata *plot2di, int option){ int i; @@ -635,78 +543,6 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){ curve->use_usermax = 0; } } -#else -void UpdateCurveBounds(plot2ddata *plot2di, int option){ - int i; - - for(i = 0; i < ndeviceinfo; i++){ - devicedata *devi; - int j; - curvedata *curve; - - devi = deviceinfo + i; - curve = plot2di->curve + i; - if(option == 1){ - curve->color[0] = 0; - curve->color[1] = 0; - curve->color[2] = 0; - curve->linewidth = 1.0; - curve->factors[0] = 1.0; - curve->factors[1] = 0.0; - curve->use_factors = 0; - } - if(devi->nvals > 0){ - float valmin, valmax; - - valmin = devi->vals[0]; - valmax = valmin; - for(j = 1; j < devi->nvals; j++){ - valmin = MIN(valmin, devi->vals[j]); - valmax = MAX(valmax, devi->vals[j]); - } - curve->valmin = valmin; - curve->valmax = valmax; - curve->usermin = valmin; - curve->usermax = valmax; - curve->use_usermin = 0; - curve->use_usermax = 0; - } - } - for(i = 0; i < nhrrinfo; i++){ - hrrdata *hrri; - int j; - curvedata *curve; - - curve = plot2di->curve + i + ndeviceinfo; - hrri = hrrinfo + i; - if(option == 1){ - curve->color[0] = 0; - curve->color[1] = 0; - curve->color[2] = 0; - curve->linewidth = 1.0; - curve->factors[0] = 1.0; - curve->factors[1] = 0.0; - curve->use_factors = 0; - } - if(hrri->nvals > 0){ - float valmin, valmax; - - valmin = hrri->vals[0]; - valmax = valmin; - for(j = 1; j < hrri->nvals; j++){ - valmin = MIN(valmin, hrri->vals[j]); - valmax = MAX(valmax, hrri->vals[j]); - } - curve->valmin = valmin; - curve->valmax = valmax; - curve->usermin = valmin; - curve->usermax = valmax; - curve->use_usermin = 0; - curve->use_usermax = 0; - } - } -} -#endif /* ------------------ InitPlot2D ------------------------ */ @@ -722,9 +558,6 @@ void InitPlot2D(plot2ddata *plot2di, int plot_index){ plot2di->plot_index = plot_index; sprintf(plot2di->plot_label, "plot %i", plot_index); plot2di->curve_index = 0; -#ifndef pp_PLOT2D_GEN - NewMemory((void **)&(plot2di->curve), (ndeviceinfo + nhrrinfo) * sizeof(curvedata)); -#endif UpdateCurveBounds(plot2di, 1); } diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 39aedd5bf3..013173e5fe 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -34,19 +34,17 @@ #define GENPLOT_REM_ALLCURVES 106 #define GENPLOT_SELECT_PLOT 107 #define GENPLOT_SELECT_CURVE 108 -#define GENPLOT_DEV_TYPE 111 -#define GENPLOT_HRR_TYPE 112 -#define GENPLOT_SHOW_PLOT 113 -#define GENPLOT_XYZ 114 -#define GENPLOT_PLOT_LABEL 115 -#define GENPLOT_SET_POS 116 -#define GENPLOT_SELECT_DEVICE_CLICK 117 -#define GENPLOT_SELECT_HRR_CLICK 118 -#ifdef pp_PLOT2D_GEN -#define GENPLOT_SELECT_CSV_FILE 119 -#define GENPLOT_CSV_TYPE 120 -#define GENPLOT_SELECT_CSV_CLICK 121 -#endif +#define GENPLOT_DEV_TYPE 109 +#define GENPLOT_HRR_TYPE 110 +#define GENPLOT_SHOW_PLOT 111 +#define GENPLOT_XYZ 112 +#define GENPLOT_PLOT_LABEL 113 +#define GENPLOT_SET_POS 114 +#define GENPLOT_SELECT_DEVICE_CLICK 115 +#define GENPLOT_SELECT_HRR_CLICK 116 +#define GENPLOT_SELECT_CSV_FILE 117 +#define GENPLOT_CSV_TYPE 118 +#define GENPLOT_SELECT_CSV_CLICK 119 #define PLOT2D_DEV 0 #define PLOT2D_HRR 1 @@ -119,7 +117,7 @@ GLUI_Checkbox *CHECKBOX_vis_hrr_plot=NULL; GLUI_EditText *EDIT_filter=NULL; -#ifdef pp_PLOT2D_GEN +#ifdef pp_PLOT2D_NEW GLUI_Listbox *LIST_csvfile = NULL; GLUI_Listbox *LIST_csvID = NULL; GLUI_Listbox *LIST_csvunits = NULL; @@ -136,7 +134,7 @@ GLUI_Listbox *LIST_devicetypes = NULL; GLUI_Listbox *LIST_open=NULL; GLUI_Listbox *LIST_hrrdata=NULL; -#ifdef pp_PLOT2D_GEN +#ifdef pp_PLOT2D_NEW GLUI_Panel *PANEL_csv = NULL; GLUI_Panel *PANEL_csv2 = NULL; #endif @@ -153,14 +151,6 @@ GLUI_Panel *PANEL_add_curve = NULL; GLUI_Panel *PANEL_plot5 = NULL; GLUI_Panel *PANEL_plots = NULL; GLUI_Panel *PANEL_plot8 = NULL; -#ifndef pp_PLOT2D_GEN -GLUI_Panel *PANEL_plot9 = NULL; -GLUI_Panel *PANEL_plot10 = NULL; -GLUI_Panel *PANEL_plotdevice_select = NULL; -GLUI_Panel *PANEL_plotgeneral_device = NULL; -GLUI_Panel *PANEL_plotgeneral_hrr = NULL; -GLUI_Panel *PANEL_plotgeneral_plot = NULL; -#endif GLUI_Panel *PANEL_plot_position = NULL; #endif GLUI_Panel *PANEL_hrr_min = NULL; @@ -401,18 +391,9 @@ void RemoveCurve(plot2ddata *plot2di, int index){ if(index < 0){ int i; -#ifdef pp_PLOT2D_GEN for(i = 0; i < PLOT2D_MAX_CURVES; i++){ LIST_plotcurves->delete_item(i); } -#else - for(i = 0; i < plot2di->ncurves; i++){ - curvedata *curve; - - curve = plot2di->curve + i; - LIST_plotcurves->delete_item(curve->index); - } -#endif plot2di->ncurves = 0; LIST_plotcurves->set_int_val(-1); } @@ -428,11 +409,7 @@ void RemoveCurve(plot2ddata *plot2di, int index){ curve = plot2di->curve+i; if(curve->index == index)continue; if(i != ii){ -#ifdef pp_PLOT2D_GEN memcpy(plot2di->curve + ii, plot2di->curve + i, sizeof(curvedata)); -#else - plot2di->curve[ii].index = plot2di->curve[i].index; -#endif } ii++; } @@ -446,7 +423,6 @@ void RemoveCurve(plot2ddata *plot2di, int index){ } } -#ifdef pp_PLOT2D_GEN /* ------------------ InCSVPlot ------------------------ */ int InCSVPlot(plot2ddata *plot2di, char *c_type, int index){ @@ -459,7 +435,6 @@ int InCSVPlot(plot2ddata *plot2di, char *c_type, int index){ } return 0; } -#endif /* ------------------ InPlot ------------------------ */ @@ -473,7 +448,6 @@ int InPlot(plot2ddata *plot2di, int type, int index){ return 0; } -#ifdef pp_PLOT2D_GEN /* ------------------ AddCSVCurve ------------------------ */ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ @@ -510,7 +484,6 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ } } } -#endif /* ------------------ AddCurve ------------------------ */ @@ -553,52 +526,22 @@ void MakeCurveList(plot2ddata *plot2di, int option){ int i; if(option == 1)LIST_plotcurves->add_item(-1, ""); -#ifdef pp_PLOT2D_GEN for(i = 0; i < plot2di->ncurves_ini; i++){ int curv_index; curv_index = plot2di->curve[i].index_ini; AddCSVCurve(plot2di, curv_index, 1); GenPlotCB(GENPLOT_SELECT_CURVE); - } -#else - for(i = 0; i < plot2di->ncurves_ini; i++){ - int curv_index; - - curv_index = plot2di->curve[i].index_ini; - if(curv_index < ndeviceinfo){ - LIST_devID1->set_int_val(curv_index); - AddCurve(plot2di, PLOT2D_DEV, 1); - } - else{ - LIST_hrr1->set_int_val(curv_index - ndeviceinfo); - AddCurve(plot2di, PLOT2D_HRR, 1); - } - GenPlotCB(GENPLOT_SELECT_CURVE); } -#endif } /* ------------------ Plot2D2Glui ------------------------ */ void Plot2D2Glui(int index){ -#ifndef pp_PLOT2D_GEN - curvedata *curve_save, *curve_from, *curve_to; -#endif - if(index >= nplot2dinfo)return; RemoveCurve(glui_plot2dinfo, -1); -#ifdef pp_PLOT2D_GEN memcpy(glui_plot2dinfo, plot2dinfo + index, sizeof(plot2ddata)); -#else - curve_save = glui_plot2dinfo->curve; - memcpy(glui_plot2dinfo, plot2dinfo + index, sizeof(plot2ddata)); - glui_plot2dinfo->curve = curve_save; - curve_from = plot2dinfo[index].curve; - curve_to = glui_plot2dinfo->curve; - memcpy(curve_to, curve_from, (ndeviceinfo + nhrrinfo) * sizeof(curvedata)); -#endif int i; for(i=0;incurves; i++){ @@ -611,7 +554,6 @@ void Plot2D2Glui(int index){ SPINNER_genplot_y->set_float_val(glui_plot2dinfo->xyz[1]); SPINNER_genplot_z->set_float_val(glui_plot2dinfo->xyz[2]); - if(glui_plot2dinfo->curve_index >= 0){ curvedata *curve; curve = glui_plot2dinfo->curve + glui_plot2dinfo->curve_index; @@ -689,20 +631,10 @@ void RemovePlot(int i){ void Glui2Plot2D(int index){ if(plot2dinfo != NULL){ -#ifndef pp_PLOT2D_GEN - curvedata *curve_save; -#endif plot2ddata *plot2di; plot2di = plot2dinfo + index; -#ifdef pp_PLOT2D_GEN - memcpy(plot2di, glui_plot2dinfo, sizeof(plot2ddata)); -#else - curve_save = plot2di->curve; memcpy(plot2di, glui_plot2dinfo, sizeof(plot2ddata)); - plot2di->curve = curve_save; - memcpy(curve_save, glui_plot2dinfo->curve, (ndeviceinfo + nhrrinfo) * sizeof(curvedata)); -#endif } } @@ -823,11 +755,6 @@ void UpdateCurveControls(void){ SPINNER_genplot_green->set_int_val(glui_curve.color[1]); SPINNER_genplot_blue->set_int_val(glui_curve.color[2]); SPINNER_genplot_linewidth->set_float_val(glui_curve.linewidth); -#ifndef pp_PLOT2D_GEN - SPINNER_genplot_factor1->set_float_val(glui_curve.factors[0]); - SPINNER_genplot_factor2->set_float_val(glui_curve.factors[1]); - CHECKBOX_genplot_use_factors->set_int_val(glui_curve.use_factors); -#endif CHECKBOX_genplot_use_usermin->set_int_val(glui_curve.use_usermin); SPINNER_genplot_usermin->set_float_val(glui_curve.usermin); CHECKBOX_genplot_use_usermax->set_int_val(glui_curve.use_usermax); @@ -877,7 +804,6 @@ extern "C" void ShowPlot2D(void){ } } -#ifdef pp_PLOT2D_GEN /* ------------------ FilterList ------------------------ */ void FilterList(void){ @@ -1001,7 +927,6 @@ void UpdateCvsList(void){ LIST_csvunits->set_int_val(-1); } } -#endif /* ------------------ GenPlotCB ------------------------ */ @@ -1011,7 +936,6 @@ void GenPlotCB(int var){ int index; curvedata *curve; -#ifdef pp_PLOT2D_GEN case GENPLOT_SELECT_CSV_CLICK: AddCSVCurve(glui_plot2dinfo, LIST_csvID->get_int_val(), 0); Glui2Plot2D(iplot2dinfo); @@ -1023,7 +947,6 @@ void GenPlotCB(int var){ case GENPLOT_CSV_TYPE: FilterList(); break; -#endif case GENPLOT_SELECT_DEVICE_CLICK: index = LIST_devID1->get_int_val(); if(InPlot(glui_plot2dinfo, PLOT2D_DEV, index) == 0){ @@ -1153,10 +1076,6 @@ void GenPlotCB(int var){ strcat(label, " curve properties"); PANEL_curve_properties->set_name(label); } -#ifndef pp_PLOT2D_GEN - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); -#endif break; case GENPLOT_ADD_PLOT: AddPlot(); @@ -1700,7 +1619,6 @@ extern "C" void GluiDeviceSetup(int main_window){ PANEL_plot5 = glui_device->add_panel_to_panel(ROLLOUT_plotgeneral, "", 0); PANEL_add_curve = glui_device->add_panel_to_panel(PANEL_plot5, "add/remove curves"); -#ifdef pp_PLOT2D_GEN if(ncsvfileinfo > 0){ PANEL_csv = glui_device->add_panel_to_panel(PANEL_add_curve, "", 0); LIST_csvfile = glui_device->add_listbox_to_panel(PANEL_csv, "curve type:", &glui_csv_type, GENPLOT_SELECT_CSV_FILE, GenPlotCB); @@ -1718,51 +1636,6 @@ extern "C" void GluiDeviceSetup(int main_window){ GenPlotCB(GENPLOT_SELECT_CSV_FILE); GenPlotCB(GENPLOT_CSV_TYPE); } -#else - if(ndevicetypes > 0){ - PANEL_plotgeneral_device = glui_device->add_panel_to_panel(PANEL_add_curve, "", false); - PANEL_plotdevice_select = glui_device->add_panel_to_panel(PANEL_plotgeneral_device, "", false); - PANEL_plot9 = glui_device->add_panel_to_panel(PANEL_plotdevice_select, "", 0); - LIST_devID1 = glui_device->add_listbox_to_panel(PANEL_plot9, "add/remove device file data:", &glui_device_index, GENPLOT_SELECT_DEVICE_CLICK, GenPlotCB); - for(i = 0; i < ndeviceinfo; i++){ - devicedata *devicei; - - devicei = deviceinfo + i; - devicei->inlist1 = 1; - LIST_devID1->add_item(i, devicei->deviceID); - } - devicetypes_index = CLAMP(devicetypes_index, 0, ndevicetypes - 1); - glui_device->add_column_to_panel(PANEL_plot9, false); - LIST_devunit1 = glui_device->add_listbox_to_panel(PANEL_plot9, "", &glui_device_unit_index, GENPLOT_DEV_TYPE, GenPlotCB); - LIST_devunit1->add_item(-1, "(all data)"); - for(i = 0; i < ndeviceunits; i++){ - LIST_devunit1->add_item(i, deviceunits[i]->unit); - } - GenPlotCB(GENPLOT_DEV_TYPE); - } - if(nhrrinfo > 0){ - PANEL_plotgeneral_hrr = glui_device->add_panel_to_panel(PANEL_add_curve, "", false); - PANEL_plot10 = glui_device->add_panel_to_panel(PANEL_plotgeneral_hrr, "", 0); - LIST_hrr1 = glui_device->add_listbox_to_panel(PANEL_plot10, "add/remove hrr file data:", &glui_hrr_index, GENPLOT_SELECT_HRR_CLICK, GenPlotCB); - for(i = 0; i < nhrrinfo; i++){ - hrrdata *hi; - - hi = hrrinfo + i; - hi->inlist1 = 0; - if(hi->label.shortlabel != NULL){ - if(strcmp(hi->label.shortlabel, "Time") == 0)continue; - hi->inlist1 = 1; - LIST_hrr1->add_item(i, hi->label.shortlabel); - } - } - glui_device->add_column_to_panel(PANEL_plot10, false); - LIST_hrrunit1 = glui_device->add_listbox_to_panel(PANEL_plot10, "", &glui_hrr_unit_index, GENPLOT_HRR_TYPE, GenPlotCB); - LIST_hrrunit1->add_item(-1, "(all data)"); - for(i = 0; i < nhrrunits; i++){ - LIST_hrrunit1->add_item(i, hrrunits[i]->label.unit); - } - } -#endif glui_device->add_button_to_panel(PANEL_add_curve, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); if(nplot2dinfo==0){ if(PANEL_add_curve!=NULL)PANEL_add_curve->disable(); @@ -1776,9 +1649,7 @@ extern "C" void GluiDeviceSetup(int main_window){ PANEL_curve_properties = glui_device->add_panel_to_panel(PANEL_plot5, "curve properties"); if(nplot2dinfo > 0 && glui_plot2dinfo->ncurves == 0)PANEL_curve_properties->disable(); LIST_plotcurves = glui_device->add_listbox_to_panel(PANEL_curve_properties, "select:", &glui_plot2dinfo->curve_index, GENPLOT_SELECT_CURVE, GenPlotCB); -#ifdef pp_PLOT2D_GEN LIST_plotcurves->add_item(-1, ""); -#endif RemoveCurve(glui_plot2dinfo, -1); MakeCurveList(glui_plot2dinfo, 1); @@ -1805,13 +1676,6 @@ extern "C" void GluiDeviceSetup(int main_window){ glui_device->add_column_to_panel(PANEL_curve_usermax, false); CHECKBOX_genplot_use_usermax = glui_device->add_checkbox_to_panel(PANEL_curve_usermax, "use", &(glui_curve.use_usermax), GENPLOT_XYZ, GenPlotCB); -#ifndef pp_PLOT2D_GEN - PANEL_modify_curve = glui_device->add_panel_to_panel(PANEL_curve_properties, "modify curve"); - SPINNER_genplot_factor1 = glui_device->add_spinner_to_panel(PANEL_modify_curve, "M", GLUI_SPINNER_FLOAT,glui_curve.factors, GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_factor2 = glui_device->add_spinner_to_panel(PANEL_modify_curve, "B", GLUI_SPINNER_FLOAT, glui_curve.factors+1, GENPLOT_XYZ, GenPlotCB); - CHECKBOX_genplot_use_factors = glui_device->add_checkbox_to_panel(PANEL_modify_curve, "M*curve+B", &(glui_curve.use_factors), GENPLOT_XYZ, GenPlotCB); -#endif - if(nplot2dini>0){ nplot2dinfo = nplot2dini; NewMemory((void **)&plot2dinfo, nplot2dinfo*sizeof(plot2ddata)); diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index d410f25f2b..916e56b546 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -17,8 +17,7 @@ //*** options: all platforms -//#define pp_PLOT2D_GEN // general 2d plot -#define pp_PLOT2D_NEW // allow multiple curves on a device 2d plot +//#define pp_PLOT2D_NEW // allow multiple curves on a single 2d plot #define pp_PLOT2D_OVERLAP // allow scene to overlap 2d plot region #define pp_PART_MULTI // load particles in parallel //#define pp_CACHE_FILEBOUNDS // cache slice and boundary file bounds diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 91aba00332..228db6ef4d 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -148,8 +148,7 @@ void UpdateHoc(void){ } } -#ifdef pp_PLOT2D_GEN - +#ifdef pp_PLOT2D_NEW /* ------------------ ReadCSV ------------------------ */ int IsDimensionless(char *unit){ @@ -7469,11 +7468,9 @@ int ReadSMV(bufferstreamdata *stream){ csvi->loaded = 0; csvi->display = 0; -#ifdef pp_PLOT2D_GEN csvi->time = NULL; csvi->ncsvinfo = 0; csvi->csvinfo = NULL; -#endif NewMemory((void **)&csvi->file, strlen(file_ptr) + 1); strcpy(csvi->file, file_ptr); @@ -10805,10 +10802,8 @@ typedef struct { if(strcmp(csvi->c_type, "ext") == 0)ReadDeviceData(csvi->file,CSV_EXP,LOAD); } SetupDeviceData(); -#ifdef pp_PLOT2D_GEN - ReadAllCSV(LOAD); -#endif #ifdef pp_PLOT2D_NEW + ReadAllCSV(LOAD); SetupPlot2DUnitData(); #endif if(nzoneinfo>0)SetupZoneDevs(); @@ -11553,9 +11548,6 @@ int ReadIni2(char *inifile, int localfile){ TrimBack(buffer); labelptr = TrimFront(buffer); strcpy(plot2di->plot_label, labelptr); -#ifndef pp_PLOT2D_GEN - NewMemory((void **)&(plot2di->curve), (ndeviceinfo+nhrrinfo) * sizeof(curvedata)); -#endif fgets(buffer, 255, stream); sscanf(buffer, " %f %f %f %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurves); diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 6dfbc751ce..042955b92e 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -15,8 +15,6 @@ EXTERNCPP void DrawGenPlots(void); EXTERNCPP int HaveGenDev(void); EXTERNCPP int HaveGenHrr(void); EXTERNCPP void ShowPlot2D(void); -#endif -#ifdef pp_PLOT2D_GEN EXTERNCPP void ReadAllCSV(int flag); #endif diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 5dffdfad3b..b49f6dfcbd 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -1529,12 +1529,10 @@ SVEXTERN int SVDECL(ndeviceinfo,0),nvdeviceinfo,ndeviceinfo_exp; SVEXTERN float max_dev_vel; SVEXTERN int SVDECL(last_prop_display,-1); SVEXTERN int SVDECL(devicetypes_index,0); -#ifdef pp_PLOT2D_GEN +#ifdef pp_PLOT2D_NEW SVEXTERN int SVDECL(glui_csv_type, 0); SVEXTERN int SVDECL(icsv_cols, 0), SVDECL(icsv_units, 0); SVEXTERN int SVDECL(plot2d_max_columns, 0); -#endif -#ifdef pp_PLOT2D_NEW SVEXTERN int SVDECL(deviceunits_index, 0); SVEXTERN int SVDECL(plot2d_dialogs_defined, 0); SVEXTERN int SVDECL(glui_device_unit_index, -1); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 2f1ab06a4c..13de764c30 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -35,7 +35,6 @@ typedef struct _procdata { #endif /* -------------------------- csvdata ------------------------------------ */ -#ifdef pp_PLOT2D_GEN typedef struct _csvdata{ flowlabels label; float val, *vals, *vals_orig; @@ -43,16 +42,13 @@ typedef struct _csvdata{ int nvals; int dimensionless; } csvdata; -#endif /* -------------------------- _csvfiledata ------------------------------------ */ typedef struct _csvfiledata { char *file; -#ifdef pp_PLOT2D_GEN csvdata *csvinfo, *time; int ncsvinfo; -#endif int loaded, display; char c_type[32]; } csvfiledata; @@ -1013,10 +1009,8 @@ typedef struct _hrrdata { #ifdef pp_PLOT2D_NEW typedef struct _curvedata{ -#ifdef pp_PLOT2D_GEN char c_type[64]; int f_index; -#endif int index, index_ini, use_usermin, use_usermax, use_factors, color[3]; float valmin, valmax, usermin, usermax; float linewidth; @@ -1031,12 +1025,8 @@ typedef struct _plot2ddata{ int ncurves, ncurves_ini; int curve_index, plot_index; int show, show_title; -#ifdef pp_PLOT2D_GEN curvedata curve[PLOT2D_MAX_CURVES]; int bounds_defined; -#else - curvedata *curve; -#endif float xyz[3]; } plot2ddata; #endif From daabe64593dc69d32de78970ff44d31174868ede Mon Sep 17 00:00:00 2001 From: gforney Date: Thu, 16 Jun 2022 23:31:20 -0400 Subject: [PATCH 15/41] smokeview source: remove unused plot2d code --- Source/smokeview/glui_objects.cpp | 250 ++---------------------------- Source/smokeview/options.h | 2 +- 2 files changed, 13 insertions(+), 239 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 013173e5fe..cfccb94679 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -27,27 +27,18 @@ #ifdef pp_PLOT2D_NEW #define GENPLOT_ADD_PLOT 101 -#define GENPLOT_ADD_DEVCURVE 102 -#define GENPLOT_ADD_HRRCURVE 103 -#define GENPLOT_REM_PLOT 104 -#define GENPLOT_REM_CURVE 105 -#define GENPLOT_REM_ALLCURVES 106 -#define GENPLOT_SELECT_PLOT 107 -#define GENPLOT_SELECT_CURVE 108 -#define GENPLOT_DEV_TYPE 109 -#define GENPLOT_HRR_TYPE 110 -#define GENPLOT_SHOW_PLOT 111 -#define GENPLOT_XYZ 112 -#define GENPLOT_PLOT_LABEL 113 -#define GENPLOT_SET_POS 114 -#define GENPLOT_SELECT_DEVICE_CLICK 115 -#define GENPLOT_SELECT_HRR_CLICK 116 -#define GENPLOT_SELECT_CSV_FILE 117 -#define GENPLOT_CSV_TYPE 118 -#define GENPLOT_SELECT_CSV_CLICK 119 - -#define PLOT2D_DEV 0 -#define PLOT2D_HRR 1 +#define GENPLOT_REM_PLOT 102 +#define GENPLOT_REM_CURVE 103 +#define GENPLOT_REM_ALLCURVES 104 +#define GENPLOT_SELECT_CSV_FILE 105 +#define GENPLOT_SELECT_PLOT 106 +#define GENPLOT_SELECT_CURVE 107 +#define GENPLOT_SHOW_PLOT 108 +#define GENPLOT_XYZ 109 +#define GENPLOT_PLOT_LABEL 110 +#define GENPLOT_SET_POS 111 +#define GENPLOT_CSV_TYPE 112 +#define GENPLOT_SELECT_CSV_CLICK 113 #endif #define WINDROSE_SHOW_FIRST 996 @@ -121,12 +112,6 @@ GLUI_EditText *EDIT_filter=NULL; GLUI_Listbox *LIST_csvfile = NULL; GLUI_Listbox *LIST_csvID = NULL; GLUI_Listbox *LIST_csvunits = NULL; -#endif -#ifdef pp_PLOT2D_NEW -GLUI_Listbox *LIST_devID1 = NULL; -GLUI_Listbox *LIST_devunit1 = NULL; -GLUI_Listbox *LIST_hrr1 = NULL; -GLUI_Listbox *LIST_hrrunit1 = NULL; GLUI_Listbox *LIST_plots = NULL; GLUI_Listbox *LIST_plotcurves = NULL; #endif @@ -199,8 +184,6 @@ GLUI_Rollout *ROLLOUT_trees = NULL; GLUI_Spinner *SPINNER_genplot_usermin = NULL; GLUI_Spinner *SPINNER_genplot_usermax = NULL; -GLUI_Spinner *SPINNER_genplot_factor1 = NULL; -GLUI_Spinner *SPINNER_genplot_factor2 = NULL; GLUI_Spinner *SPINNER_genplot_x = NULL; GLUI_Spinner *SPINNER_genplot_y = NULL; GLUI_Spinner *SPINNER_genplot_z = NULL; @@ -436,18 +419,6 @@ int InCSVPlot(plot2ddata *plot2di, char *c_type, int index){ return 0; } -/* ------------------ InPlot ------------------------ */ - -int InPlot(plot2ddata *plot2di, int type, int index){ - int i, offset = 0; - - if(type == PLOT2D_HRR)offset = ndeviceinfo; - for(i = 0; i < plot2di->ncurves; i++){ - if(plot2di->curve[i].index == index + offset)return 1; - } - return 0; -} - /* ------------------ AddCSVCurve ------------------------ */ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ @@ -485,41 +456,6 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ } } -/* ------------------ AddCurve ------------------------ */ - -void AddCurve(plot2ddata *plot2di, int type, int force){ - int have_index; - int offset = 0, index; - - if(type == PLOT2D_HRR){ - offset = ndeviceinfo; - index = LIST_hrr1->get_int_val(); - } - else{ - index = LIST_devID1->get_int_val(); - } - have_index = 0; - if(force == 0){ - have_index = InPlot(plot2di, type, index); - } - if(have_index == 0){ - char label[255]; - - plot2di->curve[plot2di->ncurves].index = offset + index; - (plot2di->ncurves)++; - if(type == PLOT2D_DEV){ - strcpy(label, "dev/"); - strcat(label, deviceinfo[index].labelptr); - } - else{ - strcpy(label, "hrr/"); - strcat(label, hrrinfo[index].label.shortlabel); - } - LIST_plotcurves->add_item(offset + index, label); - LIST_plotcurves->set_int_val(offset + index); - } -} - /* ------------------ MakeCurveList ------------------------ */ void MakeCurveList(plot2ddata *plot2di, int option){ @@ -638,102 +574,6 @@ void Glui2Plot2D(int index){ } } -/* ------------------ UpdateUnitList ------------------------ */ - -void UpdateUnitList(GLUI_Listbox *LIST_dev, int devunit_index, int type){ - int i, listval, nitems; - - if(LIST_dev == NULL)return; - if(type==PLOT2D_DEV){ - nitems = ndeviceinfo; - } - else{ - nitems = nhrrinfo; - } - listval = LIST_dev->get_int_val(); - for(i = 0; i < nitems; i++){ - int inlist1; - - if(type==PLOT2D_DEV){ - inlist1 = deviceinfo[i].inlist1; - } - else{ - inlist1 = hrrinfo[i].inlist1; - } - if(inlist1 == 1){ - if(type == PLOT2D_DEV){ - deviceinfo[i].inlist1 = 0; - } - else{ - hrrinfo[i].inlist1 = 0; - } - LIST_dev->delete_item(i); - } - } - for(i = 0; i < nitems; i++){ - int inlist, inlist1; - - inlist = 0; - if(type==PLOT2D_DEV){ - if(devunit_index == -1 || strcmp(deviceunits[devunit_index]->unit, deviceinfo[i].unit) == 0)inlist = 1; - inlist1 = deviceinfo[i].inlist1; - } - else{ - if(STRCMP(hrrinfo[i].label.shortlabel, "Time") == 0)continue; - if(devunit_index == -1 || strcmp(hrrunits[devunit_index]->label.unit, hrrinfo[i].label.unit) == 0)inlist = 1; - inlist1 = hrrinfo[i].inlist1; - } - if(inlist == 1 && inlist1 == 0){ - char label[350]; - - strcpy(label, ""); - if(InPlot(glui_plot2dinfo, type, i)==1){ - strcat(label, "*"); - if(type==PLOT2D_DEV){ - strcat(label, deviceinfo[i].deviceID); - deviceinfo[i].inlist1 = 1; - } - else{ - strcat(label, hrrinfo[i].label.shortlabel); - hrrinfo[i].inlist1 = 1; - } - LIST_dev->add_item(i, label); - } - } - } - for(i = 0; iunit, deviceinfo[i].unit)==0)inlist = 1; - inlist1 = deviceinfo[i].inlist1; - } - else{ - if(STRCMP(hrrinfo[i].label.shortlabel, "Time") == 0)continue; - if(devunit_index == -1 || strcmp(hrrunits[devunit_index]->label.unit, hrrinfo[i].label.unit) == 0)inlist = 1; - inlist1 = hrrinfo[i].inlist1; - } - if(inlist==1&&inlist1==0){ - char label[350]; - - strcpy(label, ""); - if(InPlot(glui_plot2dinfo, type, i)!=1){ - if(type==PLOT2D_DEV){ - strcat(label, deviceinfo[i].deviceID); - deviceinfo[i].inlist1 = 1; - } - else{ - strcat(label, hrrinfo[i].label.shortlabel); - hrrinfo[i].inlist1 = 1; - } - LIST_dev->add_item(i, label); - } - } - } - LIST_dev->set_int_val(listval); -} - /* ------------------ UpdatePlotList ------------------------ */ void UpdatePlotList(void){ @@ -947,63 +787,6 @@ void GenPlotCB(int var){ case GENPLOT_CSV_TYPE: FilterList(); break; - case GENPLOT_SELECT_DEVICE_CLICK: - index = LIST_devID1->get_int_val(); - if(InPlot(glui_plot2dinfo, PLOT2D_DEV, index) == 0){ - if(glui_plot2dinfo->show == 0){ - glui_plot2dinfo->show = 1; - CHECKBOX_show_genplot->set_int_val(glui_plot2dinfo->show); - GenPlotCB(GENPLOT_SHOW_PLOT); - } - GenPlotCB(GENPLOT_ADD_DEVCURVE); - } - else{ - glui_plot2dinfo->curve_index = index; - GenPlotCB(GENPLOT_REM_CURVE); - } - break; - case GENPLOT_SELECT_HRR_CLICK: - index = LIST_hrr1->get_int_val(); - if(InPlot(glui_plot2dinfo, PLOT2D_HRR, index) == 0){ - if(glui_plot2dinfo->show == 0){ - glui_plot2dinfo->show = 1; - CHECKBOX_show_genplot->set_int_val(glui_plot2dinfo->show); - GenPlotCB(GENPLOT_SHOW_PLOT); - } - GenPlotCB(GENPLOT_ADD_HRRCURVE); - } - else{ - glui_plot2dinfo->curve_index = index+ndeviceinfo; - GenPlotCB(GENPLOT_REM_CURVE); - } - break; - case GENPLOT_HRR_TYPE: - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); - break; - case GENPLOT_DEV_TYPE: - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - break; - case GENPLOT_ADD_DEVCURVE: - AddCurve(glui_plot2dinfo, PLOT2D_DEV, 0); - GenPlotCB(GENPLOT_SELECT_CURVE); - Glui2Plot2D(iplot2dinfo); - if(PANEL_curve_properties!=NULL)PANEL_curve_properties->enable(); - if(glui_plot2dinfo->ncurves > 0 && glui_plot2dinfo->curve_indexenable(); - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - if(glui_plot2dinfo->show==1){ - GenPlotCB(GENPLOT_SHOW_PLOT); - } - break; - case GENPLOT_ADD_HRRCURVE: - AddCurve(glui_plot2dinfo, PLOT2D_HRR, 0); - GenPlotCB(GENPLOT_SELECT_CURVE); - Glui2Plot2D(iplot2dinfo); - EnableDisablePlot2D(); - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); - if(glui_plot2dinfo->show){ - GenPlotCB(GENPLOT_SHOW_PLOT); - } - break; case GENPLOT_SELECT_CURVE: index = glui_plot2dinfo->curve_index; curve = glui_plot2dinfo->curve + index; @@ -1024,15 +807,11 @@ void GenPlotCB(int var){ RemoveCurve(glui_plot2dinfo, glui_plot2dinfo->curve_index); Glui2Plot2D(iplot2dinfo); EnableDisablePlot2D(); - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); break; case GENPLOT_REM_ALLCURVES: RemoveCurve(glui_plot2dinfo, -1); Glui2Plot2D(iplot2dinfo); EnableDisablePlot2D(); - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); break; case GENPLOT_SHOW_PLOT: Glui2Plot2D(iplot2dinfo); @@ -1088,8 +867,6 @@ void GenPlotCB(int var){ strcat(label, plot2dinfo[iplot2dinfo].plot_label); BUTTON_rem_plot->set_name(label); EnableDisablePlot2D(); - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); GenPlotCB(GENPLOT_SELECT_PLOT); break; case GENPLOT_REM_PLOT: @@ -1107,8 +884,6 @@ void GenPlotCB(int var){ BUTTON_rem_plot->set_name(label); EnableDisablePlot2D(); GenPlotCB(GENPLOT_SELECT_PLOT); - UpdateUnitList(LIST_devID1, glui_device_unit_index, PLOT2D_DEV); - UpdateUnitList(LIST_hrr1, glui_hrr_unit_index, PLOT2D_HRR); break; default: ASSERT(FFALSE); @@ -1689,7 +1464,6 @@ extern "C" void GluiDeviceSetup(int main_window){ LIST_plots->set_int_val(0); GenPlotCB(GENPLOT_SELECT_PLOT); } - if(ndevicetypes>0)GenPlotCB(GENPLOT_DEV_TYPE); GenPlotCB(GENPLOT_SHOW_PLOT); plot2d_dialogs_defined = 1; EnableDisablePlot2D(); diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index 916e56b546..fb33209ebe 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -17,7 +17,7 @@ //*** options: all platforms -//#define pp_PLOT2D_NEW // allow multiple curves on a single 2d plot +#define pp_PLOT2D_NEW // allow multiple curves on a single 2d plot #define pp_PLOT2D_OVERLAP // allow scene to overlap 2d plot region #define pp_PART_MULTI // load particles in parallel //#define pp_CACHE_FILEBOUNDS // cache slice and boundary file bounds From b4c4d1672591de1745ea6fccb1d1e300199570d0 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 08:51:59 -0400 Subject: [PATCH 16/41] smokeview source: change some variable names to mae code clearer --- Source/smokeview/IOplot2d.c | 24 ++++++++++++------------ Source/smokeview/glui_objects.cpp | 24 ++++++++++++------------ Source/smokeview/readsmv.c | 4 ++-- Source/smokeview/smokeviewvars.h | 2 +- Source/smokeview/structures.h | 5 +++-- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 7afe0783ab..6986d6ab55 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -21,7 +21,7 @@ int GenDevShow(void){ int j; for(j = 0; j < plot2di->ncurves; j++){ - if(plot2di->curve[j].indexcurve[j].csv_col_indexncurves; j++){ - if(plot2di->curve[j].index>=ndeviceinfo)return 1; + if(plot2di->curve[j].csv_col_index>=ndeviceinfo)return 1; } } } @@ -54,7 +54,7 @@ int HaveGenDev(void){ int i; for(i = 0; incurves; i++){ - if(glui_plot2dinfo->curve[i].indexcurve[i].csv_col_indexncurves; i++){ - if(glui_plot2dinfo->curve[i].index>=ndeviceinfo)return 1; + if(glui_plot2dinfo->curve[i].csv_col_index>=ndeviceinfo)return 1; } return 0; } @@ -231,8 +231,8 @@ char *GetPlotUnit(plot2ddata *plot2di, int i){ int fcurve_index, curve_index; char *unit; - curve_index = plot2di->curve[i].index; - fcurve_index = plot2di->curve[i].f_index; + curve_index = plot2di->curve[i].csv_col_index; + fcurve_index = plot2di->curve[i].csv_file_index; csvfi = csvfileinfo + fcurve_index; csvi = csvfi->csvinfo + curve_index; unit = csvi->label.unit; @@ -247,8 +247,8 @@ char *GetPlotShortLabel(plot2ddata *plot2di, int i){ int fcurve_index, curve_index; char *shortlabel; - curve_index = plot2di->curve[i].index; - fcurve_index = plot2di->curve[i].f_index; + curve_index = plot2di->curve[i].csv_col_index; + fcurve_index = plot2di->curve[i].csv_file_index; csvfi = csvfileinfo + fcurve_index; csvi = csvfi->csvinfo + curve_index; shortlabel = csvi->label.shortlabel; @@ -390,8 +390,8 @@ void DrawGenPlot(plot2ddata *plot2di){ csvdata *csvi; curve = plot2di->curve + i; - csvfi = csvfileinfo + curve->f_index; - csvi = csvfi->csvinfo + curve->index; + csvfi = csvfileinfo + curve->csv_file_index; + csvi = csvfi->csvinfo + curve->csv_col_index; if(global_times != NULL){ highlight_time = global_times[itimes]; highlight_val = GetCSVVal(global_times[itimes], csvfi->time->vals, csvi->vals, csvi->nvals); @@ -533,8 +533,8 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){ csvdata *csvi; curve = plot2di->curve+i; - csvfi = csvfileinfo + curve->f_index; - csvi = csvfi->csvinfo + curve->index; + csvfi = csvfileinfo + curve->csv_file_index; + csvi = csvfi->csvinfo + curve->csv_col_index; curve->valmin = csvi->valmin; curve->valmax = csvi->valmax; curve->usermin = csvi->valmin; diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index cfccb94679..064b494c94 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -390,7 +390,7 @@ void RemoveCurve(plot2ddata *plot2di, int index){ curvedata *curve; curve = plot2di->curve+i; - if(curve->index == index)continue; + if(curve->csv_col_index == index)continue; if(i != ii){ memcpy(plot2di->curve + ii, plot2di->curve + i, sizeof(curvedata)); } @@ -398,7 +398,7 @@ void RemoveCurve(plot2ddata *plot2di, int index){ } (plot2di->ncurves)--; if(plot2di->ncurves > 0){ - LIST_plotcurves->set_int_val(plot2di->curve[0].index); + LIST_plotcurves->set_int_val(plot2di->curve[0].csv_col_index); } else{ LIST_plotcurves->set_int_val(-1); @@ -412,7 +412,7 @@ int InCSVPlot(plot2ddata *plot2di, char *c_type, int index){ int i; for(i = 0; i < plot2di->ncurves; i++){ - if(plot2di->curve[i].index != index)continue; + if(plot2di->curve[i].csv_col_index != index)continue; if(strcmp(plot2di->curve[i].c_type, c_type)!=0)continue; return 1; } @@ -427,7 +427,7 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ csvdata *csvi; char *c_type; - csvfi = csvfileinfo + glui_csv_type; + csvfi = csvfileinfo + glui_csv_file_index; csvi = csvfi->csvinfo + index; c_type = csvfi->c_type; @@ -441,8 +441,8 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ if(nplots < PLOT2D_MAX_CURVES){ char label[255]; - plot2di->curve[nplots].index = index; - plot2di->curve[nplots].f_index = glui_csv_type; + plot2di->curve[nplots].csv_col_index = index; + plot2di->curve[nplots].csv_file_index = glui_csv_file_index; strcpy(plot2di->curve[nplots].c_type, c_type); nplots++; plot2di->ncurves = nplots; @@ -465,7 +465,7 @@ void MakeCurveList(plot2ddata *plot2di, int option){ for(i = 0; i < plot2di->ncurves_ini; i++){ int curv_index; - curv_index = plot2di->curve[i].index_ini; + curv_index = plot2di->curve[i].csv_col_index_ini; AddCSVCurve(plot2di, curv_index, 1); GenPlotCB(GENPLOT_SELECT_CURVE); } @@ -481,7 +481,7 @@ void Plot2D2Glui(int index){ int i; for(i=0;incurves; i++){ - glui_plot2dinfo->curve[i].index_ini = glui_plot2dinfo->curve[i].index; + glui_plot2dinfo->curve[i].csv_col_index_ini = glui_plot2dinfo->curve[i].csv_col_index; } glui_plot2dinfo->ncurves_ini = glui_plot2dinfo->ncurves; glui_plot2dinfo->ncurves = 0; @@ -658,7 +658,7 @@ void FilterList(void){ { csvfiledata *csvfi; - csvfi = csvfileinfo + glui_csv_type; + csvfi = csvfileinfo + glui_csv_file_index; unit_id = LIST_csvunits->get_int_val(); strcpy(unit_label, "all"); if(unit_id >= 0){ @@ -705,7 +705,7 @@ void UpdateCvsList(void){ { csvfiledata *csvfi; - csvfi = csvfileinfo + glui_csv_type; + csvfi = csvfileinfo + glui_csv_file_index; for(i = 0; i < csvfi->ncsvinfo; i++){ csvdata *csvi; @@ -725,7 +725,7 @@ void UpdateCvsList(void){ { csvfiledata *csvfi; - csvfi = csvfileinfo + glui_csv_type; + csvfi = csvfileinfo + glui_csv_file_index; for(i = 0; i < csvfi->ncsvinfo; i++){ csvdata *csvi; int dup_unit, j; @@ -1396,7 +1396,7 @@ extern "C" void GluiDeviceSetup(int main_window){ if(ncsvfileinfo > 0){ PANEL_csv = glui_device->add_panel_to_panel(PANEL_add_curve, "", 0); - LIST_csvfile = glui_device->add_listbox_to_panel(PANEL_csv, "curve type:", &glui_csv_type, GENPLOT_SELECT_CSV_FILE, GenPlotCB); + LIST_csvfile = glui_device->add_listbox_to_panel(PANEL_csv, "curve type:", &glui_csv_file_index, GENPLOT_SELECT_CSV_FILE, GenPlotCB); for(i = 0; i < ncsvfileinfo; i++){ csvfiledata *csvfi; diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 228db6ef4d..13fcabe9e7 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -11567,7 +11567,7 @@ int ReadIni2(char *inifile, int localfile){ curve_use_factors = 0; sscanf(buffer, " %i %i %i %i %f %f %f %i", &index, color, color+1, color+2, &linewidth1, curve_factors, curve_factors+1, &curve_use_factors); - plot2di->curve[j].index = index; + plot2di->curve[j].csv_col_index = index; curve = plot2di->curve+index; curve->color[0] = color[0]; curve->color[1] = color[1]; @@ -14962,7 +14962,7 @@ void WriteIniLocal(FILE *fileout){ int index; curvedata *curve; - index = plot2di->curve[j].index; + index = plot2di->curve[j].csv_col_index; curve = plot2di->curve+index; color = curve->color; linewidth1 = curve->linewidth; diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index b49f6dfcbd..7d4457b23b 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -1530,7 +1530,7 @@ SVEXTERN float max_dev_vel; SVEXTERN int SVDECL(last_prop_display,-1); SVEXTERN int SVDECL(devicetypes_index,0); #ifdef pp_PLOT2D_NEW -SVEXTERN int SVDECL(glui_csv_type, 0); +SVEXTERN int SVDECL(glui_csv_file_index, 0); SVEXTERN int SVDECL(icsv_cols, 0), SVDECL(icsv_units, 0); SVEXTERN int SVDECL(plot2d_max_columns, 0); SVEXTERN int SVDECL(deviceunits_index, 0); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 13de764c30..1ad0482391 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -1010,8 +1010,9 @@ typedef struct _hrrdata { #ifdef pp_PLOT2D_NEW typedef struct _curvedata{ char c_type[64]; - int f_index; - int index, index_ini, use_usermin, use_usermax, use_factors, color[3]; + int csv_file_index; + int csv_col_index, csv_col_index_ini; + int use_usermin, use_usermax, use_factors, color[3]; float valmin, valmax, usermin, usermax; float linewidth; float factors[2]; From 4f2cab99b79759c5fcd04c70c54fd866a0749f81 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 10:15:29 -0400 Subject: [PATCH 17/41] smokeview source: add routines for getting csv data structures --- Source/smokeview/IOplot2d.c | 53 ++++++++------- Source/smokeview/glui_objects.cpp | 104 ++++++++++++++---------------- Source/smokeview/smokeheaders.h | 2 + 3 files changed, 78 insertions(+), 81 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 6986d6ab55..94af4c5a16 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -8,6 +8,25 @@ #include "smokeviewvars.h" #ifdef pp_PLOT2D_NEW + +/* ------------------ GetCurrentCsv ------------------------ */ + +csvdata *GetCsv(int file_index, int col_index, csvfiledata **csvf_ptr){ + csvfiledata *csvfi; + csvdata *csvi; + + csvfi = csvfileinfo + file_index; + csvi = csvfi->csvinfo + col_index; + if(csvf_ptr != NULL)*csvf_ptr = csvfi; + return csvi; +} + +/* ------------------ GetCurrentCsv ------------------------ */ + +csvdata *GetCurrentCsv(int col_index, csvfiledata **csvf_ptr){ + return GetCsv(glui_csv_file_index, col_index, csvf_ptr); +} + /* ------------------ HaveGenDevShow ------------------------ */ int GenDevShow(void){ @@ -226,33 +245,19 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ /* ------------------ GetPlotUnit ------------------------ */ char *GetPlotUnit(plot2ddata *plot2di, int i){ - csvfiledata *csvfi; csvdata *csvi; - int fcurve_index, curve_index; - char *unit; - - curve_index = plot2di->curve[i].csv_col_index; - fcurve_index = plot2di->curve[i].csv_file_index; - csvfi = csvfileinfo + fcurve_index; - csvi = csvfi->csvinfo + curve_index; - unit = csvi->label.unit; - return unit; + + csvi = GetCsv(plot2di->curve[i].csv_file_index, plot2di->curve[i].csv_col_index, NULL); + return csvi->label.unit; } /* ------------------ GetPlotShortLabel ------------------------ */ char *GetPlotShortLabel(plot2ddata *plot2di, int i){ - csvfiledata *csvfi; csvdata *csvi; - int fcurve_index, curve_index; - char *shortlabel; - - curve_index = plot2di->curve[i].csv_col_index; - fcurve_index = plot2di->curve[i].csv_file_index; - csvfi = csvfileinfo + fcurve_index; - csvi = csvfi->csvinfo + curve_index; - shortlabel = csvi->label.shortlabel; - return shortlabel; + + csvi = GetCsv(plot2di->curve[i].csv_file_index, plot2di->curve[i].csv_col_index, NULL); + return csvi->label.shortlabel; } /* ------------------ GetCSVVal ------------------------ */ @@ -390,8 +395,8 @@ void DrawGenPlot(plot2ddata *plot2di){ csvdata *csvi; curve = plot2di->curve + i; - csvfi = csvfileinfo + curve->csv_file_index; - csvi = csvfi->csvinfo + curve->csv_col_index; + csvi = GetCsv(curve->csv_file_index, curve->csv_col_index, &csvfi); + if(global_times != NULL){ highlight_time = global_times[itimes]; highlight_val = GetCSVVal(global_times[itimes], csvfi->time->vals, csvi->vals, csvi->nvals); @@ -529,12 +534,10 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){ } for(i = 0; incurves; i++){ curvedata *curve; - csvfiledata *csvfi; csvdata *csvi; curve = plot2di->curve+i; - csvfi = csvfileinfo + curve->csv_file_index; - csvi = csvfi->csvinfo + curve->csv_col_index; + csvi = GetCsv(curve->csv_file_index, curve->csv_col_index, NULL); curve->valmin = csvi->valmin; curve->valmax = csvi->valmax; curve->usermin = csvi->valmin; diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 064b494c94..6990261dc8 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -427,8 +427,7 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ csvdata *csvi; char *c_type; - csvfi = csvfileinfo + glui_csv_file_index; - csvi = csvfi->csvinfo + index; + csvi = GetCurrentCsv(index, &csvfi); c_type = csvfi->c_type; have_plot = 0; @@ -658,13 +657,13 @@ void FilterList(void){ { csvfiledata *csvfi; - csvfi = csvfileinfo + glui_csv_file_index; + GetCurrentCsv(0, &csvfi); unit_id = LIST_csvunits->get_int_val(); strcpy(unit_label, "all"); if(unit_id >= 0){ csvdata *csvunit; - csvunit = csvfi->csvinfo + unit_id; + csvunit = GetCurrentCsv(unit_id, NULL); if(csvunit->dimensionless == 0){ strcpy(unit_label, csvunit->label.unit); } @@ -675,7 +674,7 @@ void FilterList(void){ for(i = 0; i < csvfi->ncsvinfo; i++){ csvdata *csvi; - csvi = csvfi->csvinfo + i; + csvi = GetCurrentCsv(i, NULL); if(csvi == csvfi->time)continue; if(strcmp(unit_label, "all") == 0){ LIST_csvID->add_item(i, csvi->label.shortlabel); @@ -698,74 +697,67 @@ void FilterList(void){ void UpdateCvsList(void){ int i; char label[256]; + csvfiledata *csvfi; for(i=0; idelete_item(i); } - { - csvfiledata *csvfi; + GetCurrentCsv(0, &csvfi); + for(i = 0; i < csvfi->ncsvinfo; i++){ + csvdata *csvi; - csvfi = csvfileinfo + glui_csv_file_index; - for(i = 0; i < csvfi->ncsvinfo; i++){ - csvdata *csvi; - - csvi = csvfi->csvinfo + i; - if(csvi == csvfi->time)continue; - LIST_csvID->add_item(i, csvi->label.shortlabel); - } - strcpy(label, "add/remove "); - strcat(label, csvfi->c_type); - strcat(label, " data"); - LIST_csvID->set_name(label); + csvi = GetCurrentCsv(i, NULL); + if(csvi == csvfi->time)continue; + LIST_csvID->add_item(i, csvi->label.shortlabel); } + strcpy(label, "add/remove "); + strcat(label, csvfi->c_type); + strcat(label, " data"); + LIST_csvID->set_name(label); for(i=0; idelete_item(i); } - { + for(i = 0; i < csvfi->ncsvinfo; i++){ csvfiledata *csvfi; - - csvfi = csvfileinfo + glui_csv_file_index; - for(i = 0; i < csvfi->ncsvinfo; i++){ - csvdata *csvi; - int dup_unit, j; - - dup_unit = 0; - csvi = csvfi->csvinfo + i; - if(csvi == csvfi->time)continue; - for(j=0; jcsvinfo + j; - if(csvj == csvfi->time)continue; - if(csvi->dimensionless==0){ - if(strcmp(csvi->label.unit, csvj->label.unit) == 0){ - dup_unit = 1; - break; - } - } - else{ - if(csvj->dimensionless==1){ - dup_unit = 1; - break; - } + csvdata *csvi; + int dup_unit, j; + + csvi = GetCurrentCsv(i, NULL); + dup_unit = 0; + if(csvi == csvfi->time)continue; + for(j=0; jtime)continue; + if(csvi->dimensionless==0){ + if(strcmp(csvi->label.unit, csvj->label.unit) == 0){ + dup_unit = 1; + break; } } - if(dup_unit == 0){ - if(csvi->dimensionless==0){ - LIST_csvunits->add_item(i, csvi->label.unit); - } - else{ - LIST_csvunits->add_item(i, "dimensionless"); + else{ + if(csvj->dimensionless==1){ + dup_unit = 1; + break; } } } - strcpy(label, "add/remove "); - strcat(label, csvfi->c_type); - strcat(label, " data"); - LIST_csvID->set_name(label); - LIST_csvunits->set_int_val(-1); + if(dup_unit == 0){ + if(csvi->dimensionless==0){ + LIST_csvunits->add_item(i, csvi->label.unit); + } + else{ + LIST_csvunits->add_item(i, "dimensionless"); + } + } } + strcpy(label, "add/remove "); + strcat(label, csvfi->c_type); + strcat(label, " data"); + LIST_csvID->set_name(label); + LIST_csvunits->set_int_val(-1); } /* ------------------ GenPlotCB ------------------------ */ diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 042955b92e..c8aa0c40a8 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -537,6 +537,8 @@ EXTERNCPP void ReadDeviceData(char *file, int filetype, int flag); EXTERNCPP void SetupZoneDevs(void); EXTERNCPP void SetupDeviceData(void); #ifdef pp_PLOT2D_NEW +EXTERNCPP csvdata *GetCsv(int file_index, int col_index, csvfiledata **csvf_ptr); +EXTERNCPP csvdata *GetCurrentCsv(int i, csvfiledata **csvf_ptr); EXTERNCPP void SetupPlot2DUnitData(void); #endif EXTERNCPP void DrawCGeom(int flag, geomdata *cgeom); From ec28cb19c653d95aca2a1f8de6e6efc4c9bacde2 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 10:20:11 -0400 Subject: [PATCH 18/41] smokeview source: remove shadowed declaration --- Source/smokeview/glui_objects.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 6990261dc8..7be8daf45d 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -719,7 +719,6 @@ void UpdateCvsList(void){ LIST_csvunits->delete_item(i); } for(i = 0; i < csvfi->ncsvinfo; i++){ - csvfiledata *csvfi; csvdata *csvi; int dup_unit, j; From 58d6c8d17ef3c7792ebb56ee7fd2e4851f5c0d1b Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 14:43:47 -0400 Subject: [PATCH 19/41] scripts: minor edit to line count script --- Source/smokeview/LINECOUNT_ALL.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/smokeview/LINECOUNT_ALL.bat b/Source/smokeview/LINECOUNT_ALL.bat index e30eef587a..5f13205a8e 100644 --- a/Source/smokeview/LINECOUNT_ALL.bat +++ b/Source/smokeview/LINECOUNT_ALL.bat @@ -1,2 +1,2 @@ @echo off -cat *.c *.cpp *.h *.f90 ..\shared\*.c ..\shared\*.h ..\background\*.c ..\background\*.h ..\smokediff\*.h ..\smokediff\*.c ..\smokezip\*.c ..\smokezip\*.h ..\smokezip\*.f90 ..\wind2fds\*.c ..\wind2fds\*.h ..\dem2fds\*.c ..\dem2fds\*.h| wc +cat *.c *.cpp *.h *.f90 ..\shared\*.c ..\shared\*.h ..\background\*.c ..\background\*.h ..\smokediff\*.h ..\smokediff\*.c ..\smokezip\*.c ..\smokezip\*.h ..\smokezip\*.f90 ..\wind2fds\*.c ..\wind2fds\*.h | wc -l From 6ccca49f129b02b8014bf659a32d1787ddd428c8 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 15:15:35 -0400 Subject: [PATCH 20/41] smokeview source: improve 2d plot dialog layout --- Source/smokeview/IOplot2d.c | 20 +++--- Source/smokeview/glui_objects.cpp | 116 +++++++++++++++++++----------- Source/smokeview/glui_smoke.cpp | 1 - Source/smokeview/readsmv.c | 21 ------ Source/smokeview/smokeheaders.h | 1 + Source/smokeview/smokeviewvars.h | 1 + Source/smokeview/startup.c | 20 +++--- Source/smokeview/structures.h | 4 +- 8 files changed, 100 insertions(+), 84 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 94af4c5a16..a059169cd6 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -294,7 +294,6 @@ void DrawGenPlot(plot2ddata *plot2di){ int unit_left_index=0, unit_right_index=0; float pad_length = 0.0; - void UpdateCurveBounds(plot2ddata*plot2di, int flag); if(plot2di->bounds_defined==0)UpdateCurveBounds(plot2di, 1); for(i = 0; incurves; i++){ char *unit; @@ -332,8 +331,8 @@ void DrawGenPlot(plot2ddata *plot2di){ curvedata *curve; curve = plot2di->curve+i; - valmin = curve->valmin; - valmax = curve->valmax; + valmin = curve->vmin; + valmax = curve->vmax; unit = GetPlotUnit(plot2di, i); if(axis_right_unit!=NULL&&strcmp(unit, axis_right_unit) == 0){ if(axis_right_min>axis_right_max){ @@ -538,12 +537,15 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){ curve = plot2di->curve+i; csvi = GetCsv(curve->csv_file_index, curve->csv_col_index, NULL); - curve->valmin = csvi->valmin; - curve->valmax = csvi->valmax; - curve->usermin = csvi->valmin; - curve->usermax = csvi->valmax; - curve->use_usermin = 0; - curve->use_usermax = 0; + curve->vmin = csvi->valmin; + curve->vmax = csvi->valmax; + } + for(i = plot2di->ncurves; i < PLOT2D_MAX_CURVES; i++){ + curvedata *curve; + + curve = plot2di->curve + i; + curve->vmin = 0.0; + curve->vmax = 1.0; } } diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 7be8daf45d..da450af15b 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -181,8 +181,8 @@ GLUI_Rollout **ROLLOUT_showz_windrose; GLUI_Rollout *ROLLOUT_trees = NULL; #ifdef pp_PLOT2D_NEW -GLUI_Spinner *SPINNER_genplot_usermin = NULL; -GLUI_Spinner *SPINNER_genplot_usermax = NULL; +GLUI_Spinner *SPINNER_genplot_vmin = NULL; +GLUI_Spinner *SPINNER_genplot_vmax = NULL; GLUI_Spinner *SPINNER_genplot_x = NULL; GLUI_Spinner *SPINNER_genplot_y = NULL; @@ -439,18 +439,24 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ else{ if(nplots < PLOT2D_MAX_CURVES){ char label[255]; + curvedata *curve; - plot2di->curve[nplots].csv_col_index = index; - plot2di->curve[nplots].csv_file_index = glui_csv_file_index; - strcpy(plot2di->curve[nplots].c_type, c_type); - nplots++; - plot2di->ncurves = nplots; + curve = plot2di->curve + nplots; + curve->vmax = csvi->valmax; + curve->vmin = csvi->valmin; + curve->csv_col_index = index; + curve->csv_file_index = glui_csv_file_index; + strcpy(curve->c_type, c_type); + plot2di->ncurves = nplots+1; strcpy(label, c_type); strcat(label, "/"); strcat(label, csvi->label.shortlabel); LIST_plotcurves->add_item(nplots, label); LIST_plotcurves->set_int_val(nplots); + memcpy(&glui_curve, curve, sizeof(curvedata)); + nplots++; + UpdateCurveControls(); } } } @@ -523,7 +529,9 @@ extern "C" void AddPlot(void){ strcpy(plot2dinfo[iplot2dinfo].plot_label, label); LIST_plots->add_item(iplot2dinfo, label); LIST_plots->set_int_val(iplot2dinfo); -} + memcpy(&glui_curve, &glui_curve_default, sizeof(curvedata)); + UpdateCurveControls(); + } /* ------------------ RemovePlot ------------------------ */ @@ -594,10 +602,8 @@ void UpdateCurveControls(void){ SPINNER_genplot_green->set_int_val(glui_curve.color[1]); SPINNER_genplot_blue->set_int_val(glui_curve.color[2]); SPINNER_genplot_linewidth->set_float_val(glui_curve.linewidth); - CHECKBOX_genplot_use_usermin->set_int_val(glui_curve.use_usermin); - SPINNER_genplot_usermin->set_float_val(glui_curve.usermin); - CHECKBOX_genplot_use_usermax->set_int_val(glui_curve.use_usermax); - SPINNER_genplot_usermax->set_float_val(glui_curve.usermax); + SPINNER_genplot_vmin->set_float_val(glui_curve.vmin); + SPINNER_genplot_vmax->set_float_val(glui_curve.vmax); } /* ------------------ EnableDisablePlot2D ------------------------ */ @@ -614,12 +620,14 @@ void EnableDisablePlot2D(void){ PANEL_plot_position->enable(); PANEL_plot_title->enable(); PANEL_add_curve->enable(); + PANEL_curve_bounds->disable(); if(glui_plot2dinfo->ncurves == 0){ PANEL_curve_properties->disable(); } else{ PANEL_curve_properties->enable(); + PANEL_curve_bounds->disable(); } if(glui_plot2dinfo->ncurves > 0 && glui_plot2dinfo->curve_index < ndeviceinfo){ BUTTON_plot_position->enable(); @@ -697,6 +705,7 @@ void FilterList(void){ void UpdateCvsList(void){ int i; char label[256]; + char label2[256]; csvfiledata *csvfi; for(i=0; itime)continue; LIST_csvID->add_item(i, csvi->label.shortlabel); } - strcpy(label, "add/remove "); - strcat(label, csvfi->c_type); - strcat(label, " data"); - LIST_csvID->set_name(label); + strcpy(label, "add"); + if(plot2dinfo != NULL){ + strcat(label, " curves to "); + strcat(label, plot2dinfo[iplot2dinfo].plot_label); + } + else{ + strcat(label, " curves"); + } + PANEL_add_curve->set_name(label); + + strcpy(label2, csvfi->c_type); + strcat(label2, " curves:"); + LIST_csvID->set_name(label2); for(i=0; idelete_item(i); @@ -752,10 +770,20 @@ void UpdateCvsList(void){ } } } - strcpy(label, "add/remove "); - strcat(label, csvfi->c_type); - strcat(label, " data"); - LIST_csvID->set_name(label); + strcpy(label, "add"); + if(plot2dinfo != NULL){ + strcat(label, " curves to "); + strcat(label, plot2dinfo[iplot2dinfo].plot_label); + } + else{ + strcat(label, " curves"); + } + PANEL_add_curve->set_name(label); + + strcpy(label2, csvfi->c_type); + strcat(label2, " curves:"); + LIST_csvID->set_name(label2); + LIST_csvunits->set_int_val(-1); } @@ -764,11 +792,14 @@ void UpdateCvsList(void){ void GenPlotCB(int var){ switch (var){ char label[256]; + char label2[256]; int index; curvedata *curve; + int curve_id; case GENPLOT_SELECT_CSV_CLICK: - AddCSVCurve(glui_plot2dinfo, LIST_csvID->get_int_val(), 0); + curve_id = LIST_csvID->get_int_val(); + AddCSVCurve(glui_plot2dinfo, curve_id, 0); Glui2Plot2D(iplot2dinfo); EnableDisablePlot2D(); break; @@ -845,6 +876,17 @@ void GenPlotCB(int var){ strcpy(label, plot2dinfo[iplot2dinfo].plot_label); strcat(label, " curve properties"); PANEL_curve_properties->set_name(label); + csvfiledata *csvfi; + GetCurrentCsv(0, &csvfi); + strcpy(label, "add"); + if(plot2dinfo != NULL){ + strcat(label, " curves to "); + strcat(label, plot2dinfo[iplot2dinfo].plot_label); + } + else{ + strcat(label, " curves"); + } + PANEL_add_curve->set_name(label); } break; case GENPLOT_ADD_PLOT: @@ -1383,7 +1425,7 @@ extern "C" void GluiDeviceSetup(int main_window){ BUTTON_plot_position = glui_device->add_button_to_panel(PANEL_plot_position, _("Set to device location"), GENPLOT_SET_POS, GenPlotCB); PANEL_plot5 = glui_device->add_panel_to_panel(ROLLOUT_plotgeneral, "", 0); - PANEL_add_curve = glui_device->add_panel_to_panel(PANEL_plot5, "add/remove curves"); + PANEL_add_curve = glui_device->add_panel_to_panel(PANEL_plot5, ""); if(ncsvfileinfo > 0){ PANEL_csv = glui_device->add_panel_to_panel(PANEL_add_curve, "", 0); @@ -1394,15 +1436,13 @@ extern "C" void GluiDeviceSetup(int main_window){ csvfi = csvfileinfo + i; LIST_csvfile->add_item(i, csvfi->c_type); } - PANEL_csv2 = glui_device->add_panel_to_panel(PANEL_add_curve, "", 0); - LIST_csvID = glui_device->add_listbox_to_panel(PANEL_csv2, "add/remove csv file data:", &icsv_cols, GENPLOT_SELECT_CSV_CLICK, GenPlotCB); - glui_device->add_column_to_panel(PANEL_csv2, false); - LIST_csvunits = glui_device->add_listbox_to_panel(PANEL_csv2, "", &icsv_units, GENPLOT_CSV_TYPE, GenPlotCB); + PANEL_csv2 = glui_device->add_panel_to_panel(PANEL_add_curve, ""); + LIST_csvID = glui_device->add_listbox_to_panel(PANEL_csv2, "curves:", &icsv_cols, GENPLOT_SELECT_CSV_CLICK, GenPlotCB); + LIST_csvunits = glui_device->add_listbox_to_panel(PANEL_csv2, "show", &icsv_units, GENPLOT_CSV_TYPE, GenPlotCB); LIST_csvunits->add_item(-1, "all"); GenPlotCB(GENPLOT_SELECT_CSV_FILE); GenPlotCB(GENPLOT_CSV_TYPE); } - glui_device->add_button_to_panel(PANEL_add_curve, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); if(nplot2dinfo==0){ if(PANEL_add_curve!=NULL)PANEL_add_curve->disable(); if(PANEL_plot_position!=NULL)PANEL_plot_position->disable(); @@ -1412,10 +1452,11 @@ extern "C" void GluiDeviceSetup(int main_window){ if(glui_plot2dinfo->ncurves == 0 || glui_plot2dinfo->curve_index>=ndeviceinfo)BUTTON_plot_position->disable(); } + memcpy(&glui_curve, &glui_curve_default, sizeof(curvedata)); + glui_device->add_column_to_panel(PANEL_plot5, false); PANEL_curve_properties = glui_device->add_panel_to_panel(PANEL_plot5, "curve properties"); if(nplot2dinfo > 0 && glui_plot2dinfo->ncurves == 0)PANEL_curve_properties->disable(); LIST_plotcurves = glui_device->add_listbox_to_panel(PANEL_curve_properties, "select:", &glui_plot2dinfo->curve_index, GENPLOT_SELECT_CURVE, GenPlotCB); - LIST_plotcurves->add_item(-1, ""); RemoveCurve(glui_plot2dinfo, -1); MakeCurveList(glui_plot2dinfo, 1); @@ -1427,20 +1468,15 @@ extern "C" void GluiDeviceSetup(int main_window){ SPINNER_genplot_green->set_int_limits(0, 255); SPINNER_genplot_blue->set_int_limits(0, 255); - SPINNER_genplot_linewidth = glui_device->add_spinner_to_panel(PANEL_curve_properties, "line width", GLUI_SPINNER_FLOAT, &(glui_curve.linewidth), GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_linewidth->set_float_limits(1.0,10.0); - glui_device->add_column_to_panel(PANEL_curve_properties, false); + glui_device->add_checkbox_to_panel(PANEL_curve_properties, _("remove selected curve"), &glui_remove_selected_curve); + glui_device->add_button_to_panel(PANEL_curve_properties, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "bounds"); - PANEL_curve_usermin = glui_device->add_panel_to_panel(PANEL_curve_bounds, "", 0); - SPINNER_genplot_usermin = glui_device->add_spinner_to_panel(PANEL_curve_usermin, "min", GLUI_SPINNER_FLOAT, &(glui_curve.usermin), GENPLOT_XYZ, GenPlotCB); - glui_device->add_column_to_panel(PANEL_curve_usermin, false); - CHECKBOX_genplot_use_usermin = glui_device->add_checkbox_to_panel(PANEL_curve_usermin, "use", &(glui_curve.use_usermin), GENPLOT_XYZ, GenPlotCB); - - PANEL_curve_usermax = glui_device->add_panel_to_panel(PANEL_curve_bounds, "", 0); - SPINNER_genplot_usermax = glui_device->add_spinner_to_panel(PANEL_curve_usermax, "max", GLUI_SPINNER_FLOAT, &(glui_curve.usermax), GENPLOT_XYZ, GenPlotCB); - glui_device->add_column_to_panel(PANEL_curve_usermax, false); - CHECKBOX_genplot_use_usermax = glui_device->add_checkbox_to_panel(PANEL_curve_usermax, "use", &(glui_curve.use_usermax), GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_vmin = glui_device->add_spinner_to_panel(PANEL_curve_bounds, "min", GLUI_SPINNER_FLOAT, &(glui_curve.vmin), GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_vmax = glui_device->add_spinner_to_panel(PANEL_curve_bounds, "max", GLUI_SPINNER_FLOAT, &(glui_curve.vmax), GENPLOT_XYZ, GenPlotCB); + + SPINNER_genplot_linewidth = glui_device->add_spinner_to_panel(PANEL_curve_properties, "line width", GLUI_SPINNER_FLOAT, &(glui_curve.linewidth), GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_linewidth->set_float_limits(1.0,10.0); if(nplot2dini>0){ nplot2dinfo = nplot2dini; diff --git a/Source/smokeview/glui_smoke.cpp b/Source/smokeview/glui_smoke.cpp index 01dee6bb6e..b24af86943 100644 --- a/Source/smokeview/glui_smoke.cpp +++ b/Source/smokeview/glui_smoke.cpp @@ -172,7 +172,6 @@ GLUI_StaticText *STATIC_globalframelimit_max = NULL; GLUI_StaticText *STATIC_timelimit_min = NULL; GLUI_StaticText *STATIC_timelimit_max = NULL; - #define VOLRENDER_ROLLOUT 0 #define SLICERENDER_ROLLOUT 1 #define MESH_ROLLOUT 2 diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 13fcabe9e7..cbdbd119f5 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -11576,19 +11576,7 @@ int ReadIni2(char *inifile, int localfile){ curve->factors[0] = curve_factors[0]; curve->factors[1] = curve_factors[1]; curve->use_factors = curve_use_factors; - - float *valmin2, *valmax2; - int *use_valmin2, *use_valmax2; - use_valmin2 = &(curve->use_usermin); - use_valmax2 = &(curve->use_usermax); - valmin2 = &(curve->usermin); - valmax2 = &(curve->usermax); - fgets(buffer, 255, stream); - TrimBack(buffer); - sscanf(buffer, " %i %f %i %f", use_valmin2, valmin2, use_valmax2, valmax2); } -void UpdateCurveBounds(plot2ddata *plot2di, int option); - UpdateCurveBounds(plot2di, 0); } update_glui_devices = 1; continue; @@ -14970,15 +14958,6 @@ void WriteIniLocal(FILE *fileout){ curve_use_factors = curve->use_factors; fprintf(fileout, " %i %i %i %i %f %f %f %i\n", index, color[0], color[1], color[2], linewidth1, curve_factors[0], curve_factors[1], curve_use_factors); - - int use_valmin2, use_valmax2; - float valmin2, valmax2; - - use_valmin2 = curve->use_usermin; - use_valmax2 = curve->use_usermax; - valmin2 = curve->usermin; - valmax2 = curve->usermax; - fprintf(fileout, " %i %f %i %f\n", use_valmin2, valmin2, use_valmax2, valmax2); }; } #endif diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index c8aa0c40a8..7673343389 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -537,6 +537,7 @@ EXTERNCPP void ReadDeviceData(char *file, int filetype, int flag); EXTERNCPP void SetupZoneDevs(void); EXTERNCPP void SetupDeviceData(void); #ifdef pp_PLOT2D_NEW +EXTERNCPP void UpdateCurveBounds(plot2ddata *plot2di, int flag); EXTERNCPP csvdata *GetCsv(int file_index, int col_index, csvfiledata **csvf_ptr); EXTERNCPP csvdata *GetCurrentCsv(int i, csvfiledata **csvf_ptr); EXTERNCPP void SetupPlot2DUnitData(void); diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 7d4457b23b..4a9b41a95e 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -1530,6 +1530,7 @@ SVEXTERN float max_dev_vel; SVEXTERN int SVDECL(last_prop_display,-1); SVEXTERN int SVDECL(devicetypes_index,0); #ifdef pp_PLOT2D_NEW +SVEXTERN int SVDECL(glui_remove_selected_curve, 0); SVEXTERN int SVDECL(glui_csv_file_index, 0); SVEXTERN int SVDECL(icsv_cols, 0), SVDECL(icsv_units, 0); SVEXTERN int SVDECL(plot2d_max_columns, 0); diff --git a/Source/smokeview/startup.c b/Source/smokeview/startup.c index 7d813b1106..bd0d2f943d 100644 --- a/Source/smokeview/startup.c +++ b/Source/smokeview/startup.c @@ -133,17 +133,15 @@ void InitMisc(void){ mat_specular2[3] = 1.0; #ifdef pp_PLOT2D_NEW - glui_curve_default.color[0] = 0; - glui_curve_default.color[1] = 0; - glui_curve_default.color[2] = 0; - glui_curve_default.linewidth = 1.0; - glui_curve_default.usermin = 1.0; - glui_curve_default.usermax=0.0; - glui_curve_default.use_usermin = 0; - glui_curve_default.use_usermax=0; - glui_curve_default.use_factors=0; - glui_curve_default.factors[0] = 1.0; - glui_curve_default.factors[1] = 0.0; + glui_curve_default.color[0] = 0; + glui_curve_default.color[1] = 0; + glui_curve_default.color[2] = 0; + glui_curve_default.linewidth = 1.0; + glui_curve_default.vmin = 0.0; + glui_curve_default.vmax = 1.0; + glui_curve_default.use_factors = 0; + glui_curve_default.factors[0] = 1.0; + glui_curve_default.factors[1] = 0.0; memcpy(&glui_curve, &glui_curve_default, sizeof(curvedata)); #endif diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 1ad0482391..e34a3168c8 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -1012,8 +1012,8 @@ typedef struct _curvedata{ char c_type[64]; int csv_file_index; int csv_col_index, csv_col_index_ini; - int use_usermin, use_usermax, use_factors, color[3]; - float valmin, valmax, usermin, usermax; + int use_factors, color[3]; + float vmin, vmax; float linewidth; float factors[2]; } curvedata; From 9dd86c032945574bb297a99c9efdb5ce45cde882 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 15:19:00 -0400 Subject: [PATCH 21/41] smokeview source: remove unused variables --- Source/smokeview/glui_objects.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index da450af15b..4966fc875d 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -792,7 +792,6 @@ void UpdateCvsList(void){ void GenPlotCB(int var){ switch (var){ char label[256]; - char label2[256]; int index; curvedata *curve; int curve_id; From 28b1b7db32b1e41e932d749c077d4ab9ab7b2518 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 17:58:05 -0400 Subject: [PATCH 22/41] smokeview source: improve 2d plot dialog layoutt --- Source/smokeview/glui_objects.cpp | 81 ++++++++++++++----------------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index da450af15b..6fbf9451af 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -38,7 +38,7 @@ #define GENPLOT_PLOT_LABEL 110 #define GENPLOT_SET_POS 111 #define GENPLOT_CSV_TYPE 112 -#define GENPLOT_SELECT_CSV_CLICK 113 +#define GENPLOT_ADD_CURVE 113 #endif #define WINDROSE_SHOW_FIRST 996 @@ -384,24 +384,17 @@ void RemoveCurve(plot2ddata *plot2di, int index){ int i, ii; LIST_plotcurves->delete_item(index); - - ii = 0; - for(i = 0; i < plot2di->ncurves; i++){ - curvedata *curve; - - curve = plot2di->curve+i; - if(curve->csv_col_index == index)continue; - if(i != ii){ - memcpy(plot2di->curve + ii, plot2di->curve + i, sizeof(curvedata)); - } - ii++; +// (0,...,i-1,i+1,...,n-1) + if(plot2di->ncurves>i+1){ + memmove(plot2di->curve + i, plot2di->curve + i+1, (plot2di->ncurves-i-1)*sizeof(curvedata)); } (plot2di->ncurves)--; + LIST_plotcurves->set_int_val(-1); if(plot2di->ncurves > 0){ - LIST_plotcurves->set_int_val(plot2di->curve[0].csv_col_index); - } - else{ - LIST_plotcurves->set_int_val(-1); + int index2; + + index2 = CLAMP(index, 0, plot2di->ncurves-1); + LIST_plotcurves->set_int_val(index2); } } } @@ -433,31 +426,26 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ have_plot = 0; if(force == 0)have_plot = InCSVPlot(plot2di, c_type, index); nplots = plot2di->ncurves; - if(have_plot == 1){ - GenPlotCB(GENPLOT_REM_CURVE); - } - else{ - if(nplots < PLOT2D_MAX_CURVES){ - char label[255]; - curvedata *curve; - - curve = plot2di->curve + nplots; - curve->vmax = csvi->valmax; - curve->vmin = csvi->valmin; - curve->csv_col_index = index; - curve->csv_file_index = glui_csv_file_index; - strcpy(curve->c_type, c_type); - plot2di->ncurves = nplots+1; - strcpy(label, c_type); - strcat(label, "/"); - strcat(label, csvi->label.shortlabel); - - LIST_plotcurves->add_item(nplots, label); - LIST_plotcurves->set_int_val(nplots); - memcpy(&glui_curve, curve, sizeof(curvedata)); - nplots++; - UpdateCurveControls(); - } + if(have_plot == 0 && nplots < PLOT2D_MAX_CURVES){ + char label[255]; + curvedata *curve; + + curve = plot2di->curve + nplots; + curve->vmax = csvi->valmax; + curve->vmin = csvi->valmin; + curve->csv_col_index = index; + curve->csv_file_index = glui_csv_file_index; + strcpy(curve->c_type, c_type); + plot2di->ncurves = nplots+1; + strcpy(label, c_type); + strcat(label, "/"); + strcat(label, csvi->label.shortlabel); + + LIST_plotcurves->add_item(nplots, label); + LIST_plotcurves->set_int_val(nplots); + memcpy(&glui_curve, curve, sizeof(curvedata)); + nplots++; + UpdateCurveControls(); } } @@ -797,7 +785,7 @@ void GenPlotCB(int var){ curvedata *curve; int curve_id; - case GENPLOT_SELECT_CSV_CLICK: + case GENPLOT_ADD_CURVE: curve_id = LIST_csvID->get_int_val(); AddCSVCurve(glui_plot2dinfo, curve_id, 0); Glui2Plot2D(iplot2dinfo); @@ -824,6 +812,9 @@ void GenPlotCB(int var){ BUTTON_plot_position->set_name(label); } } + if(glui_remove_selected_curve==1){ + GenPlotCB(GENPLOT_REM_CURVE); + } break; case GENPLOT_REM_CURVE: RemoveCurve(glui_plot2dinfo, glui_plot2dinfo->curve_index); @@ -1406,7 +1397,7 @@ extern "C" void GluiDeviceSetup(int main_window){ PANEL_plots = glui_device->add_panel_to_panel(PANEL_plot8, "plots"); BUTTON_add_plot = glui_device->add_button_to_panel(PANEL_plots, _("New"), GENPLOT_ADD_PLOT, GenPlotCB); BUTTON_rem_plot = glui_device->add_button_to_panel(PANEL_plots, _("Remove"), GENPLOT_REM_PLOT, GenPlotCB); - LIST_plots = glui_device->add_listbox_to_panel(PANEL_plots, "select:", &iplot2dinfo, GENPLOT_SELECT_PLOT, GenPlotCB); + LIST_plots = glui_device->add_listbox_to_panel(PANEL_plots, "select:", &iplot2dinfo, GENPLOT_SELECT_PLOT, GenPlotCB); LIST_plots->add_item(-1, ""); CHECKBOX_show_genplot = glui_device->add_checkbox_to_panel(PANEL_plots, "show", &(glui_plot2dinfo->show), GENPLOT_SHOW_PLOT, GenPlotCB); @@ -1437,8 +1428,8 @@ extern "C" void GluiDeviceSetup(int main_window){ LIST_csvfile->add_item(i, csvfi->c_type); } PANEL_csv2 = glui_device->add_panel_to_panel(PANEL_add_curve, ""); - LIST_csvID = glui_device->add_listbox_to_panel(PANEL_csv2, "curves:", &icsv_cols, GENPLOT_SELECT_CSV_CLICK, GenPlotCB); - LIST_csvunits = glui_device->add_listbox_to_panel(PANEL_csv2, "show", &icsv_units, GENPLOT_CSV_TYPE, GenPlotCB); + LIST_csvID = glui_device->add_listbox_to_panel(PANEL_csv2, "curves:", &icsv_cols, GENPLOT_ADD_CURVE, GenPlotCB); + LIST_csvunits = glui_device->add_listbox_to_panel(PANEL_csv2, "show", &icsv_units, GENPLOT_CSV_TYPE, GenPlotCB); LIST_csvunits->add_item(-1, "all"); GenPlotCB(GENPLOT_SELECT_CSV_FILE); GenPlotCB(GENPLOT_CSV_TYPE); From 909098a40c863c80dbe0df022b787cd258041341 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 18:37:48 -0400 Subject: [PATCH 23/41] smokeview source: add back plot labels --- Source/smokeview/IOplot2d.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index a059169cd6..cdf6e91692 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -95,7 +95,7 @@ int HaveGenHrr(void){ #define AXIS_NONE 2 void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_factor, float *x, float *z, int n, float x_cur, float z_cur, float zmin, float zmax, - int axis_side, char *unit, float pad_length){ + int axis_side, int position, char *label, char *unit, float pad_length){ float xmin, xmax, dx, dz; float xscale = 1.0, zscale = 1.0; int i, ndigits = 3; @@ -220,21 +220,23 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ Float2String(c_zmin, zmin, ndigits, force_fixedpoint); Float2String(c_zmax, zmax, ndigits, force_fixedpoint); if(axis_side == AXIS_LEFT){ + Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmin, c_zmin); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax , c_zmax); } else{ + Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmin, c_zmin, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax , c_zmax, pad_length); - } + } SNIFF_ERRORS("after DrawGenCurve 5"); } if(unit!=NULL){ if(axis_side == AXIS_LEFT){ - Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing)*dfont, unit); + Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing*(float)(position + 1))*dfont, unit); } else{ - Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing)*dfont, unit, pad_length); + Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing*(float)(position + 1))*dfont, unit, pad_length); } } } @@ -357,7 +359,7 @@ void DrawGenPlot(plot2ddata *plot2di){ } for(i = 0; incurves; i++){ float highlight_time, highlight_val; - char *unit; + char *unit, *shortlabel; float valmin, valmax; int option, position, side; char *unit_display; @@ -400,8 +402,10 @@ void DrawGenPlot(plot2ddata *plot2di){ highlight_time = global_times[itimes]; highlight_val = GetCSVVal(global_times[itimes], csvfi->time->vals, csvi->vals, csvi->nvals); } + shortlabel = GetPlotShortLabel(plot2di, i); DrawGenCurve(option, plot2di, curve, plot2d_size_factor, csvfi->time->vals, csvi->vals, csvi->nvals, - highlight_time, highlight_val, valmin, valmax, side, unit_display, pad_length); + highlight_time, highlight_val, valmin, valmax, side, + position, shortlabel, unit_display, pad_length); } } From b64d78563a9b551062aeb4f9c5621eefe08b82dc Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 19:11:56 -0400 Subject: [PATCH 24/41] smokeview source: fix color for 2d plot curves and labels --- Source/smokeview/IOplot2d.c | 10 +++++++--- Source/smokeview/glui_objects.cpp | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index cdf6e91692..ed8ad03a0f 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -103,6 +103,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ float *xyz0, linewidth_arg, *plot_factors; int *plot_color, use_plot_factors, show_title; char *title; + float fplot_color[3]; SNIFF_ERRORS("after DrawGenCurve 1 - beginning"); xyz0 = plot2di->xyz; @@ -112,6 +113,9 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ use_plot_factors = curve->use_factors; title = plot2di->plot_label; show_title = plot2di->show_title; + fplot_color[0] = (float)plot_color[0] / 255.0; + fplot_color[1] = (float)plot_color[1] / 255.0; + fplot_color[2] = (float)plot_color[2] / 255.0; xmin = x[0]; xmax = xmin; @@ -220,12 +224,12 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ Float2String(c_zmin, zmin, ndigits, force_fixedpoint); Float2String(c_zmax, zmax, ndigits, force_fixedpoint); if(axis_side == AXIS_LEFT){ - Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label); + Output3Text(fplot_color, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmin, c_zmin); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax , c_zmax); } else{ - Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label, pad_length); + Output3TextRight(fplot_color, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmin, c_zmin, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax , c_zmax, pad_length); } @@ -296,7 +300,7 @@ void DrawGenPlot(plot2ddata *plot2di){ int unit_left_index=0, unit_right_index=0; float pad_length = 0.0; - if(plot2di->bounds_defined==0)UpdateCurveBounds(plot2di, 1); + if(plot2di->bounds_defined==0)UpdateCurveBounds(plot2di, 0); for(i = 0; incurves; i++){ char *unit; diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 8f171f7cbb..e1d051e62b 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -1451,9 +1451,9 @@ extern "C" void GluiDeviceSetup(int main_window){ MakeCurveList(glui_plot2dinfo, 1); PANEL_curve_color = glui_device->add_panel_to_panel(PANEL_curve_properties, "color"); - SPINNER_genplot_red = glui_device->add_spinner_to_panel(PANEL_curve_color, "red", GLUI_SPINNER_INT, glui_curve.color + 0, GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_red = glui_device->add_spinner_to_panel(PANEL_curve_color, "red", GLUI_SPINNER_INT, glui_curve.color + 0, GENPLOT_XYZ, GenPlotCB); SPINNER_genplot_green = glui_device->add_spinner_to_panel(PANEL_curve_color, "green", GLUI_SPINNER_INT, glui_curve.color + 1, GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_blue = glui_device->add_spinner_to_panel(PANEL_curve_color, "blue", GLUI_SPINNER_INT, glui_curve.color + 2, GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_blue = glui_device->add_spinner_to_panel(PANEL_curve_color, "blue", GLUI_SPINNER_INT, glui_curve.color + 2, GENPLOT_XYZ, GenPlotCB); SPINNER_genplot_red->set_int_limits(0, 255); SPINNER_genplot_green->set_int_limits(0, 255); SPINNER_genplot_blue->set_int_limits(0, 255); From f6ffb773939cf8df5c81cb2041df733830ee00bb Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 19:16:32 -0400 Subject: [PATCH 25/41] smokeview source: fix to memcopy routine with a curve is deleted --- Source/smokeview/glui_objects.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index e1d051e62b..bacaf66595 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -381,12 +381,10 @@ void RemoveCurve(plot2ddata *plot2di, int index){ LIST_plotcurves->set_int_val(-1); } else{ - int i, ii; - LIST_plotcurves->delete_item(index); // (0,...,i-1,i+1,...,n-1) - if(plot2di->ncurves>i+1){ - memmove(plot2di->curve + i, plot2di->curve + i+1, (plot2di->ncurves-i-1)*sizeof(curvedata)); + if(plot2di->ncurves>index+1){ + memmove(plot2di->curve + index, plot2di->curve + index+1, (plot2di->ncurves-index-1)*sizeof(curvedata)); } (plot2di->ncurves)--; LIST_plotcurves->set_int_val(-1); From 8231ce84909ad79b5b32eeec3d5eb4682aa569a0 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 22:36:24 -0400 Subject: [PATCH 26/41] smokeview source: fixes to 2d plot curve removal, add 2d plot debug output (with pp_PLOT2D_DEBUG directive) --- Source/smokeview/IOplot2d.c | 8 ++-- Source/smokeview/glui_objects.cpp | 73 ++++++++++++++++++++++++------- Source/smokeview/options.h | 1 + Source/smokeview/smokeheaders.h | 3 +- 4 files changed, 63 insertions(+), 22 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index ed8ad03a0f..26d1235916 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -250,19 +250,19 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ /* ------------------ GetPlotUnit ------------------------ */ -char *GetPlotUnit(plot2ddata *plot2di, int i){ +char *GetPlotUnit(plot2ddata *plot2di, int curv_index){ csvdata *csvi; - csvi = GetCsv(plot2di->curve[i].csv_file_index, plot2di->curve[i].csv_col_index, NULL); + csvi = GetCsv(plot2di->curve[curv_index].csv_file_index, plot2di->curve[curv_index].csv_col_index, NULL); return csvi->label.unit; } /* ------------------ GetPlotShortLabel ------------------------ */ -char *GetPlotShortLabel(plot2ddata *plot2di, int i){ +char *GetPlotShortLabel(plot2ddata *plot2di, int curv_index){ csvdata *csvi; - csvi = GetCsv(plot2di->curve[i].csv_file_index, plot2di->curve[i].csv_col_index, NULL); + csvi = GetCsv(plot2di->curve[curv_index].csv_file_index, plot2di->curve[curv_index].csv_col_index, NULL); return csvi->label.shortlabel; } diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index bacaf66595..ae4a790ae4 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -368,33 +368,54 @@ void UpdateShowWindRoses(void) { #ifdef pp_PLOT2D_NEW +/* ------------------ PrintPlotInfo ------------------------ */ + +#ifdef pp_PLOT2D_DEBUG +void PrintPlot2dInfo(void){ + int i; + + for(i=0; incurves; j++){ + char *label; + + label = GetPlotShortLabel(plot2di, j); + printf("plot: %i, curve: %i, label: %s\n",i, j, label); + } + } +} +#endif + /* ------------------ RemoveCurve ------------------------ */ void RemoveCurve(plot2ddata *plot2di, int index){ - if(index < 0){ - int i; + int i; - for(i = 0; i < PLOT2D_MAX_CURVES; i++){ - LIST_plotcurves->delete_item(i); - } + for(i = 0; i < PLOT2D_MAX_CURVES; i++){ + LIST_plotcurves->delete_item(i); + } + if(index < 0){ plot2di->ncurves = 0; LIST_plotcurves->set_int_val(-1); } - else{ - LIST_plotcurves->delete_item(index); // (0,...,i-1,i+1,...,n-1) - if(plot2di->ncurves>index+1){ - memmove(plot2di->curve + index, plot2di->curve + index+1, (plot2di->ncurves-index-1)*sizeof(curvedata)); - } - (plot2di->ncurves)--; - LIST_plotcurves->set_int_val(-1); - if(plot2di->ncurves > 0){ - int index2; + if(plot2di->ncurves>index+1){ + memmove(plot2di->curve + index, plot2di->curve + index+1, (plot2di->ncurves-index-1)*sizeof(curvedata)); + } + (plot2di->ncurves)--; + for(i = 0; i < plot2di->ncurves; i++){ + char *label; - index2 = CLAMP(index, 0, plot2di->ncurves-1); - LIST_plotcurves->set_int_val(index2); - } + label = GetPlotShortLabel(plot2di, i); + LIST_plotcurves->add_item(i, label); } + LIST_plotcurves->set_int_val(-1); + index=-1; + if(plot2di->ncurves > 0)index = CLAMP(index-1, 0, plot2di->ncurves-1); + LIST_plotcurves->set_int_val(index); } /* ------------------ InCSVPlot ------------------------ */ @@ -783,10 +804,18 @@ void GenPlotCB(int var){ int curve_id; case GENPLOT_ADD_CURVE: +#ifdef pp_PLOT2D_DEBUG + printf("before add *********************\n"); + PrintPlot2dInfo(); +#endif curve_id = LIST_csvID->get_int_val(); AddCSVCurve(glui_plot2dinfo, curve_id, 0); Glui2Plot2D(iplot2dinfo); EnableDisablePlot2D(); +#ifdef pp_PLOT2D_DEBUG + printf("after add *********************\n"); + PrintPlot2dInfo(); +#endif break; case GENPLOT_SELECT_CSV_FILE: UpdateCvsList(); @@ -814,8 +843,18 @@ void GenPlotCB(int var){ } break; case GENPLOT_REM_CURVE: +#ifdef pp_PLOT2D_DEBUG + printf("before remove*******************\n"); + PrintPlot2dInfo(); + printf("*******************\n"); +#endif RemoveCurve(glui_plot2dinfo, glui_plot2dinfo->curve_index); Glui2Plot2D(iplot2dinfo); +#ifdef pp_PLOT2D_ removev DEBUG + printf("after*******************\n"); + PrintPlot2dInfo(); + printf("*******************\n"); +#endif EnableDisablePlot2D(); break; case GENPLOT_REM_ALLCURVES: diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index fb33209ebe..846e958874 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -17,6 +17,7 @@ //*** options: all platforms +//#define pp_PLOT2D_DEBUG // 2d plot debug output #define pp_PLOT2D_NEW // allow multiple curves on a single 2d plot #define pp_PLOT2D_OVERLAP // allow scene to overlap 2d plot region #define pp_PART_MULTI // load particles in parallel diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 7673343389..8a877e59de 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -537,7 +537,8 @@ EXTERNCPP void ReadDeviceData(char *file, int filetype, int flag); EXTERNCPP void SetupZoneDevs(void); EXTERNCPP void SetupDeviceData(void); #ifdef pp_PLOT2D_NEW -EXTERNCPP void UpdateCurveBounds(plot2ddata *plot2di, int flag); +EXTERNCPP char *GetPlotShortLabel(plot2ddata *plot2di, int curv_index); +EXTERNCPP void UpdateCurveBounds(plot2ddata * plot2di, int flag); EXTERNCPP csvdata *GetCsv(int file_index, int col_index, csvfiledata **csvf_ptr); EXTERNCPP csvdata *GetCurrentCsv(int i, csvfiledata **csvf_ptr); EXTERNCPP void SetupPlot2DUnitData(void); From cf710ac854b786bc919d896d99ff6eeaf4282311 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 22:40:00 -0400 Subject: [PATCH 27/41] smokeview source: correct a typo in pp_PLOT2D_DEBUG directive --- Source/smokeview/glui_objects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index ae4a790ae4..f0d6507aba 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -850,7 +850,7 @@ void GenPlotCB(int var){ #endif RemoveCurve(glui_plot2dinfo, glui_plot2dinfo->curve_index); Glui2Plot2D(iplot2dinfo); -#ifdef pp_PLOT2D_ removev DEBUG +#ifdef pp_PLOT2D_DEBUG printf("after*******************\n"); PrintPlot2dInfo(); printf("*******************\n"); From 6f81cc076a09e3243133e9c6546e8d6b72ca39d2 Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 23:06:40 -0400 Subject: [PATCH 28/41] smokeview source: add widget for showing/hiding axis curve labels --- Source/smokeview/IOplot2d.c | 28 +++++++++++++++------------- Source/smokeview/glui_objects.cpp | 11 +++++++---- Source/smokeview/structures.h | 2 +- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 26d1235916..15aa511f6e 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -101,21 +101,22 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ int i, ndigits = 3; float *xyz0, linewidth_arg, *plot_factors; - int *plot_color, use_plot_factors, show_title; + int *plot_color, use_plot_factors, show_title, show_curve_labels; char *title; float fplot_color[3]; SNIFF_ERRORS("after DrawGenCurve 1 - beginning"); - xyz0 = plot2di->xyz; - plot_color = curve->color; - linewidth_arg = curve->linewidth; - plot_factors = curve->factors; - use_plot_factors = curve->use_factors; - title = plot2di->plot_label; - show_title = plot2di->show_title; - fplot_color[0] = (float)plot_color[0] / 255.0; - fplot_color[1] = (float)plot_color[1] / 255.0; - fplot_color[2] = (float)plot_color[2] / 255.0; + xyz0 = plot2di->xyz; + plot_color = curve->color; + linewidth_arg = curve->linewidth; + plot_factors = curve->factors; + use_plot_factors = curve->use_factors; + title = plot2di->plot_label; + show_title = plot2di->show_title; + show_curve_labels = plot2di->show_curve_labels; + fplot_color[0] = (float)plot_color[0] / 255.0; + fplot_color[1] = (float)plot_color[1] / 255.0; + fplot_color[2] = (float)plot_color[2] / 255.0; xmin = x[0]; xmax = xmin; @@ -224,12 +225,12 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ Float2String(c_zmin, zmin, ndigits, force_fixedpoint); Float2String(c_zmax, zmax, ndigits, force_fixedpoint); if(axis_side == AXIS_LEFT){ - Output3Text(fplot_color, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label); + if(show_curve_labels==1)Output3Text(fplot_color, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmin, c_zmin); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax , c_zmax); } else{ - Output3TextRight(fplot_color, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label, pad_length); + if(show_curve_labels == 1)Output3TextRight(fplot_color, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmin, c_zmin, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax , c_zmax, pad_length); } @@ -565,6 +566,7 @@ void InitPlot2D(plot2ddata *plot2di, int plot_index){ plot2di->ncurves_ini = 0; plot2di->show = 0; plot2di->show_title = 0; + plot2di->show_curve_labels = 0; plot2di->xyz[0] = xbar0FDS; plot2di->xyz[1] = ybar0FDS; plot2di->xyz[2] = zbar0FDS; diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index f0d6507aba..9c3b44fc34 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -88,7 +88,8 @@ GLUI_Button *BUTTON_reset_fuel_hoc = NULL; GLUI_Checkbox *CHECKBOX_genplot_use_usermin = NULL; GLUI_Checkbox *CHECKBOX_genplot_use_usermax = NULL; GLUI_Checkbox *CHECKBOX_show_genplot = NULL; -GLUI_Checkbox *CHECKBOX_show_title = NULL; +GLUI_Checkbox *CHECKBOX_show_title = NULL; +GLUI_Checkbox *CHECKBOX_show_curve_labels = NULL; GLUI_Checkbox *CHECKBOX_genplot_use_factors = NULL; #endif GLUI_Checkbox *CHECKBOX_device_1=NULL; @@ -513,6 +514,7 @@ void Plot2D2Glui(int index){ CHECKBOX_show_genplot->set_int_val(glui_plot2dinfo->show); EDIT_plot_label->set_text(glui_plot2dinfo->plot_label); CHECKBOX_show_title->set_int_val(glui_plot2dinfo->show_title); + CHECKBOX_show_curve_labels->set_int_val(glui_plot2dinfo->show_curve_labels); UpdateCurveControls(); } @@ -1439,10 +1441,11 @@ extern "C" void GluiDeviceSetup(int main_window){ glui_device->add_column_to_panel(PANEL_plot8, false); - PANEL_plot_title = glui_device->add_panel_to_panel(PANEL_plot8, "plot title"); - EDIT_plot_label = glui_device->add_edittext_to_panel(PANEL_plot_title, "edit:", GLUI_EDITTEXT_TEXT, glui_plot2dinfo->plot_label, GENPLOT_PLOT_LABEL, GenPlotCB); + PANEL_plot_title = glui_device->add_panel_to_panel(PANEL_plot8, "labels"); + EDIT_plot_label = glui_device->add_edittext_to_panel(PANEL_plot_title, "edit title:", GLUI_EDITTEXT_TEXT, glui_plot2dinfo->plot_label, GENPLOT_PLOT_LABEL, GenPlotCB); glui_device->add_button_to_panel(PANEL_plot_title, _("Apply"), GENPLOT_PLOT_LABEL, GenPlotCB); - CHECKBOX_show_title = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show", &(glui_plot2dinfo->show_title), GENPLOT_PLOT_LABEL, GenPlotCB); + CHECKBOX_show_title = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show title", &(glui_plot2dinfo->show_title), GENPLOT_PLOT_LABEL, GenPlotCB); + CHECKBOX_show_curve_labels = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show curve labels", &(glui_plot2dinfo->show_curve_labels), GENPLOT_PLOT_LABEL, GenPlotCB); glui_device->add_column_to_panel(PANEL_plot8, false); PANEL_plot_position = glui_device->add_panel_to_panel(PANEL_plot8, "plot position"); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index e34a3168c8..82d98c2fa6 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -1025,7 +1025,7 @@ typedef struct _plot2ddata{ char plot_label[350]; int ncurves, ncurves_ini; int curve_index, plot_index; - int show, show_title; + int show, show_title, show_curve_labels; curvedata curve[PLOT2D_MAX_CURVES]; int bounds_defined; float xyz[3]; From 09ddc451666fed9cc43f33a879b31633a26f3a3e Mon Sep 17 00:00:00 2001 From: gforney Date: Fri, 17 Jun 2022 23:50:30 -0400 Subject: [PATCH 29/41] smokeview source: use a button to remove a selected curve, minor formatting changes to 2d plot dialog box --- Source/smokeview/glui_objects.cpp | 42 ++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 9c3b44fc34..171a6de676 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -30,15 +30,16 @@ #define GENPLOT_REM_PLOT 102 #define GENPLOT_REM_CURVE 103 #define GENPLOT_REM_ALLCURVES 104 -#define GENPLOT_SELECT_CSV_FILE 105 -#define GENPLOT_SELECT_PLOT 106 -#define GENPLOT_SELECT_CURVE 107 -#define GENPLOT_SHOW_PLOT 108 -#define GENPLOT_XYZ 109 -#define GENPLOT_PLOT_LABEL 110 -#define GENPLOT_SET_POS 111 -#define GENPLOT_CSV_TYPE 112 -#define GENPLOT_ADD_CURVE 113 +#define GENPLOT_REM_SELECTEDCURVE 105 +#define GENPLOT_SELECT_CSV_FILE 106 +#define GENPLOT_SELECT_PLOT 107 +#define GENPLOT_SELECT_CURVE 108 +#define GENPLOT_SHOW_PLOT 109 +#define GENPLOT_XYZ 110 +#define GENPLOT_PLOT_LABEL 111 +#define GENPLOT_SET_POS 112 +#define GENPLOT_CSV_TYPE 113 +#define GENPLOT_ADD_CURVE 114 #endif #define WINDROSE_SHOW_FIRST 996 @@ -123,6 +124,7 @@ GLUI_Listbox *LIST_hrrdata=NULL; #ifdef pp_PLOT2D_NEW GLUI_Panel *PANEL_csv = NULL; GLUI_Panel *PANEL_csv2 = NULL; +GLUI_Panel *PANEL_remove_curve = NULL; #endif #ifdef pp_PLOT2D_NEW GLUI_Panel *PANEL_curve_color = NULL; @@ -859,6 +861,13 @@ void GenPlotCB(int var){ #endif EnableDisablePlot2D(); break; + case GENPLOT_REM_SELECTEDCURVE: + glui_remove_selected_curve = 1; + GenPlotCB(GENPLOT_SELECT_CURVE); + glui_remove_selected_curve = 0; + Glui2Plot2D(iplot2dinfo); + EnableDisablePlot2D(); + break; case GENPLOT_REM_ALLCURVES: RemoveCurve(glui_plot2dinfo, -1); Glui2Plot2D(iplot2dinfo); @@ -1490,6 +1499,15 @@ extern "C" void GluiDeviceSetup(int main_window){ RemoveCurve(glui_plot2dinfo, -1); MakeCurveList(glui_plot2dinfo, 1); + PANEL_remove_curve = glui_device->add_panel_to_panel(PANEL_curve_properties, "remove curve(s)"); + glui_device->add_button_to_panel(PANEL_remove_curve, _("selected"), GENPLOT_REM_SELECTEDCURVE, GenPlotCB); + glui_device->add_button_to_panel(PANEL_remove_curve, _("all"), GENPLOT_REM_ALLCURVES, GenPlotCB); + + SPINNER_genplot_linewidth = glui_device->add_spinner_to_panel(PANEL_curve_properties, "line width", GLUI_SPINNER_FLOAT, &(glui_curve.linewidth), GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_linewidth->set_float_limits(1.0,10.0); + + glui_device->add_column_to_panel(PANEL_curve_properties, false); + PANEL_curve_color = glui_device->add_panel_to_panel(PANEL_curve_properties, "color"); SPINNER_genplot_red = glui_device->add_spinner_to_panel(PANEL_curve_color, "red", GLUI_SPINNER_INT, glui_curve.color + 0, GENPLOT_XYZ, GenPlotCB); SPINNER_genplot_green = glui_device->add_spinner_to_panel(PANEL_curve_color, "green", GLUI_SPINNER_INT, glui_curve.color + 1, GENPLOT_XYZ, GenPlotCB); @@ -1498,16 +1516,10 @@ extern "C" void GluiDeviceSetup(int main_window){ SPINNER_genplot_green->set_int_limits(0, 255); SPINNER_genplot_blue->set_int_limits(0, 255); - glui_device->add_column_to_panel(PANEL_curve_properties, false); - glui_device->add_checkbox_to_panel(PANEL_curve_properties, _("remove selected curve"), &glui_remove_selected_curve); - glui_device->add_button_to_panel(PANEL_curve_properties, _("Remove all curves"), GENPLOT_REM_ALLCURVES, GenPlotCB); PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "bounds"); SPINNER_genplot_vmin = glui_device->add_spinner_to_panel(PANEL_curve_bounds, "min", GLUI_SPINNER_FLOAT, &(glui_curve.vmin), GENPLOT_XYZ, GenPlotCB); SPINNER_genplot_vmax = glui_device->add_spinner_to_panel(PANEL_curve_bounds, "max", GLUI_SPINNER_FLOAT, &(glui_curve.vmax), GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_linewidth = glui_device->add_spinner_to_panel(PANEL_curve_properties, "line width", GLUI_SPINNER_FLOAT, &(glui_curve.linewidth), GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_linewidth->set_float_limits(1.0,10.0); - if(nplot2dini>0){ nplot2dinfo = nplot2dini; NewMemory((void **)&plot2dinfo, nplot2dinfo*sizeof(plot2ddata)); From f5c63f2e68351da5f3dc5208c59773f4801a0ec4 Mon Sep 17 00:00:00 2001 From: gforney Date: Sat, 18 Jun 2022 12:41:27 -0400 Subject: [PATCH 30/41] smokeview source: add axis labels show/hide parameter to ini file --- Source/smokeview/readsmv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index cbdbd119f5..f7112d3ff6 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -11550,7 +11550,7 @@ int ReadIni2(char *inifile, int localfile){ strcpy(plot2di->plot_label, labelptr); fgets(buffer, 255, stream); - sscanf(buffer, " %f %f %f %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurves); + sscanf(buffer, " %f %f %f %i %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurves, &plot2di->show_curve_labels); for(j=0; jncurves; j++){ int color[3]; float linewidth1; @@ -14942,7 +14942,7 @@ void WriteIniLocal(FILE *fileout){ plot2di = plot2dinfo + i; fprintf(fileout, " %s\n", plot2di->plot_label); - fprintf(fileout, " %f %f %f %i %i %i\n", plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, plot2di->ncurves); + fprintf(fileout, " %f %f %f %i %i %i %i\n", plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, plot2di->ncurves, plot2di->show_curve_labels); for(j = 0; j < plot2di->ncurves; j++){ int *color; float linewidth1, *curve_factors; From 8eabd1270573d5a17944a946bd40354f9fdf2d44 Mon Sep 17 00:00:00 2001 From: gforney Date: Sat, 18 Jun 2022 13:07:06 -0400 Subject: [PATCH 31/41] smv vv: add IDS to &DEVC's in wind_test2 case --- Verification/WUI/wind_test2.fds | 48 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Verification/WUI/wind_test2.fds b/Verification/WUI/wind_test2.fds index 9394134d40..f8e10aff4d 100644 --- a/Verification/WUI/wind_test2.fds +++ b/Verification/WUI/wind_test2.fds @@ -145,30 +145,30 @@ cMESH IJK=50,50,25, XB=0,50,-25,25,0,25 / -- Device files (gas phase point measurements) -&DEVC XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / -&DEVC XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / -&DEVC XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / -&DEVC XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / - -&DEVC XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / -&DEVC XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / -&DEVC XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / -&DEVC XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / - -&DEVC XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / -&DEVC XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / -&DEVC XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / -&DEVC XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / - -&DEVC XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / -&DEVC XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / -&DEVC XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / -&DEVC XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / - -&DEVC XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / -&DEVC XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / -&DEVC XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / -&DEVC XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / +&DEVC ID='UVELA', XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / +&DEVC ID='VVELA', XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / +&DEVC ID='WVELA', XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / +&DEVC ID='TEMPA', XB=10,10,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / + +&DEVC ID='UVELB', XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / +&DEVC ID='VVELB', XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / +&DEVC ID='WVELB', XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / +&DEVC ID='TEMPB', XB=40,40,-15,-15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / + +&DEVC ID='UVELC', XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / +&DEVC ID='VVELC', XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / +&DEVC ID='WVELC', XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / +&DEVC ID='TEMPC', XB=10,10,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / + +&DEVC ID='UVELD', XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / +&DEVC ID='VVELD', XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / +&DEVC ID='WVELD', XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / +&DEVC ID='TEMPD', XB=40,40,15,15,0,25,POINTS=26,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / + +&DEVC ID='UVELE', XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='U-VELOCITY' / +&DEVC ID='VVELE', XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='V-VELOCITY' / +&DEVC ID='WVELE', XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='W-VELOCITY' / +&DEVC ID='TEMPE', XB=20,20,-10,10,10,10,POINTS=21,TIME_HISTORY=.TRUE.,QUANTITY='TEMPERATURE' / - End of file &TAIL / From ffe49d608f64d187561093920c49e242a6ee971a Mon Sep 17 00:00:00 2001 From: gforney Date: Sat, 18 Jun 2022 13:08:05 -0400 Subject: [PATCH 32/41] smokeview source: increase buffer size to 10000 for rerading in csv files --- Source/smokeview/readsmv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index f7112d3ff6..c2a58d9ac2 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -36,7 +36,7 @@ #define ZVENT_1ROOM 1 #define ZVENT_2ROOM 2 -#define LENBUFFER 1024 +#define LENBUFFER 10000 /* ------------------ GetHrrCsvCol ------------------------ */ From 2c0efe76dbc21edb544a2f7aa49ee567fa4177bf Mon Sep 17 00:00:00 2001 From: gforney Date: Sat, 18 Jun 2022 13:36:48 -0400 Subject: [PATCH 33/41] smokeview source: allocate memory for plot2d csv buffers (rather than using static arrays) so large files can be read in --- Source/smokeview/readsmv.c | 41 +++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index c2a58d9ac2..90baeb7852 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -36,8 +36,6 @@ #define ZVENT_1ROOM 1 #define ZVENT_2ROOM 2 -#define LENBUFFER 10000 - /* ------------------ GetHrrCsvCol ------------------------ */ int GetHrrCsvCol(char *label){ @@ -174,11 +172,12 @@ void ReadCSV(csvfiledata *csvfi, int flag){ FILE *stream; int nrows, ncols; int nunits, nlabels; - char buffer[LENBUFFER], buffer_labels[LENBUFFER], buffer_units[LENBUFFER]; + char *buffer, *buffer_labels, *buffer_units; char *buffptr; char **labels, **units; float *vals; int *valids; + int len_buffer; int i; for(i=0; incsvinfo; i++){ @@ -194,10 +193,14 @@ void ReadCSV(csvfiledata *csvfi, int flag){ stream = fopen(csvfi->file, "r"); if(stream == NULL)return; - GetRowCols(stream, &nrows, &ncols); + len_buffer = GetRowCols(stream, &nrows, &ncols); + len_buffer = MAX(len_buffer + 100, 1000); csvfi->ncsvinfo = ncols; // allocate memory + NewMemory((void **)&(buffer), len_buffer); + NewMemory((void **)&(buffer_labels), len_buffer); + NewMemory((void **)&(buffer_units), len_buffer); NewMemory((void **)&(csvfi->csvinfo), csvfi->ncsvinfo*sizeof(csvdata)); NewMemory((void **)&labels, csvfi->ncsvinfo*sizeof(char *)); @@ -218,11 +221,11 @@ void ReadCSV(csvfiledata *csvfi, int flag){ // setup labels and units - fgets(buffer_units, LENBUFFER, stream); + fgets(buffer_units, len_buffer, stream); TrimBack(buffer_units); ParseCSV(buffer_units, units, &nunits); - fgets(buffer_labels, LENBUFFER, stream); + fgets(buffer_labels, len_buffer, stream); TrimBack(buffer_labels); ParseCSV(buffer_labels, labels, &nlabels); CheckMemory; @@ -271,7 +274,7 @@ void ReadCSV(csvfiledata *csvfi, int flag){ int irow; irow = 0; while(!feof(stream)){ - if(fgets(buffer, LENBUFFER, stream) == NULL)break; + if(fgets(buffer, len_buffer, stream) == NULL)break; TrimBack(buffer); if(strlen(buffer) == 0)break; int nvals; @@ -312,6 +315,10 @@ void ReadCSV(csvfiledata *csvfi, int flag){ FREEMEMORY(labels); FREEMEMORY(vals); FREEMEMORY(valids); + FREEMEMORY(buffer); + FREEMEMORY(buffer_labels); + FREEMEMORY(buffer_units); + fclose(stream); } @@ -336,7 +343,8 @@ void ReadHRR(int flag){ float *vals; int *valids; int i, irow; - char buffer[LENBUFFER], buffer_labels[LENBUFFER], buffer_units[LENBUFFER]; + char *buffer, *buffer_labels, *buffer_units; + int len_buffer; GetHoc(&fuel_hoc, fuel_name); fuel_hoc_default = fuel_hoc; @@ -359,12 +367,17 @@ void ReadHRR(int flag){ stream = fopen(hrr_csv_filename, "r"); if(stream==NULL)return; - GetRowCols(stream, &nrows, &ncols); + len_buffer = GetRowCols(stream, &nrows, &ncols); + len_buffer = MAX(len_buffer + 100, 1000); nhrrinfo = ncols; if(nhrrinfo == 0)return; // allocate memory + NewMemory((void **)&(buffer), len_buffer); + NewMemory((void **)&(buffer_labels), len_buffer); + NewMemory((void **)&(buffer_units), len_buffer); + NewMemory((void **)&labels, nhrrinfo*sizeof(char *)); NewMemory((void **)&units, nhrrinfo*sizeof(char *)); NewMemory((void **)&hrrinfo, 2*nhrrinfo*sizeof(hrrdata)); @@ -385,10 +398,10 @@ void ReadHRR(int flag){ // setup labels and units - fgets(buffer_units, LENBUFFER, stream); + fgets(buffer_units, len_buffer, stream); ParseCSV(buffer_units, units, &nunits); - fgets(buffer_labels, LENBUFFER, stream); + fgets(buffer_labels, len_buffer, stream); ParseCSV(buffer_labels, labels, &nlabels); CheckMemory; @@ -442,7 +455,7 @@ void ReadHRR(int flag){ // read in data irow = 0; while(!feof(stream)){ - if(fgets(buffer, LENBUFFER, stream)==NULL)break; + if(fgets(buffer, len_buffer, stream)==NULL)break; TrimBack(buffer); if(strlen(buffer)==0)break; FParseCSV(buffer, vals, valids, ncols, &nvals); @@ -541,6 +554,10 @@ void ReadHRR(int flag){ FREEMEMORY(hi->vals_orig); } CheckMemory; + FREEMEMORY(buffer); + FREEMEMORY(buffer_labels); + FREEMEMORY(buffer_units); + FREEMEMORY(units); FREEMEMORY(labels); FREEMEMORY(vals); From 8b6215856be245fba0239f309213e536aaa5dd1e Mon Sep 17 00:00:00 2001 From: gforney Date: Sat, 18 Jun 2022 23:28:42 -0400 Subject: [PATCH 34/41] smokeview source: output curve bounds in 2d plot dialog box as static text --- Source/smokeview/glui_objects.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 171a6de676..1420c470b0 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -184,9 +184,6 @@ GLUI_Rollout **ROLLOUT_showz_windrose; GLUI_Rollout *ROLLOUT_trees = NULL; #ifdef pp_PLOT2D_NEW -GLUI_Spinner *SPINNER_genplot_vmin = NULL; -GLUI_Spinner *SPINNER_genplot_vmax = NULL; - GLUI_Spinner *SPINNER_genplot_x = NULL; GLUI_Spinner *SPINNER_genplot_y = NULL; GLUI_Spinner *SPINNER_genplot_z = NULL; @@ -215,6 +212,11 @@ GLUI_Spinner *SPINNER_scale_max_windrose = NULL; GLUI_Spinner *SPINNER_windrose_first=NULL; GLUI_Spinner *SPINNER_windrose_next=NULL; +#ifdef pp_PLOT2D_NEW +GLUI_StaticText *STATIC_curv_min = NULL; +GLUI_StaticText *STATIC_curv_max = NULL; +#endif + #define OBJECTS_ROLLOUT 0 #define FLOWVECTORS_ROLLOUT 1 #define WINDROSE_ROLLOUT 2 @@ -613,8 +615,18 @@ void UpdateCurveControls(void){ SPINNER_genplot_green->set_int_val(glui_curve.color[1]); SPINNER_genplot_blue->set_int_val(glui_curve.color[2]); SPINNER_genplot_linewidth->set_float_val(glui_curve.linewidth); - SPINNER_genplot_vmin->set_float_val(glui_curve.vmin); - SPINNER_genplot_vmax->set_float_val(glui_curve.vmax); + + char label[100], cval[100]; + int ndigits = 6; + strcpy(label, "min: "); + Float2String(cval, glui_curve.vmin, ndigits, force_fixedpoint); + strcat(label, cval); + STATIC_curv_min->set_name(label); + + strcpy(label, "max: "); + Float2String(cval, glui_curve.vmax, ndigits, force_fixedpoint); + strcat(label, cval); + STATIC_curv_max->set_name(label); } /* ------------------ EnableDisablePlot2D ------------------------ */ @@ -631,14 +643,12 @@ void EnableDisablePlot2D(void){ PANEL_plot_position->enable(); PANEL_plot_title->enable(); PANEL_add_curve->enable(); - PANEL_curve_bounds->disable(); if(glui_plot2dinfo->ncurves == 0){ PANEL_curve_properties->disable(); } else{ PANEL_curve_properties->enable(); - PANEL_curve_bounds->disable(); } if(glui_plot2dinfo->ncurves > 0 && glui_plot2dinfo->curve_index < ndeviceinfo){ BUTTON_plot_position->enable(); @@ -1517,8 +1527,8 @@ extern "C" void GluiDeviceSetup(int main_window){ SPINNER_genplot_blue->set_int_limits(0, 255); PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "bounds"); - SPINNER_genplot_vmin = glui_device->add_spinner_to_panel(PANEL_curve_bounds, "min", GLUI_SPINNER_FLOAT, &(glui_curve.vmin), GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_vmax = glui_device->add_spinner_to_panel(PANEL_curve_bounds, "max", GLUI_SPINNER_FLOAT, &(glui_curve.vmax), GENPLOT_XYZ, GenPlotCB); + STATIC_curv_min = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "min: 0.0"); + STATIC_curv_max = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "max: 0.0"); if(nplot2dini>0){ nplot2dinfo = nplot2dini; From 6d3ac6477b61b94996b21451cb0d540f107cfc78 Mon Sep 17 00:00:00 2001 From: gforney Date: Sun, 19 Jun 2022 00:26:12 -0400 Subject: [PATCH 35/41] smokeview source: reject 2d plot columns that do not contain numbers --- Source/shared/string_util.c | 2 +- Source/smokeview/glui_objects.cpp | 28 +++++++++++++++------------- Source/smokeview/readsmv.c | 5 +++++ Source/smokeview/structures.h | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Source/shared/string_util.c b/Source/shared/string_util.c index c07d37146a..49b28d79cb 100644 --- a/Source/shared/string_util.c +++ b/Source/shared/string_util.c @@ -73,7 +73,7 @@ void FParseCSV(char *buffer, float *vals, int *valids, int ncols, int *ntokens){ token=strtok(buffer,","); while(token!=NULL&&nttime)continue; - if(strcmp(unit_label, "all") == 0){ - LIST_csvID->add_item(i, csvi->label.shortlabel); - continue; - } - if(csvi->dimensionless == 1 && strcmp(unit_label, "dimensionless")==0){ - LIST_csvID->add_item(i, csvi->label.shortlabel); - continue; - } - if(csvi->dimensionless == 0 && strcmp(unit_label, csvi->label.unit) == 0){ - LIST_csvID->add_item(i, csvi->label.shortlabel); - continue; + if(csvi->skip == 0){ + if(strcmp(unit_label, "all") == 0){ + LIST_csvID->add_item(i, csvi->label.shortlabel); + continue; + } + if(csvi->dimensionless == 1 && strcmp(unit_label, "dimensionless")==0){ + LIST_csvID->add_item(i, csvi->label.shortlabel); + continue; + } + if(csvi->dimensionless == 0 && strcmp(unit_label, csvi->label.unit) == 0){ + LIST_csvID->add_item(i, csvi->label.shortlabel); + continue; + } } } } @@ -737,7 +739,7 @@ void UpdateCvsList(void){ csvdata *csvi; csvi = GetCurrentCsv(i, NULL); - if(csvi == csvfi->time)continue; + if(csvi == csvfi->time||csvi->skip==1)continue; LIST_csvID->add_item(i, csvi->label.shortlabel); } strcpy(label, "add"); @@ -1128,7 +1130,7 @@ extern "C" void DeviceCB(int var){ fuel_hoc = fuel_hoc_default; SPINNER_fuel_hoc->set_float_val(fuel_hoc); DeviceCB(FUEL_HOC); - break;; + break; case FUEL_HOC: if(fuel_hoc<0.0){ fuel_hoc = 0.0; diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 90baeb7852..7e02b143a6 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -245,6 +245,8 @@ void ReadCSV(csvfiledata *csvfi, int flag){ } unit = TrimFrontBack(units[i]); + ci->skip = 0; + if(strcmp(unit, "status") == 0)ci->skip = 1; ci->dimensionless = IsDimensionless(unit); SetLabels(&(ci->label), label, label, unit); } @@ -296,6 +298,9 @@ void ReadCSV(csvfiledata *csvfi, int flag){ ci->valmax = MAX(ci->valmax, vals[i]); } } + if(irow==0 && valids[i] == 0){ + ci->skip = 1; + } } irow++; if(irow >= nrows)break; diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 82d98c2fa6..a6a613d565 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -40,7 +40,7 @@ typedef struct _csvdata{ float val, *vals, *vals_orig; float valmin, valmax; int nvals; - int dimensionless; + int dimensionless, skip; } csvdata; /* -------------------------- _csvfiledata ------------------------------------ */ From 0f8d1496b807551a80e4219a784cae15ea348b6f Mon Sep 17 00:00:00 2001 From: gforney Date: Sun, 19 Jun 2022 20:10:50 -0400 Subject: [PATCH 36/41] smokeview source: fix problem parsingg experimental csv files for 2d plots --- Source/smokeview/readsmv.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 7e02b143a6..d64a3c8f57 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -202,6 +202,25 @@ void ReadCSV(csvfiledata *csvfi, int flag){ NewMemory((void **)&(buffer_labels), len_buffer); NewMemory((void **)&(buffer_units), len_buffer); + if(strcmp(csvfi->c_type, "ext") == 0){ + fgets(buffer, len_buffer, stream); + if(feof(stream)){ + FREEMEMORY(buffer); + FREEMEMORY(buffer_labels); + FREEMEMORY(buffer_units); + return; + } + while(strstr(buffer, "//DATA") == NULL){ + fgets(buffer, len_buffer, stream); + if(feof(stream)){ + FREEMEMORY(buffer); + FREEMEMORY(buffer_labels); + FREEMEMORY(buffer_units); + return; + } + } + } + NewMemory((void **)&(csvfi->csvinfo), csvfi->ncsvinfo*sizeof(csvdata)); NewMemory((void **)&labels, csvfi->ncsvinfo*sizeof(char *)); NewMemory((void **)&units, csvfi->ncsvinfo*sizeof(char *)); @@ -259,7 +278,7 @@ void ReadCSV(csvfiledata *csvfi, int flag){ csvdata *ci; ci = csvfi->csvinfo + i; - if(strcmp(ci->label.shortlabel, "Time") == 0 || strcmp(ci->label.shortlabel, "Simulation Time") == 0){ + if(strcmp(ci->label.shortlabel, "Time") == 0 || strcmp(ci->label.shortlabel, "time") == 0 || strcmp(ci->label.shortlabel, "Simulation Time") == 0){ csvfi->time = ci; break; } From d0cde5c06c88838328569c66ac21a89776bcce13 Mon Sep 17 00:00:00 2001 From: gforney Date: Sun, 19 Jun 2022 22:10:37 -0400 Subject: [PATCH 37/41] smokeview source: add units to plot2d min/max labels --- Source/smokeview/glui_objects.cpp | 31 +++++++++++++++++++++---------- Source/smokeview/smokeheaders.h | 3 ++- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 1abed6818c..073ae921cd 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -469,7 +469,7 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int force){ LIST_plotcurves->set_int_val(nplots); memcpy(&glui_curve, curve, sizeof(curvedata)); nplots++; - UpdateCurveControls(); + UpdateCurveControls(csvi->label.unit); } } @@ -519,7 +519,7 @@ void Plot2D2Glui(int index){ EDIT_plot_label->set_text(glui_plot2dinfo->plot_label); CHECKBOX_show_title->set_int_val(glui_plot2dinfo->show_title); CHECKBOX_show_curve_labels->set_int_val(glui_plot2dinfo->show_curve_labels); - UpdateCurveControls(); + UpdateCurveControls(NULL); } /* ------------------ AddPlot ------------------------ */ @@ -543,7 +543,7 @@ extern "C" void AddPlot(void){ LIST_plots->add_item(iplot2dinfo, label); LIST_plots->set_int_val(iplot2dinfo); memcpy(&glui_curve, &glui_curve_default, sizeof(curvedata)); - UpdateCurveControls(); + UpdateCurveControls(NULL); } /* ------------------ RemovePlot ------------------------ */ @@ -610,7 +610,8 @@ void UpdatePlotList(void){ /* ------------------ UpdateCurveControls ------------------------ */ -void UpdateCurveControls(void){ + +void UpdateCurveControls(char *unit){ SPINNER_genplot_red->set_int_val(glui_curve.color[0]); SPINNER_genplot_green->set_int_val(glui_curve.color[1]); SPINNER_genplot_blue->set_int_val(glui_curve.color[2]); @@ -621,11 +622,19 @@ void UpdateCurveControls(void){ strcpy(label, "min: "); Float2String(cval, glui_curve.vmin, ndigits, force_fixedpoint); strcat(label, cval); + if(unit != NULL){ + strcat(label, " "); + strcat(label, unit); + } STATIC_curv_min->set_name(label); strcpy(label, "max: "); Float2String(cval, glui_curve.vmax, ndigits, force_fixedpoint); strcat(label, cval); + if(unit != NULL){ + strcat(label, " "); + strcat(label, unit); + } STATIC_curv_max->set_name(label); } @@ -843,7 +852,9 @@ void GenPlotCB(int var){ index = glui_plot2dinfo->curve_index; curve = glui_plot2dinfo->curve + index; memcpy(&glui_curve, curve, sizeof(curvedata)); - UpdateCurveControls(); + char *unit; + unit = GetPlotUnit(glui_plot2dinfo, index); + UpdateCurveControls(unit); if(BUTTON_plot_position != NULL){ if(glui_plot2dinfo->curve_indexenable(); @@ -1515,8 +1526,9 @@ extern "C" void GluiDeviceSetup(int main_window){ glui_device->add_button_to_panel(PANEL_remove_curve, _("selected"), GENPLOT_REM_SELECTEDCURVE, GenPlotCB); glui_device->add_button_to_panel(PANEL_remove_curve, _("all"), GENPLOT_REM_ALLCURVES, GenPlotCB); - SPINNER_genplot_linewidth = glui_device->add_spinner_to_panel(PANEL_curve_properties, "line width", GLUI_SPINNER_FLOAT, &(glui_curve.linewidth), GENPLOT_XYZ, GenPlotCB); - SPINNER_genplot_linewidth->set_float_limits(1.0,10.0); + PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "bounds"); + STATIC_curv_min = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "min: 0.0"); + STATIC_curv_max = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "max: 0.0"); glui_device->add_column_to_panel(PANEL_curve_properties, false); @@ -1528,9 +1540,8 @@ extern "C" void GluiDeviceSetup(int main_window){ SPINNER_genplot_green->set_int_limits(0, 255); SPINNER_genplot_blue->set_int_limits(0, 255); - PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "bounds"); - STATIC_curv_min = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "min: 0.0"); - STATIC_curv_max = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "max: 0.0"); + SPINNER_genplot_linewidth = glui_device->add_spinner_to_panel(PANEL_curve_properties, "line width", GLUI_SPINNER_FLOAT, &(glui_curve.linewidth), GENPLOT_XYZ, GenPlotCB); + SPINNER_genplot_linewidth->set_float_limits(1.0, 10.0); if(nplot2dini>0){ nplot2dinfo = nplot2dini; diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 8a877e59de..9d21789cfd 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -6,8 +6,9 @@ #endif #ifdef pp_PLOT2D_NEW +EXTERNCPP char *GetPlotUnit(plot2ddata * plot2di, int curv_index); EXTERNCPP void GenPlotCB(int var); -EXTERNCPP void UpdateCurveControls(void); +EXTERNCPP void UpdateCurveControls(char *unit); EXTERNCPP int GenDevShow(void); EXTERNCPP int GenHrrShow(void); EXTERNCPP void InitPlot2D(plot2ddata *plot2di, int plot_index); From a2d9da3958e129dd171e73b79ef04b0ec226278a Mon Sep 17 00:00:00 2001 From: gforney Date: Sun, 19 Jun 2022 22:25:32 -0400 Subject: [PATCH 38/41] smokeview source: fix to 2d dimensionless plots --- Source/smokeview/IOplot2d.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 15aa511f6e..5106384bf7 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -306,7 +306,6 @@ void DrawGenPlot(plot2ddata *plot2di){ char *unit; unit = GetPlotUnit(plot2di, i); - if(unit==NULL||strlen(unit)==0)continue; if(axis_right_unit == NULL){ axis_right_unit = unit; continue; @@ -321,7 +320,6 @@ void DrawGenPlot(plot2ddata *plot2di){ unit = GetPlotUnit(plot2di, i); label = GetPlotShortLabel(plot2di, i); - if(unit == NULL || strlen(unit) == 0)continue; if(axis_right_unit != NULL && strcmp(axis_right_unit, unit) == 0){ unit_right_index = i; pad_length = MAX(pad_length, GetStringLength(label)); From e204030ceb27e7da3d7b1bed453c487f16cec093 Mon Sep 17 00:00:00 2001 From: gforney Date: Mon, 20 Jun 2022 16:03:15 -0400 Subject: [PATCH 39/41] smokeview source: fix problem when selected curve index is < 0 --- Source/smokeview/glui_objects.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 073ae921cd..7f7af5575d 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -850,6 +850,7 @@ void GenPlotCB(int var){ break; case GENPLOT_SELECT_CURVE: index = glui_plot2dinfo->curve_index; + if(index < 0)break; curve = glui_plot2dinfo->curve + index; memcpy(&glui_curve, curve, sizeof(curvedata)); char *unit; From ec5f3a15f29d2dcde18db3aecda4aab99c93e446 Mon Sep 17 00:00:00 2001 From: gforney Date: Mon, 20 Jun 2022 16:45:32 -0400 Subject: [PATCH 40/41] smokeview source: add option to display plot2d values --- Source/smokeview/IOplot2d.c | 33 ++++++++++++++++++++++++------- Source/smokeview/glui_objects.cpp | 13 +++++++----- Source/smokeview/readsmv.c | 8 ++++++-- Source/smokeview/structures.h | 2 +- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 5106384bf7..1946e2a37c 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -101,7 +101,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ int i, ndigits = 3; float *xyz0, linewidth_arg, *plot_factors; - int *plot_color, use_plot_factors, show_title, show_curve_labels; + int *plot_color, use_plot_factors, show_title, show_curve_labels, show_curve_values; char *title; float fplot_color[3]; @@ -114,6 +114,7 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ title = plot2di->plot_label; show_title = plot2di->show_title; show_curve_labels = plot2di->show_curve_labels; + show_curve_values = plot2di->show_curve_values; fplot_color[0] = (float)plot_color[0] / 255.0; fplot_color[1] = (float)plot_color[1] / 255.0; fplot_color[2] = (float)plot_color[2] / 255.0; @@ -220,17 +221,34 @@ void DrawGenCurve(int option, plot2ddata *plot2di, curvedata *curve, float size_ SNIFF_ERRORS("after DrawGenCurve 4"); } { - char c_zmin[32], c_zmax[32]; - - Float2String(c_zmin, zmin, ndigits, force_fixedpoint); - Float2String(c_zmax, zmax, ndigits, force_fixedpoint); + char c_zmin[32], c_zmax[32], c_zcur[32]; + char label2[256]; + + Float2String(c_zmin, zmin, ndigits, force_fixedpoint); + Float2String(c_zmax, zmax, ndigits, force_fixedpoint); + if(show_curve_values==1)Float2String(c_zcur, z_cur, ndigits, force_fixedpoint); + strcpy(label2, ""); + if(show_curve_labels==1){ + strcat(label2, label); + if(show_curve_values==1)strcat(label2, "/"); + } + if(show_curve_values==1){ + strcat(label2, c_zcur); + pad_length = GetStringLength(label2); + } if(axis_side == AXIS_LEFT){ - if(show_curve_labels==1)Output3Text(fplot_color, xmax + 2.0 * dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label); + if(show_curve_labels==1 || show_curve_values==1){ + Output3Text(fplot_color, xmax + 2.0 * dx, + 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label2); + } Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmin, c_zmin); Output3Text(foregroundcolor, xmax + 2.0 * dx, 0.0, zmax , c_zmax); } else{ - if(show_curve_labels == 1)Output3TextRight(fplot_color, xmin - dx, 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label, pad_length); + if(show_curve_labels==1 || show_curve_values==1){ + Output3TextRight(fplot_color, xmin - dx, + 0.0, zmax - (0.5 + plot2d_font_spacing * (float)position) * dfont, label2, pad_length); + } Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmin, c_zmin, pad_length); Output3TextRight(foregroundcolor, xmin - dx, 0.0, zmax , c_zmax, pad_length); } @@ -565,6 +583,7 @@ void InitPlot2D(plot2ddata *plot2di, int plot_index){ plot2di->show = 0; plot2di->show_title = 0; plot2di->show_curve_labels = 0; + plot2di->show_curve_values = 0; plot2di->xyz[0] = xbar0FDS; plot2di->xyz[1] = ybar0FDS; plot2di->xyz[2] = zbar0FDS; diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index 7f7af5575d..ba70ca23d2 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -88,10 +88,11 @@ GLUI_Button *BUTTON_reset_fuel_hoc = NULL; #ifdef pp_PLOT2D_NEW GLUI_Checkbox *CHECKBOX_genplot_use_usermin = NULL; GLUI_Checkbox *CHECKBOX_genplot_use_usermax = NULL; -GLUI_Checkbox *CHECKBOX_show_genplot = NULL; -GLUI_Checkbox *CHECKBOX_show_title = NULL; +GLUI_Checkbox *CHECKBOX_show_genplot = NULL; +GLUI_Checkbox *CHECKBOX_show_title = NULL; GLUI_Checkbox *CHECKBOX_show_curve_labels = NULL; -GLUI_Checkbox *CHECKBOX_genplot_use_factors = NULL; +GLUI_Checkbox *CHECKBOX_show_curve_values = NULL; +GLUI_Checkbox *CHECKBOX_genplot_use_factors = NULL; #endif GLUI_Checkbox *CHECKBOX_device_1=NULL; GLUI_Checkbox *CHECKBOX_showdevice_val=NULL; @@ -519,6 +520,7 @@ void Plot2D2Glui(int index){ EDIT_plot_label->set_text(glui_plot2dinfo->plot_label); CHECKBOX_show_title->set_int_val(glui_plot2dinfo->show_title); CHECKBOX_show_curve_labels->set_int_val(glui_plot2dinfo->show_curve_labels); + CHECKBOX_show_curve_values->set_int_val(glui_plot2dinfo->show_curve_values); UpdateCurveControls(NULL); } @@ -1474,11 +1476,12 @@ extern "C" void GluiDeviceSetup(int main_window){ glui_device->add_column_to_panel(PANEL_plot8, false); - PANEL_plot_title = glui_device->add_panel_to_panel(PANEL_plot8, "labels"); + PANEL_plot_title = glui_device->add_panel_to_panel(PANEL_plot8, "plot labels"); EDIT_plot_label = glui_device->add_edittext_to_panel(PANEL_plot_title, "edit title:", GLUI_EDITTEXT_TEXT, glui_plot2dinfo->plot_label, GENPLOT_PLOT_LABEL, GenPlotCB); glui_device->add_button_to_panel(PANEL_plot_title, _("Apply"), GENPLOT_PLOT_LABEL, GenPlotCB); CHECKBOX_show_title = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show title", &(glui_plot2dinfo->show_title), GENPLOT_PLOT_LABEL, GenPlotCB); CHECKBOX_show_curve_labels = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show curve labels", &(glui_plot2dinfo->show_curve_labels), GENPLOT_PLOT_LABEL, GenPlotCB); + CHECKBOX_show_curve_values = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show curve values", &(glui_plot2dinfo->show_curve_values), GENPLOT_PLOT_LABEL, GenPlotCB); glui_device->add_column_to_panel(PANEL_plot8, false); PANEL_plot_position = glui_device->add_panel_to_panel(PANEL_plot8, "plot position"); @@ -1527,7 +1530,7 @@ extern "C" void GluiDeviceSetup(int main_window){ glui_device->add_button_to_panel(PANEL_remove_curve, _("selected"), GENPLOT_REM_SELECTEDCURVE, GenPlotCB); glui_device->add_button_to_panel(PANEL_remove_curve, _("all"), GENPLOT_REM_ALLCURVES, GenPlotCB); - PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "bounds"); + PANEL_curve_bounds = glui_device->add_panel_to_panel(PANEL_curve_properties, "", 0); STATIC_curv_min = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "min: 0.0"); STATIC_curv_max = glui_device->add_statictext_to_panel(PANEL_curve_bounds, "max: 0.0"); diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index d64a3c8f57..cd0b3a8128 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -11591,7 +11591,9 @@ int ReadIni2(char *inifile, int localfile){ strcpy(plot2di->plot_label, labelptr); fgets(buffer, 255, stream); - sscanf(buffer, " %f %f %f %i %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurves, &plot2di->show_curve_labels); + sscanf(buffer, " %f %f %f %i %i %i %i %i", + plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, + &plot2di->ncurves, &plot2di->show_curve_labels, &plot2di->show_curve_values); for(j=0; jncurves; j++){ int color[3]; float linewidth1; @@ -14983,7 +14985,9 @@ void WriteIniLocal(FILE *fileout){ plot2di = plot2dinfo + i; fprintf(fileout, " %s\n", plot2di->plot_label); - fprintf(fileout, " %f %f %f %i %i %i %i\n", plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, plot2di->ncurves, plot2di->show_curve_labels); + fprintf(fileout, " %f %f %f %i %i %i %i %i\n", + plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, + plot2di->ncurves, plot2di->show_curve_labels, plot2di->show_curve_values); for(j = 0; j < plot2di->ncurves; j++){ int *color; float linewidth1, *curve_factors; diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index a6a613d565..1f76ce6a0d 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -1025,7 +1025,7 @@ typedef struct _plot2ddata{ char plot_label[350]; int ncurves, ncurves_ini; int curve_index, plot_index; - int show, show_title, show_curve_labels; + int show, show_title, show_curve_labels, show_curve_values; curvedata curve[PLOT2D_MAX_CURVES]; int bounds_defined; float xyz[3]; From faa013f63bb00e1064b0c32817f2c894753ae679 Mon Sep 17 00:00:00 2001 From: gforney Date: Mon, 20 Jun 2022 21:15:27 -0400 Subject: [PATCH 41/41] smokeview source: preliminary code to input plot2d bounds --- Source/smokeview/IOplot2d.c | 10 ++++++ Source/smokeview/glui_objects.cpp | 59 +++++++++++++++++++++++++++++-- Source/smokeview/options.h | 1 + Source/smokeview/readsmv.c | 12 +++++++ Source/smokeview/structures.h | 4 +++ 5 files changed, 84 insertions(+), 2 deletions(-) diff --git a/Source/smokeview/IOplot2d.c b/Source/smokeview/IOplot2d.c index 1946e2a37c..4b6996db8f 100644 --- a/Source/smokeview/IOplot2d.c +++ b/Source/smokeview/IOplot2d.c @@ -587,6 +587,16 @@ void InitPlot2D(plot2ddata *plot2di, int plot_index){ plot2di->xyz[0] = xbar0FDS; plot2di->xyz[1] = ybar0FDS; plot2di->xyz[2] = zbar0FDS; +#ifdef pp_PLOT2D_BOUNDS + plot2di->use_valmin[0] = 0; + plot2di->use_valmin[1] = 0; + plot2di->use_valmax[0] = 0; + plot2di->use_valmax[1] = 0; + plot2di->valmin[0] = 0.0; + plot2di->valmin[1] = 0.0; + plot2di->valmax[0] = 1.0; + plot2di->valmax[1] = 1.0; +#endif plot2di->plot_index = plot_index; sprintf(plot2di->plot_label, "plot %i", plot_index); plot2di->curve_index = 0; diff --git a/Source/smokeview/glui_objects.cpp b/Source/smokeview/glui_objects.cpp index ba70ca23d2..74984869bb 100644 --- a/Source/smokeview/glui_objects.cpp +++ b/Source/smokeview/glui_objects.cpp @@ -40,6 +40,9 @@ #define GENPLOT_SET_POS 112 #define GENPLOT_CSV_TYPE 113 #define GENPLOT_ADD_CURVE 114 +#ifdef pp_PLOT2D_BOUNDS +#define GENPLOT_PLOT_MINMAX 115 +#endif #endif #define WINDROSE_SHOW_FIRST 996 @@ -93,6 +96,10 @@ GLUI_Checkbox *CHECKBOX_show_title = NULL; GLUI_Checkbox *CHECKBOX_show_curve_labels = NULL; GLUI_Checkbox *CHECKBOX_show_curve_values = NULL; GLUI_Checkbox *CHECKBOX_genplot_use_factors = NULL; +#ifdef pp_PLOT2D_BOUNDS +GLUI_Checkbox *CHECKBOX_genplot_use_valmin[2]; +GLUI_Checkbox *CHECKBOX_genplot_use_valmax[2]; +#endif #endif GLUI_Checkbox *CHECKBOX_device_1=NULL; GLUI_Checkbox *CHECKBOX_showdevice_val=NULL; @@ -123,11 +130,17 @@ GLUI_Listbox *LIST_open=NULL; GLUI_Listbox *LIST_hrrdata=NULL; #ifdef pp_PLOT2D_NEW +#ifdef pp_PLOT2D_BOUNDS +GLUI_Panel *PANEL_bound1 = NULL; +GLUI_Panel *PANEL_bound1a = NULL; +GLUI_Panel *PANEL_bound1b = NULL; +GLUI_Panel *PANEL_bound2 = NULL; +GLUI_Panel *PANEL_bound2a = NULL; +GLUI_Panel *PANEL_bound2b = NULL; +#endif GLUI_Panel *PANEL_csv = NULL; GLUI_Panel *PANEL_csv2 = NULL; GLUI_Panel *PANEL_remove_curve = NULL; -#endif -#ifdef pp_PLOT2D_NEW GLUI_Panel *PANEL_curve_color = NULL; GLUI_Panel *PANEL_curve_bounds = NULL; GLUI_Panel *PANEL_curve_usermin = NULL; @@ -192,6 +205,10 @@ GLUI_Spinner *SPINNER_genplot_red = NULL; GLUI_Spinner *SPINNER_genplot_green = NULL; GLUI_Spinner *SPINNER_genplot_blue = NULL; GLUI_Spinner *SPINNER_genplot_linewidth = NULL; +#ifdef pp_PLOT2D_BOUNDS +GLUI_Spinner *SPINNER_genplot_valmin[2]; +GLUI_Spinner *SPINNER_genplot_valmax[2]; +#endif #endif GLUI_Spinner *SPINNER_fuel_hoc = NULL; GLUI_Spinner *SPINNER_size_factor = NULL; @@ -521,6 +538,14 @@ void Plot2D2Glui(int index){ CHECKBOX_show_title->set_int_val(glui_plot2dinfo->show_title); CHECKBOX_show_curve_labels->set_int_val(glui_plot2dinfo->show_curve_labels); CHECKBOX_show_curve_values->set_int_val(glui_plot2dinfo->show_curve_values); +#ifdef pp_PLOT2D_BOUNDS + for(i = 0; i < 2; i++){ + CHECKBOX_genplot_use_valmin[i]->set_int_val(glui_plot2dinfo->use_valmin[i]); + CHECKBOX_genplot_use_valmax[i]->set_int_val(glui_plot2dinfo->use_valmax[i]); + SPINNER_genplot_valmin[i]->set_float_val(glui_plot2dinfo->valmin[i]); + SPINNER_genplot_valmax[i]->set_float_val(glui_plot2dinfo->valmax[i]); + } +#endif UpdateCurveControls(NULL); } @@ -830,6 +855,11 @@ void GenPlotCB(int var){ curvedata *curve; int curve_id; +#ifdef pp_PLOT2D_BOUNDS + case GENPLOT_PLOT_MINMAX: + Glui2Plot2D(iplot2dinfo); + break; +#endif case GENPLOT_ADD_CURVE: #ifdef pp_PLOT2D_DEBUG printf("before add *********************\n"); @@ -1483,6 +1513,31 @@ extern "C" void GluiDeviceSetup(int main_window){ CHECKBOX_show_curve_labels = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show curve labels", &(glui_plot2dinfo->show_curve_labels), GENPLOT_PLOT_LABEL, GenPlotCB); CHECKBOX_show_curve_values = glui_device->add_checkbox_to_panel(PANEL_plot_title, "show curve values", &(glui_plot2dinfo->show_curve_values), GENPLOT_PLOT_LABEL, GenPlotCB); +#ifdef pp_PLOT2D_BOUNDS + PANEL_bound1 = glui_device->add_panel_to_panel(PANEL_plot_title, "bound1"); + PANEL_bound1a = glui_device->add_panel_to_panel(PANEL_bound1, "",0); + + SPINNER_genplot_valmin[0] = glui_device->add_spinner_to_panel(PANEL_bound1a, "min 1", GLUI_SPINNER_FLOAT, glui_plot2dinfo->valmin, GENPLOT_PLOT_MINMAX, GenPlotCB); + glui_device->add_column_to_panel(PANEL_bound1a, 0); + CHECKBOX_genplot_use_valmin[0] = glui_device->add_checkbox_to_panel(PANEL_bound1a, "use min 1", glui_plot2dinfo->use_valmin, GENPLOT_PLOT_MINMAX, GenPlotCB); + + PANEL_bound1b = glui_device->add_panel_to_panel(PANEL_bound1, "",0); + SPINNER_genplot_valmax[0] = glui_device->add_spinner_to_panel(PANEL_bound1b, "max 1", GLUI_SPINNER_FLOAT, glui_plot2dinfo->valmax, GENPLOT_PLOT_MINMAX, GenPlotCB); + glui_device->add_column_to_panel(PANEL_bound1b, 0); + CHECKBOX_genplot_use_valmax[0] = glui_device->add_checkbox_to_panel(PANEL_bound1b, "use max 1", glui_plot2dinfo->use_valmax, GENPLOT_PLOT_MINMAX, GenPlotCB); + + PANEL_bound2 = glui_device->add_panel_to_panel(PANEL_plot_title, "bound2"); + PANEL_bound2a = glui_device->add_panel_to_panel(PANEL_bound2, "",0); + + SPINNER_genplot_valmin[1] = glui_device->add_spinner_to_panel(PANEL_bound2a, "min 2", GLUI_SPINNER_FLOAT, glui_plot2dinfo->valmin+1, GENPLOT_PLOT_MINMAX, GenPlotCB); + glui_device->add_column_to_panel(PANEL_bound2a, 0); + CHECKBOX_genplot_use_valmin[1] = glui_device->add_checkbox_to_panel(PANEL_bound2a, "use min 2", glui_plot2dinfo->use_valmin+1, GENPLOT_PLOT_MINMAX, GenPlotCB); + + PANEL_bound2b = glui_device->add_panel_to_panel(PANEL_bound2, "",0); + SPINNER_genplot_valmax[1] = glui_device->add_spinner_to_panel(PANEL_bound2b, "max 2", GLUI_SPINNER_FLOAT, glui_plot2dinfo->valmax+1, GENPLOT_PLOT_MINMAX, GenPlotCB); + glui_device->add_column_to_panel(PANEL_bound2b, 0); + CHECKBOX_genplot_use_valmax[1] = glui_device->add_checkbox_to_panel(PANEL_bound2b, "use max 2", glui_plot2dinfo->use_valmax+1, GENPLOT_PLOT_MINMAX, GenPlotCB); +#endif glui_device->add_column_to_panel(PANEL_plot8, false); PANEL_plot_position = glui_device->add_panel_to_panel(PANEL_plot8, "plot position"); SPINNER_genplot_x = glui_device->add_spinner_to_panel(PANEL_plot_position, "x", GLUI_SPINNER_FLOAT, glui_plot2dinfo->xyz+0, GENPLOT_XYZ, GenPlotCB); diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index 846e958874..5c40eec2d1 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -17,6 +17,7 @@ //*** options: all platforms +//#define pp_PLOT2D_BOUNDS // 2d plot widgets for setting bounds //#define pp_PLOT2D_DEBUG // 2d plot debug output #define pp_PLOT2D_NEW // allow multiple curves on a single 2d plot #define pp_PLOT2D_OVERLAP // allow scene to overlap 2d plot region diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index cd0b3a8128..c830445c37 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -11594,6 +11594,12 @@ int ReadIni2(char *inifile, int localfile){ sscanf(buffer, " %f %f %f %i %i %i %i %i", plot2di->xyz, plot2di->xyz+1, plot2di->xyz+2, &plot2di->show, &plot2di->show_title, &plot2di->ncurves, &plot2di->show_curve_labels, &plot2di->show_curve_values); +#ifdef pp_PLOT2D_BOUNDS + fgets(buffer, 255, stream); + sscanf(buffer, " %f %i %f %i %f %i %f %i ", + plot2di->valmin, plot2di->use_valmin, plot2di->valmax, plot2di->use_valmax, + plot2di->valmin+1, plot2di->use_valmin+1, plot2di->valmax+1, plot2di->use_valmax+1); +#endif for(j=0; jncurves; j++){ int color[3]; float linewidth1; @@ -14988,6 +14994,12 @@ void WriteIniLocal(FILE *fileout){ fprintf(fileout, " %f %f %f %i %i %i %i %i\n", plot2di->xyz[0], plot2di->xyz[1], plot2di->xyz[2], plot2di->show, plot2di->show_title, plot2di->ncurves, plot2di->show_curve_labels, plot2di->show_curve_values); +#ifdef pp_PLOT2D_BOUNDS + fprintf(fileout, " %f %i %f %i %f %i %f %i\n", + plot2di->valmin[0], plot2di->use_valmin[0], plot2di->valmax[0], plot2di->use_valmax[0], + plot2di->valmin[1], plot2di->use_valmin[1], plot2di->valmax[1], plot2di->use_valmax[1] + ); +#endif for(j = 0; j < plot2di->ncurves; j++){ int *color; float linewidth1, *curve_factors; diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 1f76ce6a0d..5ee37f4fa5 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -1026,6 +1026,10 @@ typedef struct _plot2ddata{ int ncurves, ncurves_ini; int curve_index, plot_index; int show, show_title, show_curve_labels, show_curve_values; +#ifdef pp_PLOT2D_BOUNDS + float valmin[2], valmax[2]; + int use_valmin[2], use_valmax[2]; +#endif curvedata curve[PLOT2D_MAX_CURVES]; int bounds_defined; float xyz[3];