Skip to content

Commit

Permalink
Merge pull request #2031 from JakeOShannessy/read-slice-no-global
Browse files Browse the repository at this point in the history
split slice functions and move to shared
  • Loading branch information
gforney authored Sep 24, 2024
2 parents de3df67 + 9463f7f commit 6a5e65c
Show file tree
Hide file tree
Showing 30 changed files with 959 additions and 914 deletions.
2 changes: 1 addition & 1 deletion Build/smokeview/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bin = .

csrc = callbacks.c camera.c color2rgb.c readimage.c readgeom.c readobject.c readcad.c colortimebar.c compress.c csphere.c dmalloc.c \
drawGeometry.c file_util.c getdata.c getdatabounds.c getdatacolors.c glew.c \
histogram.c infoheader.c readlabel.c readtour.c readhvac.c readsmoke.c \
histogram.c infoheader.c readlabel.c readtour.c readhvac.c readslice.c readsmoke.c \
IOboundary.c IOgeometry.c IOhvac.c IOiso.c IOobjects.c IOpart.c IOplot2d.c IOplot3d.c \
IOscript.c IOshooter.c IOslice.c IOsmoke.c IOtour.c IOvolsmoke.c IOwui.c IOzone.c IOframe.o isobox.c \
main.c md5.c menus.c output.c readsmv.c renderhtml.c renderimage.c scontour2d.c sha1.c \
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ add_executable(smokeview
Source/shared/readhvac.c
Source/shared/readgeom.c
Source/shared/readsmoke.c
Source/shared/readslice.c
Source/shared/readobject.c
Source/shared/readtour.c
Source/shared/readlabel.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,3 @@ void FreeContour(contour *ci);
void FreeContours(contour *contours,int ncontours);

#endif





40 changes: 40 additions & 0 deletions Source/shared/readslice.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "options.h"
#include "MALLOCC.h"
#include "string_util.h"
#include "gd.h"
#include <math.h>

#include <string.h>
#include "smokeviewdefs.h"
#include "contourdefs.h"
#include "isodefs.h"
#include "histogram.h"
#include "structures.h"
#include "datadefs.h"

/* ------------------ GetSliceFileHeader ------------------------ */

void GetSliceFileHeader(char *file, int *ip1, int *ip2, int *jp1, int *jp2, int *kp1, int *kp2, int *error){
FILE *stream = NULL;
int vals[6];

stream = fopen(file, "rb");
*error = 1;
*ip1 = 0;
*ip2 = 0;
*jp1 = 0;
*jp2 = 0;
*kp1 = 0;
*kp2 = 0;
if(stream==NULL)return;
fseek(stream, 3*(4+30+4), SEEK_CUR);
fseek(stream, 4, SEEK_CUR); fread(vals, sizeof(int), 6, stream);
*ip1 = vals[0];
*ip2 = vals[1];
*jp1 = vals[2];
*jp2 = vals[3];
*kp1 = vals[4];
*kp2 = vals[5];
*error = 0;
fclose(stream);
}
12 changes: 12 additions & 0 deletions Source/shared/readslice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef READSLICE_H_DEFINED
#define READSLICE_H_DEFINED
#include "options.h"
#include "MALLOCC.h"
#include "string_util.h"
#include "gd.h"

#include <string.h>

void GetSliceFileHeader(char *file, int *ip1, int *ip2, int *jp1, int *jp2, int *kp1, int *kp2, int *error);

#endif
148 changes: 148 additions & 0 deletions Source/shared/shared_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ typedef struct _sv_object {
struct _sv_object *next;
} sv_object;

#include "string_util.h"
#include "isodefs.h"
#include "contourdefs.h"
#include "histogram.h"

/* -------------------------- keyframe ------------------------------------ */

typedef struct _keyframe {
Expand Down Expand Up @@ -393,13 +398,156 @@ typedef struct _clipdata {
float zmin, zmax;
} clipdata;

/* -------------------------- compdata ------------------------------------ */

typedef struct _compdata {
int offset, size;
} compdata;

/* -------------------------- slicedata ------------------------------------ */

typedef struct _slicedata {
int seq_id, autoload;
char *file, *size_file, *bound_file;
int have_bound_file;
char *comp_file, *reg_file, *vol_file;
char *geom_file;
int nframes;
int finalize;
int slcf_index;
char *slicelabel;
unsigned char *slice_mask;
int compression_type;
int colorbar_autoflip;
int ncompressed;
int slice_filetype;
struct _multislicedata *mslice;
int menu_show;
float *constant_color;
float qval256[256];
int loaded, loading, display;
int loaded_save, display_save;
float position_orig;
int blocknumber;
int cell_center_edge;
int vec_comp;
int skipdup;
int setvalmin, setvalmax;
float globalmin_slice, globalmax_slice;
float valmin_slice, valmax_slice;
float diff_valmin, diff_valmax;
flowlabels label;
float *qslicedata, *qsliceframe, *times, *qslice;
unsigned char *times_map;
unsigned char *qslicedata_compressed;
unsigned char *slicecomplevel;
unsigned char full_mesh;
contour *line_contours;
int nline_contours;
compdata *compindex;
unsigned char *slicelevel;
char menulabel[128];
char menulabel2[128];
float *rgb_slice_ptr[256];
int ntimes,ntimes_old,itime;
unsigned char *iqsliceframe;
float above_ground_level;
int have_agl_data;
int volslice;
int is1, is2, js1, js2, ks1, ks2;
int iis1, iis2, jjs1, jjs2, kks1, kks2;
int *imap, *jmap, *kmap;
int n_imap, n_jmap, n_kmap;
int plotx, ploty, plotz;
int ijk_min[3], ijk_max[3];
float xmin,xmax,ymin,ymax,zmin,zmax;
float xyz_min[3], xyz_max[3];
int nsliceijk;
int *timeslist;
char cdir[256];
int idir, fds_dir;
float sliceoffset;
int nslicei, nslicej, nslicek;
int nslicex, nslicey;
int nslicetotal;
int slicefile_labelindex;
int vloaded, uvw;
int cell_center;
float delta_orig, dplane_min, dplane_max;
int extreme_min, extreme_max;
int hist_update;
int nhistograms;
histogramdata *histograms;
histogramdata *histogram;
struct _patchdata *patchgeom;
FILE_SIZE file_size;
int *geom_offsets;
devicedata vals2d;
#ifdef pp_SLICEFRAME
framedata *frameinfo;
#endif
} slicedata;

/* -------------------------- multislicedata ------------------------------------ */

typedef struct _multislicedata {
int seq_id, autoload;
int loaded, display, loadable;
int *islices, nslices;
int slice_filetype;
char menulabel[128];
char menulabel2[128];
} multislicedata;

/* -------------------------- multivslicedata ------------------------------------ */

typedef struct _multivslicedata {
int seq_id, autoload;
int loaded,display,mvslicefile_labelindex,loadable;
int nvslices;
int *ivslices;
char menulabel[128];
char menulabel2[128];
} multivslicedata;

/* -------------------------- vslicedata ------------------------------------ */

typedef struct _vslicedata {
int seq_id, autoload, reload;
slicedata *u,*v,*w,*val;
int volslice;
int iu, iv, iw, ival;
int skip;
int finalize;
int loaded,display;
float valmin, valmax;
int vslice_filetype;
int vslicefile_labelindex;
char menulabel[128];
char menulabel2[128];
} vslicedata;


/* -------------------------- circdata ------------------------------------- */

typedef struct _circdata {
float *xcirc, *ycirc;
int ncirc;
} circdata;

typedef struct {
int nsliceinfo;
slicedata *sliceinfo;

int nmultisliceinfo;
multislicedata *multisliceinfo;

int nvsliceinfo;
vslicedata *vsliceinfo;

int nmultivsliceinfo;
multivslicedata *multivsliceinfo;
} slice_collection;
/* -------------------------- labeldata ------------------------------------ */

typedef struct _labeldata {
Expand Down
Loading

0 comments on commit 6a5e65c

Please sign in to comment.