diff --git a/Build/smokeview/Makefile b/Build/smokeview/Makefile index c5bc9b742..7af02efc6 100644 --- a/Build/smokeview/Makefile +++ b/Build/smokeview/Makefile @@ -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 \ + histogram.c infoheader.c readlabel.c readtour.c readhvac.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 \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 92d3f81c4..f3efb60c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,6 +226,7 @@ add_executable(smokeview Source/shared/readcad.c Source/shared/readhvac.c Source/shared/readgeom.c + Source/shared/readsmoke.c Source/shared/readobject.c Source/shared/readtour.c Source/shared/readlabel.c diff --git a/Source/shared/readsmoke.c b/Source/shared/readsmoke.c new file mode 100644 index 000000000..7f28e4af8 --- /dev/null +++ b/Source/shared/readsmoke.c @@ -0,0 +1,42 @@ +#include "options.h" +#include +#include +#include +#include +#include + +#include "MALLOCC.h" +#include "contourdefs.h" +#include "histogram.h" +#include "isodefs.h" +#include "readsmoke.h" +#include "smokeviewdefs.h" +#include "string_util.h" +#include "structures.h" + +/* ------------------ FreeSmoke3d ------------------------ */ + +void FreeSmoke3D(smoke3ddata *smoke3di) { + smoke3di->lastiframe = -999; +#ifdef pp_SMOKEFRAME + FRAMEFree(smoke3di->frameinfo); + smoke3di->frameinfo = NULL; +#endif + FREEMEMORY(smoke3di->smokeframe_in); + FREEMEMORY(smoke3di->smokeframe_out); + FREEMEMORY(smoke3di->timeslist); + FREEMEMORY(smoke3di->times); + FREEMEMORY(smoke3di->times_map); + FREEMEMORY(smoke3di->use_smokeframe); + FREEMEMORY(smoke3di->nchars_compressed_smoke_full); + FREEMEMORY(smoke3di->nchars_compressed_smoke); + FREEMEMORY(smoke3di->frame_all_zeros); + FREEMEMORY(smoke3di->smoke_boxmin); + FREEMEMORY(smoke3di->smoke_boxmax); +#ifndef pp_SMOKEFRAME + FREEMEMORY(smoke3di->smoke_comp_all); +#endif + FREEMEMORY(smoke3di->smokeframe_comp_list); + FREEMEMORY(smoke3di->smokeview_tmp); + FREEMEMORY(smoke3di->smokeframe_loaded); +} diff --git a/Source/shared/readsmoke.h b/Source/shared/readsmoke.h new file mode 100644 index 000000000..4f812686b --- /dev/null +++ b/Source/shared/readsmoke.h @@ -0,0 +1,21 @@ +#ifndef READSMOKE_H_DEFINED +#define READSMOKE_H_DEFINED +#include "options.h" +#include +#include +#include +#include +#include + +#include "MALLOCC.h" +#include "contourdefs.h" +#include "histogram.h" +#include "isodefs.h" +#include "shared_structures.h" +#include "smokeviewdefs.h" +#include "string_util.h" + +#include "readobject.h" + +void FreeSmoke3D(smoke3ddata *smoke3di); +#endif diff --git a/Source/shared/shared_structures.h b/Source/shared/shared_structures.h index 04032c4d9..c4f1bd019 100644 --- a/Source/shared/shared_structures.h +++ b/Source/shared/shared_structures.h @@ -424,4 +424,100 @@ typedef struct { labeldata *label_last_ptr; } labels_collection; +/* -------------------------- smokedata ------------------------------------ */ + +typedef struct _smokedata { + int ncomp_total; + int *nchars_compressed, *nchars_compressed_full; + unsigned char *frame_in, *frame_out, *view_tmp, *comp_all, **frame_comp_list; +} smokedata; + +/* -------------------------- smokestatedata ------------------------------- */ + +typedef struct { + int loaded, index; + unsigned char *color; +} smokestatedata; + +/* -------------------------- smoke3ddata ---------------------------------- */ + +typedef struct _smoke3ddata { + int seq_id, autoload; + char *file; + char *comp_file, *reg_file; +#ifdef pp_SMOKE16 + char *s16_file; +#endif + int filetype; + int skip_smoke, skip_fire; + int is_smoke, is_fire; + int loaded, request_load, finalize, display, primary_file; + int is_zlib; +#ifdef pp_SMOKE16 + int is_s16; +#endif + smokestatedata *smokestate; + int blocknumber; + int type; + int is1, is2, js1, js2, ks1, ks2; + int compression_type, compression_type_temp; + flowlabels label; + char menulabel[128]; + float *times; + unsigned char *times_map; + int *use_smokeframe; + int *smokeframe_loaded; + float extinct, valmin, valmax; + char cextinct[32]; +#define ALPHA_X 0 +#define ALPHA_Y 1 +#define ALPHA_Z 2 +#define ALPHA_XY 3 +#define ALPHA_YZ 4 +#define ALPHA_XZ 5 + unsigned char *alphas_dir[6]; + int fire_alpha, co2_alpha; + float fire_alphas[256], co2_alphas[256]; + int *timeslist; + int ntimes, ntimes_old, ismoke3d_time, lastiframe, ntimes_full; + int nchars_uncompressed; + + int ncomp_smoke_total; + int *nchars_compressed_smoke, *nchars_compressed_smoke_full; +#ifdef pp_SMOKE16 + unsigned short *val16s; + float *val16_mins, *val16_maxs, *times16; +#endif + float maxval; + unsigned char *smokeframe_in, *smokeframe_out, **smokeframe_comp_list; + unsigned char *smokeview_tmp; +#ifndef pp_SMOKEFRAME + unsigned char *smoke_comp_all; +#endif + unsigned char *frame_all_zeros; + FILE_SIZE file_size; + float *smoke_boxmin, *smoke_boxmax; + smokedata smoke; + int dir; +#ifdef pp_SMOKEFRAME + framedata *frameinfo; +#endif +} smoke3ddata; + +/* -------------------------- smoke3dtypedata ------------------------------ */ + +typedef struct _smoke3dtypedata { + char *shortlabel, *longlabel; + int type; // color based or opacity based + int menu_id; + smoke3ddata *smoke3d; + float extinction, valmin, valmax; +} smoke3dtypedata; + +typedef struct { + int nsmoke3dinfo; + smoke3ddata *smoke3dinfo; + smoke3ddata **smoke3dinfo_sorted; +} smoke3d_collection; + #endif diff --git a/Source/smokeview/IOscript.c b/Source/smokeview/IOscript.c index 28020ab88..eefa5e241 100644 --- a/Source/smokeview/IOscript.c +++ b/Source/smokeview/IOscript.c @@ -2035,25 +2035,25 @@ void ScriptLoad3dSmoke(scriptdata *scripti){ int count=0; PRINTF("script: loading smoke3d files of type: %s\n\n",scripti->cval); - for(i = 0; i < nsmoke3dinfo; i++){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; smoke3di->finalize = 0; } - for(i = nsmoke3dinfo - 1; i >= 0; i--){ + for(i = smoke3dcoll.nsmoke3dinfo - 1; i >= 0; i--){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(MatchUpper(smoke3di->label.longlabel, scripti->cval) == MATCH){ smoke3di->finalize = 1; break; } } - for(i=0;ilabel.longlabel,scripti->cval) == MATCH){ ReadSmoke3D(ALL_SMOKE_FRAMES, i, LOAD, FIRST_TIME, &errorcode); count++; @@ -3274,10 +3274,10 @@ void ScriptLoadFile(scriptdata *scripti){ return; } } - for(i=0;ifile,scripti->cval)==0){ smoke3di->finalize = 1; smoke3di->finalize = 1; diff --git a/Source/smokeview/IOsmoke.c b/Source/smokeview/IOsmoke.c index ff3252983..58da24efe 100644 --- a/Source/smokeview/IOsmoke.c +++ b/Source/smokeview/IOsmoke.c @@ -42,10 +42,10 @@ void UpdateSmoke3dFileParms(void){ ntemploaded = 0; nco2files = 0; nco2loaded = 0; - for(i = 0; i < nsmoke3dinfo; i++){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->type==SOOT_index){ if(smoke3di->loaded==1)nsootloaded++; nsootfiles++; @@ -331,7 +331,7 @@ int IsSmokeComponentPresent(smoke3ddata *smoke3di){ smoke3ddata *smoke_component; if(smoke3di->smokestate[i].index == -1)continue; - smoke_component = smoke3dinfo + smoke3di->smokestate[i].index; + smoke_component = smoke3dcoll.smoke3dinfo + smoke3di->smokestate[i].index; if(smoke_component->loaded != 1 || smoke_component->display != 1)continue; if(smoke_component->frame_all_zeros[smoke_component->ismoke3d_time] == SMOKE3D_ZEROS_ALL)continue; return 1; @@ -385,7 +385,7 @@ void DrawSmoke3DGPU(smoke3ddata *smoke3di){ smoke3ddata *sooti = NULL; if(SOOT_index>=0&&smoke3di->smokestate[SOOT_index].index>=0){ - sooti = smoke3dinfo+smoke3di->smokestate[SOOT_index].index; + sooti = smoke3dcoll.smoke3dinfo+smoke3di->smokestate[SOOT_index].index; } else{ sooti = NULL; @@ -1538,14 +1538,14 @@ void InitAlphas(unsigned char *alphanew, void UpdateSmokeAlphas(void){ int i; - for(i = 0; iextinct<0.0)continue; smoke_mesh = meshinfo+smoke3di->blocknumber; dx = smoke_mesh->dxyz_orig[0]; @@ -3254,10 +3254,10 @@ void DrawSmokeFrame(void){ blend_mode = 1; glBlendEquation(GL_MAX); } - for(i = 0; iloaded==0||smoke3di->display==0)continue; if(smoke3di->primary_file==0)continue; IF_NOT_USEMESH_CONTINUE(USEMESH_DRAW,smoke3di->blocknumber); @@ -3527,11 +3527,11 @@ int GetSmokeNFrames(int type, float *tmin, float *tmax){ nframes = 0; *tmin = 1.0; *tmax = 0.0; - for(i = 0;i < nsmoke3dinfo;i++){ + for(i = 0;i < smoke3dcoll.nsmoke3dinfo;i++){ smoke3ddata *smoke3di; int nf; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->type == SOOT_index && (type&1) == 0)continue; if(smoke3di->type == HRRPUV_index && (type&2) == 0)continue; if(smoke3di->type == TEMP_index && (type&4) == 0)continue; @@ -3761,34 +3761,6 @@ int GetSmoke3DSizes(smoke3ddata *smoke3di, int fortran_skip, char *smokefile, in return 0; } -/* ------------------ FreeSmoke3d ------------------------ */ - -void FreeSmoke3D(smoke3ddata *smoke3di){ - - smoke3di->lastiframe = -999; -#ifdef pp_SMOKEFRAME - FRAMEFree(smoke3di->frameinfo); - smoke3di->frameinfo = NULL; -#endif - FREEMEMORY(smoke3di->smokeframe_in); - FREEMEMORY(smoke3di->smokeframe_out); - FREEMEMORY(smoke3di->timeslist); - FREEMEMORY(smoke3di->times); - FREEMEMORY(smoke3di->times_map); - FREEMEMORY(smoke3di->use_smokeframe); - FREEMEMORY(smoke3di->nchars_compressed_smoke_full); - FREEMEMORY(smoke3di->nchars_compressed_smoke); - FREEMEMORY(smoke3di->frame_all_zeros); - FREEMEMORY(smoke3di->smoke_boxmin); - FREEMEMORY(smoke3di->smoke_boxmax); -#ifndef pp_SMOKEFRAME - FREEMEMORY(smoke3di->smoke_comp_all); -#endif - FREEMEMORY(smoke3di->smokeframe_comp_list); - FREEMEMORY(smoke3di->smokeview_tmp); - FREEMEMORY(smoke3di->smokeframe_loaded); -} - /* ------------------ GetSmoke3DVersion ------------------------ */ int GetSmoke3DVersion2(smoke3ddata *smoke3di){ @@ -3847,21 +3819,21 @@ int GetSmoke3DVersion(smoke3ddata *smoke3di){ void SetSmokeColorFlags(void){ int i; - for(i = 0;ismokestate[j].loaded = 0; } } - for(i = 0;ismokestate[j].color = NULL; smoke3di->smokestate[j].index = -1; @@ -3876,12 +3848,12 @@ void SetSmokeColorFlags(void){ assert(FFALSE); } - for(j = 0;jloaded==0)continue; if(smoke3di->blocknumber!=smoke3dj->blocknumber)continue; if(smoke3di->is1!=smoke3dj->is1)continue; @@ -3912,19 +3884,19 @@ void UpdateLoadedSmoke(int *h_loaded, int *t_loaded){ *h_loaded = 0; *t_loaded = 0; - for(j = 0; jloaded==1&&smoke3dj->type==HRRPUV_index){ *h_loaded = 1; break; } } - for(j = 0; jloaded==1&&smoke3dj->type==TEMP_index){ *t_loaded = 1; break; @@ -4085,11 +4057,11 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int load_flag, int iframe_arg, int *erro int free_iblank_smoke3d_local; free_iblank_smoke3d_local = 1; - for(j = 0; jblocknumber; if(smoke3dj!=smoke3di && smoke3dj->loaded==1&&meshj==mesh_smoke3d){ free_iblank_smoke3d_local = 0; @@ -4111,11 +4083,11 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int load_flag, int iframe_arg, int *erro // if we are loading a TEMP then unload all HRRPUV's if(smoke3di->type==TEMP_index&&nhrrpuvloaded>0)printf("unloading all smoke3d hrrpuv files\n"); - for(j = 0; jloaded==1){ if((smoke3di->type==TEMP_index&&smoke3dj->type==HRRPUV_index)|| (smoke3di->type==HRRPUV_index&&smoke3dj->type==TEMP_index)){ @@ -4255,8 +4227,8 @@ FILE_SIZE ReadSmoke3D(int time_frame,int ifile_arg,int load_flag, int first_time #endif #endif START_TIMER(total_time); - assert(ifile_arg>=0&&ifile_arg=0&&ifile_argfiletype==FORTRAN_GENERATED&&smoke3di->is_zlib==0)fortran_skip=4; #endif @@ -4463,11 +4435,11 @@ FILE_SIZE ReadSmoke3D(int time_frame,int ifile_arg,int load_flag, int first_time void ReadSmoke3DAllMeshes(int iframe, int smoketype, int *errorcode){ int i; - for(i = 0; i < nsmoke3dinfo; i++){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; int first_time; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->type != smoketype)continue; if(iframe==0){ first_time = FIRST_TIME; @@ -4534,9 +4506,9 @@ void MergeSmoke3DColors(smoke3ddata *smoke3dset){ int first, last; first = 0; - last = nsmoke3dinfo-1; + last = smoke3dcoll.nsmoke3dinfo-1; if(smoke3dset != NULL){ - first = smoke3dset - smoke3dinfo; + first = smoke3dset - smoke3dcoll.smoke3dinfo; last = first; } fire_index = HRRPUV_index; @@ -4563,7 +4535,7 @@ void MergeSmoke3DColors(smoke3ddata *smoke3dset){ smoke3ddata *smoke3di, *smoke3d_soot; meshdata *mesh_smoke3d; - smoke3di=smoke3dinfo + i; + smoke3di=smoke3dcoll.smoke3dinfo + i; if(smoke3dset!=NULL&&smoke3dset!=smoke3di)continue; smoke3di->primary_file=0; if(smoke3di->loaded==0||smoke3di->display==0)continue; @@ -4616,7 +4588,7 @@ void MergeSmoke3DColors(smoke3ddata *smoke3dset){ unsigned char *mergecolor,*mergealpha; unsigned char smokeval_uc[3], co2val_uc[3]; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3dset!=NULL&&smoke3dset!=smoke3di)continue; if(smoke3di->loaded==0||smoke3di->primary_file==0)continue; if(smoke3di->is_fire == 1 && smoke3di->skip_fire == 1)continue; @@ -4803,9 +4775,9 @@ void MergeSmoke3DBlack(smoke3ddata *smoke3dset){ int first, last; first = 0; - last = nsmoke3dinfo-1; + last = smoke3dcoll.nsmoke3dinfo-1; if(smoke3dset != NULL){ - first = smoke3dset - smoke3dinfo; + first = smoke3dset - smoke3dcoll.smoke3dinfo; last = first; } @@ -4814,7 +4786,7 @@ void MergeSmoke3DBlack(smoke3ddata *smoke3dset){ smoke3ddata *smoke3di, *smoke3d_soot; meshdata *mesh_smoke3d; - smoke3di = smoke3dinfo+i; + smoke3di = smoke3dcoll.smoke3dinfo+i; if(smoke3dset!=NULL&&smoke3dset!=smoke3di)continue; smoke3di->primary_file = 0; if(smoke3di->loaded==0||smoke3di->display==0)continue; @@ -4854,7 +4826,7 @@ void MergeSmoke3DBlack(smoke3ddata *smoke3dset){ meshdata *meshi; unsigned char *firecolor_data, *smokecolor_data; - smoke3di = smoke3dinfo+i; + smoke3di = smoke3dcoll.smoke3dinfo+i; if(smoke3dset!=NULL&&smoke3dset!=smoke3di)continue; if(smoke3di->loaded==0||smoke3di->primary_file==0)continue; if(IsSmokeComponentPresent(smoke3di)==0)continue; @@ -4879,7 +4851,7 @@ void MergeSmoke3DBlack(smoke3ddata *smoke3dset){ if(smoke3di->smokestate[fire_index].index!=-1){ smoke3ddata *smoke3dref; - smoke3dref = smoke3dinfo+smoke3di->smokestate[fire_index].index; + smoke3dref = smoke3dcoll.smoke3dinfo+smoke3di->smokestate[fire_index].index; if(smoke3dref->display==0)firecolor_data = NULL; } } @@ -4888,7 +4860,7 @@ void MergeSmoke3DBlack(smoke3ddata *smoke3dset){ if(smoke3di->smokestate[SOOT_index].index!=-1){ smoke3ddata *smoke3dref; - smoke3dref = smoke3dinfo+smoke3di->smokestate[SOOT_index].index; + smoke3dref = smoke3dcoll.smoke3dinfo+smoke3di->smokestate[SOOT_index].index; if(smoke3dref->display==0)smokecolor_data = NULL; } } @@ -4938,10 +4910,10 @@ void *MtMergeSmoke3D(void *arg){ nthreads = smokei->nthreads; ithread = smokei->ithread; - for(i = ithread;i < nsmoke3dinfo;i += nthreads){ + for(i = ithread;i < smoke3dcoll.nsmoke3dinfo;i += nthreads){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->loaded == 0 || smoke3di->display == 0)continue; assert(smoke3di->timeslist != NULL); if(smoke3di->timeslist==NULL)continue; @@ -4963,8 +4935,8 @@ void UpdateSmoke3dMenuLabels(void){ smoke3ddata *smoke3di; char meshlabel[128]; - for(i=0;imenulabel, ""); if(nmeshes > 1){ meshdata *mesh_smoke3d; @@ -5032,13 +5004,13 @@ void MakeIBlankSmoke3D(void){ int i, ii; int ic; - for(i=0;iblocknumber; ibar = mesh_smoke3d->ibar; diff --git a/Source/smokeview/c_api.c b/Source/smokeview/c_api.c index f9da1c518..cd7a815d6 100644 --- a/Source/smokeview/c_api.c +++ b/Source/smokeview/c_api.c @@ -31,6 +31,9 @@ #include #endif +#include "readsmoke.h" +#include "shared_structures.h" + // function prototypes for functions drawn from other areas of smokeview // from startup.c void ReadBoundINI(void); @@ -364,10 +367,10 @@ int Loadfile(const char *filename) { return errorcode; } } - for(size_t i = 0; i < nsmoke3dinfo; i++) { + for(size_t i = 0; i < smoke3dcoll.nsmoke3dinfo; i++) { smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(strcmp(smoke3di->file, filename) == 0) { smoke3di->finalize = 1; ReadSmoke3D(ALL_SMOKE_FRAMES, i, LOAD, FIRST_TIME, &errorcode); @@ -1293,30 +1296,30 @@ void Load3dsmoke(const char *smoke_type) { int count = 0; int lastsmoke; - for(size_t i = nsmoke3dinfo - 1; i >= 0; i--) { + for(size_t i = smoke3dcoll.nsmoke3dinfo - 1; i >= 0; i--) { smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(MatchUpper(smoke3di->label.longlabel, smoke_type) == MATCH) { lastsmoke = i; break; } } - for(size_t i = nsmoke3dinfo - 1; i >= 0; i--) { + for(size_t i = smoke3dcoll.nsmoke3dinfo - 1; i >= 0; i--) { smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(MatchUpper(smoke3di->label.longlabel, smoke_type) == MATCH) { lastsmoke = i; break; } } - for(size_t i = 0; i < nsmoke3dinfo; i++) { + for(size_t i = 0; i < smoke3dcoll.nsmoke3dinfo; i++) { smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(MatchUpper(smoke3di->label.longlabel, smoke_type) == MATCH) { smoke3di->finalize = 0; if(lastsmoke == i) smoke3di->finalize = 1; @@ -1770,7 +1773,7 @@ int Unloadall() { for(size_t i = 0; i < nzoneinfo; i++) { ReadZone(i, UNLOAD, &errorcode); } - for(size_t i = 0; i < nsmoke3dinfo; i++) { + for(size_t i = 0; i < smoke3dcoll.nsmoke3dinfo; i++) { ReadSmoke3D(ALL_SMOKE_FRAMES, i, UNLOAD, FIRST_TIME, &errorcode); } if(nvolrenderinfo > 0) { @@ -4000,8 +4003,8 @@ int ShowSmoke3dShowall() { updatemenu = 1; GLUTPOSTREDISPLAY; plotstate = DYNAMIC_PLOTS; - for(size_t i = 0; i < nsmoke3dinfo; i++) { - smoke3di = smoke3dinfo + i; + for(size_t i = 0; i < smoke3dcoll.nsmoke3dinfo; i++) { + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->loaded == 1) smoke3di->display = 1; } GLUTPOSTREDISPLAY; @@ -4014,8 +4017,8 @@ int ShowSmoke3dHideall() { updatemenu = 1; GLUTPOSTREDISPLAY; - for(size_t i = 0; i < nsmoke3dinfo; i++) { - smoke3di = smoke3dinfo + i; + for(size_t i = 0; i < smoke3dcoll.nsmoke3dinfo; i++) { + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->loaded == 1) smoke3di->display = 0; } UpdateShow(); diff --git a/Source/smokeview/callbacks.c b/Source/smokeview/callbacks.c index 88375006a..47c05e3d6 100644 --- a/Source/smokeview/callbacks.c +++ b/Source/smokeview/callbacks.c @@ -1910,7 +1910,7 @@ void Keyboard(unsigned char key, int flag){ else{ usegpu=0; } - if(nsmoke3dinfo>0){ + if(smoke3dcoll.nsmoke3dinfo>0){ GLUIUpdateSmoke3dFlags(); } PrintGPUState(); diff --git a/Source/smokeview/glui_bounds.cpp b/Source/smokeview/glui_bounds.cpp index c965f018c..566718df7 100644 --- a/Source/smokeview/glui_bounds.cpp +++ b/Source/smokeview/glui_bounds.cpp @@ -4760,7 +4760,7 @@ extern "C" void GLUIBoundsSetup(int main_window){ // -------------- Show/Hide Loaded files ------------------- - if(npartinfo > 0 || nsliceinfo > 0 || nvsliceinfo > 0 || nisoinfo > 0 || npatchinfo || nsmoke3dinfo > 0 || nplot3dinfo > 0){ + if(npartinfo > 0 || nsliceinfo > 0 || nvsliceinfo > 0 || nisoinfo > 0 || npatchinfo || smoke3dcoll.nsmoke3dinfo > 0 || nplot3dinfo > 0){ ROLLOUT_showhide = glui_bounds->add_rollout_to_panel(ROLLOUT_files,_("Show/Hide"), false, SHOWHIDE_ROLLOUT, FileRolloutCB); INSERT_ROLLOUT(ROLLOUT_showhide, glui_bounds); ADDPROCINFO(fileprocinfo, nfileprocinfo, ROLLOUT_showhide, SHOWHIDE_ROLLOUT, glui_bounds); @@ -4777,7 +4777,7 @@ extern "C" void GLUIBoundsSetup(int main_window){ if(nvsliceinfo > 0)BUTTON_VSLICE = glui_bounds->add_button_to_panel(ROLLOUT_showhide, "Vector", FILESHOW_vslice, FileShowCB); if(nisoinfo > 0)BUTTON_ISO = glui_bounds->add_button_to_panel(ROLLOUT_showhide, "Isosurface", FILESHOW_isosurface, FileShowCB); if(npatchinfo > 0)BUTTON_BOUNDARY = glui_bounds->add_button_to_panel(ROLLOUT_showhide, "Boundary", FILESHOW_boundary, FileShowCB); - if(nsmoke3dinfo > 0)BUTTON_3DSMOKE = glui_bounds->add_button_to_panel(ROLLOUT_showhide, "3D smoke/fire", FILESHOW_3dsmoke, FileShowCB); + if(smoke3dcoll.nsmoke3dinfo > 0)BUTTON_3DSMOKE = glui_bounds->add_button_to_panel(ROLLOUT_showhide, "3D smoke/fire", FILESHOW_3dsmoke, FileShowCB); if(nplot3dinfo > 0)BUTTON_PLOT3D = glui_bounds->add_button_to_panel(ROLLOUT_showhide, "Plot3D", FILESHOW_plot3d, FileShowCB); glui_bounds->add_button_to_panel(ROLLOUT_showhide, "File Sizes", FILESHOW_sizes, FileShowCB); @@ -4787,7 +4787,7 @@ extern "C" void GLUIBoundsSetup(int main_window){ #ifdef pp_COMPRESS - if(smokezippath != NULL && (npatchinfo > 0 || nsmoke3dinfo > 0 || nsliceinfo > 0)){ + if(smokezippath != NULL && (npatchinfo > 0 || smoke3dcoll.nsmoke3dinfo > 0 || nsliceinfo > 0)){ ROLLOUT_compress = glui_bounds->add_rollout_to_panel(ROLLOUT_files,_("Compress"), false, COMPRESS_ROLLOUT, FileRolloutCB); INSERT_ROLLOUT(ROLLOUT_compress, glui_bounds); ADDPROCINFO(fileprocinfo, nfileprocinfo, ROLLOUT_compress, COMPRESS_ROLLOUT, glui_bounds); @@ -4925,7 +4925,7 @@ extern "C" void GLUIBoundsSetup(int main_window){ // ----------------------------------- 3D smoke ---------------------------------------- - if(nsmoke3dinfo>0||nvolrenderinfo>0){ + if(smoke3dcoll.nsmoke3dinfo>0||nvolrenderinfo>0){ ROLLOUT_smoke3d = glui_bounds->add_rollout_to_panel(ROLLOUT_filebounds,_("3D smoke"),false,SMOKE3D_ROLLOUT,BoundRolloutCB); INSERT_ROLLOUT(ROLLOUT_smoke3d, glui_bounds); ADDPROCINFO(boundprocinfo, nboundprocinfo, ROLLOUT_smoke3d, SMOKE3D_ROLLOUT, glui_bounds); diff --git a/Source/smokeview/glui_smoke.cpp b/Source/smokeview/glui_smoke.cpp index fe5cbedd0..ec9a0b8fd 100644 --- a/Source/smokeview/glui_smoke.cpp +++ b/Source/smokeview/glui_smoke.cpp @@ -360,7 +360,7 @@ extern "C" void GLUI3dSmokeSetup(int main_window){ int i; - if(nsmoke3dinfo<=0&&nvolrenderinfo<=0)return; + if(smoke3dcoll.nsmoke3dinfo<=0&&nvolrenderinfo<=0)return; if(CHECKBOX_meshvisptr!=NULL)FREEMEMORY(CHECKBOX_meshvisptr); NewMemory((void **)&CHECKBOX_meshvisptr,nmeshes*sizeof(GLUI_Checkbox *)); @@ -408,7 +408,7 @@ extern "C" void GLUI3dSmokeSetup(int main_window){ //---------------------------------------------Slice render settings-------------------------------------------------------------- - if(nsmoke3dinfo>0){ + if(smoke3dcoll.nsmoke3dinfo>0){ if(nvolrenderinfo > 0){ ROLLOUT_slices = glui_3dsmoke->add_rollout_to_panel(ROLLOUT_smoke3d, _("Slice render settings"), false, SLICERENDER_ROLLOUT, SmokeRolloutCB); INSERT_ROLLOUT(ROLLOUT_slices, glui_3dsmoke); @@ -599,9 +599,9 @@ extern "C" void GLUI3dSmokeSetup(int main_window){ GLUISmoke3dCB(UPDATE_SMOKEFIRE_COLORS2); GLUISmoke3dCB(USE_SMOKE_RGB); - if(nsmoke3dinfo<=0||nvolrenderinfo<=0){ + if(smoke3dcoll.nsmoke3dinfo<=0||nvolrenderinfo<=0){ smoke_render_option=RENDER_SLICE; - if(nsmoke3dinfo>0)smoke_render_option=RENDER_SLICE; + if(smoke3dcoll.nsmoke3dinfo>0)smoke_render_option=RENDER_SLICE; if(nvolrenderinfo>0)smoke_render_option=RENDER_VOLUME; } diff --git a/Source/smokeview/menus.c b/Source/smokeview/menus.c index 35ce17265..d70a53276 100644 --- a/Source/smokeview/menus.c +++ b/Source/smokeview/menus.c @@ -400,15 +400,15 @@ void GetFileSizes(void){ int i; printf("\n"); - if(nsmoke3dinfo>0){ + if(smoke3dcoll.nsmoke3dinfo>0){ float hrrpuv = 0.0, soot = 0.0, temp = 0.0, co2 = 0.0; float hrrpuv2 = 0.0, soot2 = 0.0, temp2 = 0.0, co22 = 0.0; - for(i = 0; ireg_file); compressed_file_size = GetFileSizeSMV(smoke3di->comp_file); @@ -502,10 +502,10 @@ void GetFileSizes(void){ void HideAllSmoke(void){ int i; - for(i = 0; i < nsmoke3dinfo; i++){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->loaded == 1)smoke3di->display = 0; } for(i = 0; i < nisoinfo; i++){ @@ -534,10 +534,10 @@ void HideAllSlices(void){ void ShowAllSmoke(void){ int i; - for(i = 0; i < nsmoke3dinfo; i++){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->loaded == 1)smoke3di->display = 1; } for(i = 0; i < nisoinfo; i++){ @@ -1140,8 +1140,8 @@ void Smoke3DShowMenu(int value){ break; #endif case SET_SMOKE3D: - for(i=0;iloaded==1)smoke3di->display=show_3dsmoke; } break; @@ -1150,7 +1150,7 @@ void Smoke3DShowMenu(int value){ } } else{ - smoke3di = smoke3dinfo + value; + smoke3di = smoke3dcoll.smoke3dinfo + value; if(plotstate!=DYNAMIC_PLOTS){ plotstate=DYNAMIC_PLOTS; smoke3di->display=1; @@ -3375,11 +3375,11 @@ void UnloadAllSmoke3D(int type){ int i; update_glui_merge_smoke = 1; - if(nsmoke3dinfo > 0){ - for(i = 0; i < nsmoke3dinfo; i++){ + if(smoke3dcoll.nsmoke3dinfo > 0){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(type == -1 || smoke3di->type == type)smoke3di->request_load = 0; if(smoke3di->loaded == 0)continue; if(type == -1 || smoke3di->type == type){ @@ -3477,7 +3477,7 @@ void LoadUnloadMenu(int value){ for(i=0;i 0){ + if(smoke3dcoll.nsmoke3dinfo > 0){ UnloadAllSmoke3D(-1); } if(nvolrenderinfo>0){ @@ -3577,10 +3577,10 @@ void LoadUnloadMenu(int value){ //*** reload 3d smoke files - for(i=0;irequest_load==1){ #ifdef pp_SMOKEFRAME ReadSmoke3D(ALL_SMOKE_FRAMES, i, load_flag, FIRST_TIME, &errorcode); @@ -4820,7 +4820,7 @@ void UnLoadSmoke3DMenu(int value){ UnloadAllSmoke3D(value); } else{ - UnloadSmoke3D(smoke3dinfo + value); + UnloadSmoke3D(smoke3dcoll.smoke3dinfo + value); SmokeWrapup(); } } @@ -4842,19 +4842,19 @@ FILE_SIZE LoadSmoke3D(int type, int frame, int *count, float *time_value){ FILE_SIZE load_size=0; if(load_only_when_unloaded == 0){ - for(i = nsmoke3dinfo - 1; i >= 0; i--){ + for(i = smoke3dcoll.nsmoke3dinfo - 1; i >= 0; i--){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->loaded==1&&IsSmokeType(smoke3di, type) == 1){ ReadSmoke3D(ALL_SMOKE_FRAMES, i, UNLOAD, FIRST_TIME, &errorcode); } } } - for(i = nsmoke3dinfo-1; i>=0; i--){ + for(i = smoke3dcoll.nsmoke3dinfo-1; i>=0; i--){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo+i; + smoke3di = smoke3dcoll.smoke3dinfo+i; IF_NOT_USEMESH_CONTINUE(smoke3di->loaded,smoke3di->blocknumber); if(IsSmokeType(smoke3di, type) == 1){ last_smoke = i; @@ -4862,10 +4862,10 @@ FILE_SIZE LoadSmoke3D(int type, int frame, int *count, float *time_value){ } } smoke3d_compression_type = COMPRESSED_UNKNOWN; - for(i=0;iloaded,smoke3di->blocknumber); if(IsSmokeType(smoke3di, type) == 1){ file_count++; @@ -4907,22 +4907,22 @@ void LoadSmoke3DMenu(int value){ if(scriptoutstream!=NULL){ char *file; - file = smoke3dinfo[value].file; + file = smoke3dcoll.smoke3dinfo[value].file; fprintf(scriptoutstream,"LOADFILE\n"); fprintf(scriptoutstream," %s\n",file); } if(scriptoutstream==NULL||script_defer_loading==0){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + value; + smoke3di = smoke3dcoll.smoke3dinfo + value; smoke3di->finalize = 1; if(smoke3di->extinct>0.0){ // only load one smoke type at a time int j, add_blank=0; - for(j = 0; jloaded==1&&smoke3dj->extinct>0.0&&smoke3di->type!=smoke3dj->type){ PRINTF("Unloading %s(%s)\n", smoke3dj->file, smoke3dj->label.shortlabel); ReadSmoke3D(ALL_SMOKE_FRAMES, j, UNLOAD, FIRST_TIME, &errorcode); @@ -4941,7 +4941,7 @@ void LoadSmoke3DMenu(int value){ } } else if(value==UNLOAD_ALL){ - for(i=0;itype == ii){ total_size += GetFileSizeSMV(smoke3di->reg_file); smoke_type = smoke3di->label.longlabel; @@ -5003,10 +5003,10 @@ void LoadSmoke3DMenu(int value){ if(smoke3di->extinct>0.0){ // only load one smoke type at a time int j, add_blank=0; - for(j = 0; jloaded==1&&smoke3dj->extinct>0.0&&smoke3di->type!=smoke3dj->type){ PRINTF("Unloading %s(%s)\n", smoke3dj->file, smoke3dj->label.shortlabel); ReadSmoke3D(ALL_SMOKE_FRAMES, j, UNLOAD, FIRST_TIME, &errorcode); @@ -5040,7 +5040,7 @@ void LoadSmoke3DMenu(int value){ int AnySmoke(void){ - if(nsmoke3dinfo>0)return 1; + if(smoke3dcoll.nsmoke3dinfo>0)return 1; return 0; } @@ -11558,7 +11558,7 @@ static int menu_count=0; CREATEMENU(filesdialogmenu, DialogMenu); glutAddMenuEntry(_("Auto load data files..."), DIALOG_AUTOLOAD); #ifdef pp_COMPRESS - if(smokezippath!=NULL&&(npatchinfo>0||nsmoke3dinfo>0||nsliceinfo>0)){ + if(smokezippath!=NULL&&(npatchinfo>0||smoke3dcoll.nsmoke3dinfo>0||nsliceinfo>0)){ #ifdef pp_DIALOG_SHORTCUTS glutAddMenuEntry(_("Compress data files... ALT z"), DIALOG_SMOKEZIP); #else @@ -12170,9 +12170,9 @@ static int menu_count=0; doit = 0; is_zlib = 0; - for(j = 0; j0){ + if(smoke3dcoll.nsmoke3dinfo>0){ if(nmeshes==1){ CREATEMENU(loadsmoke3dmenu,LoadSmoke3DMenu); } @@ -12201,11 +12201,11 @@ static int menu_count=0; if(nmeshes>1){ CREATEMENU(smoke3dtypes[ii].menu_id, LoadSmoke3DMenu); } - for(i = 0; itype!=ii)continue; strcpy(menulabel, ""); if(smoke3di->loaded==1){ @@ -12227,10 +12227,10 @@ static int menu_count=0; ntotal=0; nloaded=0; is_zlib = 0; - for(jj=0;jj 0 || nsmoke3dinfo > 0 || nsliceinfo > 0)){ + if(smokezippath != NULL && (npatchinfo > 0 || smoke3dcoll.nsmoke3dinfo > 0 || nsliceinfo > 0)){ CREATEMENU(compressmenu,CompressMenu); glutAddMenuEntry(_("Compression options"),MENU_DUMMY); // -c if(overwrite_all==1){ @@ -12946,7 +12946,7 @@ static int menu_count=0; // 3d smoke - if(nsmoke3dinfo>0){ + if(smoke3dcoll.nsmoke3dinfo>0){ strcpy(loadmenulabel,_("3D smoke")); if(tload_step > 1){ sprintf(steplabel,"/Skip %i",tload_skip); @@ -13061,7 +13061,7 @@ static int menu_count=0; GLUTADDSUBMENU(_("Configuration files"),smokeviewinimenu); GLUTADDSUBMENU(_("Scripts"),scriptmenu); #ifdef pp_COMPRESS - if(smokezippath!=NULL&&(npatchinfo>0||nsmoke3dinfo>0||nsliceinfo>0)){ + if(smokezippath!=NULL&&(npatchinfo>0||smoke3dcoll.nsmoke3dinfo>0||nsliceinfo>0)){ GLUTADDSUBMENU(_("Compression"),compressmenu); } #endif diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 63243e876..9a2fbbe68 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -16,11 +16,13 @@ #include "IOvolsmoke.h" #include "stdio_buffer.h" #include "glui_motion.h" +#include "shared_structures.h" #include "readimage.h" #include "readhvac.h" #include "readgeom.h" #include "readobject.h" #include "readlabel.h" +#include "readsmoke.h" #define BREAK break #define BREAK2 \ @@ -3324,22 +3326,22 @@ int CompareSmoketypes(const void *arg1, const void *arg2){ void UpdateSmoke3DTypes(void){ int i; - if(nsmoke3dinfo==0)return; - NewMemory((void **)&smoke3dtypes, nsmoke3dinfo*sizeof(smoke3dtypedata)); - for(i = 0; ilabel.shortlabel; doit = 1; for(j = 0; jlabel.shortlabel; if(strcmp(labeli, labelj)==0){ doit = 0; @@ -3362,12 +3364,12 @@ void UpdateSmoke3DTypes(void){ else{ FREEMEMORY(smoke3dtypes); } - for(i = 0; itype = GetSmoke3DType(smoke3di->label.shortlabel); NewMemory((void **)&smokestate, nsmoke3dtypes*sizeof(smokestatedata)); @@ -3974,13 +3976,13 @@ void UpdateMeshCoords(void){ } } UpdateVentOffset(); - if(nsmoke3dinfo>0)NewMemory((void **)&smoke3dinfo_sorted,nsmoke3dinfo*sizeof(smoke3ddata *)); + if(smoke3dcoll.nsmoke3dinfo>0)NewMemory((void **)&smoke3dcoll.smoke3dinfo_sorted,smoke3dcoll.nsmoke3dinfo*sizeof(smoke3ddata *)); NewMemory((void **)&meshvisptr,nmeshes*sizeof(int)); for(i=0;i500&&(ismoke3d%100==0||ismoke3d==nsmoke3dinfo-1)){ + if(smoke3dcoll.nsmoke3dinfo>500&&(ismoke3d%100==0||ismoke3d==smoke3dcoll.nsmoke3dinfo-1)){ PRINTF(" examining %i'st 3D smoke file\n", ismoke3dcount); } #endif @@ -6891,11 +6893,11 @@ void *CheckFiles(void *arg){ } THREADcontrol(checkfiles_threads, THREAD_UNLOCK); } - for(i = 0;i < nsmoke3dinfo;i++){ + for(i = 0;i < smoke3dcoll.nsmoke3dinfo;i++){ smoke3ddata *smoke3di; int have_file; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; have_file = FILE_EXISTS_CASEDIR(smoke3di->comp_file); THREADcontrol(checkfiles_threads, THREAD_LOCK); if(have_file == YES){ @@ -6917,10 +6919,10 @@ void *CheckFiles(void *arg){ patchi->file = patchi->comp_file; } } - for(i = 0; i < nsmoke3dinfo; i++){ + for(i = 0; i < smoke3dcoll.nsmoke3dinfo; i++){ smoke3ddata *smoke3di; - smoke3di = smoke3dinfo + i; + smoke3di = smoke3dcoll.smoke3dinfo + i; if(smoke3di->compression_type_temp == COMPRESSED_ZLIB){ smoke3di->file = smoke3di->comp_file; smoke3di->is_zlib = 1; @@ -7242,18 +7244,18 @@ int ReadSMV_Init(){ } nzoneinfo=0; - if(nsmoke3dinfo>0){ + if(smoke3dcoll.nsmoke3dinfo>0){ { smoke3ddata *smoke3di; - for(i=0;icomp_file); FREEMEMORY(smoke3di->reg_file); } - FREEMEMORY(smoke3dinfo); - nsmoke3dinfo=0; + FREEMEMORY(smoke3dcoll.smoke3dinfo); + smoke3dcoll.nsmoke3dinfo=0; } } @@ -8066,8 +8068,8 @@ int ReadSMV_Parse(bufferstreamdata *stream){ } sliceinfo_copy=sliceinfo; } - if(nsmoke3dinfo>0){ - if(NewMemory( (void **)&smoke3dinfo, nsmoke3dinfo*sizeof(smoke3ddata))==0)return 2; + if(smoke3dcoll.nsmoke3dinfo>0){ + if(NewMemory( (void **)&smoke3dcoll.smoke3dinfo, smoke3dcoll.nsmoke3dinfo*sizeof(smoke3ddata))==0)return 2; } FREEMEMORY(patchinfo); @@ -8153,7 +8155,7 @@ int ReadSMV_Parse(bufferstreamdata *stream){ if(npartinfo>0 && NewMemory((void **)&part_buffer, 3*npartinfo*MAXFILELEN) == 0)return 2; if(nsliceinfo>0 && NewMemory((void **)&slice_buffer, 7*nsliceinfo*MAXFILELEN) == 0)return 2; - if(nsmoke3dinfo>0 && NewMemory((void **)&smoke3d_buffer, 9*nsmoke3dinfo*MAXFILELEN) == 0)return 2; + if(smoke3dcoll.nsmoke3dinfo>0 && NewMemory((void **)&smoke3d_buffer, 9*smoke3dcoll.nsmoke3dinfo*MAXFILELEN) == 0)return 2; PRINT_TIMER(timer_readsmv, "pass 1"); diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 0c16d5631..db2d853dc 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -6,6 +6,7 @@ #endif #include "readgeom.h" +#include "readsmoke.h" //*** threader headers EXTERNCPP void *CheckFiles(void *arg); @@ -1075,7 +1076,6 @@ EXTERNCPP FILE_SIZE ReadPart(char *file, int ifile, int loadflag, int *errorcode EXTERNCPP void ReadZone(int ifile, int flag, int *errorcode); EXTERNCPP FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, int set_slice_color, int *errorcode); -EXTERNCPP void FreeSmoke3D(smoke3ddata *smoke3di); EXTERNCPP void GetSmoke3DTimeSteps(int fortran_skip, char *smokefile, int version, int *ntimes_found, int *ntimes_full); EXTERNCPP void ReadSmoke3DAllMeshes(int iframe, int smoketype, int *errorcode); EXTERNCPP FILE_SIZE ReadSmoke3D(int iframe, int ifile, int flag, int first_time, int *errorcode); diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 47907630a..6b968e983 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -27,6 +27,7 @@ #endif #include GLUT_H +#include "readsmoke.h" //*** threader variables @@ -838,7 +839,6 @@ SVEXTERN int SVDECL(use_glui_rotate,0); SVEXTERN int SVDECL(colorbar_coord_type, 0); SVEXTERN int SVDECL(*meshvisptr,NULL); -SVEXTERN smoke3ddata SVDECL(**smoke3dinfo_sorted,NULL); SVEXTERN int SVDECL(from_commandline,0); SVEXTERN filelistdata SVDECL(*ini_filelist,NULL), SVDECL(*filelist_casename, NULL), SVDECL(*filelist_casedir, NULL); SVEXTERN int SVDECL(nini_filelist,0), SVDECL(nfilelist_casename, 0), SVDECL(nfilelist_casedir, 0); @@ -1547,7 +1547,6 @@ SVEXTERN int SVDECL(nmultisliceinfo,0), SVDECL(nmultivsliceinfo,0); SVEXTERN sliceparmdata sliceparminfo; SVEXTERN int SVDECL(nslicebounds, 0), SVDECL(npatchbounds,0), SVDECL(npatch2,0); -SVEXTERN int SVDECL(nsmoke3dinfo,0); SVEXTERN int SVDECL(nisoinfo,0), SVDECL(niso_bounds,0); SVEXTERN int SVDECL(ntrnx,0), SVDECL(ntrny,0), SVDECL(ntrnz,0),SVDECL(npdim,0),SVDECL(nmeshes,0),SVDECL(clip_mesh,0); SVEXTERN int SVDECL(nOBST,0),SVDECL(nVENT,0),SVDECL(nCVENT,0),SVDECL(ncvents,0),SVDECL(noffset,0); @@ -2219,7 +2218,7 @@ SVEXTERN int setp3chopmin_temp, setp3chopmax_temp; SVEXTERN float p3chopmin_temp, p3chopmax_temp; SVEXTERN float glui_p3min, glui_p3max; -SVEXTERN smoke3ddata SVDECL(*smoke3dinfo,NULL); +SVEXTERN smoke3d_collection SVDECL(smoke3dcoll,{0}); SVEXTERN int SVDECL(bound_slice_init, 1); SVEXTERN int SVDECL(bound_part_init, 1); diff --git a/Source/smokeview/startup.c b/Source/smokeview/startup.c index a42b3dac6..23dd4d69a 100644 --- a/Source/smokeview/startup.c +++ b/Source/smokeview/startup.c @@ -771,10 +771,10 @@ void InitOpenGL(int option){ plot3di->autoload=0; } } - for(i=0;iloaded==1){ smoke3di->autoload=1; @@ -965,20 +965,20 @@ void InitOpenGL(int option){ // startup smoke nstartup=0; - for(i=0;iloaded==1)nstartup++; } if(nstartup!=0){ fprintf(fileout,"S3DAUTO\n"); fprintf(fileout," %i \n",nstartup); - for(i=0;iloaded==1)fprintf(fileout," %i\n",smoke3di->seq_id); } @@ -1058,10 +1058,10 @@ void InitOpenGL(int option){ void GetStartupSmoke(int seq_id){ int i; - for(i=0;iseq_id==seq_id){ smoke3di->autoload=1; @@ -1233,10 +1233,10 @@ void InitOpenGL(int option){ } } } - for(i=0;iautoload==0&&smoke3di->loaded==1)ReadSmoke3D(ALL_SMOKE_FRAMES, i, UNLOAD, FIRST_TIME, &errorcode); if(smoke3di->autoload==1)ReadSmoke3D(ALL_SMOKE_FRAMES, i, LOAD, FIRST_TIME, &errorcode); } diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index 856496269..34e7cbd36 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -983,97 +983,6 @@ typedef struct _vslicedata { char menulabel2[128]; } vslicedata; -/* -------------------------- smokedata ------------------------------------ */ - -typedef struct _smokedata { - int ncomp_total; - int *nchars_compressed, *nchars_compressed_full; - unsigned char *frame_in, *frame_out, *view_tmp, *comp_all, **frame_comp_list; -} smokedata; - - -/* -------------------------- smokestatedata ------------------------------------ */ - -typedef struct { - int loaded, index; - unsigned char *color; -} smokestatedata; - - /* -------------------------- smoke3ddata ------------------------------------ */ - -typedef struct _smoke3ddata { - int seq_id,autoload; - char *file; - char *comp_file, *reg_file; -#ifdef pp_SMOKE16 - char *s16_file; -#endif - int filetype; - int skip_smoke, skip_fire; - int is_smoke, is_fire; - int loaded, request_load, finalize, display, primary_file; - int is_zlib; -#ifdef pp_SMOKE16 - int is_s16; -#endif - smokestatedata *smokestate; - int blocknumber; - int type; - int is1, is2, js1, js2, ks1, ks2; - int compression_type, compression_type_temp; - flowlabels label; - char menulabel[128]; - float *times; - unsigned char *times_map; - int *use_smokeframe; - int *smokeframe_loaded; - float extinct, valmin, valmax; - char cextinct[32]; -#define ALPHA_X 0 -#define ALPHA_Y 1 -#define ALPHA_Z 2 -#define ALPHA_XY 3 -#define ALPHA_YZ 4 -#define ALPHA_XZ 5 - unsigned char *alphas_dir[6]; - int fire_alpha, co2_alpha; - float fire_alphas[256], co2_alphas[256]; - int *timeslist; - int ntimes,ntimes_old,ismoke3d_time,lastiframe,ntimes_full; - int nchars_uncompressed; - - int ncomp_smoke_total; - int *nchars_compressed_smoke, *nchars_compressed_smoke_full; -#ifdef pp_SMOKE16 - unsigned short *val16s; - float *val16_mins, *val16_maxs, *times16; -#endif - float maxval; - unsigned char *smokeframe_in, *smokeframe_out, **smokeframe_comp_list; - unsigned char *smokeview_tmp; -#ifndef pp_SMOKEFRAME - unsigned char *smoke_comp_all; -#endif - unsigned char *frame_all_zeros; - FILE_SIZE file_size; - float *smoke_boxmin, *smoke_boxmax; - smokedata smoke; - int dir; -#ifdef pp_SMOKEFRAME - framedata *frameinfo; -#endif -} smoke3ddata; - - /* -------------------------- smoke3dtypedata ------------------------------------ */ - -typedef struct _smoke3dtypedata { - char *shortlabel, *longlabel; - int type; // color based or opacity based - int menu_id; - smoke3ddata *smoke3d; - float extinction, valmin, valmax; -} smoke3dtypedata; - /* -------------------------- patchfacedata ------------------------------------ */ typedef struct _patchfacedata{ diff --git a/Source/smokeview/update.c b/Source/smokeview/update.c index 893211485..2b5b54fc9 100644 --- a/Source/smokeview/update.c +++ b/Source/smokeview/update.c @@ -166,7 +166,7 @@ void UpdateFrameNumber(int changetime){ patchi->geom_nval_dynamic = patchi->geom_ndynamics[patchi->geom_itime]; } } - if(show3dsmoke==1 && nsmoke3dinfo > 0){ + if(show3dsmoke==1 && smoke3dcoll.nsmoke3dinfo > 0){ INIT_PRINT_TIMER(merge_smoke_time); THREADcontrol(mergesmoke_threads, THREAD_LOCK); THREADruni(mergesmoke_threads, (unsigned char *)smokethreadinfo, sizeof(smokethreaddata)); @@ -275,10 +275,10 @@ void UpdateFileLoad(void){ } nsmoke3dloaded = 0; - for(i = 0; iloaded==1)nsmoke3dloaded++; } @@ -382,10 +382,10 @@ void UpdateShow(void){ { int ii; - for(ii=0;iiloaded==1&&smoke3di->display==1){ smoke3dflag = 1; break; @@ -818,8 +818,8 @@ void SynchTimes(void){ { smoke3ddata *smoke3di; - for(jj=0;jjloaded==0)continue; smoke3di->timeslist[n] = GetDataTimeFrame(global_times[n], smoke3di->times_map, smoke3di->times,smoke3di->ntimes); } @@ -1380,8 +1380,8 @@ void UpdateTimes(void){ if(nsmoke3dloaded>0&&vis3DSmoke3D==1){ INIT_PRINT_TIMER(smoke3d_timer); - for(i=0;iloaded==0)continue; MergeGlobalTimes(smoke3di->times, smoke3di->ntimes); } @@ -1471,8 +1471,8 @@ void UpdateTimes(void){ { smoke3ddata *smoke3di; - for(i=0;itimeslist); if(nglobal_times>0)NewMemory((void **)&smoke3di->timeslist,nglobal_times*sizeof(int)); } @@ -1798,10 +1798,10 @@ int GetPlotStateSub(int choice){ if(touri->display==0)continue; return DYNAMIC_PLOTS; } - for(i=0;iloaded==0||smoke3di->display==0)continue; return DYNAMIC_PLOTS; } @@ -1961,10 +1961,10 @@ void UpdateColorTable(colortabledata *ctableinfo, int nctableinfo){ int HaveFireLoaded(void){ int i; - for(i = 0; iloaded==1){ if(smoke3di->type==HRRPUV_index)return HRRPUV_index; if(smoke3di->type==TEMP_index)return TEMP_index; @@ -1978,10 +1978,10 @@ int HaveFireLoaded(void){ int HaveSootLoaded(void){ int i; - for(i = 0; iloaded==1&&smoke3di->extinct>0.0)return GetSmoke3DType(smoke3di->label.shortlabel); } return NO_SMOKE; diff --git a/Source/smokeview/viewports.c b/Source/smokeview/viewports.c index ee8c1cd25..8571de32f 100644 --- a/Source/smokeview/viewports.c +++ b/Source/smokeview/viewports.c @@ -12,6 +12,7 @@ #include "IOvolsmoke.h" #include "infoheader.h" #include "readtour.h" +#include "readsmoke.h" #define CONV(p,pl,pr,pxl,pxr) ( (pxl) + ((pxr)-(pxl))*((p)-(pl))/((pr)-(pl)) ) #define TIMEBAR_HEIGHT 20 @@ -1517,8 +1518,8 @@ int CompareMeshes(const void *arg1, const void *arg2){ /* ------------------ SortSmoke3dinfo ------------------------ */ void SortSmoke3dinfo(void){ - if(nsmoke3dinfo > 1){ - qsort((meshdata **)smoke3dinfo_sorted, (size_t)nsmoke3dinfo, sizeof(smoke3ddata *), CompareMeshes); + if(smoke3dcoll.nsmoke3dinfo > 1){ + qsort((meshdata **)smoke3dcoll.smoke3dinfo_sorted, (size_t)smoke3dcoll.nsmoke3dinfo, sizeof(smoke3ddata *), CompareMeshes); } } @@ -2672,7 +2673,7 @@ void ViewportScene(int quad, int view_mode, GLint screen_left, GLint screen_down ComputeAllSmokecolors(); #endif } - if(nsmoke3dinfo>0&&show3dsmoke==1){ + if(smoke3dcoll.nsmoke3dinfo>0&&show3dsmoke==1){ SortSmoke3dinfo(); GetSmokeDir(modelview_scratch); SNIFF_ERRORS("after GetSmokeDir"); diff --git a/Source/smvq/CMakeLists.txt b/Source/smvq/CMakeLists.txt index ab03e51b3..2aed26bc6 100644 --- a/Source/smvq/CMakeLists.txt +++ b/Source/smvq/CMakeLists.txt @@ -61,6 +61,7 @@ add_executable(smvq smvq.c ../shared/readcad.c ../shared/readhvac.c ../shared/readgeom.c + ../shared/readsmoke.c ../shared/readobject.c ../shared/readtour.c ../shared/readlabel.c