Skip to content

Commit

Permalink
Merge pull request #2033 from gforney/frame
Browse files Browse the repository at this point in the history
merge in frame updates to master branch
  • Loading branch information
gforney committed Sep 25, 2024
2 parents 6a5e65c + cc66163 commit ec7698a
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 18 deletions.
5 changes: 3 additions & 2 deletions Source/shared/IOframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void FRAMESetTimes(framedata *fi, int iframe, int nframes){
if(last_frame>fi->nframes - 1)last_frame = fi->nframes-1;
nframes = last_frame + 1 - first_frame;
for(i = first_frame;i <= last_frame;i++){
int offset;
FILE_SIZE offset;

offset = fi->offsets[i];
if(fi->file_type == FORTRAN_FILE)offset += 4;
Expand Down Expand Up @@ -259,7 +259,8 @@ framedata *FRAMELoadData(framedata *frameinfo, char *file, int load_flag, int ti
void GetFrameInfo(bufferdata *bufferinfo, int *headersize, int **sizes, int *nsizes,
int **subframeptrs, int **subframesizesptr, int *nsubframes,
int *compression_type, FILE_SIZE *filesizeptr)){
int nframes_before, nframes_after, nread;
int nframes_before, nframes_after;
FILE_SIZE nread;
float load_time;

if(file_type != C_FILE)file_type = FORTRAN_FILE;
Expand Down
2 changes: 1 addition & 1 deletion Source/shared/file_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ void FreeBufferInfo(bufferdata *bufferinfo){

/* ------------------ File2Buffer ------------------------ */

bufferdata *File2Buffer(char *file, bufferdata *bufferinfo, int *nreadptr){
bufferdata *File2Buffer(char *file, bufferdata *bufferinfo, FILE_SIZE *nreadptr){
FILE_SIZE nfile, offset_buffer = 0, offset_file = 0, nread_actual, nread_try;

*nreadptr = 0;
Expand Down
6 changes: 2 additions & 4 deletions Source/shared/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ int FileExistsOrig(char *filename);
EXTERNCPP int MakeFile(char *file, int size);
EXTERNCPP void FreeBufferInfo(bufferdata *bufferinfoptr);
EXTERNCPP bufferdata *InitBufferData(char *file);
EXTERNCPP bufferdata *File2Buffer(char *file, bufferdata *bufferinfo,
int *nreadptr);
EXTERNCPP FILE_SIZE fread_p(char *file, unsigned char *buffer, FILE_SIZE offset,
FILE_SIZE nchars, int nthreads);
EXTERNCPP bufferdata *File2Buffer(char *file, bufferdata *bufferinfo, FILE_SIZE *nreadptr);
EXTERNCPP FILE_SIZE fread_p(char *file, unsigned char *buffer, FILE_SIZE offset, FILE_SIZE nchars, int nthreads);
EXTERNCPP void FileErase(char *file);
EXTERNCPP FILE *FOPEN(const char *file, const char *mode);
EXTERNCPP FILE *fopen_indir(char *dir, char *file, char *mode);
Expand Down
3 changes: 0 additions & 3 deletions Source/shared/readgeom.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include "gd.h"
#include "options.h"
#include "string_util.h"
#ifdef pp_ISOFRAME
#include "IOframe.h"
#endif

#include "shared_structures.h"

Expand Down
3 changes: 3 additions & 0 deletions Source/shared/shared_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#include "isodefs.h"
#include "options.h"
#include <stdio.h>
#ifdef pp_FRAME
#include "IOframe.h"
#endif

#if defined(WIN32)
#include <windows.h>
Expand Down
28 changes: 28 additions & 0 deletions Source/shared/stdio_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,34 @@ int fseek_m(FILE_m *stream_m, long int offset, int whence){
return return_val;
}

/* ------------------ fseek_m_long ------------------------ */

int fseek_m_long(FILE_m *stream_m, long long offset, int whence){
int return_val = PASS_m;

if(stream_m->stream == NULL){
switch(whence){
case SEEK_SET:
stream_m->buffer = stream_m->buffer_beg + offset;
break;
case SEEK_CUR:
stream_m->buffer += offset;
break;
case SEEK_END:
stream_m->buffer = stream_m->buffer_end + offset;
break;
default:
assert(FFALSE);
break;
}
if(stream_m->buffer - stream_m->buffer_beg < 0 || stream_m->buffer - stream_m->buffer_end >= 0)return_val = FAIL_m;
}
else{
return_val = fseek(stream_m->stream, offset, whence);
}
return return_val;
}

/* ------------------ ftell_m ------------------------ */

long int ftell_m(FILE_m *stream_m){
Expand Down
1 change: 1 addition & 0 deletions Source/shared/stdio_m.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ FILE_m *fopen_mo(char *file, FILE_SIZE offset, FILE_SIZE size, char *mode);
size_t fread_m(void *ptr, size_t size, size_t nmemb, FILE_m *stream_m);
size_t fread_mv(void **ptr, size_t size, size_t nmemb, FILE_m *stream_m);
int fseek_m(FILE_m *stream_m, long int offset, int whence);
int fseek_m_long(FILE_m *stream_m, long long offset, int whence);
long int ftell_m(FILE_m *stream_m);
void rewind_m(FILE_m *stream_m);
#endif
2 changes: 1 addition & 1 deletion Source/smokeview/IOboundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -2718,7 +2718,7 @@ void DrawMeshBoundaryFaces(patchdata *patchi, float valmin, float valmax){
ncol = pfi->ncol;

#ifdef pp_BOUNDFRAME
patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n);
patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, pfi->start);
#else
patchvals = meshi->patchval_iframe + pfi->start;
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/smokeview/IOpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ int GetPartHeader(partdata *parti, int *nf_all, int option_arg, int print_option
float time_local;

if(nframes_all_local >= frameinfo->nframes)break;
fseek_m(stream, 4+frameinfo->offsets[nframes_all_local], SEEK_SET);
fseek_m_long(stream, (long long)(4+frameinfo->offsets[nframes_all_local]), SEEK_SET);
count = fread_m(&time_local, 4, 1, stream);
if(count != 1||nframes_all_local == npart_frames_max)break;
nframes_all_local++;
Expand Down Expand Up @@ -1757,7 +1757,7 @@ int GetPartHeader(partdata *parti, int *nf_all, int option_arg, int print_option
int j, count;
float time_local;

fseek_m(stream, 4 + frameinfo->offsets[i], SEEK_SET);
fseek_m_long(stream, (long long)(4 + frameinfo->offsets[i]), SEEK_SET);
count = fread_m(&time_local, 4, 1, stream);
fseek_m(stream, 4, SEEK_CUR);
if(count != 1)break;
Expand Down
2 changes: 1 addition & 1 deletion Source/smokeview/glui_bounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3954,7 +3954,7 @@ void BoundBoundCB(int var){
#ifdef pp_FRAME
char ctime[1024];
bufferdata *bufferinfo=NULL;
int nread;
FILE_SIZE nread;
float read_time;
#endif

Expand Down
4 changes: 2 additions & 2 deletions Source/smokeview/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ char *ProcessCommandLine(CommandlineArgs *args){
#ifdef pp_FRAME
FREEMEMORY(frametest_filename);
NewMemory((void **)&frametest_filename, len_casename + strlen(".tst") + 1);
STRCPY(caseini_filename, fdsprefix);
STRCAT(caseini_filename, ".tst");
STRCPY(frametest_filename, fdsprefix);
STRCAT(frametest_filename, ".tst");
#endif

FREEMEMORY(fedsmv_filename);
Expand Down
4 changes: 2 additions & 2 deletions Source/smokeview/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,10 +2118,10 @@ void OutputFrameSteps(void){
frames_read = 0;
total_time = 0.0;
total_wrapup_time = 0.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->loaded == 0 || smoke3di->frameinfo == NULL || smoke3di->frameinfo->update == 0)continue;
smoke3di->frameinfo->update = 0;
count++;
Expand Down

0 comments on commit ec7698a

Please sign in to comment.