Skip to content

Commit

Permalink
Merge pull request #2036 from gforney/master
Browse files Browse the repository at this point in the history
smokeview source: corrections to slice file loading for files larger …
  • Loading branch information
gforney authored Sep 25, 2024
2 parents b8b679d + 0d46b70 commit 2e07952
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Source/shared/shared_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ typedef struct _slicedata {
unsigned char *slice_mask;
int compression_type;
int colorbar_autoflip;
int ncompressed;
FILE_SIZE ncompressed;
int slice_filetype;
struct _multislicedata *mslice;
int menu_show;
Expand Down
28 changes: 13 additions & 15 deletions Source/smokeview/IOslice.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ int GetSliceHeader0(char *comp_file, char *size_file, int compression_type, int

int GetSliceHeader(char *comp_file, char *size_file, int compression_type,
int framestep, int set_tmin, int set_tmax, float tmin_local, float tmax_local,
int *nx, int *ny, int *nz, int *nsteps, int *ntotal, float *valmin, float *valmax){
int *nx, int *ny, int *nz, int *nsteps, FILE_SIZE *ntotal, float *valmin, float *valmax){
FILE *stream;
int i1, i2, jj1, j2, k1, k2;
float time_local;
Expand Down Expand Up @@ -3485,7 +3485,7 @@ FILE_SIZE GetSliceData(slicedata *sd, const char *slicefilename, int time_frame,
int count;
int iis1, iis2;
int ijk[6];
int file_size;
FILE_SIZE file_size;
FILEBUFFER *stream=NULL;
int returncode=0;
float *qq;
Expand All @@ -3509,6 +3509,7 @@ FILE_SIZE GetSliceData(slicedata *sd, const char *slicefilename, int time_frame,
FSEEK_SLICE(stream, 3*(4+30+4), SEEK_CUR);

FORT_SLICEREAD(ijk, 6, stream);
file_size += (FILE_SIZE)(4 + 6*4 + 4);
if(returncode==0){
FCLOSE_SLICE(stream);
return file_size;
Expand Down Expand Up @@ -3540,7 +3541,6 @@ FILE_SIZE GetSliceData(slicedata *sd, const char *slicefilename, int time_frame,
jp2 = ijk[3];
kp1 = ijk[4];
kp2 = ijk[5];
file_size = 6*4;
*is1ptr = ip1;
*is2ptr = ip2;
*js1ptr = jp1;
Expand Down Expand Up @@ -3592,8 +3592,8 @@ FILE_SIZE GetSliceData(slicedata *sd, const char *slicefilename, int time_frame,
break;
}
FORT_SLICEREAD(&timeval, 1, stream);
file_size += (FILE_SIZE)(4 + 4 + 4);
if(returncode==0)break;
file_size = file_size+4;
if((settmin_s_arg!=0&&timeval<tmin_s_arg)){
loadframe = 0;
}
Expand All @@ -3603,6 +3603,7 @@ FILE_SIZE GetSliceData(slicedata *sd, const char *slicefilename, int time_frame,
if(settmax_s_arg!=0&&timeval>tmax_s_arg)break;
// read(lu11, iostat = error)(((qq(i, j, k), i = 1, nxsp), j = 1, nysp), k = 1, nzsp)
FORT_SLICEREAD(qq, nxsp*nysp*nzsp, stream);
file_size += (FILE_SIZE)(4 + 4*nxsp*nysp*nzsp + 4);
if(returncode==0||nsteps>=*ntimesptr)break;
count++;
if(count%tload_step_arg!=0)loadframe = 0;
Expand Down Expand Up @@ -3651,7 +3652,6 @@ FILE_SIZE GetSliceData(slicedata *sd, const char *slicefilename, int time_frame,
}
timesptr[nsteps] = timeval;
nsteps = nsteps+1;
file_size += 4*nxsp*nysp*nzsp;

if(*idirptr==3){
float *qqto, *qqfrom;
Expand Down Expand Up @@ -3851,14 +3851,14 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val
vslicedata *vd;
meshdata *meshi;

updatemenu = 1;
update_plot_label = 1;
FILE_SIZE return_filesize=0;
int file_size=0;
FILE_SIZE file_size=0;
#ifdef pp_memstatus
unsigned int availmemory;
#endif

updatemenu = 1;
update_plot_label = 1;

#ifndef pp_SLICEFRAME
#ifndef pp_FSEEK
if(load_flag==RELOAD)load_flag = LOAD;
Expand Down Expand Up @@ -4045,7 +4045,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val
}
else{
if(time_frame==ALL_FRAMES){
sd->ntimes = (int)(GetFileSizeSMV(file)-headersize)/framesize;
sd->ntimes = (FILE_SIZE)(GetFileSizeSMV(file)-headersize)/framesize;
if(tload_step>1)sd->ntimes /= tload_step;
}
}
Expand Down Expand Up @@ -4083,7 +4083,6 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val
}
MakeTimesMap(sd->times, &sd->times_map, sd->ntimes);
file_size = sd->ncompressed;
return_filesize = (FILE_SIZE)file_size;
}
else{
int return_val;
Expand Down Expand Up @@ -4113,17 +4112,16 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val
}
if(sd->ntimes > ntimes_slice_old){
#ifdef pp_SLICEFRAME
return_filesize = sd->frameinfo->filesize;
filesize = sd->frameinfo->filesize;
qmin = frame_valmin;
qmax = frame_valmax;
#else
return_filesize = GetSliceData(sd, file, time_frame, &sd->is1, &sd->is2, &sd->js1, &sd->js2, &sd->ks1, &sd->ks2, &sd->idir,
file_size = GetSliceData(sd, file, time_frame, &sd->is1, &sd->is2, &sd->js1, &sd->js2, &sd->ks1, &sd->ks2, &sd->idir,
&qmin, &qmax, sd->qslicedata, sd->times, ntimes_slice_old, &sd->ntimes,
tload_step, use_tload_begin, use_tload_end, tload_begin, tload_end
);
#endif
MakeTimesMap(sd->times, &sd->times_map, sd->ntimes);
file_size = (int)return_filesize;
sd->valmin_slice = qmin;
sd->valmax_slice = qmax;

Expand Down Expand Up @@ -4520,7 +4518,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val
sd->frameinfo->total_time = total_time;
}
#endif
return return_filesize;
return file_size;
}

/* ------------------ UpdateSlice3DTexture ------------------------ */
Expand Down

0 comments on commit 2e07952

Please sign in to comment.