Skip to content

Commit

Permalink
Merge pull request #1616 from gforney/master
Browse files Browse the repository at this point in the history
smokeview source: remove GL and GLU headers from isobox.c - not needed
  • Loading branch information
gforney authored Jun 23, 2023
2 parents efdbe62 + 2bd5aec commit 9bf6841
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 223 deletions.
14 changes: 0 additions & 14 deletions Source/shared/isodefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@
#define ISODEFS_H_DEFINED
#define INCPOINTS 100000

#if defined(WIN32)
#include <windows.h>
#endif

#ifdef pp_DRAWISO
#ifdef pp_OSX
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#endif

#ifdef IN_ISOBOX
#define SV_EXTERN
#else
Expand Down
12 changes: 12 additions & 0 deletions Source/shared/options_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@
#define GLUT_H <GL/glut.h>
#endif

#define GL_H <GL/gl.h>
#ifdef pp_OSX
#undef GL_H
#define GL_H <OpenGL/gl.h>
#endif

#define GLU_H <GL/glu.h>
#ifdef pp_OSX
#undef GLU_H
#define GLU_H <OpenGL/glu.h>
#endif

#include "lint.h"

#endif
3 changes: 0 additions & 3 deletions Source/smokeview/IOgeometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,6 @@ void DrawGeom(int flag, int timestate){
int j;

trianglei = tris[i];
#ifndef pp_TERRAIN_CFACES
if(use_cfaces==1&&trianglei->geomtype==GEOM_GEOM)continue;
#endif
if(trianglei->geomtype!=GEOM_ISO){
if(trianglei->outside_domain==0&&showgeom_inside_domain==0)continue;
if(trianglei->outside_domain==1&&showgeom_outside_domain==0)continue;
Expand Down
5 changes: 5 additions & 0 deletions Source/smokeview/IOobjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include <math.h>
#include <string.h>

#if defined(WIN32)
#include <windows.h>
#endif
#include GLU_H

#include "datadefs.h"
#include "smokeviewvars.h"
#include "IOobjects.h"
Expand Down
116 changes: 6 additions & 110 deletions Source/smokeview/IOplot2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include <math.h>
#include <string.h>

#if defined(WIN32)
#include <windows.h>
#endif
#include GL_H

#include "datadefs.h"
#include "smokeviewvars.h"

Expand Down Expand Up @@ -366,9 +371,6 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){
curve->curve_factor = 1.0;
curve->update_avg = 0;
curve->vals = NULL;
#ifdef pp_PLOT2DMAX
curve->vals2 = NULL;
#endif
strcpy(curve->scaled_label, "");
strcpy(curve->scaled_unit, "");
}
Expand Down Expand Up @@ -420,88 +422,6 @@ void UpdateCurveBounds(plot2ddata *plot2di, int option){
}
}

#ifdef pp_PLOT2DMAX
/* ------------------ TimeAverageVals ------------------------ */

void IntegrateVals(float *times, float *vals, float *vals_integral_arg, int nvals){
int i;

vals_integral_arg[0] = 0.0;
for(i = 1;i < nvals;i++){
float dt;

dt = times[i] - times[i - 1];
vals_integral_arg[i] = vals_integral_arg[i-1] + dt*(vals[i-1] + vals[i]) / 2.0;
}
}

/* ------------------ IntegrateValsAB ------------------------ */

float IntegrateValsAB(float *times, float *vals_integral_arg, int nvals, float tbeg, float tend){
int ibeg, iend;
float vbeg, vend;
float dt1, dt2, dt;
float integral;

ibeg = GetInterval(tbeg, times, nvals);
iend = GetInterval(tend, times, nvals);
dt1 = tbeg - times[ibeg];
dt2 = times[ibeg + 1] - tbeg;
dt = times[ibeg + 1] - times[ibeg];
vbeg = (dt1 * vals_integral_arg[ibeg + 1] + dt2 * vals_integral_arg[ibeg]) / dt;

dt1 = tend - times[iend];
dt2 = times[iend + 1] - tend;
dt = times[iend + 1] - times[iend];
vend = (dt1 * vals_integral_arg[iend + 1] + dt2 * vals_integral_arg[iend]) / dt;
integral = vend - vbeg;
return integral;
}

/* ------------------ MaxAverageVal ------------------------ */

float MaxAverageVal(float *times, float *vals_integral_arg, int nvals, float delta_t){
int i;
float max_avg;
float tbeg, tend;

tbeg = times[0];
tend = tbeg + delta_t;

max_avg = IntegrateValsAB(times, vals_integral_arg, nvals, tbeg, tend) / delta_t;

for(i = 1;i < nvals;i++){
float val_avg;

tbeg = times[i];
tend = tbeg + delta_t;
if(tend > times[nvals - 1])break;
val_avg = IntegrateValsAB(times, vals_integral_arg, nvals, tbeg, tend) / delta_t;
max_avg = MAX(max_avg, val_avg);
}
return max_avg;
}

/* ------------------ MaxAverageVals ------------------------ */

void MaxAverageVals(float *times, float *vals, float *vals2, int nvals){
int i;

FREEMEMORY(v_integral);
NewMemory((void **)&v_integral, nvals * sizeof(float));
IntegrateVals(times, vals, v_integral, nvals);
for(i = 1;i < nvals;i++){
float max_avg, delta_t;

delta_t = times[i] - times[0];
max_avg = MaxAverageVal(times, v_integral, nvals, delta_t);
vals2[i] = max_avg;
}
vals2[0] = vals2[1];
FREEMEMORY(v_integral);
}
#endif

/* ------------------ HavePlot2D ------------------------ */

int HavePlot2D(float **times, int *ntimes){
Expand Down Expand Up @@ -673,42 +593,18 @@ void DrawGenPlot(plot2ddata *plot2di){
if(curve->vals==NULL){
NewMemory((void **)&curve->vals, csvi->nvals * sizeof(devicedata *));
}
#ifdef pp_PLOT2DMAX
if(curve->vals2==NULL){
NewMemory((void **)&curve->vals2, csvi->nvals * sizeof(devicedata *));
}
#endif
if(curve->update_avg==1||plot2d_time_average>0.0
#ifdef pp_PLOT2DMAX
||update_max_avg_vals==1
#endif
){
if(curve->update_avg==1||plot2d_time_average>0.0){
if(curve->update_avg==1){
curve->update_avg = 0;
TimeAveragePlot2DData(csvfi->time->vals, csvi->vals, curve->vals, csvi->nvals, plot2d_time_average);
}
#ifdef pp_PLOT2DMAX
if(update_max_avg_vals==1){
update_max_avg_vals = 0;
MaxAverageVals(csvfi->time->vals, csvi->vals, curve->vals2, csvi->nvals);
}
#endif
}
else{
memcpy(curve->vals, csvi->vals, csvi->nvals*sizeof(float));
}
if(global_times!=NULL){
float *vals;
#ifdef pp_PLOT2DMAX
if(show_max_avg_vals == 1){
vals = curve->vals2;
}
else{
vals = curve->vals;
}
#else
vals = curve->vals;
#endif
highlight_time = global_times[itimes];
highlight_val = GetCSVVal(global_times[itimes], csvfi->time->vals, vals, csvi->nvals);
DrawGenCurve(option, plot2di, curve, plot2d_size_factor, csvfi->time->vals, vals, csvi->nvals,
Expand Down
5 changes: 5 additions & 0 deletions Source/smokeview/camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include <stdio.h>
#include <string.h>

#if defined(WIN32)
#include <windows.h>
#endif
#include GL_H

#include "smokeviewvars.h"

/* ------------------ Zoom2Aperture ------------------------ */
Expand Down
5 changes: 5 additions & 0 deletions Source/smokeview/getdatabounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#include <string.h>
#include <math.h>

#if defined(WIN32)
#include <windows.h>
#endif
#include GL_H

#include "smokeviewvars.h"
#include "IOscript.h"

Expand Down
30 changes: 0 additions & 30 deletions Source/smokeview/glui_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#define GENPLOT_RESET_BOUNDS 114
#define GENPLOT_PLOT_DIST 115
#define GENPLOT_UPDATE 116
#ifdef pp_PLOT2DMAX
#define GENPLOT_MAX_VALS 117
#endif
#define GENPLOT_PLOT_TMINMAX 118
#define GENPLOT_SHOW_PLOTS 119

Expand Down Expand Up @@ -129,9 +126,7 @@ GLUI_EditText *EDIT_filter=NULL;
GLUI_Listbox *LIST_csvfile = NULL;
GLUI_Listbox *LIST_csvID = NULL;
GLUI_Listbox *LIST_curve_unit = NULL;
#ifdef pp_CFAST_CSV
GLUI_Listbox *LIST_curve_compartments = NULL;
#endif
GLUI_Listbox *LIST_plots = NULL;
GLUI_Listbox *LIST_plotcurves = NULL;
GLUI_Listbox *LIST_open=NULL;
Expand Down Expand Up @@ -401,12 +396,7 @@ void RemoveCurve(plot2ddata *plot2di, int index){
}
curve = plot2di->curve+index;
if(index >= 0){
#ifdef pp_PLOT2DMAX
FREEMEMORY(curve->vals);
FREEMEMORY(curve->vals2);
#else
FREEMEMORY(curve->vals);
#endif
}
// (0,...,i-1,i+1,...,n-1)
if(plot2di->ncurves>index+1){
Expand Down Expand Up @@ -473,9 +463,6 @@ void AddCSVCurve(plot2ddata *plot2di, int index, int option){
curve->curve_factor = glui_curve_default.curve_factor;
curve->apply_curve_factor = glui_curve_default.apply_curve_factor;
curve->vals = glui_curve_default.vals;
#ifdef pp_PLOT2DMAX
curve->vals2 = glui_curve_default.vals2;
#endif
curve->update_avg = glui_curve_default.update_avg;

shortlabel = GetPlotShortLabel2(plot2di, curve);
Expand Down Expand Up @@ -745,9 +732,7 @@ void FilterList(void){

char unit_label[256];
int unit_id;
#ifdef pp_CFAST_CSV
int compartment_id;
#endif

LOCK_CSV_LOAD_CPP;
for(i=0; i<plot2d_max_columns; i++){
Expand All @@ -771,11 +756,9 @@ void FilterList(void){
strcpy(unit_label, "dimensionless");
}
}
#ifdef pp_CFAST_CSV
if(isZoneFireModel==1){
compartment_id = LIST_curve_compartments->get_int_val();
}
#endif
for(i = 0; i < csvfi->ncsvinfo; i++){
csvdata *csvi;
int doit;
Expand All @@ -787,8 +770,6 @@ void FilterList(void){
if(doit==0&&csvi->dimensionless == 1 && strcmp(unit_label, "dimensionless")==0)doit = 1;
if(doit==0&&csvi->dimensionless == 0 && strcmp(unit_label, csvi->label.unit) == 0)doit = 1;
if(doit==0)continue;

#ifdef pp_CFAST_CSV
if(isZoneFireModel==1&&compartment_id>=0){
if(
strcmp(csvfi->c_type, "compartments") == 0 ||
Expand All @@ -811,7 +792,6 @@ void FilterList(void){

}
}
#endif
if(doit==1)LIST_csvID->add_item(i, csvi->label.shortlabel);
}
}
Expand Down Expand Up @@ -1452,11 +1432,6 @@ void GenPlotCB(int var){
break;
case GENPLOT_UPDATE:
break;
#ifdef pp_PLOT2DMAX
case GENPLOT_MAX_VALS:
update_max_avg_vals = 1;
break;
#endif
default:
ASSERT(FFALSE);
break;
Expand Down Expand Up @@ -1847,7 +1822,6 @@ extern "C" void GluiPlot2DSetup(int main_window){
LIST_curve_unit = glui_plot2d->add_listbox_to_panel(PANEL_add_curve1, "unit:", &icsv_units, GENPLOT_CURVE_UNIT, GenPlotCB);
LIST_curve_unit->add_item(-1, "any");

#ifdef pp_CFAST_CSV
if(isZoneFireModel==1){
LIST_curve_compartments = glui_plot2d->add_listbox_to_panel(PANEL_add_curve1, "compartment:", &icsv_compartments, GENPLOT_CURVE_UNIT, GenPlotCB);
for(i = 0;i < nrooms;i++){
Expand All @@ -1859,7 +1833,6 @@ extern "C" void GluiPlot2DSetup(int main_window){
LIST_curve_compartments->add_item(-1, "any");
LIST_curve_compartments->set_int_val(-1);
}
#endif

GenPlotCB(GENPLOT_CSV_FILETYPE);
GenPlotCB(GENPLOT_CURVE_UNIT);
Expand Down Expand Up @@ -1894,9 +1867,6 @@ extern "C" void GluiPlot2DSetup(int main_window){
SPINNER_size_factor = glui_plot2d->add_spinner_to_panel(PANEL_plotother, _("plot size(relative)"), GLUI_SPINNER_FLOAT, &plot2d_size_factor, GENPLOT_PLOT_SIZE, GenPlotCB);
glui_plot2d->add_spinner_to_panel(PANEL_plotother, _("vertical font spacing"), GLUI_SPINNER_FLOAT, &plot2d_font_spacing, GENPLOT_UPDATE, GenPlotCB);
SPINNER_plot2d_time_average = glui_plot2d->add_spinner_to_panel(PANEL_plotother, _("smoothing interval (s)"), GLUI_SPINNER_FLOAT, &plot2d_time_average, DEVICE_TIMEAVERAGE, DeviceCB);
#ifdef pp_PLOT2DMAX
glui_plot2d->add_checkbox_to_panel(PANEL_plotother, "max average", &show_max_avg_vals, GENPLOT_MAX_VALS, GenPlotCB);
#endif

PANEL_plotproperties2 = glui_plot2d->add_panel_to_panel(ROLLOUT_plotproperties, "", GLUI_PANEL_NONE);

Expand Down
7 changes: 0 additions & 7 deletions Source/smokeview/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
#define PROGVERSION ""
#endif


//#define pp_PLOT2DMAX // add option to plot 2d max vals
#define pp_CFAST_CSV // look for cfast spreadsheet files

//*** parallel file loading
#define pp_SLICE_MULTI // load slice files in parallel
#define pp_PART_MULTI // load particle files in parallel
Expand All @@ -33,8 +29,6 @@
#define pp_TOUR_DUP // handle duplicate keyframes
//#define pp_BNDF // merge geometry and structured boundary files in load menus

#define pp_TERRAIN_CFACES // draw terrain over cfaces and regular geometry

//#define pp_DPRINT // turn on debug print (file, line number)

// streaming directives
Expand All @@ -56,7 +50,6 @@
//#define pp_CRASH_TEST // test detection of division by zero or use of undefined pointer
#define pp_GPU // support the GPU
#define pp_THREAD // turn on multi-threading
#define pp_DRAWISO // turn on drawing routines
//#define pp_LOAD_NEWDATA // add button for loading new data

#ifdef pp_GPU
Expand Down
Loading

0 comments on commit 9bf6841

Please sign in to comment.