Skip to content

Commit

Permalink
Merge pull request #1981 from gforney/devel
Browse files Browse the repository at this point in the history
improve some load efficiencies, fix some bugs
  • Loading branch information
gforney authored Aug 13, 2024
2 parents ab0f2c5 + 3c28bb9 commit a4a2694
Show file tree
Hide file tree
Showing 17 changed files with 469 additions and 170 deletions.
2 changes: 1 addition & 1 deletion Manuals/SMV_User_Guide/SMV_User_Guide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4181,7 +4181,7 @@ \subsection{Controlling the Scene}
%%+++++++++++++++++++++++
\hitemssf{GSLICEORIEN}Set orientiation (azimuth elevation orientation angles) of general oriented slice plane.
\hitemssf{GSLICEORIEN}Set orientation (azimuth elevation orientation angles) of general oriented slice plane.
Usage:
\begin{lstlisting}
GSLICEORIEN
Expand Down
26 changes: 18 additions & 8 deletions Source/shared/shared_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,31 @@ typedef struct _meshdata {
float norm[3];
float dplane_min[4], dplane_max[4];

int *boundarytype;
int *patchdir,*patch_surfindex;
int *pi1, *pi2, *pj1, *pj2, *pk1, *pk2;
struct _meshdata *skip_nabors[6];
int *blockonpatch;

#ifdef pp_BOUNDMEM
unsigned char *buffer1;
#endif
struct _meshdata **meshonpatch;
int *blockonpatch;
int *patchdir,*patch_surfindex;
int *pi1, *pi2, *pj1, *pj2, *pk1, *pk2;
int *boundarytype;
int *vis_boundaries;
int *boundary_row, *boundary_col, *blockstart;

struct _meshdata *nabors[6];
struct _supermeshdata *super;
int *ptype;
int *boundary_row, *boundary_col, *blockstart;
unsigned int *zipoffset, *zipsize;
int *vis_boundaries;

#ifdef pp_BOUNDMEM
unsigned char *buffer2;
#endif
float *xyzpatch, *xyzpatch_threshold;
float *thresholdtime;
int *patchblank;

unsigned char *cpatchval_zlib, *cpatchval_iframe_zlib;
unsigned char *cpatchval, *cpatchval_iframe;
float *patch_times, *patch_timesi, *patchval;
Expand All @@ -182,8 +194,6 @@ typedef struct _meshdata {
#endif
unsigned char *patch_times_map;
float **patchventcolors;
float *thresholdtime;
int *patchblank;
int npatch_times,npatches;
int patch_itime;
int *patch_timeslist;
Expand Down
98 changes: 84 additions & 14 deletions Source/smokeview/IOboundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,8 +1605,12 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
updatefaces=1;
*errorcode=0;
if(load_flag != RELOAD){
FREEMEMORY(meshi->blockonpatch);
#ifdef pp_BOUNDMEM
FREEMEMORY(meshi->buffer1);
FREEMEMORY(meshi->buffer2);
#else
FREEMEMORY(meshi->meshonpatch);
FREEMEMORY(meshi->blockonpatch);
FREEMEMORY(meshi->patchdir);
FREEMEMORY(meshi->patch_surfindex);
FREEMEMORY(meshi->pi1);
Expand All @@ -1615,24 +1619,26 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
FREEMEMORY(meshi->pj2);
FREEMEMORY(meshi->pk1);
FREEMEMORY(meshi->pk2);
FREEMEMORY(meshi->boundarytype);
FREEMEMORY(meshi->vis_boundaries);
FREEMEMORY(meshi->boundary_row);
FREEMEMORY(meshi->boundary_col);
FREEMEMORY(meshi->blockstart);
FREEMEMORY(meshi->zipoffset);
FREEMEMORY(meshi->zipsize);
FREEMEMORY(meshi->boundarytype);
FREEMEMORY(meshi->vis_boundaries);

FREEMEMORY(meshi->xyzpatch);
FREEMEMORY(meshi->xyzpatch_threshold);
FREEMEMORY(meshi->thresholdtime);
FREEMEMORY(meshi->patchblank);
#endif
FREEMEMORY(meshi->zipoffset);
FREEMEMORY(meshi->zipsize);
FREEMEMORY(meshi->patchventcolors);
FREEMEMORY(meshi->cpatchval);
FREEMEMORY(meshi->cpatchval_zlib);
FREEMEMORY(meshi->cpatchval_iframe_zlib);
FREEMEMORY(meshi->patchval);
FREEMEMORY(meshi->thresholdtime);
FREEMEMORY(meshi->patch_times);
FREEMEMORY(meshi->patch_times_map);
FREEMEMORY(meshi->patchblank);
#ifdef pp_BOUNDFRAME
FRAMEFree(patchi->frameinfo);
patchi->frameinfo = NULL;
Expand All @@ -1642,7 +1648,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
if(load_flag==UNLOAD){
UpdateBoundaryType();
UpdateUnitDefs();
UpdateTimes();
update_times = 1;
meshi->npatches=0;
patchi->ntimes_old=0;
patchi->ntimes=0;
Expand Down Expand Up @@ -1712,7 +1718,29 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
patchmax_global = glui_patchmax;
}
if(meshi->npatches>0){
#ifdef pp_BOUNDMEM
int offsets[15];

offsets[0] = sizeof(meshdata *)*meshi->npatches;
offsets[1] = offsets[0] + sizeof(int)*meshi->npatches;
offsets[2] = offsets[1] + sizeof(int)*meshi->npatches;
offsets[3] = offsets[2] + sizeof(int)*meshi->npatches;
offsets[4] = offsets[3] + sizeof(int)*meshi->npatches;
offsets[5] = offsets[4] + sizeof(int)*meshi->npatches;
offsets[6] = offsets[5] + sizeof(int)*meshi->npatches;
offsets[7] = offsets[6] + sizeof(int)*meshi->npatches;
offsets[8] = offsets[7] + sizeof(int)*meshi->npatches;
offsets[9] = offsets[8] + sizeof(int)*meshi->npatches;
offsets[10] = offsets[9] + sizeof(int)*meshi->npatches;
offsets[11] = offsets[10] + sizeof(int)*meshi->npatches;
offsets[12] = offsets[11] + sizeof(int)*meshi->npatches;
offsets[13] = offsets[12] + sizeof(int)*meshi->npatches;
offsets[14] = offsets[13] + sizeof(int)*(1+meshi->npatches);
#endif
if(
#ifdef pp_BOUNDMEM
NewResizeMemory(meshi->buffer1, offsets[14]) == 0
#else
NewResizeMemory(meshi->meshonpatch, sizeof(meshdata *)*meshi->npatches)==0||
NewResizeMemory(meshi->blockonpatch, sizeof(int)*meshi->npatches)==0||
NewResizeMemory(meshi->patchdir, sizeof(int)*meshi->npatches)==0||
Expand All @@ -1727,14 +1755,33 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
NewResizeMemory(meshi->vis_boundaries, sizeof(int)*meshi->npatches)==0||
NewResizeMemory(meshi->boundary_row, sizeof(int)*meshi->npatches)==0||
NewResizeMemory(meshi->boundary_col, sizeof(int)*meshi->npatches)==0||
NewResizeMemory(meshi->blockstart, sizeof(int)*(1+meshi->npatches))==0){
NewResizeMemory(meshi->blockstart, sizeof(int)*(1+meshi->npatches))==0
#endif
){
*errorcode=1;
if(patchi->compression_type==UNCOMPRESSED){
fclose_m(stream);
}
ReadBoundary(ifile,UNLOAD,&error);
return 0;
}
#ifdef pp_BOUNDMEM
meshi->meshonpatch = (meshdata **)(meshi->buffer1);
meshi->blockonpatch = (int *)(meshi->buffer1 + offsets[0]);
meshi->patchdir = (int *)(meshi->buffer1 + offsets[1]);
meshi->patch_surfindex = (int *)(meshi->buffer1 + offsets[2]);
meshi->pi1 = (int *)(meshi->buffer1 + offsets[3]);
meshi->pi2 = (int *)(meshi->buffer1 + offsets[4]);
meshi->pj1 = (int *)(meshi->buffer1 + offsets[5]);
meshi->pj2 = (int *)(meshi->buffer1 + offsets[6]);
meshi->pk1 = (int *)(meshi->buffer1 + offsets[7]);
meshi->pk2 = (int *)(meshi->buffer1 + offsets[8]);
meshi->boundarytype = (int *)(meshi->buffer1 + offsets[9]);
meshi->vis_boundaries = (int *)(meshi->buffer1 + offsets[10]);
meshi->boundary_row = (int *)(meshi->buffer1 + offsets[11]);
meshi->boundary_col = (int *)(meshi->buffer1 + offsets[12]);
meshi->blockstart = (int *)(meshi->buffer1 + offsets[13]);
#endif
}

if(patchi->compression_type==UNCOMPRESSED){
Expand Down Expand Up @@ -1788,11 +1835,24 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
}

if(meshi->npatchsize>0){
#ifdef pp_BOUNDMEM
int offsets[4];

offsets[0] = 3*sizeof(float)*meshi->npatchsize;
offsets[1] = offsets[0] + 3*sizeof(float)*meshi->npatchsize;
offsets[2] = offsets[1] + sizeof(float)*meshi->npatchsize;
offsets[3] = offsets[2] + meshi->npatchsize*sizeof(int);
#endif
if(

#ifdef pp_BOUNDMEM
NewResizeMemory(meshi->buffer2, offsets[3]) == 0
#else
NewResizeMemory(meshi->xyzpatch, 3*sizeof(float)*meshi->npatchsize)==0||
NewResizeMemory(meshi->xyzpatch_threshold,3*sizeof(float)*meshi->npatchsize)==0||
NewResizeMemory(meshi->thresholdtime, sizeof(float)*meshi->npatchsize)==0||
NewResizeMemory(meshi->patchblank, meshi->npatchsize*sizeof(int))==0
#endif
){
*errorcode=1;
patchi->loaded=0;
Expand All @@ -1803,6 +1863,12 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
ReadBoundary(ifile,UNLOAD,&error);
return 0;
}
#ifdef pp_BOUNDMEM
meshi->xyzpatch = (float *)(meshi->buffer2);
meshi->xyzpatch_threshold = (float *)(meshi->buffer2 + offsets[0]);
meshi->thresholdtime = (float *)(meshi->buffer2 + offsets[1]);
meshi->patchblank = (int *)(meshi->buffer2 + offsets[2]);
#endif
}
for(n=0;n<meshi->npatchsize;n++){
meshi->patchblank[n]=GAS;
Expand Down Expand Up @@ -2597,17 +2663,21 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){
FREEMEMORY(meshi->patchval);
}
iboundarytype=GetBoundaryType(patchi);
ShowBoundaryMenu(INI_EXTERIORwallmenu);
if(patchi->finalize==1){
ShowBoundaryMenu(INI_EXTERIORwallmenu);
}
for(n = 0;n<meshi->npatches;n++){
meshi->vis_boundaries[n] = vis_boundary_type[meshi->boundarytype[n]];
}
plotstate=GetPlotState(DYNAMIC_PLOTS);
MakeTimesMap(meshi->patch_times, &meshi->patch_times_map, meshi->npatch_times);
UpdateTimes();
UpdateUnitDefs();
UpdateChopColors();
if(patchi->finalize==1){
UpdateTimes();
ForceIdle();
UpdateUnitDefs();
UpdateChopColors();
}
PrintMemoryInfo;
ForceIdle();

STOP_TIMER(total_time);

Expand Down
Loading

0 comments on commit a4a2694

Please sign in to comment.