From 0d46b70a858e664de796f326f294d7d8f37c4439 Mon Sep 17 00:00:00 2001 From: gforney Date: Wed, 25 Sep 2024 13:58:42 -0400 Subject: [PATCH] smokeview source: corrections to slice file loading for files larger than 4GB (ie requiring 64 bit integers to store file size) --- Source/shared/shared_structures.h | 2 +- Source/smokeview/IOslice.c | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Source/shared/shared_structures.h b/Source/shared/shared_structures.h index 29d4c308bf..2757547b8d 100644 --- a/Source/shared/shared_structures.h +++ b/Source/shared/shared_structures.h @@ -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; diff --git a/Source/smokeview/IOslice.c b/Source/smokeview/IOslice.c index f75916ebd2..3dfd98c23f 100644 --- a/Source/smokeview/IOslice.c +++ b/Source/smokeview/IOslice.c @@ -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; @@ -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; @@ -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; @@ -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; @@ -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&&timevaltmax_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; @@ -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; @@ -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; @@ -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; } } @@ -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; @@ -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; @@ -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 ------------------------ */