diff --git a/Build/smokeview/Makefile b/Build/smokeview/Makefile index 319262b31c..182bc42acd 100644 --- a/Build/smokeview/Makefile +++ b/Build/smokeview/Makefile @@ -62,7 +62,7 @@ csrc = callbacks.c camera.c color2rgb.c readimage.c readgeom.c readobject.c colo 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 \ - sha256.c shaders.c showscene.c skybox.c smokestream.c smokeview.c smv_geometry.c startup.c \ + sha256.c shaders.c showscene.c skybox.c smokestream.c smokeview.c smv_geometry.c startup.c fopen.c \ stdio_buffer.c stdio_m.c string_util.c threader.c translate.c unit.c update.c viewports.c colortable.c command_args.c cppsrc = glui_bounds.o \ diff --git a/Source/shared/IOframe.c b/Source/shared/IOframe.c index a5549eb57a..272beb628b 100644 --- a/Source/shared/IOframe.c +++ b/Source/shared/IOframe.c @@ -7,9 +7,21 @@ #include "IOframe.h" #include "file_util.h" +// The routines is this file read data files consisting of a header followed by one or +// more data frames. Each data frame starts with a time value followed by a number +// data of values. The number of values in a frame may vary. The frame data structures +// are initialized using FRAMEInit. This routine is passed a file name, a file type +// parameter (C or Fortran) and a routine that determines the size of each data frame. +// FDS generated files use the Fortran file type. Each Fortran generated data record +// is prefixed and suffixed with four bytes. Files compressed with smokezip use the +// C file type. The FRAMEsetup routine is then called when a file is read in define the +// header and data frame sizes. These operations are consolidated by the FRAMELoadFrame routine. + /* ------------------ FRAMEInit ------------------------ */ -framedata *FRAMEInit(char *file, char *size_file, int file_type, void GetFrameInfo(char *file, char *size_file, int *headersize, int **sizes, int *nsizes, FILE_SIZE *filesizeptr)){ +framedata *FRAMEInit(char *file, int file_type, void GetFrameInfo(bufferdata *bufferinfo, int *headersize, int **sizes, int *nsizes, + int **subframeptrs, int **subframessizes, int *nsubframes, + int *compression_type, FILE_SIZE *filesizeptr)){ framedata *frame=NULL; NewMemory((void **)&frame, sizeof(framedata)); @@ -20,25 +32,27 @@ framedata *FRAMEInit(char *file, char *size_file, int file_type, void GetFrameIn FREEMEMORY(frame); return NULL; } - if(size_file != NULL && strlen(size_file) > 0){ - NewMemory((void **)&frame->size_file, strlen(size_file) + 1); - strcpy(frame->size_file, size_file); - } - else{ - frame->size_file=NULL; - } + // fortran files contain an extra 4 bytes at the beginning and end of each record if(file_type != C_FILE)file_type = FORTRAN_FILE; strcpy(frame->file, file); frame->file_type = file_type; + frame->compression_type = FRAME_UNCOMPRESSED; frame->nframes = 0; + frame->frames_read = 0; + frame->bytes_read = 0; + frame->update = 0; frame->headersize = 0; frame->filesize = 0; frame->framesizes = NULL; frame->offsets = NULL; frame->frames = NULL; + frame->bufferinfo = NULL; frame->frameptrs = NULL; frame->times = NULL; frame->header = NULL; + frame->subframeoffsets = NULL; + frame->subframesizes = NULL; + frame->nsubframes = 0; frame->GetFrameInfo = GetFrameInfo; return frame; } @@ -50,21 +64,32 @@ void FRAMESetup(framedata *fi){ int i; FILE_SIZE filesize; int headersize; + int *subframeoffsets=NULL, *subframesizes=NULL, nsubframes=0; - fi->GetFrameInfo(fi->file, fi->size_file, &headersize, &framesizes, &nframes, &filesize); + fi->GetFrameInfo(fi->bufferinfo, &headersize, &framesizes, &nframes, + &subframeoffsets, &subframesizes, &nsubframes, + &fi->compression_type, &filesize); if(nframes <= 0)return; - fi->framesizes = framesizes; - fi->nframes = nframes; - fi->filesize = filesize; - fi->headersize = headersize; + if(fi->compression_type == FRAME_ZLIB)fi->file_type = C_FILE; + fi->subframeoffsets = subframeoffsets; + fi->subframesizes = subframesizes; + fi->nsubframes = nsubframes; + fi->framesizes = framesizes; + fi->nframes = nframes; + fi->filesize = filesize; + fi->headersize = headersize; + fi->bytes_read = 0; + fi->load_time = 0.0; + fi->total_time = 0.0; + fi->frames_read = 0; + fi->frames = fi->bufferinfo->buffer; + fi->header = fi->bufferinfo->buffer; if(nframes > 0){ - NewMemory((void **)&fi->header, headersize*sizeof(unsigned char)); - NewMemory((void **)&fi->offsets, nframes*sizeof(FILE_SIZE)); - NewMemory((void **)&fi->frameptrs, nframes*sizeof(float *)); - NewMemory((void **)&fi->times, nframes*sizeof(float)); - NewMemory((void **)&fi->frames, fi->filesize); + NEWMEM(fi->offsets, nframes*sizeof(FILE_SIZE)); + NEWMEM(fi->frameptrs, nframes*sizeof(float *)); + NEWMEM(fi->times, nframes*sizeof(float)); - fi->offsets[0] = 0; + fi->offsets[0] = headersize; for(i = 1;i < fi->nframes;i++){ fi->offsets[i] = fi->offsets[i - 1] + fi->framesizes[i - 1]; } @@ -73,93 +98,87 @@ void FRAMESetup(framedata *fi){ /* ------------------ FRAMEFree ------------------------ */ -void FRAMEFree(framedata **fiptr){ - framedata *fi; - - fi = *fiptr; +void FRAMEFree(framedata *fi){ if(fi == NULL)return; fi->nframes = 0; - FREEMEMORY(fi->file); - FREEMEMORY(fi->size_file); FREEMEMORY(fi->framesizes); - FREEMEMORY(fi->frames); FREEMEMORY(fi->offsets); FREEMEMORY(fi->frameptrs); FREEMEMORY(fi->times); - FREEMEMORY(fi->header); + FreeBufferInfo(fi->bufferinfo); + fi->bufferinfo = NULL; FREEMEMORY(fi); - *fiptr = NULL; } /* ------------------ FRAMEGetMinMax ------------------------ */ -int FRAMEGetMinMax(framedata *fi, float *valmin, float *valmax){ +int FRAMEGetMinMax(framedata *fi){ int i; - float vmin = 1.0, vmax = 0.0; - int returnval = 0, nvals; + float valmin = 1.0, valmax = 0.0; + int returnval = 0; - for(i = 0;i < fi->nframes;i++){ + for(i=0; inframes; i++){ int j; float *rvals; - rvals = (float *)fi->frameptrs[i]; - if(rvals == NULL||fi->framesizes[i]==0)continue; - returnval = 1; - nvals = (fi->framesizes[i] - 20) / 4; - for(j = 0;j < nvals;j++){ - float val; - - val = rvals[j]; - if(vmin > vmax){ - vmin = val; - vmax = val; - } - else{ - if(val < vmin)vmin = val; - if(val > vmax)vmax = val; + for(j=0; jnsubframes; j++){ + int k; + + rvals = (float *)FRAMEGetSubFramePtr(fi, i, j); + if(rvals == NULL || fi->framesizes[i] == 0)continue; + returnval = 1; + for(k = 0;k < fi->subframesizes[j];k++){ + float val; + + val = rvals[k]; + if(valmin > valmax){ + valmin = val; + valmax = val; + } + else{ + if(val < valmin)valmin = val; + if(val > valmax)valmax = val; + } } } } - *valmin = vmin; - *valmax = vmax; + fi->valmin = valmin; + fi->valmax = valmax; return returnval; } -/* ------------------ FRAMEReadHeader ------------------------ */ - -void FRAMEReadHeader(framedata *fi){ - FILE *stream; - - if(fi->headersize == 0)return; - stream = fopen(fi->file, "rb"); - if(stream == NULL)return; - fread(fi->header, 1, fi->headersize, stream); - fclose(stream); -} - /* ------------------ FRAMEReadFrame ------------------------ */ -void FRAMEReadFrame(framedata *fi, int iframe, int nframes){ +bufferdata *FRAMEReadFrame(framedata *fi, int iframe, int nframes, int *nreadptr){ FILE_SIZE total_size; - int i, first_frame, last_frame; + bufferdata *bufferinfo; + unsigned char *buffer; + int i, nread; FILE *stream; + if(fi == NULL)return NULL; stream = fopen(fi->file, "rb"); - if(stream == NULL)return; + if(stream == NULL)return NULL; - if(iframe < 0)iframe = 0; - first_frame = iframe; - last_frame = first_frame + nframes - 1; - if(last_frame>fi->nframes - 1)last_frame = fi->nframes-1; - nframes = last_frame + 1 - first_frame; - total_size = 0; for(i=0;iframesizes[iframe+i]; } - FRAME_FSEEK(stream, fi->headersize+fi->offsets[iframe], SEEK_SET); - fread(fi->frames + fi->offsets[iframe], 1, total_size, stream); - fclose(stream); + + NewMemory((void **)&bufferinfo, sizeof(bufferdata)); + NewMemory((void **)&buffer, fi->headersize+total_size); + bufferinfo->file = fi->file; + bufferinfo->buffer = buffer; + bufferinfo->nbuffer = total_size; + fi->frames_read = nframes; + fi->update = 1; + + fread(buffer, 1, fi->headersize, stream); + fseek(stream, fi->offsets[iframe], SEEK_SET); + nread = fread(buffer+fi->headersize, 1, total_size, stream); + bufferinfo->nfile = bufferinfo->nbuffer; + *nreadptr = nread; + return bufferinfo; } /* ------------------ FRAMESetTimes ------------------------ */ @@ -167,19 +186,22 @@ void FRAMEReadFrame(framedata *fi, int iframe, int nframes){ void FRAMESetTimes(framedata *fi, int iframe, int nframes){ int i, first_frame, last_frame; + fi->frames = fi->bufferinfo->buffer; + fi->header = fi->bufferinfo->buffer; if(iframe < 0)iframe = 0; + if(iframe > fi->nframes - 1)iframe = fi->nframes - 1; first_frame = iframe; + last_frame = first_frame + nframes - 1; if(last_frame>fi->nframes - 1)last_frame = fi->nframes-1; nframes = last_frame + 1 - first_frame; - for(i = iframe;i < nframes;i++){ + for(i = first_frame;i <= last_frame;i++){ int offset; offset = fi->offsets[i]; if(fi->file_type == FORTRAN_FILE)offset += 4; - memcpy(fi->times + i, fi->frames + offset, sizeof(float)); -//#define pp_FRAME_DEBUG -#ifdef pp_FRAME_DEBUG + memcpy(fi->times + i - first_frame, fi->frames + offset, sizeof(float)); +#ifdef pp_FRAME_DEBUG2 float time; time = fi->times[i]; printf("time[%i]=%f\n", i,time); @@ -212,29 +234,140 @@ void FRAMESetFramePtrs(framedata *fi, int iframe, int nframes){ /* ------------------ FRAMEGetPtr ------------------------ */ unsigned char *FRAMEGetFramePtr(framedata *fi, int iframe){ + if(fi == NULL)return NULL; if(iframe < 0)iframe = 0; if(iframe > fi->nframes-1)iframe = fi->nframes-1; return fi->frameptrs[iframe]; } +/* ------------------ FRAMEGetSubFramePtr ------------------------ */ + +unsigned char *FRAMEGetSubFramePtr(framedata *fi, int iframe, int isubframe){ + unsigned char *ptr; + + ptr = FRAMEGetFramePtr(fi, iframe); + if(ptr == NULL)return NULL; + if(isubframe <0)isubframe = 0; + if(isubframe >fi->nsubframes-1)isubframe = fi->nsubframes - 1;; + ptr += fi->subframeoffsets[isubframe]; + return ptr; +} + +/* ------------------ FRAMELoadData ------------------------ */ + +framedata *FRAMELoadData(framedata *frameinfo, char *file, int load_flag, int time_frame, int file_type, + 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; + float load_time; + + if(file_type != C_FILE)file_type = FORTRAN_FILE; + if(frameinfo == NULL)frameinfo = FRAMEInit(file, file_type, GetFrameInfo); + + START_TIMER(load_time); + if(frameinfo->bufferinfo == NULL || load_flag != RELOAD){ + if(frameinfo->bufferinfo!=NULL){ + FreeBufferInfo(frameinfo->bufferinfo); + frameinfo->bufferinfo = NULL; + } + frameinfo->bufferinfo = InitBufferData(file); + } + nframes_before = frameinfo->nframes; + frameinfo->bufferinfo = File2Buffer(file, frameinfo->bufferinfo, &nread); + FRAMESetup(frameinfo); + frameinfo->bytes_read = nread; + if(nread > 0){ + FRAMESetTimes( frameinfo, 0, frameinfo->nframes); + FRAMESetFramePtrs(frameinfo, 0, frameinfo->nframes); + } + frameinfo->update = 1; + nframes_after = frameinfo->nframes; + if(time_frame == ALL_FRAMES)frameinfo->frames_read = nframes_after - nframes_before; + STOP_TIMER(load_time); + if(frameinfo != NULL)frameinfo->load_time = load_time; + return frameinfo; +} + +/* ------------------ FRAMEGetNFrames ------------------------ */ +// only used for FRAME_PART +// when used for other types, needs to work when files are compressed +int FRAMEGetNFrames(char *file, int type){ + framedata *frameinfo = NULL; + int nframes = 0; + + if(file == NULL || FileExistsOrig(file) == 0)return 0; + switch(type){ + case FRAME_3DSMOKE: + frameinfo = FRAMEInit(file, FORTRAN_FILE, GetSmoke3DFrameInfo); + break; + case FRAME_BOUNDARY: + frameinfo = FRAMEInit(file, FORTRAN_FILE, GetBoundaryFrameInfo); + break; + case FRAME_PART: + frameinfo = FRAMEInit(file, FORTRAN_FILE, GetPartFrameInfo); + break; + case FRAME_ISO: + frameinfo = FRAMEInit(file, FORTRAN_FILE, GetIsoFrameInfo); + break; + case FRAME_SLICE: + frameinfo = FRAMEInit(file, FORTRAN_FILE, GetSliceFrameInfo); + break; + default: + assert(0); + return 0; + } + if(frameinfo != NULL){ + NewMemory(( void ** )&frameinfo->bufferinfo, sizeof(bufferdata)); + frameinfo->bufferinfo->file = file; + frameinfo->bufferinfo->buffer = NULL; + frameinfo->bufferinfo->nbuffer = 0; + FRAMESetup(frameinfo); + nframes = frameinfo->nframes; + FRAMEFree(frameinfo); + } + return nframes; +} +//******* The following routines define header and frame sizes for each file type +// (3d smoke, slice, isosurface, and particle - boundary file routine not implemente) /* ------------------ GetSmoke3DFrameInfo ------------------------ */ -void GetSmoke3DFrameInfo(char *file, char *size_file, int *headersizeptr, int **framesptr, int *nframesptr, FILE_SIZE *filesizeptr){ +void GetSmoke3DFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, + FILE_SIZE *filesizeptr){ FILE *stream; char buffer[255]; int headersize, nframes, *frames; FILE_SIZE filesize; char sizefile[1024]; + char *ext; - strcpy(sizefile, file); - strcat(sizefile, ".sz"); + *compression_type = FRAME_RLE; + if(bufferinfo == NULL)return; + stream = fopen(bufferinfo->file, "rb"); + if(stream == NULL)return; + fclose(stream); + + strcpy(sizefile, bufferinfo->file); + ext = strrchr(sizefile, '.'); + if(ext != NULL)ext[0] = 0; + strcat(sizefile, ".szz"); stream = fopen(sizefile, "r"); - if(stream == NULL){ - *nframesptr = 0; - *framesptr = NULL; - return; + if(stream!=NULL){ + *compression_type = FRAME_ZLIB; + } + else{ + strcpy(sizefile, bufferinfo->file); + strcat(sizefile, ".sz"); + stream = fopen(sizefile, "r"); + if(stream == NULL){ + *nframesptr = 0; + *framesptr = NULL; + return; + } } fgets(buffer, 255, stream); @@ -249,6 +382,12 @@ void GetSmoke3DFrameInfo(char *file, char *size_file, int *headersizeptr, int ** rewind(stream); fgets(buffer, 255, stream); nframes=0; + if(*compression_type == FRAME_RLE){ + headersize = 40; + } + else{ + headersize = 32; + } while(!feof(stream)){ int nchars, nchars_compressed; float time_local; @@ -258,16 +397,25 @@ void GetSmoke3DFrameInfo(char *file, char *size_file, int *headersizeptr, int ** // WRITE(LU_SMOKE3D) NCHARS_IN, NCHARS_OUT // IF(NCHARS_OUT > 0) WRITE(LU_SMOKE3D)(BUFFER_OUT(I), I = 1, NCHARS_OUT) if(fgets(buffer, 255, stream) == NULL)break; - sscanf(buffer, "%f %i %i", &time_local, &nchars, &nchars_compressed); - framesize = 4 + 4 + 4; - framesize += 4 + 8 + 4; - if(nchars_compressed > 0)framesize += 4 + nchars_compressed + 4; + if(*compression_type == FRAME_RLE){ + sscanf(buffer, "%f %i %i", &time_local, &nchars, &nchars_compressed); + framesize = 4 + 4 + 4; + framesize += 4 + 8 + 4; + if(nchars_compressed > 0)framesize += 4 + nchars_compressed + 4; + } + else{ + int dummy; + + sscanf(buffer, "%f %i %i %i", &time_local, &nchars, &dummy, &nchars_compressed); + framesize = 4; + framesize += 8; + if(nchars_compressed > 0)framesize += nchars_compressed; + } frames[nframes++] = framesize; } fclose(stream); - headersize = 40; - filesize = GetFileSizeSMV(file); + filesize = bufferinfo->nbuffer; *headersizeptr = headersize; *framesptr = frames; @@ -275,34 +423,188 @@ void GetSmoke3DFrameInfo(char *file, char *size_file, int *headersizeptr, int ** *filesizeptr = filesize; } - /* ------------------ GetSliceFrameInfo ------------------------ */ +/* ------------------ GetBoundaryFrameInfo ------------------------ */ -void GetSliceFrameInfo(char *file, char *size_file, int *headersizeptr, int **framesptr, int *nframesptr, FILE_SIZE *filesizeptr){ +void GetBoundaryFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, FILE_SIZE *filesizeptr){ FILE *stream; + int headersize, framesize, nframes, *frames, datasize; + FILE_SIZE filesize; + int npatch, i; + int *subframeoffsets=NULL, *subframesizes=NULL, nsubframes=0; + char *ext; + + ext = strrchr(bufferinfo->file, '.'); + if(ext != NULL && strcmp(ext, ".svz") == 0){ + *compression_type = FRAME_ZLIB; + } + + stream = fopen(bufferinfo->file, "rb"); + if(stream == NULL){ + *nframesptr = 0; + *framesptr = NULL; + *filesizeptr = 0; + } + + // uncompressed format + // header + // WRITE(LUBF) QUANTITY (30 chars) + // WRITE(LUBF) SHORT_NAME (30 chars) + // WRITE(LUBF) UNITS (30 chars) + // WRITE(LUBF) NPATCH + // WRITE(LUBF) I1, I2, J1, J2, K1, K2, IOR, NB, NM (NPATCH entries) + // WRITE(LUBF) I1, I2, J1, J2, K1, K2, IOR, NB, NM + + // compressed format + // endian + // completion (0/1) + // fileversion (compressed format) + // version (bndf version) + // global min max (used to perform conversion) + // local min max (min max found for this file) + // npatch + // i1,i2,j1,j2,k1,k2,idir,dummy,dummy (npatch times) + + + + if(*compression_type == FRAME_ZLIB){ + headersize = 32; // QUANTITY, SHORT_NAME, UNITS + } + else{ + headersize = 3 * (4 + 30 + 4); // QUANTITY, SHORT_NAME, UNITS + } + FSEEK(stream, headersize, SEEK_SET); + + + if(*compression_type == FRAME_ZLIB){ + headersize += 4; + fread(&npatch, sizeof(int), 1, stream); + } + else{ + FSEEK(stream, 4, SEEK_CUR);fread(&npatch, sizeof(int), 1, stream);FSEEK(stream, 4, SEEK_CUR); + headersize += (4 + sizeof(int) + 4); // NPATCH + } + + + nsubframes = npatch; + NewMemory(( void ** )&subframeoffsets, nsubframes*sizeof(int)); + NewMemory((void **)&subframesizes, nsubframes*sizeof(int)); + subframeoffsets[0] = 0; + datasize = 0; + for(i = 0;i < npatch;i++){ + int parms[9], ncells; + + if(*compression_type == FRAME_ZLIB){ + fread(parms, sizeof(int), 9, stream); + } + else{ + FSEEK(stream, 4, SEEK_CUR);fread(parms, sizeof(int), 9, stream);FSEEK(stream, 4, SEEK_CUR); + } + ncells = (parms[1] + 1 - parms[0]); + ncells *= (parms[3] + 1 - parms[2]); + ncells *= (parms[5] + 1 - parms[4]); + datasize += (4 + ncells* sizeof(float) + 4); + if(i 0){ + ResizeMemory((void **)&frames, nframes * sizeof(int)); + } + else{ + FREEMEMORY(frames); + } + filesize = GetFileSizeSMV(bufferinfo->file); + } + else{ + // UNCOMPRESSED format + // frame + // WRITE(LUBF) TIME + // WRITE(LUBF) (((QQ(I, J, K), I = 11, I2), J = J1, J2), K = K1, K2) (NPATH entries) + framesize = 4 + sizeof(float) + 4; // time + framesize += datasize; + + filesize = GetFileSizeSMV(bufferinfo->file); + nframes = (filesize - headersize) / framesize; + + NewMemory((void **)&frames, nframes * sizeof(int)); + for(i = 0;i < nframes;i++){ + frames[i] = framesize; + } + } + fclose(stream); + *headersizeptr = headersize; + *framesptr = frames; + *nframesptr = nframes; + *filesizeptr = filesize; + *subframeoffsetsptr = subframeoffsets; + *subframesizesptr = subframesizes; + *nsubframesptr = nsubframes; +} + + /* ------------------ GetSliceFrameInfo ------------------------ */ + +void GetSliceFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, FILE_SIZE *filesizeptr){ + FILE_m *stream; + int headersize, framesize, nframes, *frames; int ijk[6]; int ip1, ip2, jp1, jp2, kp1, kp2; int nxsp, nysp, nzsp; FILE_SIZE filesize; int returncode; + int *subframeoffsets = NULL, *subframesizes = NULL; + int nsubframes; - stream = fopen(file, "rb"); + nsubframes = 1; + NewMemory((void **)&subframeoffsets, nsubframes * sizeof(int)); + NewMemory((void **)&subframesizes, nsubframes * sizeof(int)); + subframeoffsets[0] = 0; + + stream = fopen_b(bufferinfo->file, bufferinfo->buffer, bufferinfo->nbuffer, "rb"); if(stream == NULL){ *nframesptr = 0; *framesptr = NULL; } headersize = 3*(4+30+4); // 3 30 byte labels + fseek_m(stream, headersize, SEEK_CUR); - FRAME_FSEEK(stream, headersize, SEEK_CUR); + fseek_m(stream, 4, SEEK_CUR);returncode = fread_m(ijk, 4, 6, stream);fseek_m(stream, 4, SEEK_CUR); - FRAME_READ(ijk, 6, stream); if(returncode!=6){ - fclose(stream); +// fclose(stream); return; } - fclose(stream); + //fclose(stream); ip1 = ijk[0]; ip2 = ijk[1]; @@ -318,24 +620,30 @@ void GetSliceFrameInfo(char *file, char *size_file, int *headersizeptr, int **fr framesize = 4 + 4 + 4; // time framesize += 4 + 4*(nxsp*nysp*nzsp) + 4; // data + subframesizes[0] = nxsp * nysp * nzsp; - filesize = GetFileSizeSMV(file); + filesize = bufferinfo->nbuffer; nframes = (int)(filesize - headersize)/framesize; // time frames NewMemory((void **)&frames, nframes *sizeof(int)); int i; for(i=0;i< nframes;i++){ frames[i] = framesize; } - *headersizeptr = headersize; - *framesptr = frames; - *nframesptr = nframes; - *filesizeptr = filesize; + *headersizeptr = headersize; + *framesptr = frames; + *nframesptr = nframes; + *filesizeptr = filesize; + *subframeoffsetsptr = subframeoffsets; + *subframesizesptr = subframesizes; + *nsubframesptr = nsubframes; } /* ------------------ GetIsoFrameInfo ------------------------ */ -void GetIsoFrameInfo(char *file, char *size_file, int *headersizeptr, int **framesptr, int *nframesptr, FILE_SIZE *filesizeptr){ - FILE *stream; +void GetIsoFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, FILE_SIZE *filesizeptr){ + FILE_m *stream; int headersize, levelsize, *frames; int niso_levels; int nframes; @@ -350,7 +658,8 @@ void GetIsoFrameInfo(char *file, char *size_file, int *headersizeptr, int **fram // WRITE(LU_ISO) ZERO // WRITE(LU_ISO) ZERO, ZERO - stream = fopen(file, "rb"); + + stream = fopen_b(bufferinfo->file, bufferinfo->buffer, bufferinfo->nbuffer, "rb"); if(stream == NULL){ *nframesptr = 0; *framesptr = NULL; @@ -359,8 +668,8 @@ void GetIsoFrameInfo(char *file, char *size_file, int *headersizeptr, int **fram headersize = 4 + 4 + 4; // ONE headersize += 4 + 4 + 4; // VERSION - FRAME_FSEEK(stream, headersize, SEEK_CUR); - FRAME_READ(&niso_levels, 1, stream); + fseek_m(stream, headersize, SEEK_CUR); + fseek_m(stream, 4, SEEK_CUR);returncode = fread_m(&niso_levels, 4, 1, stream);fseek_m(stream, 4, SEEK_CUR); headersize += 4+4+4; // NISO_LEVELS levelsize = 0; @@ -369,11 +678,11 @@ void GetIsoFrameInfo(char *file, char *size_file, int *headersizeptr, int **fram headersize += 4 + 4 + 4; // ZERO (12 bytes) headersize += 4 + 8 + 4; // ZERO, ZERO (16 bytes) headersize += levelsize; // levels - FRAME_FSEEK(stream, 28+levelsize, SEEK_CUR); + fseek_m(stream, 28+levelsize, SEEK_CUR); nframes = 0; NewMemory((void **)&frames, 1000000*sizeof(int)); - while(!feof(stream)){ + while(!feof_m(stream)){ // WRITE(LU_ISO) STIME, ZERO // WRITE(LU_ISO) N_VERT, N_FACE // IF(N_VERT_D > 0) WRITE(LU_ISO) (Xvert(I), Yvert(I), Zvert(I), I = 1, N_VERT) @@ -383,32 +692,137 @@ void GetIsoFrameInfo(char *file, char *size_file, int *headersizeptr, int **fram int nvals[2]; float times[2]; - FRAME_READ(times, 2, stream);if(returncode != 2)break; - FRAME_READ(nvals, 2, stream);if(returncode != 2)break; + fseek_m(stream, 4, SEEK_CUR);returncode = fread_m(times, 4, 2, stream);fseek_m(stream, 4, SEEK_CUR); + if(returncode != 2)break; + fseek_m(stream, 4, SEEK_CUR);returncode = fread_m(nvals, 4, 2, stream);fseek_m(stream, 4, SEEK_CUR); + if(returncode != 2)break; + int skip; skip = 0; if(nvals[0] > 0)skip += (4 + 3*nvals[0]*4 + 4); if(nvals[1] > 0)skip += (4 + 3 * nvals[1] * 4 + 4) + (4 + nvals[1] * 4 + 4); - FRAME_FSEEK(stream, skip, SEEK_CUR); + fseek_m(stream, skip, SEEK_CUR); frames[nframes++] = 4 + 8 + 4 + 4 + 8 + 4 + skip; } - if(nframes > 0)ResizeMemory((void **)&frames, nframes * sizeof(int)); + if(nframes > 0){ + ResizeMemory((void **)&frames, nframes * sizeof(int)); + } + else{ + FREEMEMORY(frames); + } - filesize = GetFileSizeSMV(file); + filesize = bufferinfo->nbuffer; + + *headersizeptr = headersize; + *framesptr = frames; + *nframesptr = nframes; + *filesizeptr = filesize; +} + +/* ------------------ GetIsoFrameInfo ------------------------ */ + +void GetGeomDataFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, FILE_SIZE *filesizeptr){ + FILE_m *stream; + int headersize, *frames; + int nframes; + FILE_SIZE filesize; + char *ext=NULL; + + // uncompressed header + // 1 + // version + // compressed header + // 1 + // completion (0/1) + // fileversion (compressed format) + // min max (used to perform conversion) + + ext = strrchr(bufferinfo->file, '.'); + if(ext != NULL && strcmp(ext, ".svz") == 0){ + *compression_type = FRAME_ZLIB; + } + + stream = fopen_b(bufferinfo->file, bufferinfo->buffer, bufferinfo->nbuffer, "rb"); + if(stream == NULL){ + *nframesptr = 0; + *framesptr = NULL; + return; + } + + if(*compression_type != FRAME_ZLIB){ + headersize = 4+4+4; // 1 + headersize += 4+4+4; // version + } + else{ + headersize = 4; // 1 + headersize += 4; // complesion + headersize += 4; // compressed format + headersize += 8; // min max + } + + // uncompressed data frame + // for each time step: + // time + // nvert_static, ntri_static, nvert_dynamic, ntri_dynamic + // if(nvert_static>0) vals_1, ...vals_nvert_static + // if(ntri_static>0) vals_1, ...vals_ntri_static + // if(nvert_dynamic>0)vals_1, ...vals_nvert_dynamic + // if(ntri_dynamic>0) vals_1, ...vals_ntri_dynamic + // compressed data frame + // for each time step + // time + // ncompressed + // compressed_1,...,compressed_ncompressed + + + fseek_m(stream, headersize, SEEK_CUR); + NewMemory((void **)&frames, 1000000 * sizeof(int)); + nframes = 0; + while(!feof_m(stream)){ + int nvals[4]; + int skip; + + if(*compression_type != FRAME_ZLIB){ + fseek_m(stream, 12, SEEK_CUR); // time 12 bytes + fseek_m(stream, 4, SEEK_CUR); fread_m(nvals, 4, 4, stream); fseek_m(stream, 4, SEEK_CUR); // nvals 24 bytes + skip = 0; + if(nvals[0] > 0)skip += 4 + 4*nvals[0] + 4; + if(nvals[1] > 0)skip += 4 + 4*nvals[1] + 4; + if(nvals[2] > 0)skip += 4 + 4*nvals[2] + 4; + if(nvals[3] > 0)skip += 4 + 4*nvals[3] + 4; + fseek_m(stream, skip, SEEK_CUR); + frames[nframes++] = 36 + skip; + } + else{ + fseek_m(stream, 4, SEEK_CUR); // time + fread_m(nvals, 4, 1, stream); // ncompressed + fseek_m(stream, nvals[0], SEEK_CUR); // ncompressed chars + } + } + if(nframes > 0){ + ResizeMemory((void **)&frames, nframes * sizeof(int)); + } + else{ + FREEMEMORY(frames); + } + filesize = bufferinfo->nbuffer; *headersizeptr = headersize; *framesptr = frames; *nframesptr = nframes; *filesizeptr = filesize; - fclose(stream); } /* ------------------ GetPartFrameInfo ------------------------ */ -void GetPartFrameInfo(char *file, char *size_file, int *headersizeptr, int **framesptr, int *nframesptr, FILE_SIZE *filesizeptr){ - FILE *stream; +void GetPartFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, FILE_SIZE *filesizeptr){ + FILE_m *stream; FILE_SIZE filesize; int headersize, *frames, nframes, returncode, n_part, *nquants; @@ -423,7 +837,7 @@ void GetPartFrameInfo(char *file, char *size_file, int *headersizeptr, int **fra // WRITE(LUPF) UDATA(PC%QUANTITIES_INDEX(NN)) ! 30 character output units // ENDDO // ENDDO - stream = fopen(file, "rb"); + stream = fopen_b(bufferinfo->file, bufferinfo->buffer, bufferinfo->nbuffer, "rb"); if(stream == NULL){ *nframesptr = 0; *framesptr = NULL; @@ -432,25 +846,28 @@ void GetPartFrameInfo(char *file, char *size_file, int *headersizeptr, int **fra headersize = 4 + 4 + 4; // ONE headersize += 4 + 4 + 4; // FDS VERSION + fseek_m(stream, headersize, SEEK_CUR); + + fseek_m(stream, 4, SEEK_CUR);returncode = fread_m(&n_part, 4, 1, stream);fseek_m(stream, 4, SEEK_CUR); + headersize += 4 + 4 + 4; // n_part + + NewMemory((void **)&nquants, 2*n_part*sizeof(int)); - FRAME_FSEEK(stream, headersize, SEEK_CUR); - FRAME_READ(&n_part, 1, stream); - NewMemory((void **)&nquants, (n_part+1)*sizeof(int)); - - headersize += 4 + 4 + 4; int i; for(i=0; i 0) WRITE(LUPF) ((QP(I,NN),I=1,NPLIM),NN=1,PC%N_QUANTITIES) // ENDDO float time_arg; - FRAME_READ(&time_arg, 1, stream); - if(returncode != 1)break; + fseek_m(stream, 4, SEEK_CUR);returncode = fread_m(&time_arg, 4, 1, stream);fseek_m(stream, 4, SEEK_CUR); framesize = 4 + 4 + 4; + + if(returncode != 1)break; for(i=0; i0){ - skip += 4 + nplim*nquants[i]*4 + 4; // qp + +// printf("nplim %i: %i\n",i, nplim); + skip = 4 + 3*nplim*sizeof(float) + 4; // xp, yp, zp + skip += 4 + nplim*sizeof(int) + 4; // tag + if(nquants[2*i] > 0){ + skip += 4 + nplim*nquants[2*i]*sizeof(float) + 4; // qp } framesize += skip; - FRAME_FSEEK(stream, skip, SEEK_CUR); + fseek_m(stream, skip, SEEK_CUR); } frames[nframes++] = framesize; } - if(nframes > 0)ResizeMemory((void **)&frames, nframes * sizeof(int)); + if(nframes > 0){ + ResizeMemory((void **)&frames, nframes * sizeof(int)); + } + else{ + FREEMEMORY(frames); + } - filesize = GetFileSizeSMV(file); + filesize = bufferinfo->nbuffer; *headersizeptr = headersize; *framesptr = frames; *nframesptr = nframes; *filesizeptr = filesize; - fclose(stream); } diff --git a/Source/shared/IOframe.h b/Source/shared/IOframe.h index a6463de42c..23fbc74ed9 100644 --- a/Source/shared/IOframe.h +++ b/Source/shared/IOframe.h @@ -1,44 +1,85 @@ #ifndef STDIO_FRAME_H_DEFINED #define STDIO_FRAME_H_DEFINED +#include "file_util.h" -// ----------------------- structures ----------------------- +// ----------------------- defines ----------------------- -#ifdef X64 -#define FRAME_FSEEK(a,b,c) _fseeki64(a,b,c) -#else -#define FRAME_FSEEK(a,b,c) fseeko(a,b,c) +#define FORTRAN_FILE 0 +#define C_FILE 1 + +#ifndef LOAD +#define LOAD 0 #endif -#define FRAME_READ(var,count,STREAM) \ - FRAME_FSEEK(STREAM,4,SEEK_CUR);returncode=fread(var,4,(count),STREAM);FRAME_FSEEK(STREAM,4,SEEK_CUR) +#ifndef UNLOAD +#define UNLOAD 1 +#endif + +#ifndef RELOAD +#define RELOAD 3 +#endif +#ifndef ALL_FRAMES +#define ALL_FRAMES -1 +#endif + +#define FRAME_SLICE 0 +#define FRAME_BOUNDARY 1 +#define FRAME_3DSMOKE 2 +#define FRAME_PART 3 +#define FRAME_ISO 4 + +#define FRAME_UNCOMPRESSED 0 +#define FRAME_RLE 1 +#define FRAME_ZLIB 2 + +#define FRAME_LOAD 0 + +// ----------------------- structure ----------------------- -#define FORTRAN_FILE 0 -#define C_FILE 1 typedef struct _framedata { - char *file, *size_file; - int nframes, file_type; - int headersize, *framesizes; - FILE_SIZE *offsets, filesize; + char *file; unsigned char *header, *frames, **frameptrs; - float *times; - void (*GetFrameInfo)(char *file, char *size_file, int *headersize, int **sizes, int *nsizes, FILE_SIZE *filesizeptr); + int nframes, frames_read, update, file_type, compression_type; + int headersize, *framesizes; + int *subframeoffsets, *subframesizes, nsubframes; + FILE_SIZE *offsets, filesize, bytes_read; + bufferdata *bufferinfo; + float *times, load_time, total_time; + float valmin, valmax; + void (*GetFrameInfo)(bufferdata *bufferinfo, int *headersize, int **sizes, int *nsizes, int **subframeoffsets, int **subframesizes, int *nsubframes, int *compression_type, FILE_SIZE *filesizeptr); } framedata; // ----------------------- headers ----------------------- -framedata *FRAMEInit(char *file, char *size_file, int file_type, void GetFrameInfo(char *file, char *size_file, int *headersize, int **sizes, int *nsizes, FILE_SIZE *filesize_ptr)); -void FRAMEFree(framedata **fi); +//*** frame routines +void FRAMEFree(framedata *fi); unsigned char *FRAMEGetFramePtr(framedata *fi, int iframe); -int FRAMEGetMinMax(framedata *fi, float *valmin, float *valmax); -void FRAMEReadFrame(framedata *fi, int iframe, int nframes); -void FRAMEReadHeader(framedata *fi); -void FRAMESetFramePtrs(framedata * fi, int iframe, int nframes); -void FRAMESetTimes(framedata *fi, int iframe, int nframes); -void FRAMESetup(framedata *fi); -void FRAMESetupVals(framedata *fi); - -void GetIsoFrameInfo( char *file, char *size_file, int *headersizeptr, int **sizesptr, int *nsizesptr, FILE_SIZE *filesizeptr); -void GetSliceFrameInfo( char *file, char *size_file, int *headersizeptr, int **sizesptr, int *nsizesptr, FILE_SIZE *filesizeptr); -void GetSmoke3DFrameInfo(char *file, char *size_file, int *headersizeptr, int **sizesptr, int *nsizesptr, FILE_SIZE *filesizeptr); -void GetPartFrameInfo(char *file, char *size_file, int *headersizeptr, int **framesptr, int *nframesptr, FILE_SIZE *filesizeptr); +int FRAMEGetMinMax(framedata *fi); +int FRAMEGetNFrames(char *file, int type); +unsigned char *FRAMEGetSubFramePtr(framedata *fi, int iframe, int isubframe); +framedata *FRAMELoadData(framedata *frameinfo, char *file, int load_flag, int time_frame, int file_type, + void GetFrameInfo(bufferdata *bufferinfo, int *headersize, int **sizes, int *nsizes, int **subframeptrs, int **subframesizesptr, int *nsubframes, int *compression_type, FILE_SIZE *filesizeptr)); + +bufferdata *FRAMEReadFrame(framedata *fi, int iframe, int nframes, int *nreadptr); + + +//*** setup routines for various file types +void GetBoundaryFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetptrs, int **subframesizesptr, int *nsubframeoffsets, + int *compression_type, FILE_SIZE *filesizeptr); +void GetGeomDataFrameInfo(bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetsptr, int **subframesizesptr, int *nsubframesptr, + int *compression_type, FILE_SIZE *filesizeptr); +void GetIsoFrameInfo(bufferdata * bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetptrs, int **subframesizesptr, int *nsubframeoffsets, + int *compression_type, FILE_SIZE *filesizeptr); +void GetPartFrameInfo( bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetptrs, int **subframesizesptr, int *nsubframeoffsets, + int *compression_type, FILE_SIZE *filesizeptr); +void GetSliceFrameInfo( bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetptrs, int **subframesizesptr, int *nsubframeoffsets, + int *compression_type, FILE_SIZE *filesizeptr); +void GetSmoke3DFrameInfo( bufferdata *bufferinfo, int *headersizeptr, int **framesptr, int *nframesptr, + int **subframeoffsetptrs, int **subframesizesptr, int *nsubframeoffsets, + int *compression_type, FILE_SIZE *filesizeptr); #endif diff --git a/Source/shared/MALLOCC.h b/Source/shared/MALLOCC.h index c2d2313481..1fd2080c9c 100644 --- a/Source/shared/MALLOCC.h +++ b/Source/shared/MALLOCC.h @@ -73,6 +73,10 @@ MMEXTERN pthread_mutex_t mutexMEM; #define ResizeMemoryMemID(f,g,h) _ResizeMemory((f),(g),(h),(#f),__FILE__,__LINE__) #endif +#ifndef NEWMEM +#define NEWMEM(a,b) ((a)==NULL ? NewMemory((void **)&a,b): ResizeMemory((void **)&a,b)) +#endif + #define NewResizeMemory(f,g) ((f)==NULL ? NewMemory((void **)&f,g) : ResizeMemory((void **)&f,g)) #define NEWMEMORY(f,g) NewMemory((void **)&(f),(g)) @@ -115,27 +119,27 @@ void _CheckMemoryOff(void); void _PrintAllMemoryInfo(void); int _CountMemoryBlocks(void); #define ValidPointer(pv,size) _ValidPointer(pv, size) -#define GetTotalMemory(size) size=_GetTotalMemory() +#define GETTOTALMEMORY (_GetTotalMemory()) #define CheckMemory _CheckMemory() #define CheckMemoryNOTHREAD _CheckMemoryNOTHREAD() #define CheckMemoryOn _CheckMemoryOn() #define CheckMemoryOff _CheckMemoryOff() #define PrintAllMemoryInfo _PrintAllMemoryInfo() -#define CountMemoryBlocks(f,g) f=_CountMemoryBlocks()-g +#define COUNTMEMORYBLOCKS(f) (_CountMemoryBlocks()-f) char *_strcpy(char *s1, const char *s2); char *_strcat(char *s1, const char *s2); #define STRCPY(f,g) _strcpy((f),(g)) #define STRCAT(f,g) _strcat((f),(g)) #else #define ValidPointer(pv,size) -#define GetTotalMemory +#define GETTOTALMEMORY #define CheckMemory #define CheckMemoryOn #define CheckMemoryOff #define PrintAllMemoryInfo #define STRCPY(f,g) strcpy((f),(g)) #define STRCAT(f,g) strcat((f),(g)) -#define CountMemoryBlocks(f,g) +#define COUNTMEMORYBLOCKS(f) #endif #ifdef pp_MEMDEBUG diff --git a/Source/shared/dmalloc.c b/Source/shared/dmalloc.c index 1070537aca..c11cf1adcc 100644 --- a/Source/shared/dmalloc.c +++ b/Source/shared/dmalloc.c @@ -363,6 +363,9 @@ mallocflag __NewMemory(void **ppv, size_t size, int memory_id, const char *varna char dirsep='/'; #endif +#ifdef pp_MEM_DEBUG_PRINT + printf("file: %s line: %i\n", file, linenumber); +#endif LOCK_MEM; return_code=_NewMemoryNOTHREAD(ppb,size,memory_id); if(return_code != 1){ diff --git a/Source/shared/file_util.c b/Source/shared/file_util.c index 0432ee3bef..af051299c8 100644 --- a/Source/shared/file_util.c +++ b/Source/shared/file_util.c @@ -1,4 +1,5 @@ #include "options.h" +#define IN_FILE_UTIL #include #include #include @@ -32,6 +33,7 @@ #include "string_util.h" #include "file_util.h" #include "threader.h" +#include "fopen.h" FILE *alt_stdout=NULL; @@ -265,6 +267,14 @@ unsigned int StreamCopy(FILE *stream_in, FILE *stream_out, int flag){ return nchars; } +/* ------------------ FileErase ------------------------ */ + +void FileErase(char *file){ + if(FileExistsOrig(file) == 1){ + UNLINK(file); + } +} + /* ------------------ FileCopy ------------------------ */ void FileCopy(char *file_in, char *file_out){ @@ -482,27 +492,41 @@ FILE_SIZE GetFileSizeSMV(const char *filename){ /* ------------------ fread_mt ------------------------ */ void *fread_mt(void *mtfileinfo){ - FILE_SIZE first, last, length, file_size; + FILE_SIZE file_beg, buffer_beg, file_end, buffer_size, file_size; FILE *stream; int i, nthreads; - char *file, *buffer; + char *file; + unsigned char *buffer; mtfiledata *mtf; + FILE_SIZE file_offset, nchars; mtf = (mtfiledata *)mtfileinfo; - i = mtf->i; - nthreads = mtf->nthreads; - file = mtf->file; - buffer = mtf->buffer; - file_size = mtf->file_size; + i = mtf->i; + nthreads = mtf->nthreads; + file = mtf->file; + buffer = mtf->buffer; + file_size = mtf->file_size; + file_offset = mtf->file_offset; + nchars = mtf->nchars; - first = i*file_size/nthreads; - last = first + file_size/nthreads - 1; - if(last > file_size - 1)last = file_size - 1; - length = last + 1 - first; + buffer_size = nchars/nthreads; + buffer_beg = i*buffer_size; + file_beg = file_offset + buffer_beg; + file_end = file_beg + buffer_size - 1; + if(i == nthreads - 1||file_end>file_size-1){ + file_end = file_size - 1; + buffer_size = file_end + 1 - file_beg; + } stream = fopen(file, "rb"); - FSEEK(stream, first, SEEK_SET); - mtf->chars_read = fread(buffer + first, 1, length, stream); + if(stream == NULL){ +#ifdef pp_THREAD + if(nthreads>1)pthread_exit(NULL); +#endif + return NULL; + } + FSEEK(stream, file_beg, SEEK_SET); + mtf->chars_read = fread(buffer + buffer_beg, 1, buffer_size, stream); fclose(stream); #ifdef pp_THREAD @@ -513,36 +537,60 @@ void *fread_mt(void *mtfileinfo){ /* ------------------ SetMtFileInfo ------------------------ */ -mtfiledata *SetMtFileInfo(char *file, char *buffer, int nthreads){ +mtfiledata *SetMtFileInfo(char *file, unsigned char *buffer, FILE_SIZE file_offset, FILE_SIZE nchars, int nthreads){ mtfiledata *mtfileinfo; int i; - FILE_SIZE file_size; NewMemory((void **)&mtfileinfo,nthreads*sizeof(mtfiledata)); - file_size = GetFileSizeSMV(file); for(i=0;ii = i; - mti->nthreads = nthreads; - mti->file = file; - mti->buffer = buffer; - mti->file_size = file_size; - mti->chars_read = 0; + mti->i = i; + mti->nthreads = nthreads; + mti->file = file; + mti->buffer = buffer; + mti->file_size = nchars; + mti->file_offset = file_offset; + mti->nchars = nchars; + mti->chars_read = 0; } return mtfileinfo; } - //chars_in=fread(buffer,1,FILE_BUFFER,stream_in1); + +/* ------------------ MakeFile ------------------------ */ + +#define BUFFERSIZE 1000000 +int MakeFile(char *file, int size){ + unsigned char *buffer; + FILE *stream; + int i; + + if(file == NULL || strlen(file) == 0)return 0; + stream = fopen(file, "w"); + if(stream == NULL)return 0; + + NewMemory(( void ** )&buffer, BUFFERSIZE); + for(i = 0; i < BUFFERSIZE; i++){ + buffer[i] = i % 255; + } + for(i = 0; i < size; i++){ + fwrite(buffer, 1, BUFFERSIZE, stream); + } + fclose(stream); + + FREEMEMORY(buffer); + return 1; +} /* ------------------ fread_p ------------------------ */ -FILE_SIZE fread_p(char *file, char *buffer, int nthreads){ +FILE_SIZE fread_p(char *file, unsigned char *buffer, FILE_SIZE offset, FILE_SIZE nchars, int nthreads){ FILE_SIZE chars_read; mtfiledata *mtfileinfo; - mtfileinfo = SetMtFileInfo(file, buffer, nthreads); + mtfileinfo = SetMtFileInfo(file, buffer, offset, nchars, nthreads); if(nthreads == 1){ FILE *stream; @@ -558,7 +606,7 @@ FILE_SIZE fread_p(char *file, char *buffer, int nthreads){ use_read_threads = 1; read_threads = THREADinit(&nthreads, &use_read_threads, fread_mt); - THREADrun(read_threads, &mtfileinfo); + THREADruni(read_threads, (unsigned char *)mtfileinfo, sizeof(mtfiledata)); THREADcontrol(read_threads, THREAD_JOIN); chars_read = 0; for(i = 0;i < nthreads;i++){ @@ -582,36 +630,135 @@ FILE_SIZE fread_p(char *file, char *buffer, int nthreads){ return chars_read; } -/* ------------------ THREADreadi ------------------------ */ -void THREADreadi(threaderdata *thi, mtfiledata *mtfileinfo){ -#ifdef pp_THREAD - if(thi == NULL)return; - if(thi->use_threads_ptr != NULL)thi->use_threads = *(thi->use_threads_ptr); - if(thi->n_threads_ptr != NULL){ - thi->n_threads = *(thi->n_threads_ptr); - if(thi->n_threads > MAX_THREADS)thi->n_threads = MAX_THREADS; +/* ------------------ PrintTime ------------------------ */ + +void PrintTime(const char *filepath, int line, float *timer, const char *label, int stop_flag){ + char *file; + + if(show_timings == 0)return; + file = strrchr(filepath, '\\'); + if(file == NULL)file = strrchr(filepath, '/'); + if(file == NULL){ + file = (char *)filepath; } - int i; + else{ + file++; + } + if(label != NULL){ + if(stop_flag == 1)STOP_TIMER(*timer); + if(*timer > 0.1)printf("%s/%i/%s %.1f s\n", file, line, label, *timer); + } + START_TIMER(*timer); +} - for(i = 0; i < thi->n_threads; i++){ - mtfiledata *mti; +/* ------------------ InitBufferData ------------------------ */ + +bufferdata *InitBufferData(char *file){ + bufferdata *buffinfo = NULL; + unsigned char *buffer = NULL; + int nbuffer = 0; + + NewMemory((void **)&buffinfo, sizeof(bufferdata)); + buffinfo->file = file; + nbuffer = GetFileSizeSMV(file); + NewMemory((void **)&buffer, nbuffer); + buffinfo->buffer = buffer; + buffinfo->nbuffer = nbuffer; + buffinfo->nfile = 0; + return buffinfo; +} - mti = mtfileinfo + i; - if(thi->use_threads == 1){ - pthread_create(thi->thread_ids + i, NULL, thi->run, (void *)mti); +/* ------------------ FreeBufferInfo ------------------------ */ + +void FreeBufferInfo(bufferdata *bufferinfo){ + if(bufferinfo == NULL)return; + FREEMEMORY(bufferinfo->buffer); + FREEMEMORY(bufferinfo); +} + +/* ------------------ File2Buffer ------------------------ */ + +bufferdata *File2Buffer(char *file, bufferdata *bufferinfo, int *nreadptr){ + FILE_SIZE nfile, offset_buffer = 0, offset_file = 0, nread_actual, nread_try; + + *nreadptr = 0; + if(file==NULL || strlen(file)==0 || FileExistsOrig(file) == 0)return NULL; + + INIT_PRINT_TIMER(timer_file2buffer); + if(bufferinfo == NULL){ // read entire file + bufferinfo = InitBufferData(file); + offset_file = 0; + offset_buffer = 0; + nread_try = bufferinfo->nbuffer; + } + else{ // read in part of file that was not read in previously + unsigned char *buffer; + + buffer = bufferinfo->buffer; + nfile = GetFileSizeSMV(file); + if(nfile == 0){ + FreeBufferInfo(bufferinfo); + *nreadptr = 0; + return NULL; + } + if(buffer!=NULL&&nfile == bufferinfo->nfile){ // file hasn't changed so nothing more to read in + PRINT_TIMER(timer_file2buffer, "File2Buffer"); + *nreadptr = 0; + return bufferinfo; + } + if(buffer == NULL){ + NewMemory((void **)&buffer, nfile*sizeof(unsigned char)); + offset_file = 0; + offset_buffer = 0; } else{ - thi->run((void *)mti); + ResizeMemory((void **)&buffer, nfile); + offset_file = bufferinfo->nfile; + offset_buffer = bufferinfo->nfile; } + bufferinfo->buffer = buffer; + nread_try = nfile - offset_file; + bufferinfo->nbuffer = nfile; } +// nread = fread_p(file, buffer, offset, delta, nthreads); + +//#define XXX +#ifdef XXX + FILE *stream; +#ifdef WIN32 + stream = _fsopen(file, "rb", _SH_DENYNO); +#ifdef pp_OPEN_TEST + if(stream != NULL){ + AddOpenFile(file, stream, __FILE__, __LINE__); + open_files++; + } +#endif #else -// args[0] = 1; -// args[1] = -1; -// thi->run(args); + stream = fopen(file, "rb"); +#endif #endif -} +#ifndef XXX + FILE *stream; + stream = fopen(file, "rb"); +#endif + if(stream == NULL){ + FreeBufferInfo(bufferinfo); + return NULL; + } + if(offset_file!=0)fseek(stream, offset_file, SEEK_SET); + nread_actual = fread(bufferinfo->buffer+offset_buffer, 1, nread_try, stream); + fclose(stream); + if(nread_actual != nread_try){ + FreeBufferInfo(bufferinfo); + return NULL; + } + bufferinfo->nfile = nfile; + PRINT_TIMER(timer_file2buffer, "File2Buffer"); + *nreadptr = nread_actual; + return bufferinfo; +} /* ------------------ FileExistsOrig ------------------------ */ @@ -686,6 +833,12 @@ FILE *fopen_indir(char *dir, char *file, char *mode){ if(dir==NULL||strlen(dir)==0){ #ifdef WIN32 stream = _fsopen(file, mode, _SH_DENYNO); +#ifdef pp_OPEN_TEST + if(stream != NULL){ + AddOpenFile(file, stream, __FILE__, __LINE__); + open_files++; + } +#endif #else stream = fopen(file,mode); #endif @@ -701,6 +854,12 @@ FILE *fopen_indir(char *dir, char *file, char *mode){ strcat(filebuffer,file); #ifdef WIN32 stream = _fsopen(filebuffer, mode, _SH_DENYNO); +#ifdef pp_OPEN_TEST + if(stream != NULL){ + AddOpenFile(filebuffer, stream, __FILE__, __LINE__); + open_files++; + } +#endif #else stream = fopen(filebuffer, mode); #endif @@ -717,6 +876,12 @@ FILE *fopen_2dir(char *file, char *mode, char *scratch_dir){ if(file == NULL)return NULL; #ifdef WIN32 stream = _fsopen(file,mode,_SH_DENYNO); +#ifdef pp_OPEN_TEST + if(stream != NULL){ + AddOpenFile(file, stream, __FILE__, __LINE__); + open_files++; + } +#endif #else stream = fopen(file,mode); #endif @@ -912,7 +1077,7 @@ char *GetProgDir(char *progname, char **svpath){ if(lastsep==NULL){ char *dir; - dir = Which(progname); + dir = Which(progname, NULL); if(dir==NULL){ NewMemory((void **)&progpath,(unsigned int)3); strcpy(progpath,"."); @@ -1055,7 +1220,7 @@ void GetProgFullPath(char *progexe, int maxlen_progexe){ if(end == NULL){ char *progpath; - progpath = Which(progexe); + progpath = Which(progexe, NULL); if(progpath != NULL){ char copy[1024]; @@ -1079,7 +1244,7 @@ void GetProgFullPath(char *progexe, int maxlen_progexe){ /* ------------------ Which ------------------------ */ -char *Which(char *progname){ +char *Which(char *progname, char **fullprognameptr){ // returns the PATH directory containing the file progname @@ -1109,7 +1274,7 @@ char *Which(char *progname){ const char *ext; ext = prognamecopy+strlen(progname)-4; - if(strlen(progname)<=4||STRCMP(ext,".exe")!=0)strcat(prognamecopy, ".exe"); + if(strlen(progname)<=4|| (STRCMP(ext,".exe")!=0 && STRCMP(ext, ".bat") != 0))strcat(prognamecopy, ".exe"); } #endif @@ -1125,7 +1290,12 @@ char *Which(char *progname){ strcpy(pathentry,dir); strcat(pathentry,dirsep); FREEMEMORY(pathlistcopy); - FREEMEMORY(fullprogname); + if(fullprognameptr != NULL){ + *fullprognameptr = fullprogname; + } + else{ + FREEMEMORY(fullprogname); + } FREEMEMORY(prognamecopy); return pathentry; } diff --git a/Source/shared/file_util.h b/Source/shared/file_util.h index 67424fef79..908f72a10d 100644 --- a/Source/shared/file_util.h +++ b/Source/shared/file_util.h @@ -1,5 +1,12 @@ #ifndef FILE_UTIL_H_DEFINED #define FILE_UTIL_H_DEFINED +#include "fopen.h" + +#ifdef IN_FILE_UTIL +int show_timings=0; +#else +extern int show_timings; +#endif // vvvvvvvvvvvvvvvvvvvvvvvv header files vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv @@ -21,8 +28,9 @@ /* -------------------------- mtfiledata ------------------------------------ */ typedef struct { - char *file, *buffer; - FILE_SIZE file_size, chars_read; + char *file; + unsigned char *buffer; + FILE_SIZE file_size, chars_read, file_offset, nchars; int i, nthreads; } mtfiledata; @@ -35,8 +43,26 @@ typedef struct { int type; } filelistdata; +/* -------------------------- bufferdata ------------------------------------ */ + +typedef struct { + char *file; + unsigned char *buffer; // copy of file + FILE_SIZE nbuffer; // size of buffer + FILE_SIZE nfile; // amount of data in buffer +} bufferdata; + // vvvvvvvvvvvvvvvvvvvvvvvv preprocessing directives vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +#ifdef pp_OPEN_TEST +#ifndef fopen +#define fopen(x,y) fopen_counting(x,y,__FILE__,__LINE__) +#endif +#ifndef fclose +#define fclose(x) fclose_counting(x) +#endif +#endif + #ifdef WIN32 #define UNLINK _unlink #else @@ -51,6 +77,9 @@ typedef struct { #define FTELL(a) ftello(a) #endif +#define ALLDATA_OFFSET 0 +#define ALLDATA_NVALS 0 + #define REPLACE_FILE 0 #define APPEND_FILE 1 @@ -60,6 +89,9 @@ typedef struct { #define NOT_FORCE_IN_DIR 0 #define FORCE_IN_DIR 1 +#define DATA_AT_START 0 +#define DATA_MAPPED 1 + #define FEOF(stream) feof_buffer(stream->fileinfo) #define FGETS(buffer,size,stream) fgets_buffer(stream->fileinfo,buffer,size) #define REWIND(stream) rewind_buffer(stream->fileinfo) @@ -106,7 +138,14 @@ int FileExistsOrig(char *filename); #include "string_util.h" // vvvvvvvvvvvvvvvvvvvvvvvv headers vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv +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 void FileErase(char *file); EXTERNCPP void GetProgFullPath(char *progexe, int maxlen_progexe); +EXTERNCPP FILE *FOPEN(const char *file, const char *mode); EXTERNCPP FILE *fopen_indir(char *dir, char *file, char *mode); EXTERNCPP FILE *fopen_2dir(char *file, char *mode, char *scratch_dir); EXTERNCPP void TestWrite(char *scratchdir, char **fileptr); @@ -139,11 +178,12 @@ EXTERNCPP void FreeFileList(filelistdata *filelist, int *nfilelist); #define DIR_MODE 1 EXTERNCPP int GetFileListSize(const char *path, char *filter, int mode) ; EXTERNCPP int MakeFileList(const char *path, char *filter, int maxfiles, int sort_files, filelistdata **filelist, int mode); -EXTERNCPP char *Which(char *progname); +EXTERNCPP char *Which(char *progname, char **fullprognameptr); EXTERNCPP FILE_SIZE GetFileSizeSMV(const char *filename); EXTERNCPP time_t FileModtime(char *filename); EXTERNCPP int IsFileNewer(char *file1, char *file2); EXTERNCPP char *GetProgDir(char *progname, char **svpath); +EXTERNCPP void PrintTime(const char *tag, int line, float *timer, const char *label, int stop_flag); EXTERNCPP int IsSootFile(char *shortlabel, char *longlabel); diff --git a/Source/shared/fopen.c b/Source/shared/fopen.c new file mode 100644 index 0000000000..9a6233d5c6 --- /dev/null +++ b/Source/shared/fopen.c @@ -0,0 +1,116 @@ +#include "options.h" +#ifdef pp_OPEN_TEST +#define IN_FOPEN +#include +#include +#include +#include +#include "MALLOCC.h" +#include "fopen.h" + +/* ------------------ InitOpenTest ------------------------ */ + +void InitOpenTest(void){ +#ifdef pp_THREAD + pthread_mutex_init(&fopen_mutex, NULL); +#endif +} + +/* ------------------ AddOpenFile ------------------------ */ + +void AddOpenFile(const char *file, FILE *stream, char *source, int line){ + if(stream != NULL){ + opendata *oi; + + LOCK_FOPEN; + NEWMEM(openinfo, (nopeninfo+1) * sizeof(opendata)); + oi = openinfo + nopeninfo; + assert(strlen(file) < 1023); + assert(strlen(source) < 1023); + assert(line >= 0); + strcpy(oi->file, file); + strcpy(oi->source, source); + oi->line = line; + oi->stream = stream; + nopeninfo++; + UNLOCK_FOPEN; + } +} + +/* ------------------ RemoveOpenFile ------------------------ */ + +void RemoveOpenFile(FILE *stream){ + int i,remove_index=-1; + + LOCK_FOPEN; + for(i = 0; i < nopeninfo; i++){ + opendata *oi; + + oi = openinfo + i; + if(oi->stream == stream){ + oi->stream = NULL; + remove_index = i; + } + } + if(remove_index < 0){ + printf("file is not in list\n"); + return; + } + int nmove; + + nmove = nopeninfo - remove_index - 1; + if(nmove>0){ + memmove(openinfo + remove_index, openinfo + remove_index + 1, nmove * sizeof(opendata)); + } + nopeninfo--; + if(nopeninfo > 0){ + ResizeMemory(( void ** )&openinfo, nopeninfo * sizeof(opendata)); + } + else{ + nopeninfo=0; + FREEMEMORY(openinfo); + } + if(nopeninfo > 0){ + for(i = 0; i < nopeninfo; i++){ + opendata *oi; + + oi = openinfo + i; + printf("file: %s\n", oi->file); + printf("source: %s\n", oi->source); + printf("line: %i\n\n", oi->line); + } + } + UNLOCK_FOPEN; +} + +/* ------------------ fopen_counting ------------------------ */ + +FILE *fopen_counting(const char *file, const char *mode, char *source, int line) +{ + FILE *stream; + + stream = fopen(file, mode); + if(stream != NULL){ + AddOpenFile(file, stream, source, line); + open_files++; + } + return stream; +} + +/* ------------------ fclose_counting ------------------------ */ + +int fclose_counting(FILE *stream) +{ + int status; + + status = fclose(stream); + if(status==0){ + RemoveOpenFile(stream); + open_files--; + if(open_files < 0){ + printf("file count negative\n"); + } + } + return status; +} +#endif \ No newline at end of file diff --git a/Source/shared/fopen.h b/Source/shared/fopen.h new file mode 100644 index 0000000000..9f5fa8a48f --- /dev/null +++ b/Source/shared/fopen.h @@ -0,0 +1,51 @@ +#ifndef FILE_FOPEN_H_DEFINED +#define FILE_FOPEN_H_DEFINED +#ifdef pp_OPEN_TEST +#ifdef pp_THREAD +#include +#endif + +//*** structure + +typedef struct _opendata{ + char file[1024], source[1024]; + int line; + FILE *stream; +} opendata; + +//*** headers + +EXTERNCPP void AddOpenFile(const char *file, FILE * stream, char *source, int line); +EXTERNCPP void InitOpenTest(void); +EXTERNCPP FILE *fopen_counting(const char *path, const char *mode, char *source, int line); +EXTERNCPP int fclose_counting(FILE *fp); + +//*** preprocessing directives + +#ifdef pp_THREAD +#define LOCK_FOPEN pthread_mutex_lock(&fopen_mutex) +#define UNLOCK_FOPEN pthread_mutex_unlock(&fopen_mutex) +#else +#define LOCK_FOPEN +#define UNLOCK_FOPEN +#endif + +//*** variables + +#ifdef IN_FOPEN +int open_files=0, nopeninfo=0; +opendata *openinfo = NULL; +#ifdef pp_THREAD +pthread_mutex_t fopen_mutex; +#endif + +#else + +extern int open_files, nopeninfo; +extern opendata *openinfo; +#ifdef pp_THREAD +extern pthread_mutex_t fopen_mutex; +#endif +#endif +#endif +#endif diff --git a/Source/shared/getdata.c b/Source/shared/getdata.c index 5504ee957e..9cd61ee1eb 100644 --- a/Source/shared/getdata.c +++ b/Source/shared/getdata.c @@ -13,6 +13,7 @@ #include "datadefs.h" #include "getdata.h" #include "string_util.h" +#include "file_util.h" #include #include #ifdef __STDC_VERSION__ @@ -31,14 +32,24 @@ _Static_assert(sizeof(float) == 4, "getdata.c assumes that float is 4 bytes"); #endif #endif -// ------------------ getzonesize ------------------------ +/* ------------------ FOPEN ------------------------ */ #ifdef WIN32 -FILE *FOPEN(const char *file, const char *mode) { - return _fsopen(file, mode, _SH_DENYNO); +FILE* FOPEN(const char* file, const char* mode) { + FILE* stream; + stream = _fsopen(file, mode, _SH_DENYNO); +#ifdef pp_OPEN_TEST + if (stream != NULL) { + AddOpenFile(file, stream, __FILE__, __LINE__); + open_files++; + } +#endif + return stream; } #else -FILE *FOPEN(const char *file, const char *mode) { return fopen(file, mode); } +FILE* FOPEN(const char* file, const char* mode) { + return fopen(file, mode); +} #endif // ------------------ fortread ------------------------ @@ -646,10 +657,6 @@ void getzonedata(const char *zonefilename, int *nzonet, int *nrooms, return; } -// ! ------------------ skipdata ------------------------ - -int skipdata(FILE *file, int skip) { return fortseek(file, 1, skip, SEEK_CUR); } - // ! ------------------ getpatchdata ------------------------ // TODO: distinguish between more error conditions void getpatchdata(FILE *file, int npatch, int *pi1, int *pi2, int *pj1, @@ -706,7 +713,7 @@ void getdata1(FILE *file, int *ipart, int *error) { if (*error != 0) return; // Skip over irrelevant data. - *error = fortseek(file, sizeof(float), ibar * jbar * kbar, SEEK_CUR); + *error = fseek(file, 4+sizeof(float)*ibar*jbar*kbar+4, SEEK_CUR); if (*error != 0) return; *error = fortread(&nb1, sizeof(nb1), 1, file); diff --git a/Source/shared/getdata.h b/Source/shared/getdata.h index 6685e18dbf..1bd65d1e6c 100644 --- a/Source/shared/getdata.h +++ b/Source/shared/getdata.h @@ -32,7 +32,6 @@ void getpartdataframe(FILE *file, int nclasses, int *nquantities, int *npoints, void getzonedata(const char *zonefilename, int *nzonet, int *nrooms, int *nfires, float *zonet, float *zoneqfire, float *zonepr, float *zoneylay, float *zonetl, float *zonetu, int *error); -int skipdata(FILE *file, int skip); void getpatchdata(FILE *file, int npatch, int *pi1, int *pi2, int *pj1, int *pj2, int *pk1, int *pk2, float *patchtime, float *pqq, int *npqq, int *file_size, int *error); diff --git a/Source/shared/options_common.h b/Source/shared/options_common.h index 5b230cafce..37f943e61d 100644 --- a/Source/shared/options_common.h +++ b/Source/shared/options_common.h @@ -161,6 +161,30 @@ #define GLU_H #endif +#ifndef START_TIMER +#define START_TIMER(a) a = (float)clock()/(float)CLOCKS_PER_SEC +#endif + +#ifndef STOP_TIMER +#define STOP_TIMER(a) a = (float)clock()/(float)CLOCKS_PER_SEC - a +#endif + +#ifndef CUM_TIMER +#define CUM_TIMER(a,b) b += ((float)clock()/(float)CLOCKS_PER_SEC - a) +#endif + +#ifndef INIT_PRINT_TIMER +#define INIT_PRINT_TIMER(timer) float timer;START_TIMER(timer) +#endif + +#ifndef PRINT_TIMER +#define PRINT_TIMER(timer, label) PrintTime(__FILE__, __LINE__, &timer, label, 1) +#endif + +#ifndef PRINT_CUM_TIMER +#define PRINT_CUM_TIMER(timer, label) PrintTime(__FILE__, __LINE__, &timer, label, 0) +#endif + #include "lint.h" #endif diff --git a/Source/shared/readgeom.c b/Source/shared/readgeom.c index f1a0fbdf3f..409080e21b 100644 --- a/Source/shared/readgeom.c +++ b/Source/shared/readgeom.c @@ -1,16 +1,16 @@ #include "options.h" - #include "MALLOCC.h" -#include "gd.h" #include "string_util.h" +#include "gd.h" +#include -#include "datadefs.h" -#include "histogram.h" +#include +#include "smokeviewdefs.h" #include "isodefs.h" +#include "histogram.h" +#include "datadefs.h" #include "readgeom.h" -#include "smokeviewdefs.h" -#include -#include +#include "stdio_m.h" // ! ------------------ Dist ------------------------ @@ -21,48 +21,6 @@ float Dist(float v1[3], float v2[3]) { return sqrt(dx * dx + dy * dy + dz * dz); } -/* ------------------ Normalize ------------------------ */ - -void Normalize(float *xyz, int n) { - float norm, norm2; - int i; - - norm2 = 0.0; - - for (i = 0; i < n; i++) { - norm2 += xyz[i] * xyz[i]; - } - norm = sqrt(norm2); - if (norm < 0.00001) { - for (i = 0; i < n - 1; i++) { - xyz[i] = 0.0; - } - xyz[n - 1] = 1.0; - } - else { - for (i = 0; i < n; i++) { - xyz[i] /= norm; - } - } -} - -/* ----------------------- Dist2Plane ------------------------ */ - -float Dist2Plane(float x, float y, float z, float xyzp[3], float xyzpn[3]) { - float return_val; - float xyz[3]; - int i; - - xyz[0] = x; - xyz[1] = y; - xyz[2] = z; - return_val = 0.0; - for (i = 0; i < 3; i++) { - return_val += (xyz[i] - xyzp[i]) * xyzpn[i]; - } - return return_val; -} - /* ------------------ InitGeom ------------------------ */ void InitGeom(geomdata *geomi, int geomtype, int fdsblock, @@ -93,6 +51,9 @@ void InitGeom(geomdata *geomi, int geomtype, int fdsblock, geomi->have_cface_normals = have_cface_normals_arg; geomi->ncface_normals = 0; geomi->cface_normals = NULL; +#ifdef pp_ISOFRAME + geomi->frameinfo = NULL; +#endif } /* ------------------ RotateU2V ------------------------ */ @@ -824,14 +785,13 @@ void ReadGeomFile2(geomdata *geomi) { /* ------------------ ReadGeomHeader0 ------------------------ */ -void ReadGeomHeader0(geomdata *geomi, int *geom_frame_index, - int *ntimes_local) { - FILE *stream; - int one = 0; +void ReadGeomHeader0(geomdata *geomi, int *geom_frame_index, int *ntimes_local){ + FILE_m *stream; + int count_read; + int one=0; int nvertfaces[2]; float times_local[2]; int nt; - int returncode = 0; int version; int nfloat_vals, nint_vals; int *int_vals; @@ -860,75 +820,73 @@ void ReadGeomHeader0(geomdata *geomi, int *geom_frame_index, // surf_1, ..., surf_ntris (each tri_i is a triple I,J,K triangle int // indices ) - stream = fopen(geomi->file, "rb"); - if (stream == NULL) { - *ntimes_local = -1; + stream = fopen_b(geomi->file, NULL, 0, "rb"); + if(stream==NULL){ + *ntimes_local=-1; return; } - FSEEK(stream, 4, SEEK_CUR); - fread(&one, 4, 1, stream); - FSEEK(stream, 4, SEEK_CUR); - FORTREAD(&version, 4, 1, stream); + FORTREAD_m(&one,4,1,stream); + FORTREAD_m(&version, 4, 1, stream); // floating point header - FORTREAD(&nfloat_vals, 4, 1, stream); - if (nfloat_vals > 0) { - NewMemoryMemID((void **)&float_vals, nfloat_vals * sizeof(float), - geomi->memory_id); - FORTREAD(float_vals, 4, nfloat_vals, stream); - geomi->float_vals = float_vals; - geomi->nfloat_vals = nfloat_vals; + FORTREAD_m(&nfloat_vals, 4, 1, stream); + if(nfloat_vals>0){ + NewMemoryMemID((void **)&float_vals,nfloat_vals*sizeof(float),geomi->memory_id); + FORTREAD_m(float_vals, 4, nfloat_vals, stream); + geomi->float_vals=float_vals; + geomi->nfloat_vals=nfloat_vals; } // integer header - FORTREAD(&nint_vals, 4, 1, stream); - if (nint_vals > 0) { - NewMemoryMemID((void **)&int_vals, nint_vals * sizeof(float), - geomi->memory_id); - FORTREAD(int_vals, 4, nint_vals, stream); - geomi->int_vals = int_vals; - geomi->nint_vals = nint_vals; + FORTREAD_m(&nint_vals, 4, 1, stream); + if(nint_vals>0){ + NewMemoryMemID((void **)&int_vals,nint_vals*sizeof(float),geomi->memory_id); + FORTREAD_m(int_vals, 4, nint_vals, stream); + geomi->int_vals=int_vals; + geomi->nint_vals=nint_vals; } // static verts - FORTREAD(nvertfaces, 4, 2, stream); - nverts = nvertfaces[0]; - ntris = nvertfaces[1]; + FORTREAD_m(nvertfaces, 4, 2, stream); + nverts=nvertfaces[0]; + ntris=nvertfaces[1]; // static vertices - if (nverts > 0) { - FSEEK(stream, 4 + 3 * nverts * 4 + 4, SEEK_CUR); + if(nverts>0){ + fseek_m(stream,4+3*nverts*4+4,SEEK_CUR); } // static triangles - if (ntris > 0) { - FSEEK(stream, 4 + 3 * ntris * 4 + 4, SEEK_CUR); - FSEEK(stream, 4 + ntris * 4 + 4, SEEK_CUR); + if(ntris>0){ + fseek_m(stream,4+3*ntris*4+4,SEEK_CUR); + fseek_m(stream,4+ntris*4+4,SEEK_CUR); } - nt = 0; - for (;;) { - FORTREADBR(times_local, 2, stream); - FORTREADBR(nvertfaces, 2, stream); - nverts = nvertfaces[0]; - ntris = nvertfaces[1]; + nt=0; + for(;;){ + FORTREAD_m(times_local, 4, 2, stream); + if(count_read!=2)break; + FORTREAD_m(nvertfaces, 4, 2, stream); + if(count_read!=2)break; + nverts=nvertfaces[0]; + ntris=nvertfaces[1]; // dynamic vertices - if (nverts > 0) { - FSEEK(stream, 4 + 3 * nverts * 4 + 4, SEEK_CUR); + if(nverts>0){ + fseek_m(stream,4+3*nverts*4+4,SEEK_CUR); } // dynamic faces - if (ntris > 0) { - FSEEK(stream, 4 + 3 * ntris * 4 + 4, SEEK_CUR); - FSEEK(stream, 4 + ntris * 4 + 4, SEEK_CUR); + if(ntris>0){ + fseek_m(stream,4+3*ntris*4+4,SEEK_CUR); + fseek_m(stream,4+ntris*4+4,SEEK_CUR); } if (geom_frame_index == NULL) { @@ -938,8 +896,8 @@ void ReadGeomHeader0(geomdata *geomi, int *geom_frame_index, } nt++; } - *ntimes_local = nt; - fclose(stream); + *ntimes_local=nt; + fclose_b(stream); } /* ------------------ ReadGeomHeader2 ------------------------ */ @@ -1036,22 +994,23 @@ void ReadGeomHeader2(geomdata *geomi, int *ntimes_local) { /* ------------------ ReadGeomHeader ------------------------ */ -void ReadGeomHeader(geomdata *geomi, int *geom_frame_index, int *ntimes_local) { - FILE *stream; - int version; - int returncode = 0; - int one = 0; +void ReadGeomHeader(geomdata *geomi, int *geom_frame_index, int *ntimes_local){ + FILE_m *stream; + int version, one=0, count_read; - stream = fopen(geomi->file, "rb"); - if (stream == NULL) { + stream = fopen_b(geomi->file, NULL, 0, "rb"); + if(stream==NULL){ + *ntimes_local=-1; + return; + } + FORTREAD_m(&one,4,1,stream); + FORTREAD_m(&version, 4, 1, stream); + if(count_read != 1){ + fclose_b(stream); *ntimes_local = -1; return; } - FSEEK(stream, 4, SEEK_CUR); - fread(&one, 4, 1, stream); - FSEEK(stream, 4, SEEK_CUR); - FORTREAD(&version, 4, 1, stream); - fclose(stream); + fclose_b(stream); if (version <= 1) { ReadGeomHeader0(geomi, geom_frame_index, ntimes_local); diff --git a/Source/shared/readgeom.h b/Source/shared/readgeom.h index ac8b8d6b46..4c29de5bec 100644 --- a/Source/shared/readgeom.h +++ b/Source/shared/readgeom.h @@ -4,6 +4,9 @@ #include "gd.h" #include "options.h" #include "string_util.h" +#ifdef pp_ISOFRAME +#include "IOframe.h" +#endif #include "shared_structures.h" @@ -110,6 +113,9 @@ typedef struct _geomdata { geomobjdata *geomobjinfo; int *geomobj_offsets; int ngeomobj_offsets; +#ifdef pp_ISOFRAME + framedata *frameinfo; +#endif } geomdata; void InitGeom(geomdata *geomi, int geomtype, int fdsblock, diff --git a/Source/shared/shared_structures.h b/Source/shared/shared_structures.h index 5de3c3251c..1e03ec8d69 100644 --- a/Source/shared/shared_structures.h +++ b/Source/shared/shared_structures.h @@ -53,8 +53,7 @@ typedef struct _meshdata { struct _meshdata *floor_mesh; #ifdef pp_GPU GLuint blockage_texture_id; - struct _smoke3ddata *smoke3d_soot, *smoke3d_hrrpuv, *smoke3d_temp, - *smoke3d_co2; + struct _smoke3ddata *smoke3d_soot, *smoke3d_hrrpuv, *smoke3d_temp, *smoke3d_co2; GLuint volsmoke_texture_id, volfire_texture_id; float *volsmoke_texture_buffer, *volfire_texture_buffer; int voltest_update; @@ -77,13 +76,11 @@ typedef struct _meshdata { int drawsides[7]; int extsides[7]; // 1 if on exterior side of a supermesh, 0 otherwise int is_extface[6]; // MESH_EXT if face i is completely adjacent to exterior, - // MESH_INT if face i is completely adjacent to another - // mesh, + // MESH_INT if face i is completely adjacent to another mesh, // MESH_BOTH if face i is neither int inside; - int in_frustum; // 1 if part or all of mesh is in the view frustum - float boxmin[3], boxmiddle[3], boxmax[3], dbox[3], boxeps[3], dcell, - dcell3[3], verts[24], eyedist; + int in_frustum; // 1 if part or all of mesh is in the view frustum + float boxmin[3], boxmiddle[3], boxmax[3], dbox[3], boxeps[3], dcell, dcell3[3], verts[24], eyedist; float boxeps_fds[3]; float slice_min[3], slice_max[3]; float boxmin_scaled[3], boxmiddle_scaled[3], boxmax_scaled[3]; @@ -102,10 +99,8 @@ typedef struct _meshdata { int n_imap, n_jmap, n_kmap; unsigned char *boundary_mask; - char *c_iblank_node0, *c_iblank_cell0, *c_iblank_x0, *c_iblank_y0, - *c_iblank_z0; - char *c_iblank_node0_temp, *c_iblank_cell0_temp, *c_iblank_x0_temp, - *c_iblank_y0_temp, *c_iblank_z0_temp; + char *c_iblank_node0, *c_iblank_cell0, *c_iblank_x0, *c_iblank_y0, *c_iblank_z0; + char *c_iblank_node0_temp, *c_iblank_cell0_temp, *c_iblank_x0_temp, *c_iblank_y0_temp, *c_iblank_z0_temp; char *c_iblank_node_html; char *c_iblank_node_html_temp; float *f_iblank_cell0; @@ -114,9 +109,8 @@ typedef struct _meshdata { float *block_zdist0; float *opacity_adjustments; - char *c_iblank_node, *c_iblank_cell, *c_iblank_x, *c_iblank_y, *c_iblank_z; - char *c_iblank_node_temp, *c_iblank_cell_temp, *c_iblank_x_temp, - *c_iblank_y_temp, *c_iblank_z_temp; + char *c_iblank_node, *c_iblank_cell, *c_iblank_x, *c_iblank_y, *c_iblank_z; + char *c_iblank_node_temp, *c_iblank_cell_temp, *c_iblank_x_temp, *c_iblank_y_temp, *c_iblank_z_temp; float *f_iblank_cell; float *f_iblank_cell_temp; char *c_iblank_embed; @@ -161,14 +155,14 @@ typedef struct _meshdata { unsigned char *iso_times_map; int *iso_timeslist; int iso_itime; - int smokedir, smokedir_old; + int smokedir,smokedir_old; float dxDdx, dyDdx, dzDdx, dxyDdx, dxzDdx, dyzDdx, dxyz_orig[3]; float smoke_dist[6]; float norm[3]; float dplane_min[4], dplane_max[4]; int *boundarytype; - int *patchdir, *patch_surfindex; + int *patchdir,*patch_surfindex; int *pi1, *pi2, *pj1, *pj2, *pk1, *pk2; struct _meshdata *skip_nabors[6]; int *blockonpatch; @@ -182,28 +176,29 @@ typedef struct _meshdata { float *xyzpatch, *xyzpatch_threshold; unsigned char *cpatchval_zlib, *cpatchval_iframe_zlib; unsigned char *cpatchval, *cpatchval_iframe; - float *patch_times, *patch_timesi, *patchval, *patchval_iframe; + float *patch_times, *patch_timesi, *patchval; +#ifndef pp_BOUNDFRAME + float *patchval_iframe; +#endif unsigned char *patch_times_map; float **patchventcolors; float *thresholdtime; int *patchblank; - int npatch_times, npatches; + int npatch_times,npatches; int patch_itime; int *patch_timeslist; int npatchsize; int visInteriorBoundaries; - float surface_tempmin, surface_tempmax; int nface_textures, nface_outlines, nfaces; int nface_normals_single, nface_normals_double, nface_transparent_double; - struct _facedata *faceinfo, **face_normals_single, **face_normals_double, - **face_transparent_double, **face_textures, **face_outlines; - struct _facedata **face_normals_single_DOWN_X, **face_normals_single_UP_X; - struct _facedata **face_normals_single_DOWN_Y, **face_normals_single_UP_Y; - struct _facedata **face_normals_single_DOWN_Z, **face_normals_single_UP_Z; - int nface_normals_single_DOWN_X, nface_normals_single_UP_X; - int nface_normals_single_DOWN_Y, nface_normals_single_UP_Y; - int nface_normals_single_DOWN_Z, nface_normals_single_UP_Z; + struct _facedata *faceinfo, **face_normals_single, **face_normals_double, **face_transparent_double, **face_textures, **face_outlines; + struct _facedata **face_normals_single_DOWN_X,**face_normals_single_UP_X; + struct _facedata **face_normals_single_DOWN_Y,**face_normals_single_UP_Y; + struct _facedata **face_normals_single_DOWN_Z,**face_normals_single_UP_Z; + int nface_normals_single_DOWN_X,nface_normals_single_UP_X; + int nface_normals_single_DOWN_Y,nface_normals_single_UP_Y; + int nface_normals_single_DOWN_Z,nface_normals_single_UP_Z; int itextureoffset; @@ -213,16 +208,16 @@ typedef struct _meshdata { struct _clipdata *box_clipinfo; - unsigned char *merge_color, *merge_alpha; + unsigned char *merge_color,*merge_alpha; unsigned char *smokecolor_ptr, *smokealpha_ptr; char *label; - int ncullgeominfo, nxyzgeomcull[3], nxyzskipgeomcull[3]; + int ncullgeominfo,nxyzgeomcull[3],nxyzskipgeomcull[3]; struct _culldata *cullgeominfo; struct _volrenderdata *volrenderinfo; - int nslicex, nslicey, nslicez; + int nslicex, nslicey, nslicez; struct _slicedata **slicex, **slicey, **slicez; struct _meshplanedata *gsliceinfo; diff --git a/Source/shared/stdio_m.c b/Source/shared/stdio_m.c index 7d293934f2..1fd5512102 100644 --- a/Source/shared/stdio_m.c +++ b/Source/shared/stdio_m.c @@ -92,6 +92,54 @@ FILE_m *fopen_m(char *file, char *mode){ return fopen_mo(file, 0, 0, mode); } +/* ------------------ fopen_b ------------------------ */ + +FILE_m *fopen_b(char *file, unsigned char *buffer, size_t nbuffer, char *mode){ + FILE_m *stream_m = NULL; + char *m_file; + + if(file == NULL || strlen(file) == 0 || mode == NULL || strlen(mode) < 2)return NULL; + if(strcmp(mode, "rb") !=0)return NULL; + + if(NewMemory(( void ** )&m_file, strlen(file) + 1) == 0){ // memory allocation failed so abort + return NULL; + } + strcpy(m_file, file); + + if(NewMemory(( void ** )&stream_m, sizeof(FILE_m)) == 0){ + FREEMEMORY(m_file); + return NULL; + } + stream_m->buffer = buffer; + stream_m->buffer_beg = buffer; + stream_m->buffer_end = buffer + nbuffer; + stream_m->file = m_file; + if(buffer == NULL){ + stream_m->stream = fopen(file, mode); + if(stream_m->stream == NULL){ + FREEMEMORY(stream_m); + FREEMEMORY(m_file); + } + } + else{ + stream_m->stream = NULL; + } + return stream_m; +} + +/* ------------------ fclose_b ------------------------ */ + +void fclose_b(FILE_m *stream_m){ + if(stream_m == NULL)return; + if(stream_m->stream == NULL){ + FREEMEMORY(stream_m->file); + FREEMEMORY(stream_m); + } + else{ + fclose(stream_m->stream); + } +} + /* ------------------ fclose_m ------------------------ */ void fclose_m(FILE_m *stream_m){ @@ -115,13 +163,13 @@ size_t fread_m(void *ptr, size_t size, size_t nmemb, FILE_m *stream_m){ unsigned char *buffer_end; buffer_end = stream_m->buffer + size*nmemb; - if(buffer_end-stream_m->buffer_end>=0){ + if(buffer_end-stream_m->buffer_end>0){ stream_m->buffer = buffer_end; return 0; } memcpy(ptr, stream_m->buffer, size*nmemb); stream_m->buffer = buffer_end; - return_val = size*nmemb; + return_val = nmemb; } else{ return_val = fread(ptr, size, nmemb, stream_m->stream); @@ -135,7 +183,7 @@ size_t fread_mv(void **ptr, size_t size, size_t nmemb, FILE_m *stream_m){ if(stream_m->stream!=NULL)return 0; *ptr= stream_m->buffer; stream_m->buffer += size*nmemb; - return size*nmemb; + return nmemb; } /* ------------------ feof_m ------------------------ */ diff --git a/Source/shared/stdio_m.h b/Source/shared/stdio_m.h index c5975e6fbb..d4d6f17d64 100644 --- a/Source/shared/stdio_m.h +++ b/Source/shared/stdio_m.h @@ -13,10 +13,20 @@ typedef struct { #define FFALSE 0 #endif +#ifndef FORTREAD_m +#define FORTREAD_m(a,b,c,d) fseek_m(stream,4,SEEK_CUR);count_read=fread_m(a,b,c,d);fseek_m(stream,4,SEEK_CUR) +#endif +#ifndef FORTREAD_mv +#define FORTREAD_mv(a,b,c,d) fseek_m(stream,4,SEEK_CUR);count_read=fread_mv(a,b,c,d);fseek_m(stream,4,SEEK_CUR) +#endif + + +void fclose_b(FILE_m *stream_m); void fclose_m(FILE_m *stream_m); char *fgets_m(char * str, int num, FILE_m *stream_m); int feof_m(FILE_m *stream_m); FILE_m *fopen_m(char *file, char *mode); +FILE_m *fopen_b(char *file, unsigned char *buffer, size_t nbuffer, char *mode); 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); diff --git a/Source/shared/string_util.c b/Source/shared/string_util.c index fa325275b5..f3de0dccad 100644 --- a/Source/shared/string_util.c +++ b/Source/shared/string_util.c @@ -370,11 +370,19 @@ char *TrimFrontZeros(char *line){ return line; } +/* ------------------ Val2String ------------------------ */ + +char *Val2String(float val, char *string){ + sprintf(string, "%f", val); + TrimZeros(string); + return string; +} + /* ------------------ TrimMZeros ------------------------ */ void TrimMZeros(char *line){ -// removes trailing zeros in each floating point number found in line +// removes trailing zeros in each floating point number found in line separated by spaces char linecopy[1024]; char *token; @@ -1299,7 +1307,7 @@ int SetLabels(flowlabels *flowlabel, char *longlabel, char *shortlabel, char *un strcpy(buffer,longlabel); } len=strlen(buffer); - if(NewMemory((void **)&flowlabel->longlabel,(unsigned int)(len+1))==0)return LABEL_ERR; + if(NEWMEM(flowlabel->longlabel,(unsigned int)(len+1))==0)return LABEL_ERR; STRCPY(flowlabel->longlabel,buffer); if(shortlabel==NULL){ @@ -1309,7 +1317,7 @@ int SetLabels(flowlabels *flowlabel, char *longlabel, char *shortlabel, char *un strcpy(buffer,shortlabel); } len=strlen(buffer); - if(NewMemory((void **)&flowlabel->shortlabel,(unsigned int)(len+1))==0)return LABEL_ERR; + if(NEWMEM(flowlabel->shortlabel,(unsigned int)(len+1))==0)return LABEL_ERR; STRCPY(flowlabel->shortlabel,buffer); if(unit==NULL){ @@ -1319,7 +1327,7 @@ int SetLabels(flowlabels *flowlabel, char *longlabel, char *shortlabel, char *un strcpy(buffer,unit); } len=strlen(buffer); - if(NewMemory((void **)&flowlabel->unit,(unsigned int)(len+1))==0)return LABEL_ERR; + if(NEWMEM(flowlabel->unit,(unsigned int)(len+1))==0)return LABEL_ERR; STRCPY(flowlabel->unit,buffer); return LABEL_OK; @@ -1694,7 +1702,7 @@ unsigned char *GetHashSHA1(char *file){ if(stream==NULL){ char *pathentry, fullpath[1024]; - pathentry = Which(file); + pathentry = Which(file, NULL); if(pathentry==NULL){ strcpy(fullpath,"."); strcat(fullpath,dirseparator); @@ -1757,7 +1765,7 @@ unsigned char *GetHashMD5(char *file){ if(stream == NULL){ char *pathentry, fullpath[1024]; - pathentry = Which(file); + pathentry = Which(file, NULL); if(pathentry==NULL){ strcpy(fullpath,"."); strcat(fullpath,dirseparator); @@ -1811,7 +1819,7 @@ unsigned char *GetHashSHA256(char *file){ if(stream==NULL){ char *pathentry, fullpath[1024]; - pathentry = Which(file); + pathentry = Which(file, NULL); if(pathentry==NULL){ strcpy(fullpath,"."); strcat(fullpath,dirseparator); diff --git a/Source/shared/string_util.h b/Source/shared/string_util.h index 36d799ec65..ea4e127595 100644 --- a/Source/shared/string_util.h +++ b/Source/shared/string_util.h @@ -116,6 +116,7 @@ EXTERNCPP const char *TrimFrontConst(const char *line); EXTERNCPP void TrimZeros(char *line); EXTERNCPP char *TrimFrontZeros(char *line); +EXTERNCPP char *Val2String(float val, char *string); EXTERNCPP void TrimMZeros(char *line); EXTERNCPP char *Strstr(char *c, char *key); EXTERNCPP char *STRSTR(char *c, const char *key); diff --git a/Source/shared/threader.c b/Source/shared/threader.c index 4d93e61eb5..6312c6b012 100644 --- a/Source/shared/threader.c +++ b/Source/shared/threader.c @@ -27,7 +27,7 @@ void *Sample(void *arg){ sample_threads = THREADinit(&n_sample_threads, &use_sample_threads, Sample); //*** call to do the work -THREADrun(sample_threads, arg); +THREADrun(sample_threads); #endif /* ------------------ THREADinit ------------------------ */ @@ -96,34 +96,9 @@ void THREADcontrol(threaderdata *thi, int var){ #endif } -/* ------------------ THREADrun ------------------------ */ - -void THREADrun(threaderdata *thi, void *arg){ -#ifdef pp_THREAD - if(thi == NULL)return; - if(thi->use_threads_ptr!=NULL)thi->use_threads = *(thi->use_threads_ptr); - if(thi->n_threads_ptr != NULL){ - thi->n_threads = *(thi->n_threads_ptr); - if(thi->n_threads>MAX_THREADS)thi->n_threads = MAX_THREADS; - } - if(thi->use_threads == 1){ - int i; - - for(i = 0; i < thi->n_threads; i++){ - pthread_create(thi->thread_ids + i, NULL, thi->run, arg); - } - } - else{ - thi->run(arg); - } -#else - thi->run(arg); -#endif -} - /* ------------------ THREADruni ------------------------ */ -void THREADruni(threaderdata *thi, int *args){ +void THREADruni(threaderdata *thi, unsigned char *datainfo, int sizedatai){ #ifdef pp_THREAD if(thi == NULL)return; if(thi->use_threads_ptr != NULL)thi->use_threads = *(thi->use_threads_ptr); @@ -134,21 +109,30 @@ void THREADruni(threaderdata *thi, int *args){ int i; for(i = 0; i < thi->n_threads; i++){ - int *arg; + unsigned char *datai; - arg = args + 2 * i; - arg[0] = thi->n_threads; - arg[1] = i; + datai = datainfo + i*sizedatai; if(thi->use_threads == 1){ - pthread_create(thi->thread_ids + i, NULL, thi->run, arg); + pthread_create(thi->thread_ids + i, NULL, thi->run, (void *)datai); } else{ - thi->run(arg); + thi->run(datai); } } #else - args[0] = 1; - args[1] = -1; - thi->run(args); + int i; + + for(i = 0; i < thi->n_threads; i++){ + unsigned char *data; + + datai = datainfo + i*sizedatai; + thi->run(datai); + } #endif } + +/* ------------------ THREADrun ------------------------ */ + +void THREADrun(threaderdata *thi){ + THREADruni(thi, NULL, 0); +} diff --git a/Source/shared/threader.h b/Source/shared/threader.h index df61d5da1f..8bc7997044 100644 --- a/Source/shared/threader.h +++ b/Source/shared/threader.h @@ -1,6 +1,7 @@ #ifndef THREADER_H_DEFINED #define THREADER_H_DEFINED #include +#include "file_util.h" //*** parameters @@ -29,8 +30,8 @@ typedef struct _threaderdata{ //*** routines EXTERNCPP void THREADcontrol(threaderdata *thi, int var); -EXTERNCPP void THREADrun(threaderdata *thi, void *arg); -EXTERNCPP void THREADruni(threaderdata *thi, int *args); +EXTERNCPP void THREADrun(threaderdata *thi); +EXTERNCPP void THREADruni(threaderdata *thi, unsigned char *datainfo, int sizedatai); EXTERNCPP threaderdata *THREADinit(int *nthreads_arg, int *threading_on_arg, void *(*run_arg)(void *arg)); //*** threader controls diff --git a/Source/smokeview/IOboundary.c b/Source/smokeview/IOboundary.c index 8701858d67..cf18ea1678 100644 --- a/Source/smokeview/IOboundary.c +++ b/Source/smokeview/IOboundary.c @@ -1030,7 +1030,7 @@ void DrawOnlyThreshold(const meshdata *meshi){ void GetBoundaryDataZlib(patchdata *patchi, unsigned char *data, int ndata, float *local_times, unsigned int *zipoffset, unsigned int *zipsize, int ntimes_local){ - FILE *stream; + FILE_m *stream; float local_time; unsigned int compressed_size; int npatches; @@ -1055,22 +1055,34 @@ void GetBoundaryDataZlib(patchdata *patchi, unsigned char *data, int ndata, // compressed size of frame // compressed buffer - stream = fopen(patchi->file, "rb"); + +#ifdef pp_BOUNDFRAME + unsigned char *buffer=NULL; + int nbuffer=0; + + if(patchi->frameinfo!=NULL&&patchi->frameinfo->bufferinfo!=NULL){ + buffer = patchi->frameinfo->bufferinfo->buffer; + nbuffer = patchi->frameinfo->bufferinfo->nbuffer; + } + stream = fopen_b(( char * )patchi->file, buffer, nbuffer, "rb"); +#else + stream = fopen_m((char *)patchi->file, "rb"); +#endif if(stream==NULL)return; - FSEEK(stream, 12, SEEK_CUR); - fread(&version, 4, 1, stream); - FSEEK(stream, 16, SEEK_CUR); - fread(&npatches, 4, 1, stream); + fseek_m(stream, 12, SEEK_CUR); + fread_m(&version, 4, 1, stream); + fseek_m(stream, 16, SEEK_CUR); + fread_m(&npatches, 4, 1, stream); if(version==0){ local_skip = 6*npatches*4; } else{ local_skip = 9*npatches*4; } - return_code = FSEEK(stream, local_skip, SEEK_CUR); + return_code = fseek_m(stream, local_skip, SEEK_CUR); if(return_code!=0){ - fclose(stream); + fclose_m(stream); return; } datacopy = data; @@ -1082,19 +1094,22 @@ void GetBoundaryDataZlib(patchdata *patchi, unsigned char *data, int ndata, for(;;){ int skip_frame; - if(fread(&local_time, 4, 1, stream)==0)break; + if(fread_m(&local_time, 4, 1, stream)!=1)break; skip_frame = 1; if(local_time>time_max){ time_max = local_time; skip_frame = 0; local_count++; } - if(fread(&compressed_size, 4, 1, stream)==0)break; + if(fread_m(&compressed_size, 4, 1, stream) != 1)break; if(skip_frame==0&&local_count%tload_step==0){ - if(fread(datacopy, 1, compressed_size, stream)==0)break; + int count; + + count = fread_m(datacopy, 1, compressed_size, stream); + if(count != compressed_size)break; } else{ - FSEEK(stream, compressed_size, SEEK_CUR); + if(fseek_m(stream, compressed_size, SEEK_CUR) != 0)break; } if(skip_frame==1||local_count%tload_step!=0)continue; @@ -1107,7 +1122,9 @@ void GetBoundaryDataZlib(patchdata *patchi, unsigned char *data, int ndata, datacopy += compressed_size; offset += compressed_size; } - fclose(stream); +#ifndef pp_BOUNDFRAME + fclose_m(stream); +#endif } /* ------------------ GetBoundaryHeader ------------------------ */ @@ -1389,9 +1406,122 @@ int GetPatchNTimes(char *file){ return count; } +// ! ------------------ GetPatchSizes1 ------------------------ + +void GetPatchSizes1(FILE_m **stream, const char *patchfilename, unsigned char *buffer, int nbuffer, int *npatch, int *headersize, int *error){ + + *error = 0; + assert(stream !=NULL); + if(stream == NULL){ + printf("***Error: null pointer in getpatchsizes1 routine\n"); + *error = 1; + return; + } +#ifdef pp_BOUNDFRAME + *stream = fopen_b(( char * )patchfilename, buffer, nbuffer, "rb"); +#else + *stream = fopen_m((char *)patchfilename, "rb"); +#endif + if(*stream == NULL){ + printf(" The boundary file , %s, failed to open\n", patchfilename); + *error = 1; + return; + } + + // skip over long, short and unit labels (each 30 characters in length); + *error = fseek_m(*stream, 4+30+4, SEEK_SET); + *error = fseek_m(*stream, 4+30+4, SEEK_CUR); + *error = fseek_m(*stream, 4+30+4, SEEK_CUR); + if(*error == 0){ + fseek_m(*stream, 4, SEEK_CUR); fread_m(npatch, sizeof(*npatch), 1, *stream); fseek_m(*stream, 4, SEEK_CUR); + } + *headersize = 3 * (4 + 30 + 4) + 4 + 4 + 4; + return; +} + +// ! ------------------ GetPatchSizes2 ------------------------ + +void GetPatchSizes2(FILE_m *stream, int version, int npatch, int *npatchsize, + int *pi1, int *pi2, int *pj1, int *pj2, int *pk1, int *pk2, + int *patchdir, int *headersize, int *framesize){ + int ijkp[9] = {0}; + + *npatchsize = 0; + + int n; + for (n = 0; n < npatch; n++){ + if(version == 0){ + fseek_m(stream, 4, SEEK_CUR);fread_m(ijkp, sizeof(*ijkp), 6, stream);fseek_m(stream, 4, SEEK_CUR); + } + else { + fseek_m(stream, 4, SEEK_CUR); fread_m(ijkp, sizeof(*ijkp), 9, stream); fseek_m(stream, 4, SEEK_CUR); + patchdir[n] = ijkp[6]; + } + pi1[n] = ijkp[0]; + pi2[n] = ijkp[1]; + pj1[n] = ijkp[2]; + pj2[n] = ijkp[3]; + pk1[n] = ijkp[4]; + pk2[n] = ijkp[5]; + + int i1 = ijkp[0]; + int i2 = ijkp[1]; + int j1 = ijkp[2]; + int j2 = ijkp[3]; + int k1 = ijkp[4]; + int k2 = ijkp[5]; + *npatchsize += (i2 + 1 - i1) * (j2 + 1 - j1) * (k2 + 1 - k1); + } + *headersize += npatch * (4 + 6 * 4 + 4); + if(version == 1){ + *headersize += npatch * 4; + } + *framesize = 8 + 4 + 8 * npatch + (*npatchsize) * 4; + + return; +} +/* ------------------ GetPatchData ------------------------ */ + +void GetPatchData(FILE_m *stream, int npatch, int *pi1, int *pi2, int *pj1, + int *pj2, int *pk1, int *pk2, float *patchtime, float *pqq, + int *npqq, int *file_sizeptr, int *error){ + int i1, i2, j1, j2, k1, k2, size, ibeg; + int file_size; + int count; + + file_size = 0; + *error = 0; + fseek_m(stream, 4, SEEK_CUR); count = fread_m(patchtime, sizeof(*patchtime), 1, stream); fseek_m(stream, 4, SEEK_CUR); + if(count != 1)*error = 1; + file_size = file_size + 4; + if(*error != 0) return; + ibeg = 0; + *npqq = 0; + + int i; + for(i = 0; i < npatch; i++){ + i1 = pi1[i]; + i2 = pi2[i]; + j1 = pj1[i]; + j2 = pj2[i]; + k1 = pk1[i]; + k2 = pk2[i]; + size = (i2 + 1 - i1) * (j2 + 1 - j1) * (k2 + 1 - k1); + *npqq += size; + fseek_m(stream, 4, SEEK_CUR); count = fread_m(&pqq[ibeg], sizeof(*pqq), size, stream); fseek_m(stream, 4, SEEK_CUR); + if(count != size)*error = 1; + // TODO: hardcodes float size. + file_size += 4 * size; + if(*error != 0) break; + ibeg += size; + } + *file_sizeptr = file_size; + return; +} + /* ------------------ ReadBoundaryBndf ------------------------ */ -FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ +FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){ int error; int patchfilenum; float *xyzpatchcopy; @@ -1414,18 +1544,21 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ int npatchvals; char patchcsvfile[1024]; int framestart; +#ifdef pp_BOUNDFRAME + int time_frame = ALL_FRAMES; +#endif int nn; int filenum; int ncompressed_buffer; char *file; float read_time, total_time; - FILE *file_unit = NULL; + FILE_m *stream = NULL; int wallcenter=0; FILE_SIZE return_filesize = 0; patchi = patchinfo + ifile; - if(patchi->loaded==0&&flag==UNLOAD)return 0; + if(patchi->loaded==0&&load_flag==UNLOAD)return 0; if(strcmp(patchi->label.shortlabel,"wc")==0)wallcenter=1; if(output_patchdata==1){ @@ -1441,7 +1574,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ highlight_mesh = blocknumber; meshi = meshinfo+blocknumber; UpdateCurrentMesh(meshi); - if(flag!=UNLOAD&&meshi->patchfilenum >= 0 && meshi->patchfilenum < npatchinfo){ + if(load_flag!=RELOAD&&load_flag!=UNLOAD&&meshi->patchfilenum >= 0 && meshi->patchfilenum < npatchinfo){ patchdata *patchold; patchold = patchinfo + meshi->patchfilenum; @@ -1454,11 +1587,13 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ meshi->patchfilenum = ifile; filenum = meshi->patchfilenum; +#ifndef pp_BOUNDFRAME #ifndef pp_FSEEK - if(flag==RELOAD)flag = LOAD; + if(load_flag==RELOAD)load_flag = LOAD; +#endif #endif - if(flag!=RELOAD&&filenum>=0&&filenum=0&&filenumloaded=0; } @@ -1469,7 +1604,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ if(nbb==0)nbb=1; updatefaces=1; *errorcode=0; - if(flag != RELOAD){ + if(load_flag != RELOAD){ FREEMEMORY(meshi->blockonpatch); FREEMEMORY(meshi->meshonpatch); FREEMEMORY(meshi->patchdir); @@ -1498,9 +1633,13 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ FREEMEMORY(meshi->patch_times); FREEMEMORY(meshi->patch_times_map); FREEMEMORY(meshi->patchblank); +#ifdef pp_BOUNDFRAME + FRAMEFree(patchi->frameinfo); + patchi->frameinfo = NULL; +#endif } - if(flag==UNLOAD){ + if(load_flag==UNLOAD){ UpdateBoundaryType(); UpdateUnitDefs(); UpdateTimes(); @@ -1511,6 +1650,16 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ PrintMemoryInfo; return 0; } + +#ifdef pp_BOUNDFRAME + patchi->frameinfo = FRAMELoadData(patchi->frameinfo, patchi->file, load_flag, time_frame, FORTRAN_FILE, GetBoundaryFrameInfo); + patchi->ntimes = patchi->frameinfo->nframes; + NewMemory((void **)&meshi->patch_times, patchi->ntimes*sizeof(float)); + memcpy(meshi->patch_times, patchi->frameinfo->times, patchi->ntimes*sizeof(float)); + FRAMEGetMinMax(patchi->frameinfo); + update_frame = 1; +#endif + if(ifile>=0&&ifilelabel.shortlabel); } @@ -1541,7 +1690,15 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ } if(patchi->compression_type==UNCOMPRESSED){ - getpatchsizes1(&file_unit,file,&meshi->npatches,&headersize,&error); + unsigned char *buffer = NULL; + int nbuffer = 0; +#ifdef pp_BOUNDFRAME + if(patchi->frameinfo != NULL && patchi->frameinfo->bufferinfo != NULL){ + buffer = patchi->frameinfo->bufferinfo->buffer; + nbuffer = patchi->frameinfo->bufferinfo->nbuffer; + } +#endif + GetPatchSizes1(&stream, file, buffer, nbuffer, &meshi->npatches, &headersize, &error); if(error!=0){ ReadBoundary(ifile,UNLOAD,&error); *errorcode=1; @@ -1573,7 +1730,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ NewResizeMemory(meshi->blockstart, sizeof(int)*(1+meshi->npatches))==0){ *errorcode=1; if(patchi->compression_type==UNCOMPRESSED){ - closefortranfile(file_unit); + fclose_m(stream); } ReadBoundary(ifile,UNLOAD,&error); return 0; @@ -1581,7 +1738,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ } if(patchi->compression_type==UNCOMPRESSED){ - getpatchsizes2(file_unit,patchi->version, + GetPatchSizes2(stream,patchi->version, meshi->npatches,&meshi->npatchsize, meshi->pi1,meshi->pi2,meshi->pj1,meshi->pj2,meshi->pk1,meshi->pk2,meshi->patchdir, &headersize,&framesize); @@ -1591,7 +1748,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ // 1 - load compressed data set loadpatchbysteps=UNCOMPRESSED_ALLFRAMES; - if(flag==LOAD||flag==RELOAD){ + if(load_flag==LOAD||load_flag==RELOAD){ maxtimes_boundary = MAXFRAMES+51; statfile=STAT(file,&statbuffer); if(statfile==0&&framesize!=0){ @@ -1641,7 +1798,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ patchi->loaded=0; patchi->display=0; if(patchi->compression_type==UNCOMPRESSED){ - closefortranfile(file_unit); + fclose_m(stream); } ReadBoundary(ifile,UNLOAD,&error); return 0; @@ -2133,7 +2290,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ NewResizeMemory(meshi->zipsize, sizeof(unsigned int)*maxtimes_boundary); if(meshi->patch_times==NULL){ *errorcode=1; - closefortranfile(file_unit); + fclose_m(stream); ReadBoundary(ifile,UNLOAD,&error); return 0; } @@ -2147,11 +2304,11 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ else{ if(meshi->patchval == NULL){ *errorcode = 1; - closefortranfile(file_unit); + fclose_m(stream); ReadBoundary(ifile, UNLOAD, &error); return 0; } - if(flag == RELOAD&&patchi->ntimes_old > 0){ + if(load_flag == RELOAD&&patchi->ntimes_old > 0){ framestart = patchi->ntimes_old; } else{ @@ -2162,7 +2319,9 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ START_TIMER(read_time); for(ii=framestart;iipatchval_iframe = meshi->patchval + ii*meshi->npatchsize; +#endif } meshi->patch_timesi = meshi->patch_times + ii; @@ -2172,20 +2331,25 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ int framesizes; framesizes = framesize*framestart-8; - skipdata(file_unit,framesizes); + fseek_m(stream, framesizes, SEEK_CUR); local_first = 0; } +#ifdef pp_BOUNDFRAME + return_filesize = patchi->frameinfo->filesize; + meshi->npatch_times = patchi->frameinfo->nframes; +#else for(n=0;nnpatches, + GetPatchData(stream,meshi->npatches, meshi->pi1,meshi->pi2,meshi->pj1,meshi->pj2,meshi->pk1,meshi->pk2, meshi->patch_timesi,meshi->patchval_iframe,&npatchval_iframe,&filesize, &error); return_filesize += filesize; } } +#endif } if(do_threshold==1){ if(local_first==1){ @@ -2201,11 +2365,14 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ { nn=0; - if(loadpatchbysteps==COMPRESSED_ALLFRAMES)UncompressBoundaryDataBNDF(meshi,ii); + if(loadpatchbysteps == COMPRESSED_ALLFRAMES)UncompressBoundaryDataBNDF(meshi, ii); for(n=0;nnpatches;n++){ meshdata *meshblock; float dval; int j; +#ifdef pp_BOUNDFRAME + float *patchn; +#endif iblock=meshi->blockonpatch[n]; meshblock = meshi->meshonpatch[n]; @@ -2214,11 +2381,20 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ if(iblock!=-1&&meshblock!=NULL){ switch(loadpatchbysteps){ case UNCOMPRESSED_ALLFRAMES: +#ifdef pp_BOUNDFRAME + patchn = (float *)FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n); for(j=0;jthresholdtime[nn+j]<0.0&&meshi->patchval_iframe[nn+j]>=temp_threshold){ - meshi->thresholdtime[nn+j]=meshi->patch_times[ii]; + if(meshi->thresholdtime[nn+j]<0.0&&patchn[j]>=temp_threshold){ + meshi->thresholdtime[nn+j]=meshi->patch_times[ii]; + } + } +#else + for(j = 0; j < nsize; j++){ + if(meshi->thresholdtime[nn + j] < 0.0 && meshi->patchval_iframe[nn + j] >= temp_threshold){ + meshi->thresholdtime[nn + j] = meshi->patch_times[ii]; } } +#endif break; case COMPRESSED_ALLFRAMES: dval = (glui_patchmax-glui_patchmin)/255.0; @@ -2248,6 +2424,9 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ switch(loadpatchbysteps){ case UNCOMPRESSED_ALLFRAMES: +#ifdef pp_BOUNDFRAME + ii++; +#else if(!(use_tload_begin!=0&&*meshi->patch_timesinpatch_times++; patchi->ntimes=meshi->npatch_times; @@ -2261,12 +2440,13 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ ){ *errorcode=1; ReadBoundary(ifile,UNLOAD,&error); - closefortranfile(file_unit); + fclose_m(stream); return 0; } } ii++; } +#endif break; case COMPRESSED_ALLFRAMES: ii++; @@ -2287,7 +2467,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ npatchvals = meshi->npatch_times*meshi->npatchsize; if(npatchvals==0||NewResizeMemory(meshi->cpatchval,sizeof(unsigned char)*npatchvals)==0){ *errorcode=1; - closefortranfile(file_unit); + fclose_m(stream); ReadBoundary(ifile,UNLOAD,&error); return 0; } @@ -2295,7 +2475,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ if(NewResizeMemory(colorlabelpatch,MAXRGB*sizeof(char *))==0){ *errorcode=1; if(loadpatchbysteps!=COMPRESSED_ALLFRAMES){ - closefortranfile(file_unit); + fclose_m(stream); } ReadBoundary(ifile,UNLOAD,&error); return 0; @@ -2307,7 +2487,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ if(NewResizeMemory(colorlabelpatch[n],11)==0){ *errorcode=1; if(loadpatchbysteps!=COMPRESSED_ALLFRAMES){ - closefortranfile(file_unit); + fclose_m(stream); } ReadBoundary(ifile,UNLOAD,&error); return 0; @@ -2351,10 +2531,6 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ assert(FFALSE); break; } - if(do_threshold==1){ - meshi->surface_tempmax=patchmax_global; - meshi->surface_tempmin=patchmin_global; - } GLUI2GlobalBoundaryBounds(patchi->label.shortlabel); @@ -2435,6 +2611,11 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ STOP_TIMER(total_time); +#ifdef pp_BOUNDFRAME + if(load_flag != RELOAD){ + printf("\n"); + } +#else if(return_filesize > 1000000000){ PRINTF(" - %.1f GB in %.1f s\n", (float)return_filesize / 1000000000., total_time); } @@ -2444,6 +2625,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ else{ PRINTF(" - %.0f kB in %.1f s\n", (float)return_filesize / 1000., total_time); } +#endif #ifdef pp_RECOMPUTE_DEBUG if(recompute == 1)printf("***recomputing bounds\n"); #endif @@ -2451,6 +2633,11 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){ update_patch_bounds = ifile; GLUTPOSTREDISPLAY; +#ifdef pp_BOUNDFRAME + if(patchi->frameinfo != NULL){ + patchi->frameinfo->total_time = total_time; + } +#endif return return_filesize; } @@ -2548,7 +2735,10 @@ void DrawBoundaryTexture(const meshdata *meshi){ float r11, r12, r21, r22; int n; int nrow, ncol, irow, icol; - float *patchvals, *patchval_iframe; + float *patchvals; +#ifndef pp_BOUNDFRAME + float *patchval_iframe; +#endif unsigned char *cpatchvals; float *xyzpatchcopy; int *patchblankcopy; @@ -2589,8 +2779,10 @@ void DrawBoundaryTexture(const meshdata *meshi){ patchi=patchinfo+meshi->patchfilenum; switch(patchi->compression_type){ case UNCOMPRESSED: +#ifndef pp_BOUNDFRAME assert(meshi->cpatchval_iframe!=NULL); patchval_iframe=meshi->patchval_iframe; +#endif break; case COMPRESSED_ZLIB: break; @@ -2636,7 +2828,11 @@ void DrawBoundaryTexture(const meshdata *meshi){ ncol=boundary_col[n]; xyzpatchcopy = xyzpatch + 3*blockstart[n]; patchblankcopy = patchblank + blockstart[n]; +#ifdef pp_BOUNDFRAME + patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe + blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; for(irow=0;irowframeinfo, meshi->patch_itime, n); + +#else + if(patchi->compression_type != COMPRESSED_ZLIB)patchvals = patchval_iframe+blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; if(hidepatchsurface==0){ glPushMatrix(); @@ -2836,7 +3037,11 @@ void DrawBoundaryTexture(const meshdata *meshi){ ncol=boundary_col[n]; xyzpatchcopy = xyzpatch + 3*blockstart[n]; patchblankcopy = patchblank + blockstart[n]; - patchvals = patchval_iframe+blockstart[n]; +#ifdef pp_BOUNDFRAME + patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n); +#else + if(patchi->compression_type != COMPRESSED_ZLIB)patchvals = patchval_iframe+blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; if(hidepatchsurface==0){ glPushMatrix(); @@ -2932,7 +3137,9 @@ void DrawBoundaryTextureThreshold(const meshdata *meshi){ int nrow, ncol, irow, icol; float *patchvals; unsigned char *cpatchvals; +#ifndef pp_BOUNDFRAME float *patchval_iframe; +#endif float *xyzpatchcopy; int *patchblankcopy; float *patch_times; @@ -2962,8 +3169,10 @@ void DrawBoundaryTextureThreshold(const meshdata *meshi){ patchi=patchinfo+meshi->patchfilenum; switch(patchi->compression_type){ case UNCOMPRESSED: +#ifndef pp_BOUNDFRAME assert(meshi->patchval_iframe!=NULL); patchval_iframe=meshi->patchval_iframe; +#endif break; case COMPRESSED_ZLIB: break; @@ -3007,7 +3216,12 @@ void DrawBoundaryTextureThreshold(const meshdata *meshi){ ncol=boundary_col[n]; xyzpatchcopy = xyzpatch + 3*blockstart[n]; patchblankcopy = patchblank + blockstart[n]; + +#ifdef pp_BOUNDFRAME + patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe + blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; for(irow=0;irowframeinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe + blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; for(irow=0;irowframeinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe + blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; for(irow=0;irowcompression_type){ case UNCOMPRESSED: +#ifndef pp_BOUNDFRAME patchval_iframe = meshi->patchval_iframe; if(patchval_iframe==NULL)return; +#endif break; case COMPRESSED_ZLIB: break; @@ -3570,7 +3796,11 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ if(drawit==1){ nrow = boundary_row[n]; ncol = boundary_col[n]; +#ifdef pp_BOUNDFRAME + patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe+blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; for(irow = 0;irowframeinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe+blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; if(hidepatchsurface==0){ glPushMatrix(); @@ -3750,7 +3984,11 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ if(drawit==1){ nrow = boundary_row[n]; ncol = boundary_col[n]; +#ifdef pp_BOUNDFRAME + patchvals = ( float * )FRAMEGetSubFramePtr(patchi->frameinfo, meshi->patch_itime, n); +#else patchvals = patchval_iframe+blockstart[n]; +#endif if(patchi->compression_type == COMPRESSED_ZLIB)cpatchvals = meshi->cpatchval_iframe_zlib + blockstart[n]; if(hidepatchsurface==0){ glPushMatrix(); diff --git a/Source/smokeview/IOgeometry.c b/Source/smokeview/IOgeometry.c index 0f5da825c8..3a9906d5c9 100644 --- a/Source/smokeview/IOgeometry.c +++ b/Source/smokeview/IOgeometry.c @@ -71,7 +71,9 @@ void GetFaceInfo(void){ geomlistdata *geomlisti; vertdata **verts; int j; +#ifndef pp_ISOFRAME int ndups=0,nused=0,nskinny=0; +#endif geomi = geominfoptrs[i]; geomlisti = geomi->geomlistinfo; @@ -91,9 +93,11 @@ void GetFaceInfo(void){ trii->verts[2]->nused=0; } qsort(verts,geomlisti->nverts,sizeof(vertdata *),CompareVerts); +#ifndef pp_ISOFRAME for(j=1;jnverts;j++){ if(CompareVerts(verts[j-1],verts[j])==0)ndups++; } +#endif for(j=0;jntriangles;j++){ tridata *trii; @@ -103,12 +107,15 @@ void GetFaceInfo(void){ trii->verts[2]->nused++; if(GetMinAngle(trii)<=10.0){ trii->skinny=1; +#ifndef pp_ISOFRAME nskinny++; +#endif } else{ trii->skinny=0; } } +#ifndef pp_ISOFRAME for(j=0;jnverts;j++){ if(verts[j]->nused>0)nused++; } @@ -120,6 +127,7 @@ void GetFaceInfo(void){ PRINTF(" unused: %i\n", geomlisti->nverts-nused); PRINTF(" duplicates: %i\n\n", ndups); } +#endif FREEMEMORY(verts); } } @@ -1714,18 +1722,18 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse float time; int one, version; int nvert_s, nvert_d, nface_s, nface_d; - FILE *stream=NULL; - int returncode=0; + FILE_m *stream=NULL; int nvars_local, ntimes_local; int iframe; int geom_offset_index=0, geom_offset = 0, frame_start; int is_compressed=0; + int count_read; *error=1; *nvars = 0; if(filename==NULL)return 0; if(cvals_sizes != NULL)is_compressed = 1; - stream = fopen(filename,"rb"); + stream = fopen_b(filename,NULL,0,"rb"); if(stream == NULL){ if(is_compressed == 1){ printf(" The compressed boundary file %s failed to open\n", filename); @@ -1749,11 +1757,11 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse // nval1,nval2,nval3,nval4 // ncompressed // compressed_1,...,compressed_ncompressed - fseek(stream, 20, SEEK_CUR); + fseek_m(stream, 20, SEEK_CUR); } else{ - FORTREAD(&one, 4, 1, stream); - FORTREAD(&version, 4, 1, stream); + FORTREAD_m(&one, 4, 1, stream); + FORTREAD_m(&version, 4, 1, stream); } geom_offset = 0; @@ -1764,7 +1772,7 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse } else{ frame_start = time_frame; - fseek(stream, geom_offsets[time_frame], SEEK_CUR); + fseek_m(stream, geom_offsets[time_frame], SEEK_CUR); } int count = 0; for(iframe=frame_start;;iframe++){ @@ -1772,25 +1780,25 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse if(geom_offset_flag!=NULL&&*geom_offset_flag==BUILD_GEOM_OFFSETS)geom_offsets[geom_offset_index] = geom_offset; if(is_compressed==1){ - returncode = fread(&time, 4, 1, stream); + count_read = fread_m(&time, 4, 1, stream); geom_offset += 4; } else{ - FORTREAD(&time, 4, 1, stream); + FORTREAD_m(&time, 4, 1, stream); geom_offset += (4+4+4); } - if(returncode==0)break; + if(count_read != 1)break; if(is_compressed==1){ int ncvals; int ntotal; - fread(nvals, 4, 4, stream); + fread_m(nvals, 4, 4, stream); if(max_buffer_size != NULL){ ntotal = nvals[0] + nvals[1] + nvals[2] + nvals[3]; *max_buffer_size = MAX(*max_buffer_size, ntotal); } geom_offset += 16; - fread(&ncvals, 4, 1, stream); + fread_m(&ncvals, 4, 1, stream); if(cvals_offsets != NULL){ if(count == 0){ cvals_offsets[count] = 0; @@ -1803,13 +1811,13 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse } geom_offset += 4; nvars_local += ncvals; - fseek(stream, ncvals, SEEK_CUR); + fseek_m(stream, ncvals, SEEK_CUR); geom_offset += ncvals; } else{ - FORTREAD(nvals, 4, 4, stream); + FORTREAD_m(nvals, 4, 4, stream); geom_offset += (4+4*4+4); - if(returncode==0)break; + if(count_read != 4)break; nvert_s = nvals[0]; nface_s = nvals[1]; nvert_d = nvals[2]; @@ -1830,10 +1838,10 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse geom_offset_index++; if(geom_offset_flag!=NULL&&*geom_offset_flag==GET_GEOM_OFFSETS&&time_frame==iframe)break; if(is_compressed == 0){ - if(fseek(stream, nskip, SEEK_CUR) != 0)break; + if(fseek_m(stream, nskip, SEEK_CUR) != 0)break; } } - fclose(stream); + fclose_b(stream); *nvars = nvars_local; if(geom_offset_flag!=NULL&&*geom_offset_flag==BUILD_GEOM_OFFSETS)*geom_offset_flag = geom_offset_index; return ntimes_local; @@ -1841,14 +1849,13 @@ int GetGeomDataSize(char *filename, int *nvars, int time_frame, int *cvals_offse /* ------------------ GetGeomData------------------------ */ -FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, int *nstatics, int *ndynamics, float *vals, +FILE_SIZE GetGeomData(patchdata *patchi, char *filename, int load_flag, int ntimes, int nvals, float *times, int *nstatics, int *ndynamics, float *vals, int time_frame, float *time_value, int *geom_offsets, int *error){ FILE_SIZE file_size; int one, nvars; int nvert_s, ntri_s, nvert_d, ntri_d; int version; - int returncode=0; int count; float time; int iframe, frame_start, frame_stop; @@ -1878,16 +1885,37 @@ FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, int * // ncompressed // compressed_1,...,compressed_ncompressed + FILE_m *stream; + int count_read; - FILE *stream; +#ifdef pp_BOUNDFRAME + if(patchi != NULL&&load_flag!=UNLOAD){ + patchi->frameinfo = FRAMELoadData(patchi->frameinfo, patchi->file, load_flag, time_frame, FORTRAN_FILE, GetGeomDataFrameInfo); + update_frame = 1; + } +#endif cvals = (unsigned char *)vals; - file_size = 0; *error = 1; if(filename==NULL)return 0; ext = strrchr(filename, '.'); if(ext != NULL && strcmp(ext, ".svz") == 0)is_compressed = 1; - stream = fopen(filename, "rb"); +#ifdef pp_BOUNDFRAME + if(patchi!=NULL && patchi->frameinfo!=NULL && patchi->frameinfo->bufferinfo!=NULL){ + bufferdata *bufferinfo; + + bufferinfo = patchi->frameinfo->bufferinfo; + stream = fopen_b(patchi->reg_file, bufferinfo->buffer, bufferinfo->nbuffer, "rb"); + file_size = patchi->frameinfo->filesize; + } + else{ + stream = fopen_b(filename, NULL, 0, "rb"); + file_size = GetFileSizeSMV(filename); + } +#else + stream = fopen_b(filename, NULL, 0, "rb"); + file_size = GetFileSizeSMV(filename); +#endif if(stream == NULL){ if(is_compressed == 1){ printf(" The compressed boundary file %s failed to open\n", filename); @@ -1902,16 +1930,14 @@ FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, int * if(is_compressed == 1){ int completion; - fread(&one, 4, 1, stream); - fread(&completion, 4, 1, stream); - fread(&version, 4, 1, stream); - fread(valminmax, 4, 2, stream); - file_size = 20; + fread_m(&one, 4, 1, stream); + fread_m(&completion, 4, 1, stream); + fread_m(&version, 4, 1, stream); + fread_m(valminmax, 4, 2, stream); } else{ - FORTREAD(&one, 4, 1, stream); - FORTREAD(&version, 4, 1, stream); - file_size = 2 * (4 + 4 + 4); + FORTREAD_m(&one, 4, 1, stream); + FORTREAD_m(&version, 4, 1, stream); } nvars = 0; count = 0; @@ -1922,30 +1948,27 @@ FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, int * else{ frame_start = time_frame; frame_stop = time_frame+1; - fseek(stream, geom_offsets[time_frame], SEEK_CUR); + fseek_m(stream, geom_offsets[time_frame], SEEK_CUR); } for(iframe = frame_start; iframe0){ - fread(cvals, 1, ncompressed, stream); + fread_m(cvals, 1, ncompressed, stream); cvals += ncompressed; } } else{ if(nvert_s > 0){ if(time_frame == ALL_FRAMES || time_frame == iframe){ - FORTREAD(vals + nvars, 4, nvert_s, stream); - if(returncode == 0)break; - file_size += (4 + 4 * nvert_s + 4); + FORTREAD_m(vals + nvars, 4, nvert_s, stream); + if(count_read!=nvert_s)break; nvars += nvert_s; } else{ - fseek(stream, 4 + 4 * nvert_s + 4, SEEK_CUR); + fseek_m(stream, 4 + 4 * nvert_s + 4, SEEK_CUR); } } if(ntri_s > 0){ if(time_frame == ALL_FRAMES || time_frame == iframe){ - FORTREAD(vals + nvars, 4, ntri_s, stream); - if(returncode == 0)break; - file_size += (4 + 4 * ntri_s + 4); + FORTREAD_m(vals + nvars, 4, ntri_s, stream); + if(count_read!=ntri_s)break; nvars += ntri_s; } else{ - fseek(stream, (4 + 4 * ntri_s + 4), SEEK_CUR); + fseek_m(stream, (4 + 4 * ntri_s + 4), SEEK_CUR); } } } @@ -1987,24 +2008,22 @@ FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, int * if(is_compressed == 0){ if(nvert_d > 0){ if(time_frame == ALL_FRAMES || time_frame == iframe){ - FORTREAD(vals + nvars, 4, nvert_d, stream); - if(returncode == 0)break; - file_size += (4 + 4 * nvert_d + 4); + FORTREAD_m(vals + nvars, 4, nvert_d, stream); + if(count_read!=nvert_d)break; nvars += nvert_d; } else{ - fseek(stream, 4 + 4 * nvert_d + 4, SEEK_CUR); + fseek_m(stream, 4 + 4 * nvert_d + 4, SEEK_CUR); } } if(ntri_d > 0){ if(time_frame == ALL_FRAMES || time_frame == iframe){ - FORTREAD(vals + nvars, 4, ntri_d, stream); - if(returncode == 0)break; - file_size += (4 + 4 * ntri_d + 4); + FORTREAD_m(vals + nvars, 4, ntri_d, stream); + if(count_read!=ntri_d)break; nvars += ntri_d; } else{ - fseek(stream, 4 + 4 * ntri_d + 4, SEEK_CUR); + fseek_m(stream, 4 + 4 * ntri_d + 4, SEEK_CUR); } } } @@ -2014,7 +2033,9 @@ FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, int * } if(time_frame==ALL_FRAMES)count++; } - fclose(stream); +#ifndef pp_BOUNDFRAME + fclose_m(stream); +#endif return file_size; } @@ -2028,9 +2049,9 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int int error; FILE_SIZE return_filesize = 0; float total_time; - int *geom_offsets=NULL, geom_offset_flag; - int *cvals_offsets=NULL, *cvals_sizes=NULL; - int max_buffer_size=0; + int *geom_offsets = NULL, geom_offset_flag; + int *cvals_offsets = NULL, *cvals_sizes = NULL; + int max_buffer_size = 0; unsigned char *cbuffer = NULL; if(patchi->structured == YES)return 0; @@ -2046,7 +2067,7 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int slicei->ntimes = 0; slicei->times = NULL; } - patchi->bounds.defined=0; + patchi->bounds.defined = 0; FREEMEMORY(patchi->geom_nstatics); FREEMEMORY(patchi->geom_ndynamics); @@ -2058,6 +2079,13 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int FREEMEMORY(patchi->geom_ivals); FREEMEMORY(patchi->geom_times); FREEMEMORY(patchi->geom_times_map); +#ifdef pp_BOUNDFRAME + if(load_flag != RELOAD){ + FRAMEFree(patchi->frameinfo); + patchi->frameinfo = NULL; + } +#endif + if(load_flag==UNLOAD){ plotstate = GetPlotState(DYNAMIC_PLOTS); if(patchi->boundary==1)UpdateBoundaryType(); @@ -2141,7 +2169,7 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int if(current_script_command==NULL||NOT_LOADRENDER){ PRINTF("Loading %s(%s)", patchi->file, patchi->label.shortlabel); } - filesize=GetGeomData(patchi->file, ntimes_local, nvals, patchi->geom_times, + filesize=GetGeomData(patchi, patchi->file, load_flag, ntimes_local, nvals, patchi->geom_times, patchi->geom_nstatics, patchi->geom_ndynamics, patchi->geom_vals, time_frame, time_value, geom_offsets, &error); MakeTimesMap(patchi->geom_times, patchi->geom_times_map, ntimes_local); @@ -2231,15 +2259,22 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int slicei->valmax_slice = qmax; if(slice_average_flag==1){ int data_per_timestep, nvals2, ntimes; - float *vals, *times; + float *times, **qvalptrs; show_slice_average = 1; - vals = slicei->patchgeom->geom_vals; nvals2 = slicei->patchgeom->geom_nvals; times = patchi->geom_times; ntimes = patchi->ngeom_times; data_per_timestep = nvals2/ntimes; - if(TimeAverageData(vals, vals, nvals2, data_per_timestep, times, ntimes, slice_average_interval)==1){ +#ifdef pp_SLICEFRAME + qvalptrs = ( float ** )slicei->frameinfo->frameptrs; +#else + NewMemory(( void ** )&qvalptrs, ntimes*sizeof(float *)); + for(i = 0; i < ntimes; i++){ + qvalptrs[i] = slicei->patchgeom->geom_vals + i*data_per_timestep; + } +#endif + if(TimeAverageData(qvalptrs, qvalptrs, nvals2, data_per_timestep, times, ntimes, slice_average_interval)==1){ show_slice_average = 0; } } @@ -2489,7 +2524,7 @@ void *ReadAllGeom(void *arg){ geomi->read_status = 1; THREADcontrol(readallgeom_threads, THREAD_UNLOCK); - ReadGeom(geomi, LOAD, GEOM_GEOM, NULL); + ReadGeom(geomi, NULL, 0, LOAD, GEOM_GEOM, NULL); THREADcontrol(readallgeom_threads, THREAD_LOCK); geomi->read_status = 2; THREADcontrol(readallgeom_threads, THREAD_UNLOCK); @@ -2506,7 +2541,7 @@ void *ReadAllGeom(void *arg){ geomi->read_status = 1; THREADcontrol(readallgeom_threads, THREAD_UNLOCK); - ReadGeom(geomi, LOAD, GEOM_CGEOM, NULL); + ReadGeom(geomi, NULL, 0, LOAD, GEOM_CGEOM, NULL); UpdateGeomTriangles(geomi, GEOM_STATIC); THREADcontrol(readallgeom_threads, THREAD_LOCK); geomi->read_status = 2; @@ -2532,15 +2567,15 @@ void UpdateAllGeomTriangles(void){ /* ------------------ ReadGeom0 ------------------------ */ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_index){ - FILE *stream; + FILE_m *stream; int one=1; - int returncode=0; int ntimes_local; int version; int nvertfacesvolumes[3]; int nfloat_vals, nint_vals; int iframe, icount; FILE_SIZE return_filesize; + int count_read; FreeAllMemory(geomi->memory_id); geomi->geomlistinfo = NULL; @@ -2556,27 +2591,46 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in ReadGeomHeader(geomi,geom_frame_index,&ntimes_local); if(ntimes_local<0)return 0; - stream = fopen(geomi->file,"rb"); - if(stream==NULL)return 0; + unsigned char *filebuffer=NULL; + int nfilebuffer=0; + + filebuffer = NULL; + nfilebuffer = 0; +#ifdef pp_ISOFRAME + if(geomi->frameinfo != NULL && geomi->frameinfo->bufferinfo != NULL){ + filebuffer = geomi->frameinfo->bufferinfo->buffer; + nfilebuffer = geomi->frameinfo->bufferinfo->nbuffer; + } +#endif + // header + // one + // version + // nfloats + // nfloat vals + // nints + // nint vals - FSEEK(stream,4,SEEK_CUR);fread(&one,4,1,stream);FSEEK(stream,4,SEEK_CUR); - FORTREAD(&version,4,1,stream); + stream = fopen_b(geomi->file, filebuffer, nfilebuffer, "rb"); + if(stream==NULL)return 0; + + FORTREAD_m(&one,4,1,stream); + FORTREAD_m(&version, 4, 1, stream); return_filesize = 2*(4+4+4); - FORTREAD(&nfloat_vals,4,1,stream); + FORTREAD_m(&nfloat_vals, 4, 1, stream); return_filesize += (4+4+4); if(nfloat_vals>0){ - FSEEK(stream, 4+nfloat_vals*4+4, SEEK_CUR); + fseek_m(stream, 4+nfloat_vals*4+4, SEEK_CUR); return_filesize += 4+nfloat_vals*4+4; } - FORTREAD(&nint_vals,4,1,stream); + FORTREAD_m(&nint_vals, 4, 1, stream); return_filesize += (4+4+4); if(nint_vals>0){ - FSEEK(stream, 4+nint_vals*4+4, SEEK_CUR); + fseek_m(stream, 4+nint_vals*4+4, SEEK_CUR); return_filesize += 4+nint_vals*4+4; } @@ -2586,6 +2640,12 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in geomi->geomlistinfo=geomi->geomlistinfo_0+1; NewMemoryMemID((void **)&geomi->times,ntimes_local*sizeof(float),geomi->memory_id); + // frame + // time + // nverts nfaces + // xyz 3*nverts + // ijk 3*ntris + // surf_ind ntris icount=-1; for(iframe=-1;iframe=0){ - - FORTREADBR(times_local,2,stream); + FORTREAD_m(times_local, 4, 2, stream); + if(count_read != 2)break; return_filesize += 4+4+4; icount++; @@ -2616,8 +2676,8 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in if(skipframe == 0)geomi->currentframe = geomlisti; } } - - FORTREADBR(nvertfacesvolumes,2,stream); + FORTREAD_m(nvertfacesvolumes, 4, 2, stream); + if(count_read != 2)break; return_filesize += (4+8+4); nverts=nvertfacesvolumes[0]; @@ -2626,30 +2686,37 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in int file_offset = 0; if(nverts>0)file_offset += 4+3*nverts*4+4; if(ntris>0)file_offset += (4+3*ntris*4+4)+(4+ntris*4+4); - if(file_offset>0)FSEEK(stream, file_offset, SEEK_CUR); + if(file_offset>0)fseek_m(stream, file_offset, SEEK_CUR); } if(skipframe==0&&nverts>0){ int ii; float *xyz=NULL; float *zORIG; +#ifndef pp_ISOFRAME NewMemoryMemID((void **)&xyz,3*nverts*sizeof(float), geomi->memory_id); +#endif NewMemoryMemID((void **)&verts,nverts*sizeof(vertdata), geomi->memory_id); NewMemoryMemID((void **)&zORIG, nverts*sizeof(float), geomi->memory_id); geomlisti->zORIG = zORIG; geomlisti->verts = verts; geomlisti->nverts=nverts; - FORTREADBR(xyz,3*nverts,stream); +#ifdef pp_ISOFRAME + FORTREAD_mv((void **)&xyz, 4, 3*nverts, stream); +#else + FORTREAD_m(xyz, 4, 3*nverts, stream); +#endif + if(count_read != 3 * nverts)break; return_filesize += 4+3*nverts*4+4; for(ii=0;ii0){ int *surf_ind=NULL,*ijk=NULL; @@ -2658,15 +2725,27 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in tridata *triangles; NewMemoryMemID((void **)&triangles,ntris*sizeof(tridata), geomi->memory_id); +#ifndef pp_ISOFRAME NewMemoryMemID((void **)&ijk,3*ntris*sizeof(int), geomi->memory_id); NewMemoryMemID((void **)&surf_ind,ntris*sizeof(int), geomi->memory_id); +#endif geomlisti->triangles=triangles; geomlisti->ntriangles=ntris; - FORTREADBR(ijk,3*ntris,stream); +#ifdef pp_ISOFRAME + FORTREAD_mv((void **)&ijk, 4, 3*ntris, stream); +#else + FORTREAD_m(ijk, 4, 3*ntris, stream); +#endif + if(count_read != 3 * ntris)break; return_filesize += 4+3*ntris*4+4; - FORTREADBR(surf_ind,ntris,stream); +#ifdef pp_ISOFRAME + FORTREAD_mv((void **)&surf_ind, 4, ntris, stream); +#else + FORTREAD_m(surf_ind, 4, ntris, stream); +#endif + if(count_read != ntris)break; return_filesize += 4+ntris*4+4; if(type==GEOM_ISO)offset=nsurfinfo; @@ -2688,8 +2767,10 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in surfi->used_by_geom = 1; triangles[ii].textureinfo=NULL; } +#ifndef pp_ISOFRAME FREEMEMORY(ijk); FREEMEMORY(surf_ind); +#endif } if(skipframe==0||geom_frame_index!=NULL){ @@ -2700,7 +2781,7 @@ FILE_SIZE ReadGeom0(geomdata *geomi, int load_flag, int type, int *geom_frame_in } geomi->loaded = 1; geomi->display=1; - fclose(stream); + fclose_b(stream); return return_filesize; } @@ -3474,19 +3555,20 @@ void ClassifyGeom(geomdata *geomi,int *geom_frame_index){ /* ------------------ ReadGeom ------------------------ */ -FILE_SIZE ReadGeom(geomdata *geomi, int load_flag, int type, int *geom_frame_index){ - FILE *stream; +FILE_SIZE ReadGeom(geomdata *geomi, unsigned char *buffer, int nbuffer, int load_flag, int type, int *geom_frame_index){ + FILE_m *stream; int version; - int returncode=0; int one=0; + int count_read; FILE_SIZE return_filesize=0; - if(geomi->file==NULL)return 0; - stream = fopen(geomi->file,"rb"); - if(stream==NULL)return 0; - FSEEK(stream,4,SEEK_CUR);fread(&one,4,1,stream);FSEEK(stream,4,SEEK_CUR); - FORTREAD(&version,4,1,stream); - fclose(stream); + if(geomi->file == NULL && buffer==NULL)return 0; + stream = fopen_b(geomi->file, buffer, nbuffer, "rb"); + if(stream == NULL)return 0; + FORTREAD_m(&one,4,1,stream); + FORTREAD_m(&version, 4, 1, stream); + if(count_read!=1)fclose_b(stream); + fclose_b(stream); return_filesize = 2*(4+4+4); if(version<=1){ @@ -4783,8 +4865,7 @@ void ShowHideSortGeometry(int sort_geom, float *mm){ if(iter == 0){ CheckMemory; if(count_transparent == 0 && count_opaque == 0)return; - FREEMEMORY(alltriangles); - NewMemory((void **)&alltriangles, (count_opaque + count_transparent)*sizeof(tridata **)); + NEWMEM(alltriangles, (count_opaque + count_transparent) * sizeof(tridata **)); transparent_triangles = alltriangles; opaque_triangles = alltriangles + count_transparent; } diff --git a/Source/smokeview/IOiso.c b/Source/smokeview/IOiso.c index 2469d47779..5325be4c6a 100644 --- a/Source/smokeview/IOiso.c +++ b/Source/smokeview/IOiso.c @@ -158,7 +158,7 @@ void ReadIsoGeomWrapup(int flag){ if(triangles_threads == NULL){ triangles_threads = THREADinit(&n_triangles_threads, &use_triangles_threads, UpdateTrianglesAll); } - THREADrun(triangles_threads, NULL); + THREADrun(triangles_threads); if(flag == FOREGROUND)THREADcontrol(triangles_threads, THREAD_JOIN); UpdateTimes(); GetFaceInfo(); @@ -201,6 +201,12 @@ void UnloadIso(meshdata *meshi){ if(meshi->isofilenum == -1)return; ib = isoinfo + meshi->isofilenum; +#ifdef pp_SLICEFRAME + FRAMEFree(ib->frameinfo); + ib->frameinfo = NULL; + ib->geominfo->frameinfo = NULL; +#endif + FreeAllMemory(ib->memory_id); meshi->iso_times = NULL; meshi->iso_times_map = NULL; @@ -448,37 +454,64 @@ FILE_SIZE ReadIsoGeom(int ifile, int load_flag, int *geom_frame_index, int *erro int i; surfdata *surfi; FILE_SIZE return_filesize=0; +#ifdef pp_ISOFRAME + int time_frame = ALL_FRAMES; + float total_time; +#endif +#ifdef pp_ISOFRAME + START_TIMER(total_time); +#endif isoi = isoinfo + ifile; - if(load_flag==LOAD){ + if(load_flag==LOAD||load_flag==RELOAD){ THREADcontrol(isosurface_threads, THREAD_JOIN); } if(load_flag==UNLOAD){ CancelUpdateTriangles(); -#ifdef pp_FRAME - if(isoi->frameinfo != NULL)FRAMEFree(&isoi->frameinfo); +#ifdef pp_ISOFRAME + if(isoi->frameinfo != NULL){ + FRAMEFree(isoi->frameinfo); + isoi->frameinfo = NULL; + } #endif } meshi = meshinfo + isoi->blocknumber; geomi = isoi->geominfo; +#ifdef pp_ISOFRAME + if(load_flag != RELOAD){ + UnloadIso(meshi); + FreeAllMemory(isoi->memory_id); + } +#else UnloadIso(meshi); FreeAllMemory(isoi->memory_id); +#endif meshi->showlevels = NULL; meshi->isolevels = NULL; -#ifdef pp_FRAME - if(load_flag == LOAD){ - if(isoi->frameinfo == NULL)isoi->frameinfo = FRAMEInit(isoi->file, NULL, FORTRAN_FILE, GetIsoFrameInfo); +#ifdef pp_ISOFRAME + unsigned char *buffer=NULL; + int nbuffer=0; + + if(load_flag != UNLOAD){ + isoi->frameinfo = FRAMELoadData(isoi->frameinfo, isoi->file, load_flag, time_frame, FORTRAN_FILE, GetIsoFrameInfo); + update_frame = 1; + + geomi->frameinfo = isoi->frameinfo; if(isoi->frameinfo != NULL){ - FRAMESetup(isoi->frameinfo); - FRAMEReadFrame(isoi->frameinfo, 0, isoi->frameinfo->nframes); - FRAMESetTimes(isoi->frameinfo, 0, isoi->frameinfo->nframes); - FRAMESetFramePtrs(isoi->frameinfo, 0, isoi->frameinfo->nframes); + buffer = isoi->frameinfo->bufferinfo->buffer; + nbuffer = isoi->frameinfo->bufferinfo->nbuffer; + } + else{ + buffer = NULL; + nbuffer = 0; } } + return_filesize = ReadGeom(geomi, buffer, nbuffer, load_flag, GEOM_ISO, geom_frame_index); + if(load_flag != UNLOAD && isoi->frameinfo != NULL)return_filesize = isoi->frameinfo->bytes_read; +#else + return_filesize = ReadGeom(geomi, NULL, 0, load_flag, GEOM_ISO, geom_frame_index); #endif - return_filesize=ReadGeom(geomi,load_flag,GEOM_ISO,geom_frame_index); - if(load_flag==UNLOAD){ meshi->isofilenum = -1; return 0; @@ -498,7 +531,7 @@ FILE_SIZE ReadIsoGeom(int ifile, int load_flag, int *geom_frame_index, int *erro NewMemoryMemID((void **)&isoi->geom_vals, isoi->geom_nvals*sizeof(float), isoi->memory_id); } - filesize = GetGeomData(isoi->tfile, ntimes_local, isoi->geom_nvals, isoi->geom_times, + filesize = GetGeomData(NULL, isoi->tfile, load_flag, ntimes_local, isoi->geom_nvals, isoi->geom_times, isoi->geom_nstatics, isoi->geom_ndynamics, isoi->geom_vals, ALL_FRAMES, NULL, NULL, &error); return_filesize += filesize; @@ -606,6 +639,12 @@ FILE_SIZE ReadIsoGeom(int ifile, int load_flag, int *geom_frame_index, int *erro GLUTPOSTREDISPLAY; CheckMemory; +#ifdef pp_ISOFRAME + if(isoi->frameinfo != NULL){ + STOP_TIMER(total_time); + isoi->frameinfo->total_time = total_time; + } +#endif return return_filesize; } @@ -1056,7 +1095,12 @@ FILE_SIZE ReadIso(const char *file, int ifile, int flag, int *geom_frame_index, if(ifile>=0&&ifileloaded == 0)return 0; +#ifdef pp_ISOFRAME + if(flag != RELOAD)PRINTF("Loading %s(%s)", file, isoi->surface_label.shortlabel); +#else if(flag==LOAD)PRINTF("Loading %s(%s)", file,isoi->surface_label.shortlabel); +#endif if(isoi->geomflag==1){ return_filesize=ReadIsoGeom(ifile,flag,geom_frame_index,errorcode); } diff --git a/Source/smokeview/IOobjects.c b/Source/smokeview/IOobjects.c index 64fa31ab2e..8bbb807cc8 100644 --- a/Source/smokeview/IOobjects.c +++ b/Source/smokeview/IOobjects.c @@ -5908,6 +5908,23 @@ void UpdateObjectUsed(void){ } } +/* ----------------------- Dist2Plane ------------------------ */ + +float Dist2Plane(float x, float y, float z, float xyzp[3], float xyzpn[3]){ + float return_val; + float xyz[3]; + int i; + + xyz[0]=x; + xyz[1]=y; + xyz[2]=z; + return_val=0.0; + for(i=0;i<3;i++){ + return_val+=(xyz[i]-xyzp[i])*xyzpn[i]; + } + return return_val; +} + /* ----------------------- InitDevicePlane ------------------------ */ void InitDevicePlane(devicedata *devicei){ @@ -6018,3 +6035,29 @@ void UpdatePartClassDepend(partclassdata *partclassi){ partclassi->vars_dep_index[nvar-1]= GetObjectFrameTokenLoc("B",obj_frame); } } + +/* ------------------ Normalize ------------------------ */ + +void Normalize(float *xyz, int n){ + float norm,norm2; + int i; + + norm2 = 0.0; + + for(i=0;iloaded==1&&parti->stream!=NULL){ - FCLOSE_m(parti->stream); + fclose_m(parti->stream); parti->stream = NULL; } } @@ -636,7 +604,11 @@ void FreePart5Data(part5data *datacopy_arg){ /* ------------------ FreeAllPart5Data ------------------------ */ -void FreeAllPart5Data(partdata *parti){ +#ifdef pp_PARTFRAME +void FreeAllPart5Data(partdata *parti, int load_flag){ +#else +void FreeAllPart5Data(partdata * parti){ +#endif int i; part5data *datacopy_local; @@ -654,6 +626,13 @@ void FreeAllPart5Data(partdata *parti){ FREEMEMORY(parti->sy); FREEMEMORY(parti->sz); FREEMEMORY(parti->irvals); +#ifdef pp_PARTFRAME + if(load_flag != RELOAD){ + FRAMEFree(parti->frameinfo); + parti->frameinfo = NULL; + } +#endif + } /* ------------------ InitPart5Data ------------------------ */ @@ -761,6 +740,7 @@ void UpdateAllPartVis(partdata *parti){ } } +#ifndef pp_PARTFRAME /* ------------------ GetSizeFileStatus ------------------------ */ int GetSizeFileStatus(partdata *parti){ @@ -846,46 +826,46 @@ void CreatePartSizeFileFromBound(char *part5boundfile_arg, char *part5sizefile_a /* ------------------ CreatePartSizeFileFromPart ------------------------ */ void CreatePartSizeFileFromPart(char *part5file_arg, char *part5sizefile_arg, LINT file_offset_arg){ - FILE *PART5FILE, *streamout_local; - int returncode=0; + FILE *streamout_local; + FILE_m *stream; + int count_read; int one_local, version_local, nclasses_local=0; int i; int *numtypes_local, *numpoints_local; int skip_local, numvals_local; - PART5FILE = fopen(part5file_arg, "rb"); + stream = fopen_b(part5file_arg, NULL, 0, "rb"); streamout_local = FOPEN_2DIR(part5sizefile_arg, "w"); - FSEEK(PART5FILE, 4, SEEK_CUR); fread(&one_local, 4, 1, PART5FILE); FSEEK(PART5FILE, 4, SEEK_CUR); - FORTPART5READ(&version_local, 1); - - FORTPART5READ(&nclasses_local, 1); + FORTREAD_m(&one_local, 4, 1, stream); + FORTREAD_m(&version_local, 4, 1, stream); + FORTREAD_m(&nclasses_local, 4, 1, stream); NewMemory((void **)&numtypes_local, 2*nclasses_local* sizeof(int)); NewMemory((void **)&numpoints_local, nclasses_local* sizeof(int)); for (i = 0; i < nclasses_local; i++){ - FORTPART5READ(numtypes_local+2*i, 2); + FORTREAD_m(numtypes_local+2*i, 4, 2, stream); numvals_local = numtypes_local[2 * i] + numtypes_local[2 * i + 1]; skip_local = 2*numvals_local*(4 + 30 + 4); - FSEEK(PART5FILE, skip_local, SEEK_CUR); + fseek_m(stream, skip_local, SEEK_CUR); } - while (!feof(PART5FILE)){ + while (!feof_m(stream)){ float time_local; LINT frame_size_local; char format[128]; frame_size_local =0; - FORTPART5READ(&time_local, 1); + FORTREAD_m(&time_local, 4, 1, stream); frame_size_local += 12; - if(returncode == FAIL_m)break; + if(count_read != 1)break; for (i = 0; i < nclasses_local; i++){ - FORTPART5READ(numpoints_local+ i, 1); + FORTREAD_m(numpoints_local+ i, 4, 1, stream); frame_size_local += 12; skip_local = 4+4*NXYZ_COMP_PART*numpoints_local[i]+4; skip_local += 4 + 4 * numpoints_local[i] + 4; if(numtypes_local[2 * i] > 0) skip_local += 4 + 4 * numpoints_local[i] * numtypes_local[2 * i] + 4; if(numtypes_local[2 * i + 1] > 0)skip_local += 4 + 4 * numpoints_local[i] * numtypes_local[2 * i + 1] + 4; - FSEEK(PART5FILE, skip_local, SEEK_CUR); + fseek_m(stream, skip_local, SEEK_CUR); frame_size_local +=skip_local; } #ifdef INTEL_WIN_COMPILER @@ -900,7 +880,7 @@ void CreatePartSizeFileFromPart(char *part5file_arg, char *part5sizefile_arg, LI fprintf(streamout_local, " %i\n", numpoints_local[i]); } } - fclose(PART5FILE); + fclose_m(stream); fclose(streamout_local); FREEMEMORY(numtypes_local); FREEMEMORY(numpoints_local); @@ -911,26 +891,26 @@ void CreatePartSizeFileFromPart(char *part5file_arg, char *part5sizefile_arg, LI LINT GetPartHeaderOffset(partdata *parti_arg){ LINT file_offset_local=0; int nclasses_local, one_local; - FILE *PART5FILE=NULL; + FILE_m *stream=NULL; int version_local; - int returncode=0; + int count_read; int skip_local; int i; int *numtypes_local = NULL, *numtypescopy_local, *numpoints_local = NULL; int numtypes_temp_local[2]; - PART5FILE = fopen(parti_arg->reg_file,"rb"); - if(PART5FILE==NULL)return 0; + stream = fopen_b(parti_arg->reg_file, NULL, 0, "rb"); + if(stream==NULL)return 0; - FSEEK(PART5FILE,4,SEEK_CUR);fread(&one_local,4,1,PART5FILE);FSEEK(PART5FILE,4,SEEK_CUR); + FORTREAD_m(&one_local, 4, 1, stream); file_offset_local += 12; - FORTPART5READ(&version_local, 1); - if(returncode == FAIL_m)goto wrapup; + FORTREAD_m(&version_local, 4, 1, stream); + if(count_read != 1)goto wrapup; file_offset_local += 12; - FORTPART5READ(&nclasses_local,1); - if(returncode == FAIL_m)goto wrapup; + FORTREAD_m(&nclasses_local, 4, 1, stream); + if(count_read != 1)goto wrapup; file_offset_local += 12; NewMemory((void **)&numtypes_local,2*nclasses_local*sizeof(int)); @@ -940,54 +920,56 @@ LINT GetPartHeaderOffset(partdata *parti_arg){ numtypes_temp_local[1]=0; CheckMemory; for(i=0;ireg_file!=NULL)PART5FILE = fopen_m(parti->reg_file, "rbm"); - if(parti->reg_file==NULL||PART5FILE==NULL)return; + if(parti->reg_file == NULL)return; + stream = fopen_b(parti->reg_file, NULL, 0, "rb"); + if(stream==NULL)return; if(parti->bound_file!=NULL)stream_out_local = FOPEN_2DIR(parti->bound_file, "w"); if(stream_out_local==NULL){ - FCLOSE_m(PART5FILE); + fclose_b(stream); return; } - FSEEK_m(PART5FILE, 4, SEEK_CUR); - FREAD_m(&one_local, 4, 1, PART5FILE); - FSEEK_m(PART5FILE, 4, SEEK_CUR); - - FORTPART5READ_m(&version_local, 1); - if(returncode == FAIL_m)goto wrapup; + FORTREAD_m(&one_local, 4, 1, stream); + FORTREAD_m(&version_local, 4, 1, stream); + if(count_read != 1)goto wrapup; - FORTPART5READ_m(&nclasses_local, 1); - if(returncode == FAIL_m)goto wrapup; + FORTREAD_m(&nclasses_local, 4, 1, stream); + if(count_read != 1)goto wrapup; NewMemory((void **)&numtypes_local, 2*nclasses_local*sizeof(int)); numtypes_temp_local[0] = 0; @@ -996,15 +978,13 @@ void CreatePartBoundFile(partdata *parti){ for(i = 0; i0){ - FORTPART5READ_mv((void **)&rvals_local, nparts_local*numtypes_local[2*jj]); - if(returncode == FAIL_m)goto wrapup; + FORTREAD_mv((void **)&rvals_local, 4, nparts_local*numtypes_local[2*jj], stream); + if(count_read != nparts_local * numtypes_local[2 * jj])goto wrapup; } CheckMemory; for(kk = 0; kksize_file)); CreatePartSizeFileFromPart(parti->reg_file, parti->size_file, header_offset_local); } +#endif /* ------------------ GetPartHistogramFile ------------------------ */ void GetPartHistogramFile(partdata *parti){ @@ -1203,36 +1184,53 @@ void GeneratePartHistograms(void){ /* ------------------ GetPartData ------------------------ */ void GetPartData(partdata *parti, int nf_all_arg, FILE_SIZE *file_size_arg){ - FILE_m *PART5FILE; + FILE_m *stream; int class_index; int one_local, version_local, nclasses_local; int skip_local, nparts_local; int *numtypes_local = NULL, *numtypescopy_local, *numpoints_local = NULL; int numtypes_temp_local[2]; int count_local, count2_local, first_frame_local = 1; + int count_read; size_t returncode; float time_local; part5data *datacopy_local; - *file_size_arg = GetFileSizeSMV(parti->reg_file); - if(parti->stream!=NULL){ - FCLOSE_m(parti->stream); +#ifdef pp_PARTFRAME + fclose_b(parti->stream); +#else + fclose_m(parti->stream); +#endif parti->stream = NULL; } - PART5FILE = fopen_m(parti->reg_file, "rbm"); - parti->stream = PART5FILE; - if(PART5FILE==NULL)return; +#ifdef pp_PARTFRAME + if(parti->frameinfo!=NULL&&parti->frameinfo->bufferinfo!=NULL){ + bufferdata *bufferinfo; + + bufferinfo = parti->frameinfo->bufferinfo; + stream = fopen_b(parti->reg_file, bufferinfo->buffer, bufferinfo->nbuffer, "rb"); + *file_size_arg = parti->frameinfo->filesize; + } + else{ + stream = fopen_b(parti->reg_file, NULL, 0, "rb"); + *file_size_arg = GetFileSizeSMV(parti->reg_file); + } +#else + stream = fopen_m(parti->reg_file, "rbm"); + *file_size_arg = GetFileSizeSMV(parti->reg_file); +#endif + parti->stream = stream; + if(stream==NULL)return; - FSEEK_m(PART5FILE,4,SEEK_CUR); - FREAD_m(&one_local,4,1,PART5FILE); - FSEEK_m(PART5FILE,4,SEEK_CUR); + FORTREAD_m(&one_local,4,1,stream); + if(count_read!=1)goto wrapup; - FORTPART5READ_m(&version_local, 1); - if(returncode==FAIL_m)goto wrapup; + FORTREAD_m(&version_local, 4, 1, stream); + if(count_read!=1)goto wrapup; - FORTPART5READ_m(&nclasses_local,1); - if(returncode==FAIL_m)goto wrapup; + FORTREAD_m(&nclasses_local,4, 1, stream); + if(count_read!=1)goto wrapup; NewMemory((void **)&numtypes_local,2*nclasses_local*sizeof(int)); NewMemory((void **)&numpoints_local,nclasses_local*sizeof(int)); @@ -1241,13 +1239,14 @@ void GetPartData(partdata *parti, int nf_all_arg, FILE_SIZE *file_size_arg){ numtypes_temp_local[1]=0; CheckMemory; for(class_index=0;class_index=nf_all_arg)break; - FORTPART5READ_m(&time_local,1); - if(returncode==FAIL_m)break; + FORTREAD_m(&time_local,4,1,stream); + if(count_read!=1)goto wrapup; if((tload_step>1 && count_local%tload_step!=0)|| (use_tload_begin==1 && time_localntimes = count2_local+1; } for(class_index=0;class_index0){ float *x_local, *y_local, *z_local; @@ -1325,8 +1324,8 @@ void GetPartData(partdata *parti, int nf_all_arg, FILE_SIZE *file_size_arg){ int j; sort_tags_local = datacopy_local->sort_tags; - FORTPART5READ_m(datacopy_local->tags,nparts_local); - if(returncode==FAIL_m)goto wrapup; + FORTREAD_m(datacopy_local->tags,4, nparts_local, stream); + if(count_read!=nparts_local)goto wrapup; CheckMemory; if(nparts_local>0){ for(j=0;j0){ float *valmin_part, *valmax_part; - FORTPART5READ_mv((void **)&(datacopy_local->rvals), nparts_local*numtypes_local[2*class_index]); - if(returncode==FAIL_m)goto wrapup; + FORTREAD_mv((void **)&(datacopy_local->rvals), 4, nparts_local*numtypes_local[2*class_index], stream); + if(count_read!=nparts_local*numtypes_local[2*class_index])goto wrapup; valmin_part = parti->valmin_part; valmax_part = parti->valmax_part; @@ -1370,7 +1369,6 @@ void GetPartData(partdata *parti, int nf_all_arg, FILE_SIZE *file_size_arg){ } } } - if(returncode==FAIL_m)goto wrapup; } } else{ @@ -1381,8 +1379,8 @@ void GetPartData(partdata *parti, int nf_all_arg, FILE_SIZE *file_size_arg){ CheckMemory; if(skip_local>0){ - FSEEK_m(PART5FILE,skip_local,SEEK_CUR); - if(returncode==FAIL_m)goto wrapup; + returncode = fseek_m(stream,skip_local,SEEK_CUR); + if(returncode!=PASS_m)goto wrapup; } else{ datacopy_local++; @@ -1591,6 +1589,16 @@ void InitPartProp(void){ } } +#ifdef pp_PARTFRAME +/* ------------------ GetNPartFrames ------------------------ */ + +int GetNPartFrames(partdata *parti){ + int nframes; + + nframes = FRAMEGetNFrames(parti->file, FRAME_PART); + return nframes; +} +#else /* ------------------ GetNPartFrames ------------------------ */ int GetNPartFrames(partdata *parti){ @@ -1652,6 +1660,7 @@ int GetNPartFrames(partdata *parti){ fclose(stream); return nframes_all; } +#endif /* ------------------ GetMinPartFrames ------------------------ */ @@ -1659,6 +1668,7 @@ int GetMinPartFrames(int flag){ int i; int min_frames=-1; + INIT_PRINT_TIMER(timer_nparts); for(i=0;iframeinfo; + stream = fopen_b(parti->file, frameinfo->bufferinfo->buffer, frameinfo->bufferinfo->nbuffer, "rb"); + + fseek_m(stream, 2 * (4 + 4 + 4), SEEK_SET); + fseek_m(stream, 4, SEEK_CUR); fread_m(&n_part, sizeof(int), 1, stream); fseek_m(stream, 4, SEEK_CUR); + NewMemory(( void ** )&n_quants, n_part*sizeof(int)); + for(i = 0; i < n_part; i++){ + int vals[2]; + + fseek_m(stream, 4, SEEK_CUR); fread_m(vals, sizeof(int), 2, stream); fseek_m(stream, 4, SEEK_CUR); + n_quants[i] = vals[0]; + fseek_m(stream, 2*vals[0]*(4 + 30 + 4), SEEK_CUR); + } +// WRITE(LUPF) ONE_INTEGER ! Integer 1 to check Endian-ness +// WRITE(LUPF) NINT(VERSION*100.) ! FDS version number +// WRITE(LUPF) N_PART ! Number of PARTicle classes +// DO N=1,N_PART +// PC => PARTICLE_CLASS(N) +// WRITE(LUPF) PC%N_QUANTITIES,ZERO_INTEGER ! ZERO_INTEGER is a place holder +// DO NN=1,PC%N_QUANTITIES +// WRITE(LUPF) CDATA(PC%QUANTITIES_INDEX(NN)) ! 30 character output quantity +// WRITE(LUPF) UDATA(PC%QUANTITIES_INDEX(NN)) ! 30 character output units +// ENDDO +// ENDDO + + // pass 1: count frames + + nframes_all_local = 0; + parti->ntimes = 0; + for(;;){ + int count; + float time_local; + + if(nframes_all_local >= frameinfo->nframes)break; + fseek_m(stream, 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++; + if(tload_step > 1 && (nframes_all_local - 1) % tload_step != 0)continue; + if(use_tload_begin == 1 && time_local < tload_begin - TEPS)continue; + if(use_tload_end == 1 && time_local > tload_end + TEPS)break; + (parti->ntimes)++; + } + rewind_m(stream); + *nf_all = nframes_all_local; + if(parti->ntimes == 0){ + return 0; + } + + // allocate memory for number of time steps * number of classes + + CheckMemory; + NewMemory(( void ** )&parti->data5, parti->nclasses * parti->ntimes * sizeof(part5data)); + NewMemory(( void ** )&parti->times, parti->ntimes * sizeof(float)); + NewMemory(( void ** )&parti->times_map, parti->ntimes); + + // free memory for x, y, z frame data + + for(i = 0; i < parti->nclasses; i++){ + partclassdata *partclassi; + + partclassi = parti->partclassptr[i]; + partclassi->maxpoints = 0; + } + + // pass 2 - allocate memory for x, y, z frame data + + int nall_points_local; + part5data *datacopy_local; + int fail_local; + int nall_points_types_local; + + fail_local = 0; + datacopy_local = parti->data5; + for(i = 0; i < nframes_all_local; i++){ + int j, count; + float time_local; + + fseek_m(stream, 4 + frameinfo->offsets[i], SEEK_SET); + count = fread_m(&time_local, 4, 1, stream); + fseek_m(stream, 4, SEEK_CUR); + if(count != 1)break; + + int skipit = 0; + if(tload_step > 1 && i % tload_step != 0)skipit = 1; + if(use_tload_begin == 1 && time_local < tload_begin - TEPS)skipit = 1; + if(use_tload_end == 1 && time_local > tload_end + TEPS)break; + if(skipit==1)continue; + for(j = 0; j < parti->nclasses; j++){ + int npoints_local; + partclassdata *partclassj; + + datacopy_local->time = time_local; + partclassj = parti->partclassptr[j]; + InitPart5Data(datacopy_local, partclassj); + fseek_m(stream, 4, SEEK_CUR); count = fread_m(&datacopy_local->npoints_file, 4, 1, stream); fseek_m(stream, 4, SEEK_CUR); + if(count != 1)break; + npoints_local = datacopy_local->npoints_file; + fseek_m(stream, 4 + 3*sizeof(float)*npoints_local + 4, SEEK_CUR); + fseek_m(stream, 4 + sizeof(int)*npoints_local + 4, SEEK_CUR); + if(n_quants[j]>0)fseek_m(stream, 4 + n_quants[j]*sizeof(float)*npoints_local + 4, SEEK_CUR); + + if(npoints_local > partclassj->maxpoints)partclassj->maxpoints = npoints_local; + if(npoints_local > 0){ + if(partfast == NO){ + NewMemory(( void ** )&datacopy_local->dsx, npoints_local * sizeof(float)); + NewMemory(( void ** )&datacopy_local->dsy, npoints_local * sizeof(float)); + NewMemory(( void ** )&datacopy_local->dsz, npoints_local * sizeof(float)); + } + } + datacopy_local++; + } + if(fail_local == 1)break; + } + if(fail_local == 1)parti->ntimes = i; + rewind_m(stream); + + nall_points_types_local = 0; + nall_points_local = 0; + datacopy_local = parti->data5; + for(i = 0; i < parti->ntimes; i++){ + int j; + + for(j = 0; j < parti->nclasses; j++){ + int npoints_local, ntypes_local; + + npoints_local = datacopy_local->npoints_file; + ntypes_local = datacopy_local->partclassbase->ntypes; + nall_points_types_local += npoints_local * ntypes_local; + nall_points_local += npoints_local; + datacopy_local++; + } + } + FREEMEMORY(parti->vis_part); + FREEMEMORY(parti->tags); + FREEMEMORY(parti->sort_tags); + FREEMEMORY(parti->sx); + FREEMEMORY(parti->sy); + FREEMEMORY(parti->sz); + FREEMEMORY(parti->irvals); + FREEMEMORY(n_quants); + + NewMemory(( void ** )&parti->vis_part, MAX(nall_points_local, 1)); + NewMemory(( void ** )&parti->tags, MAX(nall_points_local, 1)*sizeof(int)); + NewMemory(( void ** )&parti->sort_tags, 2*MAX(nall_points_local, 1)*sizeof(int)); + NewMemory(( void ** )&parti->sx, MAX(nall_points_local, 1)*sizeof(short)); + NewMemory(( void ** )&parti->sy, MAX(nall_points_local, 1)*sizeof(short)); + NewMemory(( void ** )&parti->sz, MAX(nall_points_local, 1)*sizeof(short)); + NewMemory(( void ** )&parti->irvals, MAX(nall_points_types_local, 1)); + + datacopy_local = parti->data5; + nall_points_types_local = 0; + nall_points_local = 0; + for(i = 0; i < parti->ntimes; i++){ + int j; + + for(j = 0; j < parti->nclasses; j++){ + int npoints_local, ntypes_local; + + datacopy_local->irvals = parti->irvals + nall_points_types_local; + datacopy_local->vis_part = parti->vis_part + nall_points_local; + datacopy_local->tags = parti->tags + nall_points_local; + datacopy_local->sort_tags = parti->sort_tags + 2 * nall_points_local; + datacopy_local->sx = parti->sx + nall_points_local; + datacopy_local->sy = parti->sy + nall_points_local; + datacopy_local->sz = parti->sz + nall_points_local; + + npoints_local = datacopy_local->npoints_file; + ntypes_local = datacopy_local->partclassbase->ntypes; + nall_points_types_local += npoints_local * ntypes_local; + nall_points_local += npoints_local; + datacopy_local++; + } + } + if(nall_points_local == 0)return 0; + return 1; +} +#endif + +/* ------------------ GetPartHeader ------------------------ */ + +#ifndef pp_PARTFRAME +int GetPartHeader(partdata * parti, int *nf_all, int option_arg, int print_option_arg){ FILE *stream; char buffer_local[256]; float time_local; @@ -1710,6 +1910,7 @@ int GetPartHeader(partdata *parti, int *nf_all, int option_arg, int print_option // pass 1: count frames nframes_all_local =0; + parti->ntimes = 0; for(;;){ int exitloop_local; @@ -1722,7 +1923,7 @@ int GetPartHeader(partdata *parti, int *nf_all, int option_arg, int print_option break; } } - if(exitloop_local==1)break; + if(exitloop_local == 1)break; nframes_all_local++; if(tload_step>1 && (nframes_all_local-1)%tload_step!=0)continue; if(use_tload_begin==1 && time_localntimes)++; } rewind(stream); - *nf_all = nframes_all_local; + *nf_all = nframes_all_local; if(parti->ntimes==0){ fclose(stream); return 0; @@ -1888,7 +2089,7 @@ int GetPartHeader(partdata *parti, int *nf_all, int option_arg, int print_option } return 1; } - +#endif /* ------------------ UpdatePartColors ------------------------ */ void UpdatePartColors(partdata *parti, int flag){ @@ -1990,21 +2191,33 @@ void FinalizePartLoad(partdata *parti){ /* ----- ------------- ReadPart ------------------------ */ -FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorcode_arg){ +FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int load_flag, int *errorcode_arg){ size_t lenfile_local; int error_local=0, nf_all_local; partdata *parti; FILE_SIZE file_size_local; float load_time_local; +#ifdef pp_PARTFRAME + int time_frame = ALL_FRAMES; + float total_time; +#endif SetTimeState(); +#ifdef pp_PARTFRAME + START_TIMER(total_time); +#endif START_TIMER(load_time_local); assert(ifile_arg>=0&&ifile_argloaded==0&&loadflag_arg==UNLOAD)return 0.0; + if(load_flag==UNLOAD)parti->skipload = 1; + if(parti->loaded==0&&load_flag==UNLOAD)return 0.0; *errorcode_arg =0; parti->loaded = 0; @@ -2017,24 +2230,13 @@ FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorco THREADcontrol(partload_threads, THREAD_UNLOCK); #endif -#ifdef pp_FRAME - if(parti->frameinfo == NULL)parti->frameinfo = FRAMEInit(file_arg, NULL, FORTRAN_FILE, GetPartFrameInfo); - if(parti->frameinfo != NULL){ - // float valmin, valmax; - - FRAMESetup(parti->frameinfo); - FRAMEReadFrame(parti->frameinfo, 0, parti->frameinfo->nframes); - FRAMESetTimes(parti->frameinfo, 0, parti->frameinfo->nframes); - FRAMESetFramePtrs(parti->frameinfo, 0, parti->frameinfo->nframes); - // FRAMEGetMinMax(sd->frameinfo, &valmin, &valmax); - } -#endif - FREEMEMORY(parti->times); FREEMEMORY(parti->times_map); +#ifndef pp_PARTFRAME FREEMEMORY(parti->filepos); +#endif - if(loadflag_arg==UNLOAD){ + if(load_flag == UNLOAD){ if(parti->finalize == 1){ UpdatePartColors(parti, 0); UpdateTimes(); @@ -2043,13 +2245,18 @@ FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorco PrintMemoryInfo; #ifdef pp_PART_SPEEDUP THREADcontrol(partload_threads, THREAD_LOCK); - plotstate=GetPlotState(DYNAMIC_PLOTS); + plotstate = GetPlotState(DYNAMIC_PLOTS); THREADcontrol(partload_threads, THREAD_UNLOCK); #endif } return 0.0; } +#ifdef pp_PARTFRAME + parti->frameinfo = FRAMELoadData(parti->frameinfo, parti->file, load_flag, time_frame, FORTRAN_FILE, GetPartFrameInfo); + update_frame = 1; +#endif + lenfile_local = strlen(file_arg); if(lenfile_local==0){ ReadPart("",ifile_arg,UNLOAD,&error_local); @@ -2063,11 +2270,19 @@ FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorco THREADcontrol(partload_threads, THREAD_UNLOCK); } else{ +#ifdef pp_PARTFRAME + if(load_flag!=RELOAD)PRINTF("Loading %s\n", file_arg); +#else PRINTF("Loading %s", file_arg); +#endif } int have_particles; +#ifdef pp_PARTFRAME + have_particles = GetPartHeader(parti, &nf_all_local, NOT_FORCE, 1, parti->frameinfo->nframes); +#else have_particles = GetPartHeader(parti, &nf_all_local, NOT_FORCE, 1); +#endif if(have_particles==0){ ReadPart("", ifile_arg, UNLOAD, &error_local); return 0.0; @@ -2084,7 +2299,7 @@ FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorco } THREADcontrol(partload_threads, THREAD_UNLOCK); if(cache_part_data==0){ - FCLOSE_m(parti->stream); + fclose_m(parti->stream); parti->stream = NULL; } @@ -2105,6 +2320,7 @@ FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorco PRINT_TIMER(finalize_part, "finalize particle time"); } STOP_TIMER(load_time_local); +#ifndef pp_PARTFRAME if(file_size_local>1000000000){ PRINTF(" - %.1f GB/%.1f s\n", (float)file_size_local/1000000000., load_time_local); } @@ -2114,8 +2330,15 @@ FILE_SIZE ReadPart(char *file_arg, int ifile_arg, int loadflag_arg, int *errorco else{ PRINTF(" - %.0f kB/%.1f s\n", (float)file_size_local/1000., load_time_local); } +#endif update_part_bounds = 1; } +#ifdef pp_PARTFRAME + if(parti->frameinfo != NULL){ + STOP_TIMER(total_time); + parti->frameinfo->total_time = total_time; + } +#endif return file_size_local; } diff --git a/Source/smokeview/IOslice.c b/Source/smokeview/IOslice.c index 7a1c0f02e8..cb647432ca 100644 --- a/Source/smokeview/IOslice.c +++ b/Source/smokeview/IOslice.c @@ -19,10 +19,13 @@ #define SLICE_HEADER_SIZE 4 #define SLICE_TRAILER_SIZE 4 -#ifdef pp_FRAME -#define IJK_SLICE(i,j,k) ( ((k)-sd->ks1)*sd->nslicei*sd->nslicej + ((j)-sd->js1)*sd->nslicei + ((i)-sd->is1) ) +#ifdef pp_SLICEFRAME +#define IJK_SLICE(i,j,k) ( sd->compression_type==UNCOMPRESSED ? \ + ( ((k)-sd->ks1)*sd->nslicei*sd->nslicej + ((j)-sd->js1)*sd->nslicei + ((i)-sd->is1) ) :\ + ( ((i)-sd->is1)*sd->nslicej*sd->nslicek + ((j)-sd->js1)*sd->nslicek + ((k)-sd->ks1) ) \ + ) #else -#define IJK_SLICE(i,j,k) ( ((i)-sd->is1)*sd->nslicej*sd->nslicek + ((j)-sd->js1)*sd->nslicek + ((k)-sd->ks1) ) +#define IJK_SLICE(i,j,k) ( ((i)-sd->is1)*sd->nslicej*sd->nslicek + ((j)-sd->js1)*sd->nslicek + ((k)-sd->ks1) ) #endif #define SLICEVAL(i,j,k) \ @@ -150,7 +153,11 @@ float Get3DSliceVal(slicedata *sd, float *xyz){ float dxbar, dybar, dzbar; int ibar, jbar, kbar; int nx, ny, nz; +#ifdef pp_SLICEFRAME + int slice_nx, slice_ny; +#else int slice_ny, slice_nz; +#endif float dx, dy, dz; float val000, val100, val010, val110; float val001, val101, val011, val111; @@ -176,8 +183,13 @@ float Get3DSliceVal(slicedata *sd, float *xyz){ nx = ibar + 1; ny = jbar + 1; nz = kbar + 1; +#ifdef pp_SLICEFRAME + slice_nx = sd->ijk_max[0] - sd->ijk_min[0] + 1; + slice_ny = sd->ijk_max[1] - sd->ijk_min[1] + 1; +#else slice_ny = sd->ijk_max[1] - sd->ijk_min[1] + 1; slice_nz = sd->ijk_max[2] - sd->ijk_min[2] + 1; +#endif i = GETINDEX(xyz[0], xplt[0], dxbar, nx); j = GETINDEX(xyz[1], yplt[0], dybar, ny); @@ -187,7 +199,11 @@ float Get3DSliceVal(slicedata *sd, float *xyz){ ijk_min = sd->ijk_min; ijk_max = sd->ijk_max; +#ifdef pp_SLICEFRAME + ijk = (k-ijk_min[2])*slice_nx*slice_ny + (j-ijk_min[1])*slice_nx + (i-ijk_min[0]); +#else ijk = (i - ijk_min[0])*slice_nz*slice_ny + (j - ijk_min[1])*slice_nz + (k - ijk_min[2]); +#endif dx = (xyz[0] - xplt[i]) / dxbar; dx = CLAMP(dx, 0.0, 1.0); @@ -198,9 +214,15 @@ float Get3DSliceVal(slicedata *sd, float *xyz){ // ijk +#ifdef pp_SLICEFRAME + if(i <= ijk_max[0])ip1 = 1; + if(j <= ijk_max[1])jp1 = slice_nx; + if(k <= ijk_max[2])kp1 = slice_nx*slice_ny; +#else if(i <= ijk_max[0])ip1 = slice_nz*slice_ny; if(j <= ijk_max[1])jp1 = slice_nz; if(k <= ijk_max[2])kp1 = 1; +#endif val000 = (float)GET_VAL_N(sd, ijk); // i,j,k val001 = (float)GET_VAL_N(sd, ijk + kp1); // i,j,k+1 @@ -237,7 +259,11 @@ float GetSliceTextureIndex(float *xyz){ float dxbar, dybar, dzbar; int ibar, jbar, kbar; int nx, ny, nz; +#ifdef pp_SLICEFRAME + int slice_nx, slice_ny; +#else int slice_ny, slice_nz; +#endif float dx, dy, dz; float val000, val100, val010, val110; float val001, val101, val011, val111; @@ -269,8 +295,13 @@ float GetSliceTextureIndex(float *xyz){ nx = ibar + 1; ny = jbar + 1; nz = kbar + 1; +#ifdef pp_SLICEFRAME + slice_nx = gslice->ijk_max[0] - gslice->ijk_min[0] + 1; + slice_ny = gslice->ijk_max[1] - gslice->ijk_min[1] + 1; +#else slice_ny = gslice->ijk_max[1] - gslice->ijk_min[1] + 1; slice_nz = gslice->ijk_max[2] - gslice->ijk_min[2] + 1; +#endif i = GETINDEX(xyz[0], xplt[0], dxbar, nx); j = GETINDEX(xyz[1], yplt[0], dybar, ny); @@ -279,7 +310,11 @@ float GetSliceTextureIndex(float *xyz){ // val(i,j,k) = di*nj*nk + dj*nk + dk ijk_min = gslice->ijk_min; ijk_max = gslice->ijk_max; - ijk = (i - ijk_min[0])*slice_nz*slice_ny + (j - ijk_min[1])*slice_nz + (k - ijk_min[2]); +#ifdef pp_SLICEFRAME + ijk = (i - ijk_min[0]) + (j - ijk_min[1])*slice_nx + (k - ijk_min[2])*slice_nx*slice_ny; +#else + ijk = (i - ijk_min[0]) * slice_nz * slice_ny + (j - ijk_min[1]) * slice_nz + (k - ijk_min[2]); +#endif dx = (xyz[0] - xplt[i]) / dxbar; dx = CLAMP(dx, 0.0, 1.0); @@ -289,9 +324,15 @@ float GetSliceTextureIndex(float *xyz){ dz = CLAMP(dz, 0.0, 1.0); vv = slicedata0 + ijk; +#ifdef pp_SLICEFRAME + if(i + 1 <= ijk_max[0])iplus = 1; + if(j + 1 <= ijk_max[1])jplus = slice_nx; + if(k + 1 <= ijk_max[2])kplus = slice_nx*slice_ny; +#else if(i + 1 <= ijk_max[0])iplus = slice_nz*slice_ny; if(j + 1 <= ijk_max[1])jplus = slice_nz; if(k + 1 <= ijk_max[2])kplus = 1; +#endif val000 = (float)vv[0]; // i,j,k val001 = (float)vv[kplus]; // i,j,k+1 @@ -750,82 +791,9 @@ int GetSliceHeader(char *comp_file, char *size_file, int compression_type, return 2 + *nsteps; } -/* ------------------ CReadSlice_frame ------------------------ */ - -int CReadSlice_frame(int frame_index_local,int sd_index,int flag){ - slicedata *sd; - int headersize,framesize; - int frame_size; - long int skip_local; - FILEBUFFER *SLICEFILE=NULL; - float *time_local,*slicevals; - int error; - int returncode=0; - - sd = sliceinfo + sd_index; - if(sd->loaded==1)ReadSlice(sd->file,sd_index, ALL_FRAMES, NULL, UNLOAD,SET_SLICECOLOR,&error); - if(flag==UNLOAD){ - FREEMEMORY(sd->qslicedata); - FREEMEMORY(sd->times); - return 0; - } - if(frame_index_local==first_frame_index){ - if(sd->compression_type==UNCOMPRESSED){ - - - GetSliceSizes(sd->file, ALL_FRAMES, &sd->nslicei, &sd->nslicej, &sd->nslicek, &sd->ntimes, tload_step, &error, - use_tload_begin, use_tload_end, tload_begin, tload_end, &headersize, &framesize); - } - else if(sd->compression_type!=UNCOMPRESSED){ - if( - GetSliceHeader(sd->comp_file,sd->size_file,sd->compression_type, - tload_step, use_tload_begin, use_tload_end, tload_begin, tload_end, - &sd->nslicei, &sd->nslicej, &sd->nslicek, &sd->ntimes, &sd->ncompressed, &sd->valmin_slice, &sd->valmax_slice)==0){ - ReadSlice("",sd_index, ALL_FRAMES,NULL,UNLOAD,SET_SLICECOLOR,&error); - return -1; - } - } - } - skip_local = (HEADER_SIZE+30 +TRAILER_SIZE); // long label - skip_local += (HEADER_SIZE+30 +TRAILER_SIZE); // short label - skip_local += (HEADER_SIZE+30 +TRAILER_SIZE); // unit label - skip_local += (HEADER_SIZE+6*4 +TRAILER_SIZE); // is1, is2, js1, js2, ks1, ks2 - - frame_size = sd->nslicei*sd->nslicej*sd->nslicek; - skip_local += frame_index_local*(HEADER_SIZE + 4 + TRAILER_SIZE); // - skip_local += frame_index_local*(HEADER_SIZE + frame_size*4 + TRAILER_SIZE); // - - if(SLICEFILE==NULL){ - SLICEFILE=FOPEN_SLICE(sd->file,"rb"); - } - if(SLICEFILE==NULL){ - return -1; - } - - FSEEK_SLICE(SLICEFILE,skip_local,SEEK_SET); // skip from beginning of file - - if(frame_index_local==first_frame_index){ - if(NewMemory((void **)&sd->qslicedata,2*frame_size*sizeof(float))==0|| - NewMemory((void **)&sd->times,sizeof(float))==0){ - FCLOSE_SLICE(SLICEFILE); - return -1; - } - } - slicevals=sd->qslicedata; - if(frame_index_local%2!=0){ - slicevals+=frame_size; - } - time_local=sd->times; - - FORT_SLICEREAD(time_local,1,SLICEFILE); - FORT_SLICEREAD(slicevals,frame_size,SLICEFILE); - FCLOSE_SLICE(SLICEFILE); - return 0; -} - /* ------------------ ReadVSlice ------------------------ */ -FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, int set_slicecolor, int *errorcode){ +FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int load_flag, int set_slicecolor, int *errorcode){ vslicedata *vd; float valmin, valmax; int display; @@ -844,7 +812,7 @@ FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, i if(vd->iu!=-1)sliceinfo[vd->iu].uvw = 1; if(vd->iv!=-1)sliceinfo[vd->iv].uvw = 1; if(vd->iw!=-1)sliceinfo[vd->iw].uvw = 1; - if(flag==UNLOAD){ + if(load_flag==UNLOAD){ if(vd->loaded==0)return 0; if(vd->iu!=-1){ slicedata *u=NULL; @@ -940,7 +908,7 @@ FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, i return_filesize += ReadGeomData(u->patchgeom, u, LOAD, time_frame, time_value, 0, errorcode); } else{ - return_filesize += ReadSlice(u->file, vd->iu, time_frame,time_value, flag, set_slicecolor, errorcode); + return_filesize += ReadSlice(u->file, vd->iu, time_frame,time_value, load_flag, set_slicecolor, errorcode); } if(*errorcode!=0){ vd->loaded = 1; @@ -967,7 +935,7 @@ FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, i return_filesize += ReadGeomData(v->patchgeom, v, LOAD, time_frame, time_value, 0, errorcode); } else{ - return_filesize += ReadSlice(v->file, vd->iv, time_frame,time_value,flag, set_slicecolor, errorcode); + return_filesize += ReadSlice(v->file, vd->iv, time_frame,time_value,load_flag, set_slicecolor, errorcode); } if(*errorcode!=0){ fprintf(stderr, "*** Error: unable to load V velocity vector components in %s . Vector load aborted\n", v->file); @@ -995,7 +963,7 @@ FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, i return_filesize += ReadGeomData(w->patchgeom, w, LOAD, time_frame, time_value, 0, errorcode); } else{ - return_filesize += ReadSlice(w->file, vd->iw, time_frame,time_value,flag, set_slicecolor, errorcode); + return_filesize += ReadSlice(w->file, vd->iw, time_frame,time_value,load_flag, set_slicecolor, errorcode); } if(*errorcode!=0){ fprintf(stderr, "*** Error: unable to load W velocity vector components in %s . Vector load aborted\n", w->file); @@ -1024,7 +992,7 @@ FILE_SIZE ReadVSlice(int ivslice, int time_frame, float *time_value, int flag, i return_filesize += ReadGeomData(val->patchgeom, val, LOAD, time_frame, time_value, 0, errorcode); } else{ - return_filesize += ReadSlice(val->file, vd->ival, time_frame,time_value,flag, set_slicecolor, errorcode); + return_filesize += ReadSlice(val->file, vd->ival, time_frame,time_value,load_flag, set_slicecolor, errorcode); } if(*errorcode!=0){ fprintf(stderr, "*** Error: unable to load vector values in %s . Vector load aborted\n", val->file); @@ -2328,6 +2296,14 @@ void GetSliceParams(sliceparmdata *sp){ is1 = iis1; is2 = iis2; } +#ifdef pp_SLICEFRAME + if(sd->slice_filetype == SLICE_CELL_CENTER && is1 != is2){ + is1--; + is1 = MAX(is1, 0); + sd->is1 = is1; + sd->iis1 = is1; + } +#endif ni = is2+1-is1; nj = js2+1-js1; nk = ks2+1-ks1; @@ -3160,7 +3136,7 @@ void GetSliceDataBounds(slicedata *sd, float *pmin, float *pmax){ /* ------------------ TimeAverageData ------------------------ */ -int TimeAverageData(float *data_out, float *data_in, int ndata, int data_per_timestep, float *times_local, int ntimes_local, float average_time){ +int TimeAverageData(float **data_out, float **data_in, int ndata, int data_per_timestep, float *times_local, int ntimes_local, float average_time){ #define IND(itime,ival) ((itime)*data_per_timestep + (ival)) float *datatemp = NULL; @@ -3197,15 +3173,23 @@ int TimeAverageData(float *data_out, float *data_in, int ndata, int data_per_tim naverage = above + 1 - below; for(k = 0; k < data_per_timestep; k++){ for(j = below; j <= above; j++){ - datatemp[IND(i, k)] += data_in[IND(j, k)]; + float *valinptr; + + valinptr = data_in[j]; + datatemp[IND(i, k)] += valinptr[k]; } } for(k = 0; k < data_per_timestep; k++){ datatemp[IND(i, k)] /= (float)naverage; } } - for(i = 0; i < ndata; i++){ - data_out[i] = datatemp[i]; + for(k = 0; k < data_per_timestep; k++){ + for(j = 0; j < ntimes_local;j++){ + float *valoutptr; + + valoutptr = data_out[j]; + valoutptr[k] = datatemp[j*data_per_timestep + k]; + } } FREEMEMORY(datatemp); return 0; @@ -3839,11 +3823,17 @@ void GetSliceTimes(char *file, float *times, int ntimes){ /* ------------------ ReadSlice ------------------------ */ -FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_value, int flag, int set_slicecolor, int *errorcode){ +FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_value, int load_flag, int set_slicecolor, int *errorcode){ float *xplt_local, *yplt_local, *zplt_local, offset, qmin, qmax, read_time, total_time; - int blocknumber, error, headersize, framesize, flag2 = 0; + int blocknumber, error, flag2 = 0; slicedata *sd; int ntimes_slice_old; +#ifdef pp_SLICEFRAME + float frame_valmin, frame_valmax; +#endif +#ifndef pp_SLICEFRAME + int headersize, framesize; +#endif SNIFF_ERRORS("ReadSlice: start"); SetTimeState(); @@ -3858,8 +3848,10 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val unsigned int availmemory; #endif +#ifndef pp_SLICEFRAME #ifndef pp_FSEEK - if(flag==RELOAD)flag = LOAD; + if(load_flag==RELOAD)load_flag = LOAD; +#endif #endif CheckMemory; START_TIMER(total_time); @@ -3874,8 +3866,8 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val blocknumber = sd->blocknumber; meshi = meshinfo + blocknumber; - if(flag != RESETBOUNDS){ - if(sd->loaded == 0 && flag == UNLOAD)return 0; + if(load_flag != RESETBOUNDS){ + if(sd->loaded == 0 && load_flag == UNLOAD)return 0; sd->display = 0; #ifdef pp_MEMDEBUG if(sd->qslicedata != NULL){ @@ -3885,7 +3877,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val // free memory buffers - if(flag!=RELOAD){ + if(load_flag!=RELOAD){ if(sd->qslicedata != NULL){ FreeMemory(sd->qslicedata); sd->qslicedata = NULL; @@ -3895,8 +3887,9 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val FREEMEMORY(sd->compindex); FREEMEMORY(sd->qslicedata_compressed); FREEMEMORY(sd->slicecomplevel); -#ifdef pp_FRAME - FRAMEFree(&sd->frameinfo); +#ifdef pp_SLICEFRAME + FRAMEFree(sd->frameinfo); + sd->frameinfo = NULL; #endif } @@ -3904,7 +3897,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val // reset slice variables to an unloaded state - if(flag == UNLOAD){ + if(load_flag == UNLOAD){ int ii; update_flipped_colorbar = 1; @@ -3918,7 +3911,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val ReadVolSlice = 0; for(ii = 0; iiframeinfo == NULL)sd->frameinfo = FRAMEInit(sd->file, sd->size_file, FORTRAN_FILE, GetSliceFrameInfo); - if(sd->frameinfo != NULL){ - float valmin, valmax; +// load entire slice file (load_flag=LOAD) or +// load only portion of slice file written to since last time it was loaded (load_flag=RELOAD) - FRAMESetup(sd->frameinfo); - FRAMEReadFrame(sd->frameinfo, 0, sd->frameinfo->nframes); - FRAMESetTimes(sd->frameinfo, 0, sd->frameinfo->nframes); - FRAMESetFramePtrs(sd->frameinfo, 0, sd->frameinfo->nframes); - FRAMEGetMinMax(sd->frameinfo, &valmin, &valmax); +#ifdef pp_SLICEFRAME + if(sd->compression_type == UNCOMPRESSED){ + sd->frameinfo = FRAMELoadData(sd->frameinfo, sd->file, load_flag, time_frame, FORTRAN_FILE, GetSliceFrameInfo); + sd->ntimes = sd->frameinfo->nframes; + NewMemory((void **)&sd->times, sd->ntimes * sizeof(float)); + memcpy(sd->times, sd->frameinfo->times, sd->ntimes * sizeof(float)); + FRAMEGetMinMax(sd->frameinfo); + frame_valmin = sd->frameinfo->valmin; + frame_valmax = sd->frameinfo->valmax; + update_frame = 1; } #endif if(sd->compression_type == UNCOMPRESSED){ +#ifndef pp_SLICEFRAME sd->ntimes_old = sd->ntimes; GetSliceSizes(file, time_frame, &sd->nslicei, &sd->nslicej, &sd->nslicek, &sd->ntimes, tload_step, &error, use_tload_begin, use_tload_end, tload_begin, tload_end, &headersize, &framesize); +#endif } else if(sd->compression_type != UNCOMPRESSED){ if( @@ -4027,6 +4022,11 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val *errorcode = 1; return 0; } +#ifdef pp_SLICEFRAME + if(time_frame == ALL_FRAMES&&load_flag!=RELOAD){ + PRINTF("Loading %s(%s)\n", file, sd->label.shortlabel); + } +#else if(use_tload_begin== 0 &&use_tload_end == 0 && sd->compression_type == UNCOMPRESSED){ if(framesize <= 0){ fprintf(stderr, "*** Error: frame size is 0 in slice file %s . \n", file); @@ -4047,6 +4047,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val if(time_frame==ALL_FRAMES){ PRINTF("Loading %s(%s)", file, sd->label.shortlabel); } +#endif MEMSTATUS(1, &availmemory, NULL, NULL); START_TIMER(read_time); if(sd->compression_type != UNCOMPRESSED){ @@ -4090,7 +4091,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val #endif ntimes_slice_old = 0; - if(flag==RELOAD){ + if(load_flag==RELOAD){ ntimes_slice_old = sd->ntimes_old; qmin = sd->globalmin_slice; qmax = sd->globalmax_slice; @@ -4100,10 +4101,16 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val qmax = -1.0e30; } if(sd->ntimes > ntimes_slice_old){ +#ifdef pp_SLICEFRAME + return_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, &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; @@ -4129,18 +4136,32 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val int data_per_timestep; int ndata; int ntimes_local; + float **qvalptrs; + data_per_timestep = sd->nslicei*sd->nslicej*sd->nslicek; ntimes_local = sd->ntimes; ndata = data_per_timestep*ntimes_local; show_slice_average = 1; +#ifdef pp_SLICEFRAME + qvalptrs = ( float **)sd->frameinfo->frameptrs; +#else + int i; + NewMemory(( void ** )&qvalptrs, sd->ntimes*sizeof(float *)); + for(i=0; i< sd->ntimes ; i++){ + qvalptrs[i] = sd->qslicedata + i*data_per_timestep; + } +#endif if( sd->compression_type != UNCOMPRESSED || - TimeAverageData(sd->qslicedata, sd->qslicedata, ndata, data_per_timestep, sd->times, ntimes_local, slice_average_interval) == 1 + TimeAverageData(qvalptrs, qvalptrs, ndata, data_per_timestep, sd->times, ntimes_local, slice_average_interval) == 1 ){ show_slice_average = 0; // averaging failed } +#ifndef pp_SLICEFRAME + FREEMEMORY(qvalptrs); +#endif } /* initialize slice data */ @@ -4313,7 +4334,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val CheckMemory; //*** comment out following line to prevent crash when loading a slice when particles are loaded - //if(flag!=RESETBOUNDS)update_research_mode=1; + //if(load_flag!=RESETBOUNDS)update_research_mode=1; if(use_set_slicecolor==0||set_slicecolor==SET_SLICECOLOR){ if(sd->compression_type==UNCOMPRESSED){ int i; @@ -4405,7 +4426,8 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val STOP_TIMER(total_time); - if(time_frame==ALL_FRAMES&&flag != RESETBOUNDS){ +#ifndef pp_SLICEFRAME + if(time_frame==ALL_FRAMES&&load_flag != RESETBOUNDS){ if(file_size>1000000000){ PRINTF(" - %.1f GB/%.1f s\n", (float)file_size / 1000000000., total_time); } @@ -4416,6 +4438,7 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val PRINTF(" - %.0f KB/%.1f s\n", (float)file_size / 1000., total_time); } } +#endif #ifdef pp_RECOMPUTE_DEBUG if(recompute==1)printf("***recomputing bounds\n"); #endif @@ -4481,6 +4504,11 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val PrintMemoryInfo; } SNIFF_ERRORS("ReadSlice: end"); +#ifdef pp_SLICEFRAME + if(sd->frameinfo != NULL){ + sd->frameinfo->total_time = total_time; + } +#endif return return_filesize; } @@ -4489,12 +4517,17 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val void UpdateSlice3DTexture(meshdata *meshi, slicedata *slicei, float *valdata){ GLint xoffset = 0, yoffset = 0, zoffset = 0; GLsizei nx, ny, nz, nxy; +#ifdef pp_SLICEFRAME + int slice_nx, slice_ny; + int slice_nxy; +#else int slice_ny, slice_nz; + int slice_nyz; +#endif int i, j, k; float *cbuffer; int *ijk_min, *ijk_max; int kindex; - int slice_nyz; nx = meshi->ibar + 1; @@ -4503,10 +4536,33 @@ void UpdateSlice3DTexture(meshdata *meshi, slicedata *slicei, float *valdata){ ijk_min = slicei->ijk_min; ijk_max = slicei->ijk_max; +#ifdef pp_SLICEFRAME + slice_nx = ijk_max[0] - ijk_min[0] + 1; + slice_ny = ijk_max[1] - ijk_min[1] + 1; + slice_nxy = slice_nx * slice_ny; +#else slice_ny = ijk_max[1] - ijk_min[1] + 1; slice_nz = ijk_max[2] - ijk_min[2] + 1; slice_nyz = slice_ny*slice_nz; +#endif + +#ifdef pp_SLICEFRAME + nxy = nx * ny; + for(k = ijk_min[2], kindex = 0; k < ijk_max[2] + 1; k++, kindex+=slice_nxy){ + int jindex; + for(j = ijk_min[1], jindex = 0; j < ijk_max[1] + 1; j++, jindex += slice_nx){ + float *v; + + cbuffer = meshi->slice3d_c_buffer + IJKNODE(ijk_min[0], j, k); + v = valdata + jindex + kindex; + for(i = ijk_min[0]; i < ijk_max[0] + 1; i++){ + *cbuffer++ = *v; + v ++; + } + } + } +#else nxy = nx*ny; for(k = ijk_min[2],kindex=0; kslice3d_c_buffer; glActiveTexture(GL_TEXTURE0); @@ -4589,8 +4646,7 @@ void DrawGSliceDataGpu(slicedata *slicei){ /* ------------------ DrawVolSliceCellFaceCenter ------------------------ */ -void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, - int is1, int is2, int js1, int js2, int ks1, int ks2, int slicedir){ +void DrawVolSliceCellFaceCenter(const slicedata *sd, int is1, int is2, int js1, int js2, int ks1, int ks2, int slicedir){ float *xplt, *yplt, *zplt; int plotx, ploty, plotz; int ibar, jbar; @@ -4632,7 +4688,14 @@ void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, ploty = js1; plotz = ks1; //tentative fix (was iimin = plotx) to FDS issue 7266 +#ifdef pp_SLICEFRAME + incx = 1; + incy = 1; + incz = 1; + iimin = 0; +#else iimin = plotx+1; +#endif } ibar = meshi->ibar; @@ -4654,19 +4717,15 @@ void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, float constval; int maxj; int j; - + int xindex; int plotxm1; + + xindex = plotx + 1 - incx - iimin + sd->is1; +#ifdef pp_SLICEFRAME + if(sd->volslice == 0)xindex = sd->is1; +#endif plotxm1 = MAX(plotx-1, 0); - switch(flag){ - case SLICE_CELL_CENTER: - constval = (xplt[plotx] + xplt[plotxm1]) / 2.0; - break; - default: - constval = (xplt[plotx] + xplt[plotxm1]) / 2.0; - assert(FFALSE); - break; - } - constval += SCALE2SMV(slice_dz); + constval = (xplt[plotx] + xplt[plotxm1])/2.0 + SCALE2SMV(slice_dz); glBegin(GL_TRIANGLES); maxj = MAX(js2, js1 + 1); @@ -4695,7 +4754,8 @@ void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, } if(skip_slice_in_embedded_mesh == 1 && iblank_embed != NULL&&iblank_embed[IJKCELL(plotx, j, k)] == EMBED_YES)continue; - index_cell = (plotx+1-incx-iimin)*sd->nslicej*sd->nslicek + (j+1-sd->js1)*sd->nslicek + k+1-sd->ks1; +// index_cell = (plotx+1-incx-iimin)*sd->nslicej*sd->nslicek + (j+1-sd->js1)*sd->nslicek + k+1-sd->ks1; + index_cell = IJK_SLICE(xindex, j+1, k+1); i33 = SLICECOLOR(index_cell); z1 = zplt[k]; z3 = zplt[k + 1]; @@ -4722,22 +4782,19 @@ void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, if(slicedir>0&&slicedir!=YDIR)doit = 0; if(doit == 1){ float constval; - int i; - int maxi; + int i, maxi; + int yindex; - switch(flag){ - case SLICE_CELL_CENTER: - constval = (yplt[ploty] + yplt[ploty - 1]) / 2.0; - break; - default: - constval = (yplt[ploty] + yplt[ploty - 1]) / 2.0; - assert(FFALSE); - break; - } - constval += SCALE2SMV(slice_dz); + yindex = ploty + 1 - incy; +#ifdef pp_SLICEFRAME + if(sd->volslice == 0)yindex = sd->js1; +#endif + + constval = (yplt[ploty] + yplt[ploty - 1])/2.0 + SCALE2SMV(slice_dz); glBegin(GL_TRIANGLES); maxi = MAX(is2, is1 + 1); + for(i = is1; iis1)*sd->nslicej*sd->nslicek + (ploty+1-incy-sd->js1)*sd->nslicek + k+1-sd->ks1; +// index_cell = (i+incx-sd->is1)*sd->nslicej*sd->nslicek + (ploty+1-incy-sd->js1)*sd->nslicek + k+1-sd->ks1; + index_cell = IJK_SLICE(i+incx, yindex, k+1); i33 = SLICECOLOR(index_cell); z1 = zplt[k]; z3 = zplt[k + 1]; @@ -4790,17 +4848,14 @@ void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, float constval; int i; int maxi; + int zindex; - switch(flag){ - case SLICE_CELL_CENTER: - constval = (zplt[plotz] + zplt[plotz - 1]) / 2.0; - break; - default: - constval = (zplt[plotz] + zplt[plotz - 1]) / 2.0; - assert(FFALSE); - break; - } - constval += SCALE2SMV(slice_dz); + constval = (zplt[plotz] + zplt[plotz - 1]) / 2.0 + SCALE2SMV(slice_dz); + + zindex = plotz+1-incz; +#ifdef pp_SLICEFRAME + if(sd->volslice==0)zindex = sd->ks1; +#endif glBegin(GL_TRIANGLES); maxi = MAX(is2, is1 + 1); @@ -4826,7 +4881,8 @@ void DrawVolSliceCellFaceCenter(const slicedata *sd, int flag, } if(skip_slice_in_embedded_mesh == 1 && iblank_embed != NULL&&iblank_embed[IJKCELL(i, j, plotz)] == EMBED_YES)continue; - index_cell = (i+1-sd->is1)*sd->nslicej*sd->nslicek + (j+incy-sd->js1)*sd->nslicek + plotz+1-incz-sd->ks1; +// index_cell = (i+1-sd->is1)*sd->nslicej*sd->nslicek + (j+incy-sd->js1)*sd->nslicek + plotz+1-incz-sd->ks1; + index_cell = IJK_SLICE(i+1, j+incy, zindex); i33 = SLICECOLOR(index_cell); yy1 = yplt[j]; y3 = yplt[j + 1]; @@ -5028,7 +5084,7 @@ void DrawVolSliceValues(slicedata *sd){ /* ------------------ DrawVolSliceCellValues ------------------------ */ -void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ +void DrawVolSliceCellFaceCenterValues(const slicedata *sd){ float *xplt, *yplt, *zplt; int plotx, ploty, plotz; int ibar, jbar; @@ -5057,7 +5113,14 @@ void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ ploty = sd->js1; plotz = sd->ks1; //tentative fix (was iimin = plotx) to FDS issue 7266 +#ifdef pp_SLICEFRAME + incx = 1; + incy = 1; + incz = 1; + iimin = 0; +#else iimin = plotx+1; +#endif } ibar = meshi->ibar; @@ -5072,19 +5135,16 @@ void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ float constval; int maxj; int j; - + int xindex; int plotxm1; + + xindex = plotx + 1 - incx - iimin + sd->is1; +#ifdef pp_SLICEFRAME + if(sd->volslice == 0)xindex = sd->is1; +#endif + plotxm1 = MAX(plotx-1, 0); - switch(flag){ - case SLICE_CELL_CENTER: - constval = (xplt[plotx] + xplt[plotxm1]) / 2.0; - break; - default: - constval = (xplt[plotx] + xplt[plotxm1]) / 2.0; - assert(FFALSE); - break; - } - constval += SCALE2SMV(slice_dz); + constval = (xplt[plotx] + xplt[plotxm1]) / 2.0 + SCALE2SMV(slice_dz); if(show_slice_values[0]==1||show_slice_values[1]==1||show_slice_values[2]==1){ maxj = sd->js2; @@ -5119,7 +5179,8 @@ void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ n+1 (y1,z3) n2+1 (y3,z3) n (y1,z1) n2 (y3,z1) */ - index_cell = (plotx+1-incx-iimin)*sd->nslicej*sd->nslicek + (j+1-sd->js1)*sd->nslicek + k+1-sd->ks1; +// index_cell = (plotx+1-incx-iimin)*sd->nslicej*sd->nslicek + (j+1-sd->js1)*sd->nslicek + k+1-sd->ks1; + index_cell = IJK_SLICE(xindex, j+1, k+1); GET_VAL(sd, val, index_cell); Output3Val(constval, (yy1 + y3) / 2.0, (z1 + z3) / 2.0, val); @@ -5131,17 +5192,14 @@ void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ float constval; int i; int maxi; + int yindex; - switch(flag){ - case SLICE_CELL_CENTER: - constval = (yplt[ploty] + yplt[ploty - 1]) / 2.0; - break; - default: - constval = (yplt[ploty] + yplt[ploty - 1]) / 2.0; - assert(FFALSE); - break; - } - constval += SCALE2SMV(slice_dz); + yindex = ploty + 1 - incy; +#ifdef pp_SLICEFRAME + if(sd->volslice == 0)yindex = sd->js1; +#endif + + constval = (yplt[ploty] + yplt[ploty - 1]) / 2.0 + SCALE2SMV(slice_dz); if(show_slice_values[0]==1||show_slice_values[1]==1||show_slice_values[2]==1){ maxi = sd->is1 + sd->nslicei - 1; @@ -5170,7 +5228,8 @@ void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ } if(skip_slice_in_embedded_mesh == 1 && iblank_embed != NULL&&iblank_embed[IJKCELL(i, ploty, k)] == EMBED_YES)continue; - index_cell = (i+incx-sd->is1)*sd->nslicej*sd->nslicek + (ploty+1-incy-sd->js1)*sd->nslicek + k+1-sd->ks1; +// index_cell = (i+incx-sd->is1)*sd->nslicej*sd->nslicek + (ploty+1-incy-sd->js1)*sd->nslicek + k+1-sd->ks1; + index_cell = IJK_SLICE(i+incx, yindex, k+1); z1 = zplt[k]; z3 = zplt[k + 1]; /* @@ -5190,22 +5249,19 @@ void DrawVolSliceCellFaceCenterValues(const slicedata *sd, int flag){ int i; int maxi; - switch(flag){ - case SLICE_CELL_CENTER: - constval = (zplt[plotz] + zplt[plotz - 1]) / 2.0; - break; - default: - constval = (zplt[plotz] + zplt[plotz - 1]) / 2.0; - assert(FFALSE); - break; - } - constval += SCALE2SMV(slice_dz); + constval = (zplt[plotz] + zplt[plotz - 1]) / 2.0 + SCALE2SMV(slice_dz); if(show_slice_values[0]==1||show_slice_values[1]==1||show_slice_values[2]==1){ maxi = sd->is1 + sd->nslicei - 1; if(sd->is1 + 1>maxi){ maxi = sd->is1 + 1; } + int zindex; + + zindex = plotz+1-incz; +#ifdef pp_SLICEFRAME + if(sd->volslice==0)zindex = sd->ks1; +#endif for(i = sd->is1; iis1)*sd->nslicej*sd->nslicek + (j+incy-sd->js1)*sd->nslicek + plotz+1-incz-sd->ks1; +// index_cell = (i+1-sd->is1)*sd->nslicej*sd->nslicek + (j+incy-sd->js1)*sd->nslicek + plotz+1-incz-sd->ks1; + index_cell = IJK_SLICE(i+1, j+incy, zindex); yy1 = yplt[j]; y3 = yplt[j + 1]; /* @@ -7247,7 +7304,7 @@ int SetupSlice(slicedata *sd){ } else{ sd->iqsliceframe = sd->slicelevel + sd->itime * sd->nsliceijk; -#ifdef pp_FRAME +#ifdef pp_SLICEFRAME sd->qslice = (float *)FRAMEGetFramePtr(sd->frameinfo, sd->itime); #else sd->qslice = sd->qslicedata + sd->itime * sd->nsliceijk; @@ -7259,7 +7316,11 @@ int SetupSlice(slicedata *sd){ assert(ValidPointer(sd->qslicedata, sizeof(float) * sd->nslicetotal)); } #endif +#ifdef pp_SLICEFRAME + sd->qsliceframe = (float *)FRAMEGetFramePtr(sd->frameinfo, sd->itime); +#else if(sd->qslicedata != NULL)sd->qsliceframe = sd->qslicedata + sd->itime * sd->nsliceijk; +#endif } return 1; } @@ -7440,19 +7501,16 @@ void DrawSliceFrame(){ #endif break; case SLICE_CELL_CENTER: - { + if(sortslices==0||sd->volslice==1){ int is2; - if(sd->volslice==1){ + if(sd->volslice == 1){ is2 = sd->is1 + sd->nslicei - 1; } else{ is2 = sd->is2; } - if(sortslices==0||sd->volslice==1){ - DrawVolSliceCellFaceCenter(sd, SLICE_CELL_CENTER, - sd->is1, is2, sd->js1, sd->js2, sd->ks1, sd->ks2, 0); - } + DrawVolSliceCellFaceCenter(sd, sd->is1, is2, sd->js1, sd->js2, sd->ks1, sd->ks2, 0); } SNIFF_ERRORS("after DrawVolSliceCellFaceCenter SLICE_CELL_CENTER"); if(show_slice_outlines[IN_SOLID_GLUI]==1||show_slice_outlines[IN_GAS_GLUI]==1){ @@ -7464,7 +7522,7 @@ void DrawSliceFrame(){ SNIFF_ERRORS("after DrawVolSliceVerts SLICE_CELL_CENTER"); } if(show_slice_values[IN_SOLID_GLUI]==1||show_slice_values[IN_GAS_GLUI]==1){ - DrawVolSliceCellFaceCenterValues(sd, SLICE_CELL_CENTER); + DrawVolSliceCellFaceCenterValues(sd); SNIFF_ERRORS("after DrawVolSliceVerts SLICE_CELL_CENTER"); } break; @@ -7605,7 +7663,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_v; float dy; - index_v = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1)*sd->nslicek + k + 1 - sd->ks1; + // index_v = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1)*sd->nslicek + k + 1 - sd->ks1; + index_v = IJK_SLICE(plotx, j, k+1); GET_VEC_DXYZ(v, dy, index_v); ADJUST_VEC_DX(dy); glVertex3f(constval, yy1 - dy, zhalf); @@ -7615,7 +7674,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_w; float dz; - index_w = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1 + 1)*sd->nslicek + k - sd->ks1; +// index_w = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1 + 1)*sd->nslicek + k - sd->ks1; + index_w = IJK_SLICE(plotx, j, k); GET_VEC_DXYZ(w, dz, index_w); ADJUST_VEC_DX(dz); glVertex3f(constval, yhalf, z1 - dz); @@ -7664,7 +7724,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_v; float dy; - index_v = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1)*sd->nslicek + k - sd->ks1 + 1; +// index_v = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1)*sd->nslicek + k - sd->ks1 + 1; + index_v = IJK_SLICE(plotx, j, k+1); GET_VEC_DXYZ(v, dy, index_v); ADJUST_VEC_DX(dy); glVertex3f(constval, yy1 + dy, zhalf); @@ -7673,7 +7734,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_w; float dz; - index_w = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1 + 1)*sd->nslicek + k - sd->ks1; +// index_w = (plotx - sd->is1)*sd->nslicej*sd->nslicek + (j - sd->js1 + 1)*sd->nslicek + k - sd->ks1; + index_w = IJK_SLICE(plotx, j, k); GET_VEC_DXYZ(w, dz, index_w); ADJUST_VEC_DX(dz); glVertex3f(constval, yhalf, z1 + dz); @@ -7730,7 +7792,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_u; float dx; - index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k + 1 - sd->ks1; +// index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k + 1 - sd->ks1; + index_u = IJK_SLICE(i, ploty, k+1); GET_VEC_DXYZ(u, dx, index_u); ADJUST_VEC_DX(dx); glVertex3f(x1 - dx, constval, zhalf); @@ -7740,7 +7803,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_w; float dz; - index_w = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k - sd->ks1; +// index_w = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k - sd->ks1; + index_w = IJK_SLICE(i+1, ploty, k); GET_VEC_DXYZ(w, dz, index_w); ADJUST_VEC_DX(dz); glVertex3f(xhalf, constval, z1 - dz); @@ -7785,7 +7849,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_u; float dx; - index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k + 1 - sd->ks1; +// index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k + 1 - sd->ks1; + index_u = IJK_SLICE(i, ploty, k+1); GET_VEC_DXYZ(u, dx, index_u); ADJUST_VEC_DX(dx); glVertex3f(x1 + dx, constval, zhalf); @@ -7794,7 +7859,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_w; float dz; - index_w = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k - sd->ks1; +// index_w = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (ploty - sd->js1)*sd->nslicek + k - sd->ks1; + index_w = IJK_SLICE(i+1, ploty, k); GET_VEC_DXYZ(w, dz, index_w); ADJUST_VEC_DX(dz); glVertex3f(xhalf, constval, z1 + dz); @@ -7851,7 +7917,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_u; float dx; - index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j + 1 - sd->js1)*sd->nslicek; +// index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j + 1 - sd->js1)*sd->nslicek; + index_u = IJK_SLICE(i, j+1, plotz); GET_VEC_DXYZ(u, dx, index_u); ADJUST_VEC_DX(dx); glVertex3f(x1 - dx, yhalf, constval); @@ -7861,7 +7928,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_v; float dy; - index_v = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j - sd->js1)*sd->nslicek; +// index_v = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j - sd->js1)*sd->nslicek; + index_v = IJK_SLICE(i+1, j, plotz); GET_VEC_DXYZ(v, dy, index_v); ADJUST_VEC_DX(dy); glVertex3f(xhalf, yy1 - dy, constval); @@ -7908,7 +7976,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_u; float dx; - index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j + 1 - sd->js1)*sd->nslicek; +// index_u = (i - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j + 1 - sd->js1)*sd->nslicek; + index_u = IJK_SLICE(i, j+1, plotz); GET_VEC_DXYZ(u, dx, index_u); ADJUST_VEC_DX(dx); glVertex3f(x1 + dx, yhalf, constval); @@ -7917,7 +7986,8 @@ void DrawVVolSliceCellCenter(const vslicedata *vd){ int index_v; float dy; - index_v = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j - sd->js1)*sd->nslicek; +// index_v = (i + 1 - sd->is1)*sd->nslicej*sd->nslicek + (plotz - sd->ks1) + (j - sd->js1)*sd->nslicek; + index_v = IJK_SLICE(i+1, j, plotz); GET_VEC_DXYZ(v, dy, index_v); ADJUST_VEC_DX(dy); glVertex3f(xhalf, yy1 + dy, constval); @@ -8513,10 +8583,18 @@ void DrawVSliceFrame(void){ else{ if(val!=NULL){ val->iqsliceframe = val->slicelevel+val->itime*val->nsliceijk; +#ifdef pp_SLICEFRAME + val->qslice = (float *)FRAMEGetFramePtr(val->frameinfo, val->itime); +#else val->qslice = val->qslicedata+val->itime*val->nsliceijk; +#endif } } +#ifdef pp_SLICEFRAME + val->qsliceframe = (float *)FRAMEGetFramePtr(val->frameinfo, val->itime); +#else if(val->qslicedata!=NULL)val->qsliceframe = val->qslicedata+val->itime*val->nsliceijk; +#endif if(u!=NULL){ if(u->compression_type!=UNCOMPRESSED){ UncompressSliceDataFrame(u, u->itime); @@ -8545,13 +8623,25 @@ void DrawVSliceFrame(void){ } } if(u!=NULL&&u->compression_type==UNCOMPRESSED){ +#ifdef pp_SLICEFRAME + u->qslice = (float *)FRAMEGetFramePtr(u->frameinfo, u->itime); +#else u->qslice = u->qslicedata+u->itime*u->nsliceijk; +#endif } if(v!=NULL&&v->compression_type==UNCOMPRESSED){ +#ifdef pp_SLICEFRAME + v->qslice = (float *)FRAMEGetFramePtr(v->frameinfo, v->itime); +#else v->qslice = v->qslicedata+v->itime*v->nsliceijk; +#endif } if(w!=NULL&&w->compression_type==UNCOMPRESSED){ +#ifdef pp_SLICEFRAME + w->qslice = (float *)FRAMEGetFramePtr(w->frameinfo, w->itime); +#else w->qslice = w->qslicedata+w->itime*w->nsliceijk; +#endif } } @@ -9452,8 +9542,7 @@ void DrawSortSlices(void){ DrawVolSliceTexture(sd, si->is1, si->is2, si->js1, si->js2, si->ks1, si->ks2, si->splitdir); break; case SLICE_CELL_CENTER: - DrawVolSliceCellFaceCenter(sd, SLICE_CELL_CENTER, - si->is1, si->is2, si->js1, si->js2, si->ks1, si->ks2, si->splitdir); + DrawVolSliceCellFaceCenter(sd, si->is1, si->is2, si->js1, si->js2, si->ks1, si->ks2, si->splitdir); break; default: assert(FFALSE); diff --git a/Source/smokeview/IOsmoke.c b/Source/smokeview/IOsmoke.c index e95c719786..63801370a6 100644 --- a/Source/smokeview/IOsmoke.c +++ b/Source/smokeview/IOsmoke.c @@ -3755,8 +3755,9 @@ int GetSmoke3DSizes(smoke3ddata *smoke3di, int fortran_skip, char *smokefile, in void FreeSmoke3D(smoke3ddata *smoke3di){ smoke3di->lastiframe = -999; -#ifdef pp_FRAME - FRAMEFree(&smoke3di->frameinfo); +#ifdef pp_SMOKEFRAME + FRAMEFree(smoke3di->frameinfo); + smoke3di->frameinfo = NULL; #endif FREEMEMORY(smoke3di->smokeframe_in); FREEMEMORY(smoke3di->smokeframe_out); @@ -3769,7 +3770,7 @@ void FreeSmoke3D(smoke3ddata *smoke3di){ FREEMEMORY(smoke3di->frame_all_zeros); FREEMEMORY(smoke3di->smoke_boxmin); FREEMEMORY(smoke3di->smoke_boxmax); -#ifndef pp_FRAME +#ifndef pp_SMOKEFRAME FREEMEMORY(smoke3di->smoke_comp_all); #endif FREEMEMORY(smoke3di->smokeframe_comp_list); @@ -3792,7 +3793,7 @@ int GetSmoke3DVersion(smoke3ddata *smoke3di){ if(smoke3di->filetype==FORTRAN_GENERATED&&smoke3di->is_zlib==0)fortran_skip = 4; file = smoke3di->comp_file; - SMOKE3D_COMPFILE = fopen(file, "rb"); + if(file!=NULL)SMOKE3D_COMPFILE = fopen(file, "rb"); if(SMOKE3D_COMPFILE==NULL){ file = smoke3di->reg_file; SMOKE3D_REGFILE = fopen(file, "rb"); @@ -4018,17 +4019,17 @@ void ReadSmoke16(smoke3ddata *smoke3di, int flag){ /* ------------------ SetupSmoke3D ------------------------ */ -int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *errorcode_arg){ +int SetupSmoke3D(smoke3ddata *smoke3di, int load_flag, int iframe_arg, int *errorcode_arg){ meshdata *mesh_smoke3d; -#ifdef pp_FRAME +#ifdef pp_SMOKEFRAME int i, j; #else + int ncomp_smoke_total_local; + int ncomp_smoke_total_skipped_local; int i, j, ii; #endif int fortran_skip = 0; int error_local; - int ncomp_smoke_total_local; - int ncomp_smoke_total_skipped_local; mesh_smoke3d = meshinfo+smoke3di->blocknumber; if(smoke3di->extinct>0.0){ @@ -4048,19 +4049,19 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *error if(smoke3di->filetype==FORTRAN_GENERATED&&smoke3di->is_zlib==0)fortran_skip = 4; - if(smoke3di->loaded==1&&flag_arg!=RELOAD){ + if(smoke3di->loaded==1&&load_flag!=RELOAD){ FreeSmoke3D(smoke3di); smoke3di->loaded = 0; smoke3di->display = 0; smoke3di->primary_file = 0; } - if(flag_arg!=RELOAD){ + if(load_flag!=RELOAD){ FREEMEMORY(mesh_smoke3d->merge_alpha); FREEMEMORY(mesh_smoke3d->merge_color); } - if(flag_arg==UNLOAD){ + if(load_flag==UNLOAD){ plotstate = GetPlotState(DYNAMIC_PLOTS); UpdateTimes(); SetSmokeColorFlags(); @@ -4126,7 +4127,11 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *error UpdateSmoke3dMenuLabels(); #endif } +#ifdef pp_SMOKEFRAME + if(iframe_arg == ALL_SMOKE_FRAMES&&load_flag!=RELOAD)PRINTF("Loading %s(%s)", smoke3di->file, smoke3di->label.shortlabel); +#else if(iframe_arg==ALL_SMOKE_FRAMES)PRINTF("Loading %s(%s)", smoke3di->file, smoke3di->label.shortlabel); +#endif CheckMemory; smoke3di->request_load = 1; smoke3di->ntimes_old = smoke3di->ntimes; @@ -4156,7 +4161,11 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *error if(smoke3di->type==SOOT_index&&smoke3di->maxval<=load_3dsmoke_cutoff){ SetupSmoke3D(smoke3di, UNLOAD, iframe_arg, &error_local); *errorcode_arg = 0; +#ifdef pp_SMOKEFRAME + if(load_flag!=RELOAD)PRINTF(" - skipped (opacity<%0.f)\n", load_3dsmoke_cutoff); +#else PRINTF(" - skipped (opacity<%0.f)\n", load_3dsmoke_cutoff); +#endif return_flag_local = 1; } if(return_flag_local==1){ @@ -4186,6 +4195,7 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *error smoke3di->frame_all_zeros[i] = SMOKE3D_ZEROS_UNKNOWN; } +#ifndef pp_SMOKEFRAME ncomp_smoke_total_local = 0; ncomp_smoke_total_skipped_local = 0; for(i = 0; intimes_full; i++){ @@ -4195,7 +4205,6 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *error } } smoke3di->ncomp_smoke_total = ncomp_smoke_total_skipped_local; -#ifndef pp_FRAME if(NewResizeMemory(smoke3di->smoke_comp_all, ncomp_smoke_total_skipped_local*sizeof(unsigned char))==0){ SetupSmoke3D(smoke3di, UNLOAD, iframe_arg, &error_local); *errorcode_arg = 1; @@ -4218,13 +4227,12 @@ int SetupSmoke3D(smoke3ddata *smoke3di, int flag_arg, int iframe_arg, int *error /* ------------------ ReadSmoke3D ------------------------ */ -FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, int *errorcode_arg){ +FILE_SIZE ReadSmoke3D(int time_frame,int ifile_arg,int load_flag, int first_time, int *errorcode_arg){ smoke3ddata *smoke3di; FILE_SIZE file_size_local=0; - float total_time_local; -#ifndef pp_FRAME + float total_time; +#ifndef pp_SMOKEFRAME int error_local; - int nxyz_local[8]; MFILE *SMOKE3DFILE; float read_time_local; int iii; @@ -4238,46 +4246,88 @@ FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, #endif #ifdef pp_SMOKE_SPEEDUP - update_merge_smoke = 1; + update_glui_merge_smoke = 1; GLUTPOSTREDISPLAY; #endif SetTimeState(); update_smokefire_colors = 1; +#ifndef pp_SMOKEFRAME #ifndef pp_FSEEK - if(flag_arg==RELOAD)flag_arg = LOAD; + if(load_flag==RELOAD)load_flag = LOAD; #endif - START_TIMER(total_time_local); +#endif + START_TIMER(total_time); assert(ifile_arg>=0&&ifile_argfiletype==FORTRAN_GENERATED&&smoke3di->is_zlib==0)fortran_skip=4; #endif #ifdef pp_SMOKE16 - if(load_smoke16==1||flag_arg==UNLOAD ){ - ReadSmoke16(smoke3di, flag_arg); + if(load_smoke16==1||load_flag==UNLOAD ){ + ReadSmoke16(smoke3di, load_flag); } #endif if(first_time == FIRST_TIME){ - if(SetupSmoke3D(smoke3di, flag_arg,iframe_arg, errorcode_arg)==READSMOKE3D_RETURN){ + if(SetupSmoke3D(smoke3di, load_flag,time_frame, errorcode_arg)==READSMOKE3D_RETURN){ return 0; } } if(smoke3di->smokeframe_comp_list==NULL)return 0; - IF_NOT_USEMESH_RETURN0(smoke3di->loaded,smoke3di->blocknumber); - -//*** read in data +#ifdef pp_SMOKEFRAME + if(load_flag != RELOAD){ + IF_NOT_USEMESH_RETURN0(smoke3di->loaded, smoke3di->blocknumber); + } +#else + IF_NOT_USEMESH_RETURN0(smoke3di->loaded, smoke3di->blocknumber); +#endif -#ifndef pp_FRAME +#ifdef pp_SMOKEFRAME + smoke3di->frameinfo = FRAMELoadData(smoke3di->frameinfo, smoke3di->file, load_flag, time_frame, FORTRAN_FILE, GetSmoke3DFrameInfo); + if(smoke3di->frameinfo->compression_type == FRAME_ZLIB)smoke3di->compression_type = COMPRESSED_ZLIB; + update_frame = 1; + int i, ii; + int *nxyzptr; + int offset; + + nxyzptr = ( int * )smoke3di->frameinfo->header; + if(smoke3di->compression_type == COMPRESSED_ZLIB){ + offset = 12; + smoke3di->is1 = nxyzptr[2]; + smoke3di->is2 = nxyzptr[3]; + smoke3di->js1 = nxyzptr[4]; + smoke3di->js2 = nxyzptr[5]; + smoke3di->ks1 = nxyzptr[6]; + smoke3di->ks2 = nxyzptr[7]; + } + else{ + offset = 16; + smoke3di->is1 = nxyzptr[3]; + smoke3di->is2 = nxyzptr[4]; + smoke3di->js1 = nxyzptr[5]; + smoke3di->js2 = nxyzptr[6]; + smoke3di->ks1 = nxyzptr[7]; + smoke3di->ks2 = nxyzptr[8]; + } + i = 0; + for(ii = 0; ii < smoke3di->ntimes_full; ii++){ + if(smoke3di->use_smokeframe[ii] == 1){ + smoke3di->smokeframe_comp_list[i] = smoke3di->frameinfo->frameptrs[ii] + offset; + i++; + } + } +#else SMOKE3DFILE=FOPEN_SMOKE(smoke3di->file,"rb", n_smokeload_threads, use_smokeload_threads); if(SMOKE3DFILE==NULL){ - SetupSmoke3D(smoke3di,UNLOAD, iframe_arg, &error_local); + SetupSmoke3D(smoke3di,UNLOAD, time_frame, &error_local); *errorcode_arg =1; return 0; } + int nxyz_local[8]; + SKIP_SMOKE;FREAD_SMOKE(nxyz_local,4,8,SMOKE3DFILE);SKIP_SMOKE; file_size_local +=4+4*8+4; smoke3di->is1=nxyz_local[2]; @@ -4290,8 +4340,8 @@ FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, // read smoke data START_TIMER(read_time_local); - if(iframe_arg==ALL_SMOKE_FRAMES){ - if(flag_arg== RELOAD&&smoke3di->ntimes_old > 0){ + if(time_frame==ALL_SMOKE_FRAMES){ + if(load_flag== RELOAD&&smoke3di->ntimes_old > 0){ SkipSmokeFrames(SMOKE3DFILE, smoke3di, smoke3di->ntimes_old); frame_start_local = smoke3di->ntimes_old; } @@ -4301,9 +4351,9 @@ FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, frame_end_local = smoke3di->ntimes_full; } else { - SkipSmokeFrames(SMOKE3DFILE, smoke3di, iframe_arg); - frame_start_local = iframe_arg; - frame_end_local = iframe_arg+1; + SkipSmokeFrames(SMOKE3DFILE, smoke3di, time_frame); + frame_start_local = time_frame; + frame_end_local = time_frame+1; } iii = frame_start_local; nframes_found_local = frame_start_local; @@ -4377,13 +4427,16 @@ FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, if(smoke3di->finalize == 1){ SmokeWrapup(); } - STOP_TIMER(total_time_local); - if(iframe_arg==ALL_SMOKE_FRAMES){ + STOP_TIMER(total_time); +#ifdef pp_SMOKEFRAME + if(load_flag!=RELOAD)printf("\n"); +#else + if(time_frame==ALL_SMOKE_FRAMES){ if(file_size_local>1000000){ - PRINTF(" - %.1f MB/%.1f s", (float)file_size_local/1000000., total_time_local); + PRINTF(" - %.1f MB/%.1f s", (float)file_size_local/1000000., total_time); } else{ - PRINTF(" - %.0f kB/%.1f s", (float)file_size_local/1000., total_time_local); + PRINTF(" - %.0f kB/%.1f s", (float)file_size_local/1000., total_time); } char max_label[256]; @@ -4391,6 +4444,7 @@ FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, PRINTF(" - max: %s\n", max_label); PrintMemoryInfo; } +#endif if(smoke3di->extinct>0.0){ SOOT_index = GetSmoke3DType(smoke3di->label.shortlabel); update_smoke_alphas = 1; @@ -4398,6 +4452,11 @@ FILE_SIZE ReadSmoke3D(int iframe_arg,int ifile_arg,int flag_arg, int first_time, GLUISmoke3dCB(SMOKE_EXTINCT); } *errorcode_arg = 0; +#ifdef pp_SMOKEFRAME + if(smoke3di->frameinfo != NULL){ + smoke3di->frameinfo->total_time = total_time; + } +#endif return file_size_local; } @@ -4436,37 +4495,6 @@ int UpdateSmoke3D(smoke3ddata *smoke3di){ unsigned char *buffer_in; case COMPRESSED_RLE: -#ifdef pp_FRAME - if(smoke3di->frameinfo == NULL){ - int i, ii; - int *nxyz_local; - - smoke3di->frameinfo = FRAMEInit(smoke3di->file, NULL, FORTRAN_FILE, GetSmoke3DFrameInfo); - if(smoke3di->frameinfo != NULL){ - FRAMESetup(smoke3di->frameinfo); - FRAMEReadHeader(smoke3di->frameinfo); - FRAMEReadFrame(smoke3di->frameinfo, 0, smoke3di->frameinfo->nframes); - FRAMESetTimes(smoke3di->frameinfo, 0, smoke3di->frameinfo->nframes); - FRAMESetFramePtrs(smoke3di->frameinfo, 0, smoke3di->frameinfo->nframes); - FRAMEReadHeader(smoke3di->frameinfo); - nxyz_local = (int *)smoke3di->frameinfo->header; - smoke3di->compression_type=nxyz_local[2]; - smoke3di->is1=nxyz_local[3]; - smoke3di->is2=nxyz_local[4]; - smoke3di->js1=nxyz_local[5]; - smoke3di->js2=nxyz_local[6]; - smoke3di->ks1=nxyz_local[7]; - smoke3di->ks2=nxyz_local[8]; - } - i = 0; - for(ii = 0; ii < smoke3di->ntimes_full; ii++){ - if(smoke3di->use_smokeframe[ii] == 1){ - smoke3di->smokeframe_comp_list[i] = smoke3di->frameinfo->frameptrs[ii] + 16; - i++; - } - } - } -#endif buffer_in = smoke3di->smokeframe_comp_list[iframe_local]; countout = UnCompressRLE(buffer_in,countin,smoke3di->smokeframe_in); CheckMemory; @@ -4903,13 +4931,13 @@ void UpdateGluiMergeSmoke(void){ void *MtMergeSmoke3D(void *arg){ int nthreads, ithread; - int *nthreadptr, *ithreadptr; int i; + smokethreaddata *smokei; + + smokei = ( smokethreaddata * )arg; - nthreadptr = (int *)arg; - ithreadptr = (int *)arg+1; - nthreads = *nthreadptr; - ithread = *ithreadptr; + nthreads = smokei->nthreads; + ithread = smokei->ithread; for(i = ithread;i < nsmoke3dinfo;i += nthreads){ smoke3ddata *smoke3di; diff --git a/Source/smokeview/IOvolsmoke.c b/Source/smokeview/IOvolsmoke.c index 6b217cfcbc..aa691f5a86 100644 --- a/Source/smokeview/IOvolsmoke.c +++ b/Source/smokeview/IOvolsmoke.c @@ -3264,7 +3264,7 @@ void ReadVolsmokeAllFramesAllMeshes(void){ if(volsmokeload_threads == NULL){ volsmokeload_threads = THREADinit(&n_volsmokeload_threads, &use_volsmokeload_threads, ReadVolsmokeAllFramesAllMeshes2); } - THREADrun(volsmokeload_threads, NULL); + THREADrun(volsmokeload_threads); } /* ------------------ UnloadVolsmokeTextures ------------------------ */ diff --git a/Source/smokeview/IOzone.c b/Source/smokeview/IOzone.c index 39ff3f3725..aa70c3911f 100644 --- a/Source/smokeview/IOzone.c +++ b/Source/smokeview/IOzone.c @@ -830,7 +830,7 @@ void GetZoneGlobalBounds(const float *pdata, int ndata, float *pglobalmin, float *pglobalmax = pmax2; } - /* ------------------ LoadTempSlices ------------------------ */ + /* ------------------ GetSliceTempBounds ------------------------ */ void GetSliceTempBounds(void){ int i; diff --git a/Source/smokeview/callbacks.c b/Source/smokeview/callbacks.c index 214899a9e4..004ed4c3db 100644 --- a/Source/smokeview/callbacks.c +++ b/Source/smokeview/callbacks.c @@ -10,6 +10,7 @@ #include "smokeviewvars.h" #include "IOvolsmoke.h" #include "glui_motion.h" +#include "fopen.h" #ifdef pp_LUA #include "lua_api.h" @@ -2079,6 +2080,26 @@ void Keyboard(unsigned char key, int flag){ } } break; + case 'l': + case 'L': +#ifdef pp_MEMDEBUG + printf("memory blocks: %i total size: %i\n", COUNTMEMORYBLOCKS(0), (int)GETTOTALMEMORY); +#endif +#ifdef pp_OPEN_TEST + printf("open files: %i\n", open_files); + if(nopeninfo > 0){ + for(i = 0; i < nopeninfo; i++){ + opendata *oi; + + oi = openinfo + i; + printf("file: %s\n", oi->file); + printf("source: %s\n", oi->source); + printf("line: %i\n\n", oi->line); + } + } + printf("nopeninfo: %i\n", nopeninfo); +#endif + break; case 'M': clip_commandline = 1-clip_commandline; if(clip_commandline==1){ @@ -2537,7 +2558,7 @@ void Keyboard(unsigned char key, int flag){ skip_slice_in_embedded_mesh = 1 - skip_slice_in_embedded_mesh; break; default: - if(key2=='U'){ + if(key2=='u'){ ReloadMenu(RELOAD_INCREMENTAL_NOW); } else{ @@ -2811,6 +2832,7 @@ void Keyboard(unsigned char key, int flag){ case '/': updatemenu=1; partfast = 1 - partfast; +#ifndef pp_PARTFRAME if(current_script_command==NULL){ if(npartinfo>1){ use_partload_threads = partfast; @@ -2819,6 +2841,7 @@ void Keyboard(unsigned char key, int flag){ use_partload_threads = 0; } } +#endif if(use_partload_threads==1){ if(n_partload_threads > 1)printf("parallel particle loading: on(%i threads)\n", n_partload_threads); if(n_partload_threads == 1)printf("parallel particle loading: on(1 thread)\n"); @@ -3583,7 +3606,7 @@ void IdleCB(void){ CheckMemory; if(use_graphics==1)SetMainWindow(); UpdateShow(); - START_TICKS(thistime); + thistime = glutGet(GLUT_ELAPSED_TIME); thisinterval = thistime - lasttime; frame_count++; diff --git a/Source/smokeview/camera.c b/Source/smokeview/camera.c index c48288a5cb..54b78721c3 100644 --- a/Source/smokeview/camera.c +++ b/Source/smokeview/camera.c @@ -426,13 +426,12 @@ void SortCameras(void){ cameradata *ca; int i; - FREEMEMORY(cameras_sorted); ncameras_sorted=0; for(ca = camera_list_first.next; ca->next != NULL; ca = ca->next){ ncameras_sorted++; } if(ncameras_sorted == 0)return; - NewMemory((void **)&cameras_sorted, ncameras_sorted*sizeof(cameradata *)); + NEWMEM(cameras_sorted, ncameras_sorted*sizeof(cameradata *)); for(i=0,ca = camera_list_first.next; ca->next != NULL; ca = ca->next,i++){ cameras_sorted[i] = ca; } @@ -516,13 +515,12 @@ void SortCamerasID(void){ cameradata *ca; int i; - FREEMEMORY(cameras_sorted); ncameras_sorted = 0; for(ca = camera_list_first.next; ca->next!=NULL; ca = ca->next){ ncameras_sorted++; } if(ncameras_sorted==0)return; - NewMemory((void **)&cameras_sorted, ncameras_sorted*sizeof(cameradata *)); + NEWMEM(cameras_sorted, ncameras_sorted*sizeof(cameradata *)); for(i = 0, ca = camera_list_first.next; ca->next!=NULL; ca = ca->next, i++){ cameras_sorted[i] = ca; } diff --git a/Source/smokeview/drawGeometry.c b/Source/smokeview/drawGeometry.c index f937a4aebd..912e43ac70 100644 --- a/Source/smokeview/drawGeometry.c +++ b/Source/smokeview/drawGeometry.c @@ -644,6 +644,10 @@ void DrawOrigObstOutlines(void){ int i; float *color, *oldcolor=NULL; + +#ifdef pp_FDS + THREADcontrol(readsmvorig_threads, THREAD_JOIN); +#endif glPushMatrix(); glScalef(SCALE2SMV(1.0),SCALE2SMV(1.0),SCALE2SMV(1.0)); glTranslatef(-xbar0,-ybar0,-zbar0); @@ -4019,35 +4023,29 @@ void AllocateFaces(){ ntotal = 6*meshi->nbptrs + meshi->nvents+12; ntotal2 += ntotal; - FREEMEMORY(meshi->faceinfo); - FREEMEMORY(meshi->face_normals_single); - FREEMEMORY(meshi->face_normals_double); - FREEMEMORY(meshi->face_transparent_double); - FREEMEMORY(meshi->face_textures); - FREEMEMORY(meshi->face_outlines); if(ntotal>0){ - if(abortflag==0&&NewMemory((void **)&meshi->faceinfo,sizeof(facedata)*ntotal)==0){ + if(abortflag==0 && NEWMEM(meshi->faceinfo,sizeof(facedata)*ntotal)==0){ abortflag=1; } - if(abortflag==0&&NewMemory((void **)&meshi->face_normals_single,sizeof(facedata *)*ntotal)==0){ - abortflag=1; + if(abortflag==0 && NEWMEM(meshi->face_normals_single,sizeof(facedata *)*ntotal)==0){ + abortflag = 1; } - if(abortflag==0&&NewMemory((void **)&meshi->face_normals_double,sizeof(facedata *)*ntotal)==0){ + if(abortflag==0 && NEWMEM(meshi->face_normals_double,sizeof(facedata *)*ntotal)==0){ abortflag=1; } - if(abortflag==0&&NewMemory((void **)&meshi->face_transparent_double,sizeof(facedata *)*ntotal)==0){ + if(abortflag==0 && NEWMEM(meshi->face_transparent_double,sizeof(facedata *)*ntotal)==0){ abortflag=1; } - if(abortflag==0&&NewMemory((void **)&meshi->face_textures,sizeof(facedata *)*ntotal)==0){ + if(abortflag==0 && NEWMEM(meshi->face_textures,sizeof(facedata *)*ntotal)==0){ abortflag=1; } - if(abortflag==0&&NewMemory((void **)&meshi->face_outlines,sizeof(facedata *)*ntotal)==0){ + if(abortflag==0 && NEWMEM(meshi->face_outlines,sizeof(facedata *)*ntotal)==0){ abortflag=1; } } } if(ntotal2>0){ - if(abortflag==0&&NewMemory((void **)&face_transparent,sizeof(facedata *)*ntotal2)==0){ + if(abortflag==0&&NEWMEM(face_transparent,sizeof(facedata *)*ntotal2)==0){ abortflag=1; } } diff --git a/Source/smokeview/getdatabounds.c b/Source/smokeview/getdatabounds.c index 39968cb8a7..c510706ab1 100644 --- a/Source/smokeview/getdatabounds.c +++ b/Source/smokeview/getdatabounds.c @@ -327,7 +327,17 @@ void GetGlobalPatchBounds(int flag, int set_flag){ } if(force_bound_update == 1)doit = 1; if(doit==1){ +#ifdef pp_BOUNDFRAME + if(patchi->frameinfo != NULL){ + valmin = patchi->frameinfo->valmin; + valmax = patchi->frameinfo->valmax; + } + else{ + BoundsGet(patchi->reg_file, patchglobalboundsinfo, sorted_patch_filenames, npatchinfo, 1, &valmin, &valmax); + } +#else BoundsGet(patchi->reg_file, patchglobalboundsinfo, sorted_patch_filenames, npatchinfo, 1, &valmin, &valmax); +#endif if(valmin > valmax)continue; patchi->valmin_patch = valmin; patchi->valmax_patch = valmax; @@ -1124,10 +1134,23 @@ void BoundsUpdateDoit(int file_type){ } } else{ +#ifdef pp_SLICEFRAME + int itime; + for(itime=0;itimentimes;itime++){ + vals = (float *)FRAMEGetFramePtr(slicei->frameinfo, slicei->itime); + if(vals != NULL){ + for(j = 0;j < slicei->ntimes * slicei->nsliceijk;j++){ + valmin = MIN(valmin, vals[j]); + valmax = MAX(valmax, vals[j]); + } + } + } +#else for(j = 0;j < slicei->ntimes * slicei->nsliceijk;j++){ valmin = MIN(valmin, vals[j]); valmax = MAX(valmax, vals[j]); } +#endif } fi->defined = 1; } @@ -1739,6 +1762,7 @@ int ReadPartBounds(partdata *parti,int read_bounds_arg){ globalmax_part[j] = -1000000000.0; } } +#ifndef pp_PARTFRAME // make sure a size file exists @@ -1752,6 +1776,7 @@ int ReadPartBounds(partdata *parti,int read_bounds_arg){ fclose(stream); stream = NULL; } +#endif // make sure a bound file exists diff --git a/Source/smokeview/glui_bounds.cpp b/Source/smokeview/glui_bounds.cpp index b484e96d34..ae6b8a8a16 100644 --- a/Source/smokeview/glui_bounds.cpp +++ b/Source/smokeview/glui_bounds.cpp @@ -86,7 +86,7 @@ class bounds_dialog{ GLUI_Checkbox *CHECKBOX_set_chopmin, *CHECKBOX_set_chopmax, *CHECKBOX_cache; GLUI_Checkbox *CHECKBOX_research_mode; GLUI_Checkbox *CHECKBOX_hist_show_labels; - GLUI_Checkbox *CHECKBOX_chop_hide = NULL; + GLUI_Checkbox *CHECKBOX_chop_hide; GLUI_RadioGroup *RADIO_set_valtype, *RADIO_set_valmin, *RADIO_set_valmax; GLUI_RadioButton *RADIO_button_loaded_min, *RADIO_button_loaded_max; GLUI_RadioButton *RADIO_button_all_min, *RADIO_button_all_max; @@ -439,6 +439,7 @@ void bounds_dialog::setup(const char *file_type, GLUI_Rollout * ROLLOUT_dialog, STATIC_chopmin_unit->set_w(10); glui_bounds->add_column_to_panel(PANEL_truncate_min, false); CHECKBOX_set_chopmin = glui_bounds->add_checkbox_to_panel(PANEL_truncate_min, _("Below"), &(bounds.set_chopmin), BOUND_SETCHOPMIN, Callback); + CHECKBOX_chop_hide = NULL; if(strcmp(file_type, "slice")==0){ CHECKBOX_chop_hide = glui_bounds->add_checkbox_to_panel(ROLLOUT_truncate, "hide triangles with truncated values", &(bounds.chop_hide), BOUND_CHOP_HIDE, Callback); } @@ -1947,8 +1948,8 @@ extern "C" void GLUIHVACSliceBoundsCPP_CB(int var){ SetLoadedSliceBounds(NULL, 0); THREADcontrol(compress_threads, THREAD_LOCK); SetLoadedSliceBounds(NULL, 0); - ReloadAllVectorSliceFiles(); - ReloadAllSliceFiles(); + ReloadAllVectorSliceFiles(LOAD); + ReloadAllSliceFiles(LOAD); THREADcontrol(compress_threads, THREAD_UNLOCK); GLUIHVACSliceBoundsCPP_CB(BOUND_UPDATE_COLORS); break; @@ -2847,10 +2848,13 @@ GLUI_Panel *PANEL_slice_plot2de = NULL; GLUI_Panel *PANEL_slice_plot2df = NULL; GLUI_Panel *PANEL_loadbounds = NULL; GLUI_Panel *PANEL_intersection_box = NULL; +GLUI_Panel *PANEL_read_test = NULL; GLUI_Spinner *SPINNER_partdrawskip = NULL; GLUI_Spinner *SPINNER_sliceval_ndigits = NULL; +#ifndef pp_PARTFRAME GLUI_Spinner *SPINNER_n_part_threads = NULL; +#endif GLUI_Spinner *SPINNER_iso_outline_ioffset = NULL; GLUI_Spinner *SPINNER_iso_level = NULL; GLUI_Spinner *SPINNER_iso_colors[4]; @@ -2862,6 +2866,12 @@ GLUI_Spinner *SPINNER_line_contour_width=NULL; GLUI_Spinner *SPINNER_line_contour_min=NULL; GLUI_Spinner *SPINNER_line_contour_max=NULL; GLUI_Spinner *SPINNER_timebounds=NULL; +#ifdef pp_FRAME +GLUI_Spinner *SPINNER_nframe_threads = NULL; +#endif +#ifdef pp_FRAME_DEBUG +GLUI_Spinner *SPINNER_read_buffer_size = NULL; +#endif GLUI_Spinner *SPINNER_tload_begin=NULL; GLUI_Spinner *SPINNER_tload_end=NULL; GLUI_Spinner *SPINNER_tload_skip=NULL; @@ -2908,7 +2918,9 @@ GLUI_Checkbox *CHECKBOX_sortslices_debug = NULL; GLUI_Checkbox *CHECKBOX_visColorbarHorizontal2 = NULL; GLUI_Checkbox *CHECKBOX_visColorbarVertical2 = NULL; GLUI_Checkbox *CHECKBOX_show_boundary_outline=NULL; +#ifndef pp_PARTFRAME GLUI_Checkbox *CHECKBOX_use_partload_threads = NULL; +#endif GLUI_Checkbox *CHECKBOX_partfast = NULL; GLUI_Checkbox *CHECKBOX_show_slice_shaded = NULL; GLUI_Checkbox *CHECKBOX_show_vector_slice = NULL; @@ -3352,7 +3364,9 @@ extern "C" void GLUISetLabelControls2(){ extern "C" void GLUIUpdatePartFast(void){ if(CHECKBOX_partfast!=NULL)CHECKBOX_partfast->set_int_val(partfast); +#ifndef pp_PARTFRAME if(CHECKBOX_use_partload_threads!=NULL)CHECKBOX_use_partload_threads->set_int_val(use_partload_threads); +#endif PartBoundCB(PARTFAST); } @@ -3934,9 +3948,29 @@ extern "C" void GLUIImmersedBoundCB(int var){ void BoundBoundCB(int var){ int i; +#ifdef pp_FRAME + char ctime[1024]; + bufferdata *bufferinfo=NULL; + int nread; + float read_time; +#endif SNIFF_ERRORS("BoundBoundCB: start"); switch(var){ +#ifdef pp_FRAME + case READ_TEST: + if(MakeFile(frametest_filename, read_buffer_size) == 1){ + START_TIMER(read_time); + bufferinfo = File2Buffer(frametest_filename, bufferinfo, &nread); + STOP_TIMER(read_time); + sprintf(ctime, "%f", read_time); + TrimZeros(ctime); + printf("threads: %i time (s): %s\n", nframe_threads, ctime); + FreeBufferInfo(bufferinfo); + FileErase(frametest_filename); + } + break; +#endif case SHOW_BOUNDARY_OUTLINE: if(ngeom_data==0)break; if(show_boundary_outline==1&&boundary_edgetype==OUTLINE_HIDDEN)boundary_edgetype = OUTLINE_POLYGON; @@ -4065,7 +4099,7 @@ void BoundBoundCB(int var){ if(compress_threads == NULL){ compress_threads = THREADinit(&n_compress_threads, &use_compress_threads, Compress); } - THREADrun(compress_threads, NULL); + THREADrun(compress_threads); break; case COMPRESS_AUTOLOADED: updatemenu = 1; @@ -5120,6 +5154,7 @@ extern "C" void GLUIBoundsSetup(int main_window){ PANEL_partread=glui_bounds->add_panel_to_panel(ROLLOUT_particle_settings,_("Particle loading")); CHECKBOX_partfast = glui_bounds->add_checkbox_to_panel(PANEL_partread, _("Fast loading"), &partfast, PARTFAST, PartBoundCB); +#ifndef pp_PARTFRAME CHECKBOX_use_partload_threads = glui_bounds->add_checkbox_to_panel(PANEL_partread, _("Parallel loading"), &use_partload_threads); SPINNER_n_part_threads = glui_bounds->add_spinner_to_panel(PANEL_partread, _("Files loaded at once:"), GLUI_SPINNER_INT, &n_partload_threads); if(npartinfo>1){ @@ -5128,6 +5163,7 @@ extern "C" void GLUIBoundsSetup(int main_window){ else{ SPINNER_n_part_threads->set_int_limits(1,1); } +#endif SPINNER_partdrawskip = glui_bounds->add_spinner_to_panel(PANEL_partread, _("Draw skip:"), GLUI_SPINNER_INT, &partdrawskip, PARTSKIP, PartBoundCB); PartBoundCB(PARTFAST); PartBoundCB(PARTSKIP); @@ -5460,6 +5496,19 @@ hvacductboundsCPP.setup("hvac", ROLLOUT_hvacduct, hvacductbounds_cpp, nhvacductb INSERT_ROLLOUT(ROLLOUT_time, glui_bounds); ADDPROCINFO(fileprocinfo, nfileprocinfo, ROLLOUT_time, TIME_ROLLOUT, glui_bounds); +#ifdef pp_FRAME + SPINNER_nframe_threads = glui_bounds->add_spinner_to_panel(ROLLOUT_time, _("read threads:"), GLUI_SPINNER_INT, &nframe_threads); + SPINNER_nframe_threads->set_int_limits(1, MAX_THREADS); + +#ifdef pp_FRAME_DEBUG + PANEL_read_test = glui_bounds->add_panel_to_panel(ROLLOUT_time, "Timing test", true); + SPINNER_read_buffer_size = glui_bounds->add_spinner_to_panel(PANEL_read_test, _("Buffer size (MB):"), GLUI_SPINNER_INT, &read_buffer_size); + SPINNER_read_buffer_size->set_int_limits(1, 1000); + glui_bounds->add_button_to_panel(PANEL_read_test, _("Test"), READ_TEST, BoundBoundCB); +#endif + +#endif + PANEL_loadbounds = glui_bounds->add_panel_to_panel(ROLLOUT_time,"", GLUI_PANEL_NONE); ROLLOUT_autoload = glui_bounds->add_rollout_to_panel(PANEL_loadbounds,_("Auto load"), false, LOAD_AUTO_ROLLOUT, LoadRolloutCB); @@ -5501,9 +5550,6 @@ hvacductboundsCPP.setup("hvac", ROLLOUT_hvacduct, hvacductbounds_cpp, nhvacductb SPINNER_tload_skip->set_int_limits(0, 1000); glui_bounds->add_button_to_panel(ROLLOUT_time2, _("Reload all data"), RELOAD_ALL_DATA, TimeBoundCB); -#ifdef pp_LOAD_INC - glui_bounds->add_button_to_panel(ROLLOUT_time2, _("Reload new data"), RELOAD_INCREMENTAL_DATA, TimeBoundCB); -#endif TimeBoundCB(TBOUNDS_USE); TimeBoundCB(TBOUNDS); @@ -6314,6 +6360,7 @@ void PartBoundCB(int var){ break; case TRACERS: case PARTFAST: +#ifndef pp_PARTFRAME if(npartinfo<=1){ CHECKBOX_use_partload_threads->disable(); SPINNER_n_part_threads->disable(); @@ -6324,6 +6371,7 @@ void PartBoundCB(int var){ CHECKBOX_use_partload_threads->set_int_val(use_partload_threads); } updatemenu=1; +#endif break; case CHOPUPDATE: UpdateChopColors(); @@ -6795,8 +6843,8 @@ extern "C" void GLUISliceBoundCB(int var){ GLUISliceBoundCB(SET_GLOBAL_BOUNDS); } SetLoadedSliceBounds(NULL, 0); - ReloadAllVectorSliceFiles(); - ReloadAllSliceFiles(); + ReloadAllVectorSliceFiles(RELOAD); + ReloadAllSliceFiles(RELOAD); GLUIHVACSliceBoundsCPP_CB(BOUND_UPDATE_COLORS); break; default: diff --git a/Source/smokeview/glui_bounds.h b/Source/smokeview/glui_bounds.h index cf01a2f33f..27905237c3 100644 --- a/Source/smokeview/glui_bounds.h +++ b/Source/smokeview/glui_bounds.h @@ -128,7 +128,10 @@ #define SORTSLICES 126 #define SORTSLICES_DEBUG 127 #define SLICE_OPTION 131 -#define COLORINDEX 132 +#ifdef pp_FRAME +#define READ_TEST 132 +#endif +#define COLORINDEX 133 #define UPDATE_VECTOR 101 #define UPDATE_VECTOR_FROM_SMV 102 diff --git a/Source/smokeview/glui_motion.cpp b/Source/smokeview/glui_motion.cpp index a27b68d649..e58af9c352 100644 --- a/Source/smokeview/glui_motion.cpp +++ b/Source/smokeview/glui_motion.cpp @@ -2618,7 +2618,7 @@ void RenderCB(int var){ if(playmovie_threads == NULL){ playmovie_threads = THREADinit(&n_playmovie_threads, &use_playmovie_threads, PlayMovie); } - THREADrun(playmovie_threads, NULL); + THREADrun(playmovie_threads); break; case OUTPUT_FFMPEG: output_ffmpeg_command=1; diff --git a/Source/smokeview/main.c b/Source/smokeview/main.c index 4569d5cc4e..7ff894dc7f 100644 --- a/Source/smokeview/main.c +++ b/Source/smokeview/main.c @@ -10,6 +10,7 @@ #include "string_util.h" #include "smokeviewvars.h" #include "command_args.h" +#include "fopen.h" #ifdef WIN32 #include @@ -340,6 +341,13 @@ char *ProcessCommandLine(CommandlineArgs *args) { STRCPY(caseini_filename, fdsprefix); STRCAT(caseini_filename, ".ini"); +#ifdef p_FRAME + FREEMEMORY(frametest_filename); + NewMemory((void **)&frametest_filename, len_casename + strlen(".tst") + 1); + STRCPY(caseini_filename, fdsprefix); + STRCAT(caseini_filename, ".tst"); +#endif + FREEMEMORY(fedsmv_filename); NewMemory((void **)&fedsmv_filename, len_casename + strlen(".fedsmv") + 1); STRCPY(fedsmv_filename, fdsprefix); @@ -832,6 +840,9 @@ int main(int argc, char **argv){ // to use the lua interpreter we ignore the code below and exit once the lua // run is complete. return return_code; +#endif +#ifdef pp_OPEN_TEST + InitOpenTest(); #endif SetStdOut(stdout); initMALLOC(); @@ -853,6 +864,12 @@ int main(int argc, char **argv){ GetProgFullPath(smokeview_progname, 1024); smv_filename = ParseCommandline(argc, argv); +#ifdef WIN32 + if(Which("fds_local.bat", &fdsprog) != NULL)strcpy(fdsprog, "fds_local.bat"); +#else + Which("fds", &fdsprog); +#endif + prog_fullpath = progname; if(smokeview_bindir==NULL){ smokeview_bindir = GetProgDir(progname, &smokeviewpath); diff --git a/Source/smokeview/menus.c b/Source/smokeview/menus.c index 8840f61117..75f0095088 100644 --- a/Source/smokeview/menus.c +++ b/Source/smokeview/menus.c @@ -2739,7 +2739,7 @@ void CompressMenu(int value){ if(compress_threads == NULL){ compress_threads = THREADinit(&n_compress_threads, &use_compress_threads, Compress); } - THREADrun(compress_threads, NULL); + THREADrun(compress_threads); break; case MENU_OVERWRITECOMPRESS: erase_all=0; @@ -2751,7 +2751,7 @@ void CompressMenu(int value){ if(compress_threads == NULL){ compress_threads = THREADinit(&n_compress_threads, &use_compress_threads, Compress); } - THREADrun(compress_threads, NULL); + THREADrun(compress_threads); break; case MENU_COMPRESSAUTOLOAD: compress_autoloaded=1-compress_autoloaded; @@ -2994,9 +2994,6 @@ void ReloadMenu(int value){ case RELOAD_SMV_FILE: UpdateSMVDynamic(smv_filename); break; - case RELOAD_MODE_INCREMENTAL: - load_incremental = 1; - break; case RELOAD_MODE_ALL: load_incremental = 0; break; @@ -3209,7 +3206,7 @@ void UnloadAllSliceFiles(char *longlabel){ /* ------------------ ReloadAllVectorSliceFiles ------------------------ */ -void ReloadAllVectorSliceFiles(void){ +void ReloadAllVectorSliceFiles(int load_flag){ int i, errorcode; for(i = 0; i=0; i--){ @@ -3256,10 +3255,10 @@ void ReloadAllVectorSliceFiles(void){ vslicei = vsliceinfo+i; if(vslicei->reload==1){ if(i==lastslice){ - ReadVSlice(i, ALL_FRAMES, NULL, LOAD, SET_SLICECOLOR, &errorcode); + ReadVSlice(i, ALL_FRAMES, NULL, load_flag, SET_SLICECOLOR, &errorcode); } else{ - ReadVSlice(i, ALL_FRAMES, NULL, LOAD, DEFER_SLICECOLOR, &errorcode); + ReadVSlice(i, ALL_FRAMES, NULL, load_flag, DEFER_SLICECOLOR, &errorcode); } } } @@ -3267,10 +3266,13 @@ void ReloadAllVectorSliceFiles(void){ /* ------------------ ReloadAllSliceFiles ------------------------ */ -void ReloadAllSliceFiles(void){ +void ReloadAllSliceFiles(int load_flag){ int ii; +#ifndef pp_SLICEFRAME int file_count = 0; - float load_size = 0.0, load_time; + float load_size = 0.0; +#endif + float load_time; slicedata **reload_slicelist; if(nsliceinfo == 0)return; @@ -3299,16 +3301,28 @@ void ReloadAllSliceFiles(void){ i = slicei-sliceinfo; if(slicei->slice_filetype == SLICE_GEOM){ +#ifdef pp_SLICEFRAME + ReadGeomData(slicei->patchgeom, slicei, load_flag, ALL_FRAMES, NULL, 0, &errorcode); +#else load_size+=ReadGeomData(slicei->patchgeom, slicei, LOAD, ALL_FRAMES, NULL, 0, &errorcode); +#endif } else{ - load_size+=ReadSlice(slicei->file, i, ALL_FRAMES, NULL, LOAD, DEFER_SLICECOLOR, &errorcode); +#ifdef pp_SLICEFRAME + ReadSlice(slicei->file, i, ALL_FRAMES, NULL, load_flag, DEFER_SLICECOLOR, &errorcode); +#else + load_size += ReadSlice(slicei->file, i, ALL_FRAMES, NULL, LOAD, DEFER_SLICECOLOR, &errorcode); +#endif } +#ifndef pp_SLICEFRAME file_count++; +#endif } STOP_TIMER(load_time); FREEMEMORY(reload_slicelist); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif slicefile_labelindex = slicefile_labelindex_save; } @@ -3352,6 +3366,7 @@ void UnloadSmoke3D(smoke3ddata *smoke3di){ FreeSmoke3D(smoke3di); smoke3di->loaded = 0; smoke3di->display = 0; + smoke3di->request_load = 0; } /* ------------------ UnloadAllSmoke3D ------------------------ */ @@ -3360,7 +3375,7 @@ void UnloadAllSmoke3D(int type){ int i; #ifdef pp_SMOKE_SPEEDUP - update_merge_smoke = 1; + update_glui_merge_smoke = 1; #endif if(nsmoke3dinfo > 0){ for(i = 0; i < nsmoke3dinfo; i++){ @@ -3381,8 +3396,13 @@ void UnloadAllSmoke3D(int type){ void LoadUnloadMenu(int value){ int errorcode; int i; + +#ifndef pp_SLICEFRAME int file_count = 0; - float load_size = 0.0, load_time; + float load_size = 0.0; +#endif + float load_time; + int load_flag; if(value==MENU_DUMMY)return; GLUTSETCURSOR(GLUT_CURSOR_WAIT); @@ -3445,6 +3465,16 @@ void LoadUnloadMenu(int value){ break; case RELOADALL: case RELOAD_INCREMENTAL_ALL: +#ifdef pp_FRAME + if(value == RELOADALL){ + load_flag = LOAD; + } + else{ + load_flag = RELOAD; + } +#else + load_flag = LOAD; +#endif THREADcontrol(compress_threads, THREAD_LOCK); if(hrr_csv_filename!=NULL){ ReadHRR(LOAD); @@ -3460,11 +3490,13 @@ void LoadUnloadMenu(int value){ slicefile_labelindex_save = slicefile_labelindex; START_TIMER(load_time); SetLoadedSliceBounds(NULL, 0); - ReloadAllVectorSliceFiles(); - ReloadAllSliceFiles(); + ReloadAllVectorSliceFiles(load_flag); + ReloadAllSliceFiles(load_flag); GLUIHVACSliceBoundsCPP_CB(BOUND_UPDATE_COLORS); STOP_TIMER(load_time); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif slicefile_labelindex=slicefile_labelindex_save; //*** reload plot3d files @@ -3494,8 +3526,11 @@ void LoadUnloadMenu(int value){ patchi = patchinfo + i; assert(patchi->loaded==0||patchi->loaded==1); if(patchi->loaded == 1){ - PRINTF("Loading %s(%s)", patchi->file, patchi->label.shortlabel); +#ifdef pp_BOUNDFRAME + ReadBoundary(i, load_flag, &errorcode); +#else ReadBoundary(i, LOAD,&errorcode); +#endif } } @@ -3503,12 +3538,24 @@ void LoadUnloadMenu(int value){ for(i=0;iloaded==0)continue; +#ifdef pp_ISOFRAME + ReadIso(isoi->file, i, load_flag, NULL, &errorcode); + if(isoi->frameinfo==NULL||isoi->frameinfo->frames_read>0)printf("\n"); +#else ReadIso(isoi->file,i,LOAD,NULL,&errorcode); printf("\n"); +#endif } if(update_readiso_geom_wrapup == UPDATE_ISO_ALL_NOW)ReadIsoGeomWrapup(BACKGROUND); update_readiso_geom_wrapup = UPDATE_ISO_OFF; @@ -4012,15 +4064,34 @@ void LoadAllPartFiles(int partnum){ FILE_SIZE file_size; parti = partinfo+i; +#ifdef pp_PARTFRAME + if(partnum != RELOAD_LOADED_PART_FILES && partnum != LOAD_ALL_PART_FILES){ + IF_NOT_USEMESH_CONTINUE(parti->loaded, parti->blocknumber); + } +#else IF_NOT_USEMESH_CONTINUE(parti->loaded,parti->blocknumber); +#endif if(parti->skipload==1)continue; if(partnum>=0&&i!=partnum)continue; // load only particle file with file index partnum THREADcontrol(partload_threads, THREAD_LOCK); // or load all particle files - if(parti->loadstatus==FILE_UNLOADED){ - if(partnum==LOAD_ALL_PART_FILES||(partnum==RELOAD_LOADED_PART_FILES&&parti->reload==1)||partnum==i){ + if(parti->loadstatus==FILE_UNLOADED +#ifdef pp_PARTFRAME + || partnum==RELOAD_LOADED_PART_FILES || partnum == LOAD_ALL_PART_FILES +#endif + ){ + if(partnum==LOAD_ALL_PART_FILES||(partnum==RELOAD_LOADED_PART_FILES&&parti->loaded==1)||partnum==i){ parti->loadstatus = FILE_LOADING; THREADcontrol(partload_threads, THREAD_UNLOCK); +#ifdef pp_PARTFRAME + if(partnum == RELOAD_LOADED_PART_FILES){ + file_size = ReadPart(parti->file, i, RELOAD, &errorcode); + } + else{ + file_size = ReadPart(parti->file, i, LOAD, &errorcode); + } +#else file_size = ReadPart(parti->file, i, LOAD, &errorcode); +#endif THREADcontrol(partload_threads, THREAD_LOCK); parti->loadstatus = FILE_LOADED; part_load_size += file_size; @@ -4101,7 +4172,11 @@ void *MtLoadAllPartFiles(void *arg){ valptr = ( int * )(arg); LoadAllPartFiles(*valptr); +#ifdef pp_PARTFRAME + return NULL; +#else THREAD_EXIT(partload_threads); +#endif } /* ------------------ LoadAllPartFilesMT ------------------------ */ @@ -4109,11 +4184,19 @@ void *MtLoadAllPartFiles(void *arg){ void LoadAllPartFilesMT(int partnum){ int i; + INIT_PRINT_TIMER(part_load_timer); +#ifdef pp_PARTFRAME + LoadAllPartFiles(partnum); +#else if(partload_threads == NULL){ partload_threads = THREADinit(&n_partload_threads, &use_partload_threads, MtLoadAllPartFiles); } - THREADrun(partload_threads, &partnum); + int partnuminfo[1]; + partnuminfo[0] = partnum; + THREADruni(partload_threads, (unsigned char *)partnuminfo, 0); THREADcontrol(partload_threads, THREAD_JOIN); +#endif + PRINT_TIMER(part_load_timer, "LoadAllPartFilesMT"); INIT_PRINT_TIMER(part_timer); if(partnum < 0){ @@ -4261,7 +4344,9 @@ void LoadParticleMenu(int value){ } } STOP_TIMER(part_load_time); +#ifndef pp_PARTFRAME PrintFileLoadTimes(part_file_count,part_load_size,part_load_time); +#endif if(have_particles==0)printf("***warning: particle files have no particles\n"); } @@ -4437,8 +4522,11 @@ FILE_SIZE LoadVSliceMenu2(int value){ vslicedata *vslicei; slicedata *slicei; int dir; +#ifndef pp_SLICEFRAME int file_count = 0; - float load_size = 0.0, load_time; + float load_size = 0.0; +#endif + float load_time; int lastslice=0; value = -(1000 + value); @@ -4469,16 +4557,29 @@ FILE_SIZE LoadVSliceMenu2(int value){ longlabel = slicei->label.longlabel; if(strcmp(longlabel,submenulabel)!=0)continue; if(dir!=0&&dir!=slicei->idir)continue; +#ifndef pp_SLICEFRAME file_count++; +#endif +#ifdef pp_SLICEFRAME + if(lastslice==i){ + ReadVSlice(i,ALL_FRAMES, NULL, LOAD, SET_SLICECOLOR, &errorcode); + } + else{ + ReadVSlice(i,ALL_FRAMES, NULL, LOAD, DEFER_SLICECOLOR, &errorcode); + } +#else if(lastslice==i){ load_size+=ReadVSlice(i,ALL_FRAMES, NULL, LOAD, SET_SLICECOLOR, &errorcode); } else{ load_size+=ReadVSlice(i,ALL_FRAMES, NULL, LOAD, DEFER_SLICECOLOR, &errorcode); } +#endif } STOP_TIMER(load_time); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif } GLUTSETCURSOR(GLUT_CURSOR_LEFT_ARROW); return return_filesize; @@ -4737,7 +4838,10 @@ FILE_SIZE LoadSmoke3D(int type, int frame, int *count, float *time_value){ void LoadSmoke3DMenu(int value){ int i,errorcode; int file_count; - float load_time, load_size; + float load_time; +#ifndef pp_SMOKEFRAME + float load_size; +#endif #define MENU_DUMMY_SMOKE -9 #define MENU_SMOKE_SETTINGS -4 @@ -4748,7 +4852,9 @@ void LoadSmoke3DMenu(int value){ if(value == MENU_DUMMY_SMOKE)return; START_TIMER(load_time); +#ifndef pp_SMOKEFRAME load_size = 0.0; +#endif file_count=0; GLUTSETCURSOR(GLUT_CURSOR_WAIT); if(value>=0){ @@ -4868,11 +4974,17 @@ void LoadSmoke3DMenu(int value){ if(smoke3di->type == HRRPUV_index)type = 2; if(smoke3di->type == TEMP_index)type = 4; if(smoke3di->type == CO2_index)type = 8; +#ifdef pp_SMOKEFRAME + LoadSmoke3D(type, ALL_SMOKE_FRAMES, &file_count, NULL); +#else load_size=LoadSmoke3D(type, ALL_SMOKE_FRAMES, &file_count, NULL); +#endif } } STOP_TIMER(load_time); +#ifndef pp_SMOKEFRAME PrintFileLoadTimes(file_count, load_size, load_time); +#endif updatemenu=1; GLUTPOSTREDISPLAY; GLUTSETCURSOR(GLUT_CURSOR_LEFT_ARROW); @@ -4961,8 +5073,10 @@ FILE_SIZE LoadAllSliceFiles(int last_slice, char *submenulabel, int dir, int *fc void LoadSliceMenu(int value){ int errorcode,i; +#ifndef pp_SLICEFRAME float load_time, load_size = 0.0; int file_count=0; +#endif SNIFF_ERRORS("LoadSliceMenu: start"); if(value==MENU_DUMMY)return; @@ -4974,10 +5088,12 @@ void LoadSliceMenu(int value){ else{ switch (value){ int submenutype; - char *submenulabel; slicedata *slicei; +#ifndef pp_SLICEFRAME + char *submenulabel; int dir; int last_slice; +#endif case UNLOAD_ALL: for(i=0;ilabel.longlabel; + dir=value%4; last_slice = nsliceinfo - 1; for(i = nsliceinfo-1; i>=0; i--){ char *longlabel; @@ -5026,6 +5143,7 @@ void LoadSliceMenu(int value){ load_size = LoadAllSliceFiles(last_slice, submenulabel, dir, &file_count); STOP_TIMER(load_time); PrintFileLoadTimes(file_count,load_size,load_time); +#endif } } updatemenu=1; @@ -5038,8 +5156,11 @@ void LoadSliceMenu(int value){ void LoadMultiVSliceMenu(int value){ int i; +#ifndef pp_SLICEFRAME int file_count = 0; - float load_size = 0.0, load_time; + float load_size = 0.0; +#endif + float load_time; if(value==MENU_DUMMY)return; if(value>=0){ @@ -5093,13 +5214,19 @@ void LoadMultiVSliceMenu(int value){ vslicei = vsliceinfo + mvslicei->ivslices[i]; IF_NOT_USEMESH_CONTINUE(vslicei->loaded,sliceinfo[vslicei->ival].blocknumber); if(vslicei->skip==0&&vslicei->loaded==0){ +#ifdef pp_SLICEFRAME + LoadVSliceMenu2(mvslicei->ivslices[i]); +#else load_size+=LoadVSliceMenu2(mvslicei->ivslices[i]); file_count++; +#endif } if(vslicei->skip==1&&vslicei->loaded==1)UnloadVSliceMenu(mvslicei->ivslices[i]); } STOP_TIMER(load_time); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif } script_multivslice=0; } @@ -5129,10 +5256,14 @@ void LoadMultiVSliceMenu(int value){ if(strcmp(longlabel,submenulabel)!=0)continue; if(dir!=0&&dir!=slicej->idir)continue; LoadMultiVSliceMenu(i); +#ifndef pp_SLICEFRAME file_count++; +#endif } STOP_TIMER(load_time); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif } else{ switch(value){ @@ -5224,7 +5355,9 @@ FILE_SIZE LoadAllMSlices(int last_slice, multislicedata *mslicei){ SetLoadedSliceBounds(mslicei->islices, mslicei->nslices); file_size = LoadAllMSlicesMT(last_slice, mslicei, &file_count); STOP_TIMER(load_time); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,(float)file_size,load_time); +#endif return file_size; } @@ -5306,8 +5439,11 @@ void LoadMultiSliceMenu(int value){ int submenutype, dir, errorcode; char *submenulabel; slicedata *slicei; - float load_time, load_size = 0.0; + float load_time; +#ifndef pp_SLICEFRAME + float load_size = 0.0; int file_count = 0; +#endif value = -(1000 + value); submenutype=value/4; @@ -5325,6 +5461,14 @@ void LoadMultiSliceMenu(int value){ if(strcmp(longlabel,submenulabel)!=0)continue; if(dir!=0&&dir!=slicei->idir)continue; if(dir!=0&&slicei->volslice==1)continue; +#ifdef pp_SLICEFRAME + if(slicei->slice_filetype == SLICE_GEOM){ + ReadGeomData(slicei->patchgeom, slicei, LOAD, ALL_FRAMES, NULL, 0, &errorcode); + } + else{ + ReadSlice(slicei->file,i, ALL_FRAMES, NULL, LOAD,SET_SLICECOLOR,&errorcode); + } +#else if(slicei->slice_filetype == SLICE_GEOM){ load_size += ReadGeomData(slicei->patchgeom, slicei, LOAD, ALL_FRAMES, NULL, 0, &errorcode); } @@ -5332,9 +5476,12 @@ void LoadMultiSliceMenu(int value){ load_size += ReadSlice(slicei->file,i, ALL_FRAMES, NULL, LOAD,SET_SLICECOLOR,&errorcode); } file_count++; +#endif } STOP_TIMER(load_time); +#ifndef pp_SLICEFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif } else{ switch(value){ @@ -5703,8 +5850,11 @@ FILE_SIZE LoadIsoI(int value){ void LoadAllIsos(int iso_type){ int i; +#ifndef pp_ISOFRAME int file_count=0; - float load_time=0.0, load_size=0.0; + float load_size=0.0; +#endif + float load_time=0.0; if(load_only_when_unloaded == 0){ for(i = 0; i < nisoinfo; i++){ @@ -5743,12 +5893,18 @@ void LoadAllIsos(int iso_type){ isoi = isoinfo + i; IF_NOT_USEMESH_CONTINUE(isoi->loaded,isoi->blocknumber); if(iso_type==isoi->type){ +#ifdef pp_ISOFRAME + LoadIsoI(i); +#else load_size+=LoadIsoI(i); file_count++; +#endif } } STOP_TIMER(load_time); +#ifndef pp_ISOFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif } /* ------------------ LoadIsoMenu ------------------------ */ @@ -5877,8 +6033,11 @@ void LoadBoundaryMenu(int value){ fprintf(scriptoutstream," %s\n",patchj->label.longlabel); } if(scriptoutstream==NULL||script_defer_loading==0){ +#ifndef pp_BOUNDFRAME int file_count=0; - float load_time=0.0, load_size=0.0; + float load_size=0.0; +#endif + float load_time=0.0; START_TIMER(load_time); @@ -5931,16 +6090,24 @@ void LoadBoundaryMenu(int value){ if(patchi->structured == YES){ PRINTF("Loading %s(%s)", patchi->file, patchi->label.shortlabel); } +#ifdef pp_BOUNDFRAME + ReadBoundary(i, LOAD, &errorcode); +#else load_size+=ReadBoundary(i, LOAD, &errorcode); +#endif if(patchi->structured!=NO&&patchi->finalize==1){ UpdateTriangles(GEOM_STATIC, GEOM_UPDATE_ALL); } +#ifndef pp_BOUNDFRAME file_count++; +#endif THREADcontrol(compress_threads, THREAD_UNLOCK); } } STOP_TIMER(load_time); +#ifndef pp_BOUNDFRAME PrintFileLoadTimes(file_count,load_size,load_time); +#endif } force_redisplay=1; UpdateFrameNumber(0); @@ -7834,7 +8001,8 @@ void InitLoadMultiSubMenu(int **loadsubmslicemenuptr, int *nmultisliceloadedptr) sdim1 = sliceinfo+(multisliceinfo+i-1)->islices[0]; if(strcmp(sd->label.longlabel, sdim1->label.longlabel)!=0)nloadsubmslicemenu++; } - NewMemory((void **)&loadsubmslicemenu, nloadsubmslicemenu*sizeof(int)); + loadsubmslicemenu = *loadsubmslicemenuptr; + NEWMEM(loadsubmslicemenu, nloadsubmslicemenu*sizeof(int)); *loadsubmslicemenuptr = loadsubmslicemenu; for(i = 0;i 0){ - NewMemory((void **)&loadsubpatchmenu_s, nloadsubpatchmenu_s * sizeof(int)); - NewMemory((void **)&nsubpatchmenus_s, nloadsubpatchmenu_s * sizeof(int)); + loadsubpatchmenu_s = *loadsubpatchmenu_sptr; + NEWMEM(loadsubpatchmenu_s, nloadsubpatchmenu_s * sizeof(int)); *loadsubpatchmenu_sptr = loadsubpatchmenu_s; + + nsubpatchmenus_s = *nsubpatchmenus_sptr; + NEWMEM(nsubpatchmenus_s, nloadsubpatchmenu_s * sizeof(int)); *nsubpatchmenus_sptr = nsubpatchmenus_s; } for(ii = 0;ii0.1)printf("%s/%i/%s %.1f s\n", file, line, label, *timer); - } - START_TIMER(*timer); -} - /* ------------------------ GetFontHeight ------------------------- */ int GetFontHeight(void){ diff --git a/Source/smokeview/readsmv.c b/Source/smokeview/readsmv.c index 4c59340535..5c46de0b77 100644 --- a/Source/smokeview/readsmv.c +++ b/Source/smokeview/readsmv.c @@ -193,6 +193,9 @@ FILE_SIZE ReadCSVFile(csvfiledata *csvfi, int flag){ ci = csvfi->csvinfo + i; FREEMEMORY(ci->vals); FREEMEMORY(ci->vals_orig); + FREEMEMORY(ci->label.longlabel); + FREEMEMORY(ci->label.shortlabel); + FREEMEMORY(ci->label.unit); } FREEMEMORY(csvfi->csvinfo); } @@ -311,6 +314,9 @@ FILE_SIZE ReadCSVFile(csvfiledata *csvfi, int flag){ ci->skip = 0; if(strcmp(unit, "status") == 0)ci->skip = 1; ci->dimensionless = IsDimensionless(unit); + ci->label.longlabel = NULL; + ci->label.shortlabel = NULL; + ci->label.unit = NULL; SetLabels(&(ci->label), label, label, unit); } CheckMemory; @@ -403,6 +409,9 @@ FILE_SIZE ReadCSVFile(csvfiledata *csvfi, int flag){ cchirad->valmax = MAX(cchirad->valmax, vals2[i]); } } + cchirad->label.longlabel = NULL; + cchirad->label.shortlabel = NULL; + cchirad->label.unit = NULL; SetLabels(&(cchirad->label), "-QRAD_I/HRR", "-QRAD_I/HRR", ""); csvfi->ncsvinfo++; } @@ -504,6 +513,9 @@ void ReadHRR(int flag){ hi = hrrinfo + i; FREEMEMORY(hi->vals); FREEMEMORY(hi->vals_orig); + FREEMEMORY(hi->label.longlabel); + FREEMEMORY(hi->label.shortlabel); + FREEMEMORY(hi->label.unit); } FREEMEMORY(hrrinfo); nhrrinfo = 0; @@ -561,6 +573,9 @@ void ReadHRR(int flag){ hi = hrrinfo+i; TrimBack(labels[i]); TrimBack(units[i]); + hi->label.longlabel = NULL; + hi->label.shortlabel = NULL; + hi->label.unit = NULL; SetLabels(&(hi->label), labels[i], labels[i], units[i]); } CheckMemory; @@ -594,6 +609,9 @@ void ReadHRR(int flag){ hi2->base_col = i; strcpy(label, "HOC*"); strcat(label, hi->label.longlabel); + hi2->label.longlabel = NULL; + hi2->label.shortlabel = NULL; + hi2->label.unit = NULL; SetLabels(&(hi2->label), label, label, "kW"); mlr_col = hi2-hrrinfo; have_mlr = 1; @@ -632,6 +650,9 @@ void ReadHRR(int flag){ hi_chirad = hrrinfo+chirad_col; strcpy(label, "CHIRAD"); + hi_chirad->label.longlabel = NULL; + hi_chirad->label.shortlabel = NULL; + hi_chirad->label.unit = NULL; SetLabels(&(hi_chirad->label), label, label, "-"); hi_chirad->nvals = nrows - 2; nhrrhcinfo++; @@ -1062,7 +1083,9 @@ void InitMesh(meshdata *meshi){ meshi->patch_times = NULL; meshi->patch_times_map = NULL; meshi->patchval = NULL; +#ifndef pp_BOUNDFRAME meshi->patchval_iframe = NULL; +#endif meshi->thresholdtime = NULL; meshi->patchblank = NULL; meshi->patch_timeslist = NULL; @@ -1085,9 +1108,6 @@ void InitMesh(meshdata *meshi){ meshi->theat = NULL; meshi->blockageinfoptrs = NULL; - meshi->surface_tempmax = SURFACE_TEMPMAX; - meshi->surface_tempmin = SURFACE_TEMPMIN; - meshi->faceinfo = NULL; meshi->face_normals_single = NULL; meshi->face_normals_double = NULL; @@ -3028,7 +3048,7 @@ void UpdateBoundInfo(void){ #ifdef pp_PARTBOUND_MULTI if(partbound_threads == NULL){ partbound_threads = THREADinit(&n_partbound_threads, &use_partbound_threads, GetGlobalPartBoundsReduced); - THREADrun(partbound_threads, NULL); + THREADrun(partbound_threads); } #else GetGlobalPartBounds(0); @@ -3039,14 +3059,14 @@ void UpdateBoundInfo(void){ if(slicebound_threads == NULL){ slicebound_threads = THREADinit(&n_slicebound_threads, &use_slicebound_threads, GetGlobalSliceBoundsFull); } - THREADrun(slicebound_threads, NULL); + THREADrun(slicebound_threads); PRINT_TIMER(bound_timer, "GetGlobalSliceBounds"); GetGlobalPatchBoundsReduced(); if(patchbound_threads == NULL){ patchbound_threads = THREADinit(&n_patchbound_threads, &use_patchbound_threads, GetGlobalPatchBoundsFull); } - THREADrun(patchbound_threads, NULL); + THREADrun(patchbound_threads); PRINT_TIMER(bound_timer, "GetGlobalPatchBounds"); GetGlobalHVACDuctBounds(0); @@ -3247,7 +3267,7 @@ void UpdateMeshBoxBounds(void){ for(i = 0; iboxmin[0] = meshi->xplt[0]; meshi->boxmin[1] = meshi->yplt[0]; @@ -4930,7 +4950,7 @@ int ParseISOFProcess(bufferstreamdata *stream, char *buffer, int *iiso_in, int * return RETURN_BREAK; } -#ifdef pp_FRAME +#ifdef pp_ISOFRAME isoi->frameinfo = NULL; #endif isoi->fds_skip = fds_skip; @@ -5117,7 +5137,7 @@ int ParsePRT5Process(bufferstreamdata *stream, char *buffer, int *nn_part_in, in blocknumber--; } -#ifdef pp_FRAME +#ifdef pp_PARTFRAME parti->frameinfo = NULL; #endif parti->blocknumber = blocknumber; @@ -5129,6 +5149,7 @@ int ParsePRT5Process(bufferstreamdata *stream, char *buffer, int *nn_part_in, in parti->valmax_part = NULL; parti->stream = NULL; parti->hist_update = 0; + parti->skipload = 1; if(FGETS(buffer, 255, stream)==NULL){ npartinfo--; return RETURN_BREAK; @@ -5181,7 +5202,9 @@ int ParsePRT5Process(bufferstreamdata *stream, char *buffer, int *nn_part_in, in parti->timeslist = NULL; parti->histograms = NULL; parti->bounds_set = 0; +#ifndef pp_PARTFRAME parti->filepos = NULL; +#endif parti->tags = NULL; parti->sort_tags = NULL; parti->vis_part = NULL; @@ -5301,9 +5324,12 @@ int ParseBNDFProcess(bufferstreamdata *stream, char *buffer, int *nn_patch_in, i for(i = 0; i<6; i++){ patchi->ijk[i] = -1; } +#ifdef pp_BOUNDFRAME + patchi->frameinfo = NULL; +#endif patchi->finalize = 1; - patchi->valmin_patch = 1.0; - patchi->valmax_patch = 0.0; + patchi->valmin_patch = 1.0; + patchi->valmax_patch = 0.0; patchi->skip = 0; patchi->version = version; patchi->ntimes = 0; @@ -5378,7 +5404,7 @@ int ParseBNDFProcess(bufferstreamdata *stream, char *buffer, int *nn_patch_in, i strcat(patchi->bound_file, ".bnd"); patchi->have_bound_file = NO; - NewMemory((void **)&patchi->comp_file, (unsigned int)(len+4+1)); + NewMemory((void **)&patchi->comp_file, (unsigned int)(len + 4 + 1)); STRCPY(patchi->comp_file, bufferptr); STRCAT(patchi->comp_file, ".svz"); @@ -5595,7 +5621,7 @@ int ParseSMOKE3DProcess(bufferstreamdata *stream, char *buffer, int *nn_smoke3d_ smoke3di->val16_maxs = NULL; smoke3di->times16 = NULL; #endif -#ifdef pp_FRAME +#ifdef pp_SMOKEFRAME smoke3di->frameinfo = NULL; #endif smoke3di->seq_id = nn_smoke3d; @@ -5606,7 +5632,7 @@ int ParseSMOKE3DProcess(bufferstreamdata *stream, char *buffer, int *nn_smoke3d_ smoke3di->smokeframe_comp_list = NULL; smoke3di->smokeframe_out = NULL; smoke3di->timeslist = NULL; -#ifndef pp_FRAME +#ifndef pp_SMOKEFRAME smoke3di->smoke_comp_all = NULL; #endif smoke3di->smokeview_tmp = NULL; @@ -5636,7 +5662,7 @@ int ParseSMOKE3DProcess(bufferstreamdata *stream, char *buffer, int *nn_smoke3d_ smoke3di->comp_file = SMOKE3DBUFFER(len + 1); STRCPY(smoke3di->comp_file, buffer2); - if(have_compressed_files==1&&FILE_EXISTS_CASEDIR(smoke3di->comp_file) == YES){ + if(FILE_EXISTS_CASEDIR(smoke3di->comp_file) == YES){ smoke3di->file = smoke3di->comp_file; smoke3di->is_zlib = 1; smoke3di->compression_type = COMPRESSED_ZLIB; @@ -5855,7 +5881,7 @@ int ParseSLCFProcess(int option, bufferstreamdata *stream, char *buffer, int *nn #ifdef pp_SLICE_MULTI sd->loadstatus = FILE_UNLOADED; #endif -#ifdef pp_FRAME +#ifdef pp_SLICEFRAME sd->frameinfo = NULL; #endif sd->slice_mask = NULL; @@ -6462,7 +6488,7 @@ void UpdateObstBoundingBox(float *XB){ } } -/* ------------------ ReadSMVOrig ------------------------ */ +/* ------------------ GetBlockagePtr ------------------------ */ blockagedata *GetBlockagePtr(float *xyz){ float xyzcenter[3]; @@ -6494,6 +6520,188 @@ blockagedata *GetBlockagePtr(float *xyz){ return NULL; } +#ifdef pp_FDS +/* ------------------ SkipFdsContinueLines ------------------------ */ + +void SkipFdsContinueLines(FILE *streamin, FILE *streamout, char *buffer){ + char *slash; + + slash = strrchr(buffer, '/'); + while(slash==NULL){ + if(fgets(buffer, 255, streamin) == NULL)return; + slash = strrchr(buffer, '/'); + } +} + +/* ------------------ ConvertFDSInputFile ------------------------ */ + +char *ConvertFDSInputFile(char *filein, int *ijk_arg, float *xb_arg){ + FILE *streamin, *streamout; + char *ext, fileout[1024], chid0[1024]; + int ijk[3] = {32, 32, 32}; + float xb[6] = {0.0, 1.6, 0.0, 1.6, 0.0, 3.2}; + int outmesh=1; + + if(filein == NULL)return NULL; + + strcpy(fileout, filein); + ext = strrchr(fileout, '.'); + if(ext != NULL)ext[0] = 0; + strcat(fileout, "_1m.fds"); + + strcpy(chid0, filein); + ext = strrchr(chid0, '.'); + if(ext != NULL)ext[0] = 0; + strcat(chid0, "_1m"); + + streamin = fopen(filein, "r"); + if(streamin == NULL)return NULL; + + streamout = fopen(fileout, "w"); + if(streamout == NULL){ + fclose(streamin); + return NULL; + } + + if(ijk_arg != NULL)memcpy(ijk, ijk_arg, 3 * sizeof(int)); + if(xb_arg != NULL)memcpy(xb, xb_arg, 6 * sizeof(float)); + while(!feof(streamin)){ + char buffer[255], *first; + + if(fgets(buffer, 255, streamin) == NULL)break; + first = TrimFrontBack(buffer); + if(first==NULL || first[0] != '&'){ + fprintf(streamout, "%s\n", buffer); + continue; + } + if(strncmp(first, "&HEAD", 5) == 0){ + fprintf(streamout, "&HEAD CHID='%s' /\n", chid0); + SkipFdsContinueLines(streamin, streamout, buffer); + continue; + } + else if(strncmp(first, "&MESH", 5) == 0){ + if(outmesh==1){ + int i; + char czero[256]; + + outmesh=0; + fprintf(streamout, "&MESH IJK=%i,%i,%i, XB=", ijk[0], ijk[1], ijk[2]); + for(i = 0;i < 5;i++){ + fprintf(streamout, "%s,", Val2String(xb[i], czero)); + } + fprintf(streamout, "%s /\n", Val2String(xb[5], czero)); + } + SkipFdsContinueLines(streamin, streamout, buffer); + continue; + } + else if(strncmp(first, "&TIME", 5) == 0){ + fprintf(streamout, "&TIME T_END=0.0 /\n"); + SkipFdsContinueLines(streamin, streamout, buffer); + continue; + } + fprintf(streamout, "%s\n", buffer); + } + fclose(streamin); + fclose(streamout); + + char *outfile; + NewMemory(( void ** )&outfile, strlen(fileout)+1); + strcpy(outfile, fileout); + return outfile; +} + +/* ------------------ GenerateSmvOrigFile ------------------------ */ + +int GenerateSmvOrigFile(void){ + int i; + int ijk[6]; + float xb[6]; + float dxmin, dymin, dzmin; + + if(fdsprog == NULL)return 0; + if(FileExistsOrig(smv_orig_filename) == 1 && IsFileNewer(smv_orig_filename, smv_filename) == 1)return 0; + + xb[0] = xbar0ORIG; + xb[1] = xbarORIG; + xb[2] = ybar0ORIG; + xb[3] = ybarORIG; + xb[4] = zbar0ORIG; + xb[5] = zbarORIG; + for(i = 0; i < nmeshes; i++){ + meshdata *meshi; + float dx, dy, dz; + float *xplt, *yplt, *zplt; + + meshi = meshinfo + i; + xplt = meshi->xplt_orig; + yplt = meshi->yplt_orig; + zplt = meshi->zplt_orig; + dx = (xplt[meshi->ibar] - xplt[0]) / (float)meshi->ibar; + dy = (yplt[meshi->jbar] - yplt[0]) / (float)meshi->jbar; + dz = (zplt[meshi->kbar] - zplt[0]) / (float)meshi->kbar; + if(i == 0){ + dxmin = dx; + dymin = dy; + dzmin = dz; + } + else{ + dxmin = MIN(dx, dxmin); + dymin = MIN(dy, dymin); + dzmin = MIN(dz, dzmin); + } + } + float nx, ny, nz; + + nx = (xbarORIG - xbar0ORIG) / dxmin + 1; + ny = (ybarORIG - ybar0ORIG) / dymin + 1; + nz = (zbarORIG - zbar0ORIG) / dzmin + 1; + if(nx * ny * nz > 10000000.0)return 0; + + ijk[0] = (int)nx; + ijk[1] = (int)ny; + ijk[2] = (int)nz; + + char *fdsonemesh, command_line[1024], smvonemesh[1024], gitonemesh[1024], *ext; + + fdsonemesh = ConvertFDSInputFile(fds_filein, ijk, xb); + if(FileExistsOrig(fdsonemesh) == 0 || fdsprog == NULL)return 0; + +// setup and run fds case + strcpy(command_line, fdsprog); + strcat(command_line, " "); + strcat(command_line, fdsonemesh); + strcat(command_line, " > Nul 2> Nul"); + system(command_line); + + strcpy(smvonemesh, fdsonemesh); + ext = strrchr(smvonemesh, '.'); + if(ext!=NULL)ext[0]=0; + strcat(smvonemesh, ".smv"); + if(FileExistsOrig(smvonemesh) == 0)return 0; + + strcpy(gitonemesh, fdsonemesh); + ext = strrchr(gitonemesh, '.'); + if(ext != NULL)ext[0] = 0; + strcat(gitonemesh, "_git.txt"); + + FileCopy(smvonemesh, smv_orig_filename); + FileErase(fdsonemesh); + FileErase(smvonemesh); + FileErase(gitonemesh); + return 1; +} + +/* ------------------ GenerateSmvOrigFileWrapper ------------------------ */ + +void *GenerateSmvOrigFileWrapper(void *arg){ + if(GenerateSmvOrigFile()==1){ + printf("%s generated\n", smv_orig_filename); + } + ReadSMVOrig(); + THREAD_EXIT(readsmvorig_threads); +} +#endif + /* ------------------ ReadSMVOrig ------------------------ */ void ReadSMVOrig(void){ @@ -6817,12 +7025,18 @@ int ReadSMV_Init() { START_TIMER(timer_readsmv); START_TIMER(processing_time); +#ifdef pp_ISOFRAME + use_isosurface_threads = 0; +#endif //** initialize multi-threading if(runscript == 1){ use_checkfiles_threads = 0; use_ffmpeg_threads = 0; use_readallgeom_threads = 0; use_isosurface_threads = 0; +#ifdef pp_FDS + use_readsmvorig_threads = 0; +#endif #ifdef pp_SMOKEDRAW_SPEEDUP use_mergesmoke_threads = 0; #endif @@ -11684,7 +11898,7 @@ int ReadSMV_Configure(){ if(checkfiles_threads != NULL){ checkfiles_threads = THREADinit(&n_checkfiles_threads, &use_checkfiles_threads, CheckFiles); } - THREADrun(checkfiles_threads, NULL); + THREADrun(checkfiles_threads); PRINT_TIMER(timer_readsmv, "CheckFiles"); CheckMemory; UpdateIsoColors(); @@ -11756,13 +11970,20 @@ int ReadSMV_Configure(){ if(readallgeom_threads == NULL){ readallgeom_threads = THREADinit(&n_readallgeom_threads, &use_readallgeom_threads, ReadAllGeom); } - THREADrun(readallgeom_threads, NULL); + THREADrun(readallgeom_threads); THREADcontrol(readallgeom_threads, THREAD_JOIN); PRINT_TIMER(timer_readsmv, "ReadAllGeomMT"); UpdateMeshCoords(); PRINT_TIMER(timer_readsmv, "UpdateMeshCoords"); +#ifdef pp_FDS + if(readsmvorig_threads == NULL){ + readsmvorig_threads = THREADinit(&n_readsmvorig_threads, &use_readsmvorig_threads, GenerateSmvOrigFileWrapper); + } + THREADrun(readsmvorig_threads); +#endif + UpdateSmoke3DTypes(); PRINT_TIMER(timer_readsmv, "UpdateSmoke3DTypes"); CheckMemory; @@ -11800,7 +12021,9 @@ int ReadSMV_Configure(){ } } if(npartinfo>=64){ +#ifndef pp_PARTFRAME use_partload_threads = 1; +#endif partfast = 1; } @@ -11829,7 +12052,7 @@ int ReadSMV_Configure(){ if(sliceparms_threads == NULL){ sliceparms_threads = THREADinit(&n_sliceparms_threads, &use_sliceparms_threads, UpdateVSlices); } - THREADrun(sliceparms_threads, &sliceparminfo); + THREADruni(sliceparms_threads, (unsigned char *)&sliceparminfo, 0); THREADcontrol(sliceparms_threads, THREAD_JOIN); PRINT_TIMER(timer_readsmv, "UpdateVSlices"); @@ -11875,19 +12098,23 @@ int ReadSMV_Configure(){ #ifdef pp_SMOKEDRAW_SPEEDUP if(mergesmoke_threads == NULL){ mergesmoke_threads = THREADinit(&n_mergesmoke_threads, &use_mergesmoke_threads, MtMergeSmoke3D); + for(i = 0; i < n_mergesmoke_threads; i++){ + smokethreadinfo[i].ithread = i; + smokethreadinfo[i].nthreads = n_mergesmoke_threads; + } } #endif if(ffmpeg_threads == NULL){ ffmpeg_threads = THREADinit(&n_ffmpeg_threads, &use_ffmpeg_threads, SetupFF); } - THREADrun(ffmpeg_threads, NULL); + THREADrun(ffmpeg_threads); PRINT_TIMER(timer_readsmv, "SetupFFMT"); if(isosurface_threads == NULL){ isosurface_threads = THREADinit(&n_isosurface_threads, &use_isosurface_threads, SetupAllIsosurfaces); } - THREADrun(isosurface_threads, NULL); + THREADrun(isosurface_threads); THREADcontrol(isosurface_threads, THREAD_JOIN); PRINT_TIMER(timer_readsmv, "SetupAllIsosurfaces"); @@ -12004,7 +12231,7 @@ int ReadSMV_Configure(){ if(classifyallgeom_threads == NULL){ classifyallgeom_threads = THREADinit(&n_readallgeom_threads, &use_readallgeom_threads, ClassifyAllGeom); } - THREADrun(classifyallgeom_threads, NULL); + THREADrun(classifyallgeom_threads); } PRINT_TIMER(timer_readsmv, "ClassifyGeom"); @@ -12392,6 +12619,12 @@ int ReadIni2(char *inifile, int localfile){ update_research_mode=1; continue; } +#ifdef pp_FRAME + if(MatchINI(buffer, "FRAMETHREADS") == 1){ + fgets(buffer, 255, stream); + sscanf(buffer, " %i", &nframe_threads); + } +#endif if(MatchINI(buffer, "LOADMESH") == 1){ fgets(buffer, 255, stream); sscanf(buffer, " %i %i", &show_intersection_box, &show_intersected_meshes); @@ -14823,6 +15056,9 @@ int ReadIni2(char *inifile, int localfile){ if(current_script_command==NULL){ sscanf(buffer, "%i %i %i", &partfast, &use_partload_threads, &n_partload_threads); } +#ifdef pp_PARTFRAME + use_partload_threads = 0; +#endif continue; } if(MatchINI(buffer, "WINDOWOFFSET") == 1){ @@ -16969,6 +17205,10 @@ void WriteIni(int flag,char *filename){ fprintf(fileout, "CSV\n"); fprintf(fileout, " %i\n", csv_loaded); +#ifdef pp_FRAME + fprintf(fileout, "FRAMETHREADS\n"); + fprintf(fileout, " %i\n", nframe_threads); +#endif fprintf(fileout, "LOADINC\n"); fprintf(fileout, " %i\n", load_incremental); fprintf(fileout, "NOPART\n"); diff --git a/Source/smokeview/renderimage.c b/Source/smokeview/renderimage.c index ce70dd32e0..1e6bb06eb2 100644 --- a/Source/smokeview/renderimage.c +++ b/Source/smokeview/renderimage.c @@ -165,8 +165,6 @@ void MakeMovie(void){ EnableDisableMakeMovie(ON); EnableDisablePlayMovie(); - - update_makemovie = 0; } /* ------------------ ResetRenderResolution ------------------------ */ diff --git a/Source/smokeview/smokeheaders.h b/Source/smokeview/smokeheaders.h index 1e6abd3990..60e01df2bb 100644 --- a/Source/smokeview/smokeheaders.h +++ b/Source/smokeview/smokeheaders.h @@ -362,8 +362,6 @@ EXTERNCPP void GLUIUpdateShowOnlyTop(void); EXTERNCPP void GeneratePartHistograms(void); FILE_SIZE LoadAllMSlicesMT(int last_slice, multislicedata *mslicei, int *fcount); -EXTERNCPP void PrintTime(const char *tag, int line, float *timer, const char *label, int stop_flag); - EXTERNCPP void DrawObstBoundingBox(void); EXTERNCPP void DrawGeomBoundingBox(float *boundingbox_color); EXTERNCPP void ClassifyGeom(geomdata *geomi, int *geom_frame_index); @@ -375,7 +373,7 @@ EXTERNCPP void SetTimeState(void); EXTERNCPP int GetGeomDataSize(char *file, int *nvals, int time_frame, int *cvals_offsets, int *cvals_sizes, int *geom_offsets, int *geom_offset_flag, int *max_buffer_size, int *error); -EXTERNCPP FILE_SIZE GetGeomData(char *filename, int ntimes, int nvals, float *times, +EXTERNCPP FILE_SIZE GetGeomData(patchdata *patchi, char *filename, int load_flag, int ntimes, int nvals, float *times, int *nstatics, int *ndynamics, float *vals, int time_frame, float *time_value, int *geom_offsets, int *error); @@ -444,10 +442,9 @@ EXTERNCPP void GenerateSliceMenu(int from_commandline); void DrawTerrainGeom(int option); void GenerateTerrainGeom(float **vertices_arg, unsigned int **indices_arg, int *nindices_arg); -EXTERNCPP int GetPartHeader(partdata *parti, int *nf_all, int option_arg, int print_option_arg); EXTERNCPP void SetMainWindow(void); EXTERNCPP void GetSliceFileHeader(char *file, int *ip1, int *ip2, int *jp1, int *jp2, int *kp1, int *kp2, int *error); -EXTERNCPP int TimeAverageData(float *data_out, float *data_in, int ndata, int data_per_timestep, float *times_local, int ntimes_local, float average_time); +EXTERNCPP int TimeAverageData(float **data_out, float **data_in, int ndata, int data_per_timestep, float *times_local, int ntimes_local, float average_time); bufferstreamdata *GetSMVBuffer(char *file); EXTERNCPP void UpdateBlockType(void); boundsdata *GetSliceBoundsInfo(char *shortlabel); @@ -550,8 +547,8 @@ EXTERNCPP void UpdateVentOffset(void); EXTERNCPP void UpdateOpacityMap(void); EXTERNCPP int GetVolFrameMax(int meshnum); EXTERNCPP void UpdateGluiRotateAbout(int val); -EXTERNCPP void ReloadAllSliceFiles(void); -EXTERNCPP void ReloadAllVectorSliceFiles(void); +EXTERNCPP void ReloadAllSliceFiles(int load_flag); +EXTERNCPP void ReloadAllVectorSliceFiles(int load_flag); EXTERNCPP void UnloadAllSliceFiles(char *longlabel); EXTERNCPP void ParticleStreakShowMenu(int var); EXTERNCPP void UpdateGeomNormals(); @@ -1105,7 +1102,7 @@ EXTERNCPP void DrawCADGeom(const cadgeomdata *cd); EXTERNCPP void ReadPlot3D(char *file, int ifile, int flag,int *errorcode); EXTERNCPP void SetupReadAllGeom(void); -EXTERNCPP FILE_SIZE ReadGeom(geomdata *geomi, int load_flag, int type, int *geom_frame_index); +EXTERNCPP FILE_SIZE ReadGeom(geomdata *geomi, unsigned char *buffer, int nbuffer, int load_flag, int type, int *geom_frame_index); EXTERNCPP FILE_SIZE ReadBoundary(int ifile, int flag, int *errorcode); EXTERNCPP FILE_SIZE ReadPart(char *file, int ifile, int loadflag, int *errorcode); diff --git a/Source/smokeview/smokeviewdefs.h b/Source/smokeview/smokeviewdefs.h index 79bebf832f..4a029f9835 100644 --- a/Source/smokeview/smokeviewdefs.h +++ b/Source/smokeview/smokeviewdefs.h @@ -252,31 +252,6 @@ EXTERNCPP void _Sniff_Errors(const char *whereat, const char *file, int line); #define UPDATE_WINDROSE_CHECKBOX 1 #define UPDATE_WINDROSE_SHOWHIDE 2 -#ifndef START_TIMER -#define START_TIMER(a) a = (float)clock()/(float)CLOCKS_PER_SEC -#endif - -#ifndef STOP_TIMER -#define STOP_TIMER(a) a = (float)clock()/(float)CLOCKS_PER_SEC - a -#endif - -#ifndef CUM_TIMER -#define CUM_TIMER(a,b) b += ((float)clock()/(float)CLOCKS_PER_SEC - a) -#endif - -#ifndef INIT_PRINT_TIMER -#define INIT_PRINT_TIMER(timer) float timer;START_TIMER(timer) -#endif - -#ifndef PRINT_TIMER -#define PRINT_TIMER(timer, label) PrintTime(__FILE__, __LINE__, &timer, label, 1) -#endif - -#ifndef PRINT_CUM_TIMER -#define PRINT_CUM_TIMER(timer, label) PrintTime(__FILE__, __LINE__, &timer, label, 0) -#endif - - #ifndef START_TICKS #define START_TICKS(a) a = glutGet(GLUT_ELAPSED_TIME) #endif @@ -761,7 +736,6 @@ EXTERNCPP void _Sniff_Errors(const char *whereat, const char *file, int line); #define RELOAD_INCREMENTAL_NOW -2 #define RELOAD_SWITCH -4 #define STOP_RELOADING -1 -#define RELOAD_MODE_INCREMENTAL -5 #define RELOAD_MODE_ALL -6 #define RELOAD_SMV_FILE -7 diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 70b0188da6..a1a0077c29 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -31,9 +31,15 @@ #ifdef pp_SMOKEDRAW_SPEEDUP SVEXTERN int SVDECL(n_mergesmoke_threads, 4), SVDECL(use_mergesmoke_threads, 1); SVEXTERN threaderdata SVDECL(*mergesmoke_threads, NULL); -SVEXTERN int merge_args[2 * MAX_THREADS]; +SVEXTERN smokethreaddata smokethreadinfo[MAX_THREADS]; SVEXTERN int SVDECL(n_mergesmoke_glui_threads, 4), SVDECL(use_mergesmoke_glui_threads, 1); -SVEXTERN int SVDECL(update_merge_smoke, 1); +SVEXTERN int SVDECL(update_glui_merge_smoke, 1); +#endif + +//***readsmvorig +#ifdef pp_FDS +SVEXTERN int SVDECL(n_readsmvorig_threads, 1), SVDECL(use_readsmvorig_threads, 1); +SVEXTERN threaderdata SVDECL(*readsmvorig_threads, NULL); #endif //***isosurface @@ -60,7 +66,12 @@ SVEXTERN threaderdata SVDECL(*ffmpeg_threads, NULL); SVEXTERN int SVDECL(n_iso_threads, 1), SVDECL(use_iso_threads, 0), SVDECL(use_iso_threads_save,0); //*** part -SVEXTERN int SVDECL(n_partload_threads, 2), SVDECL(use_partload_threads, 1); +SVEXTERN int SVDECL(n_partload_threads, 2); +#ifdef pp_PARTFRAME +SVEXTERN int SVDECL(use_partload_threads, 0); +#else +SVEXTERN int SVDECL(use_partload_threads, 1); +#endif SVEXTERN threaderdata SVDECL(*partload_threads, NULL); //*** patchbounds @@ -109,6 +120,9 @@ SVEXTERN int SVDECL(update_device_timeaverage, 0); SVEXTERN int SVDECL(update_colorbar_list, 0); SVEXTERN int SVDECL(force_bound_update, 0); SVEXTERN int SVDECL(update_colorbar_dialog, 1); +#ifdef pp_FRAME +SVEXTERN int SVDECL(update_frame, 0); +#endif // hvac data SVEXTERN int SVDECL(hvacductvar_index, -1), SVDECL(hvacnodevar_index, -1); @@ -267,7 +281,6 @@ SVEXTERN devicedata SVDECL(**deviceinfo_sortedz, NULL); SVEXTERN int SVDECL(nztreedeviceinfo, 0); SVEXTERN int SVDECL(readini_output, 0); -SVEXTERN int SVDECL(show_timings, 0); SVEXTERN int SVDECL(show_trirates, 0); SVEXTERN float SVDECL(pixel_dens, 1.0); @@ -583,6 +596,9 @@ SVEXTERN int SVDECL(light_faces, 1); SVEXTERN char SVDECL(*prog_fullpath, NULL); SVEXTERN int SVDECL(nwindrosez_checkboxes, 0); SVEXTERN float startup_time; +#ifdef pp_FRAME +SVEXTERN int SVDECL(nframe_threads, 4), SVDECL(read_buffer_size, 10); +#endif #ifdef pp_FAST SVEXTERN int SVDECL(fast_startup, 1), SVDECL(lookfor_compressed_files,0); #else @@ -1949,9 +1965,12 @@ SVEXTERN FILE SVDECL(*LOG_FILENAME,NULL); SVEXTERN char SVDECL(*flushfile,NULL), SVDECL(*chidfilebase,NULL); SVEXTERN int SVDECL(csv_loaded, 0), SVDECL(devices_setup,0),SVDECL(update_csv_load,0); SVEXTERN char SVDECL(*hrr_csv_filename,NULL),SVDECL(*devc_csv_filename,NULL),SVDECL(*exp_csv_filename,NULL); -SVEXTERN char SVDECL(*smokezippath,NULL),SVDECL(*smokeviewpath,NULL); +SVEXTERN char SVDECL(*smokezippath,NULL), SVDECL(*smokeviewpath,NULL), SVDECL(*fdsprog, NULL); SVEXTERN char SVDECL(*INI_fds_filein,NULL), SVDECL(*fds_filein,NULL); SVEXTERN char SVDECL(*caseini_filename,NULL); +#ifdef pp_FRAME +SVEXTERN char SVDECL(*frametest_filename, NULL); +#endif SVEXTERN char SVDECL(*fedsmv_filename, NULL); SVEXTERN char SVDECL(*expcsv_filename, NULL); SVEXTERN char SVDECL(*event_filename, NULL); diff --git a/Source/smokeview/startup.c b/Source/smokeview/startup.c index 205a395ae9..22da9505f5 100644 --- a/Source/smokeview/startup.c +++ b/Source/smokeview/startup.c @@ -261,7 +261,9 @@ int SetupCase(char *filename){ } // read casename.smo (only OBST lines) to define a one mesh version of OBST's +#ifndef pp_FDS ReadSMVOrig(); +#endif } if(return_code==0&&trainer_mode==1){ GLUIShowTrainer(); diff --git a/Source/smokeview/structures.h b/Source/smokeview/structures.h index ada2a34712..75b7314bee 100644 --- a/Source/smokeview/structures.h +++ b/Source/smokeview/structures.h @@ -26,6 +26,13 @@ typedef struct _sliceparmdata { } sliceparmdata; +/* -------------------------- langlistdata ------------------------------------ */ +#ifdef pp_SMOKEDRAW_SPEEDUP +typedef struct _smokethreaddata{ + int ithread, nthreads; +} smokethreaddata; +#endif + /* -------------------------- langlistdata ------------------------------------ */ typedef struct _lanlistdata { @@ -508,7 +515,7 @@ typedef struct _isodata { unsigned char *geom_times_map; float globalmin_iso, globalmax_iso; int geom_nvals; -#ifdef pp_FRAME +#ifdef pp_ISOFRAME framedata *frameinfo; #endif } isodata; @@ -839,7 +846,9 @@ typedef struct _partdata { float zoffset, *times; unsigned char *times_map; FILE_SIZE reg_file_size, file_size; +#ifndef pp_PARTFRAME LINT *filepos; +#endif char menulabel[128]; @@ -856,7 +865,7 @@ typedef struct _partdata { int *sort_tags; short *sx, *sy, *sz; unsigned char *irvals; -#ifdef pp_FRAME +#ifdef pp_PARTFRAME framedata *frameinfo; #endif } partdata; @@ -1052,7 +1061,7 @@ typedef struct _slicedata { FILE_SIZE file_size; int *geom_offsets; devicedata vals2d; -#ifdef pp_FRAME +#ifdef pp_SLICEFRAME framedata *frameinfo; #endif #ifdef pp_SLICE_MULTI @@ -1236,7 +1245,7 @@ typedef struct _smoke3ddata { float maxval; unsigned char *smokeframe_in, *smokeframe_out, **smokeframe_comp_list; unsigned char *smokeview_tmp; -#ifndef pp_FRAME +#ifndef pp_SMOKEFRAME unsigned char *smoke_comp_all; #endif unsigned char *frame_all_zeros; @@ -1244,7 +1253,7 @@ typedef struct _smoke3ddata { float *smoke_boxmin, *smoke_boxmax; smokedata smoke; int dir; -#ifdef pp_FRAME +#ifdef pp_SMOKEFRAME framedata *frameinfo; #endif } smoke3ddata; @@ -1310,6 +1319,9 @@ typedef struct _patchdata { int hist_update; bounddata bounds; boundsdata *bounds2; +#ifdef pp_BOUNDFRAME + framedata *frameinfo; +#endif } patchdata; /* -------------------------- plot3ddata ------------------------------------ */ diff --git a/Source/smokeview/update.c b/Source/smokeview/update.c index a0bba0bcc7..1584ed0f66 100644 --- a/Source/smokeview/update.c +++ b/Source/smokeview/update.c @@ -170,7 +170,7 @@ void UpdateFrameNumber(int changetime){ INIT_PRINT_TIMER(merge_smoke_time); #ifdef pp_SMOKEDRAW_SPEEDUP THREADcontrol(mergesmoke_threads, THREAD_LOCK); - THREADruni(mergesmoke_threads, merge_args); + THREADruni(mergesmoke_threads, (unsigned char *)smokethreadinfo, sizeof(smokethreaddata)); THREADcontrol(mergesmoke_threads, THREAD_JOIN); THREADcontrol(mergesmoke_threads, THREAD_UNLOCK); #else @@ -216,8 +216,11 @@ void UpdateFrameNumber(int changetime){ if(patchi->structured == NO||meshi->patch_times==NULL||meshi->patch_timeslist==NULL)continue; meshi->patch_itime=meshi->patch_timeslist[itimes]; if(patchi->compression_type==UNCOMPRESSED){ - meshi->cpatchval_iframe = meshi->cpatchval + meshi->patch_itime*meshi->npatchsize; - meshi->patchval_iframe = meshi->patchval+meshi->patch_itime*meshi->npatchsize; + +#ifndef pp_BOUNDFRAME + meshi->patchval_iframe = meshi->patchval + meshi->patch_itime*meshi->npatchsize; +#endif + meshi->cpatchval_iframe = meshi->cpatchval + meshi->patch_itime * meshi->npatchsize; } else{ UncompressBoundaryDataBNDF(meshi, meshi->patch_itime); @@ -1192,6 +1195,28 @@ void MergeGlobalTimes(float *time_in, int ntimes_in){ FREEMEMORY(times_map); } + /* ------------------ UpdateSliceNtimes ------------------------ */ + +#ifdef pp_SLICEFRAME +void UpdateSliceNtimes(void){ + int minslice_index = 1000000000, i; + for(i = 0;i < nsliceinfo;i++){ + slicedata *sd; + + sd = sliceinfo + i; + if(sd->loaded == 0 || sd->display == 0)continue; + minslice_index = MIN(minslice_index, sd->ntimes); + } + for(i = 0;i < nsliceinfo;i++){ + slicedata *sd; + + sd = sliceinfo + i; + if(sd->loaded == 0 || sd->display == 0)continue; + sd->ntimes = minslice_index; + } +} +#endif + /* ------------------ UpdateTimes ------------------------ */ void UpdateTimes(void){ @@ -1946,80 +1971,402 @@ void UpdateIsoIni(void){ } } +/* ------------------ Bytes2Label ------------------------ */ + +char *Bytes2Label(char *label, FILE_SIZE bytes){ + char vallabel[256]; + + if(bytes >= 0 && bytes < 1000){ + sprintf(label, "%iB", (int)bytes); + } + else if(bytes >= 1000 && bytes < 1000000){ + Float2String(vallabel, (float)bytes/1000.0, ncolorlabel_digits, force_fixedpoint); + sprintf(label, "%sKB", vallabel); + } + else if(bytes >= 1000000 && bytes < 1000000000){ + Float2String(vallabel, (float)bytes/1000000.0, ncolorlabel_digits, force_fixedpoint); + sprintf(label, "%sMB", vallabel); + } + else{ + Float2String(vallabel, (float)bytes/1000000000.0, ncolorlabel_digits, force_fixedpoint); + sprintf(label, "%sGB", vallabel); + } + return label; +} + +/* ------------------ OutputFrameSteps ------------------------ */ + +#ifdef pp_FRAME +void OutputFrameSteps(void){ + int i, count, frames_read, show; + float total_time, total_wrapup_time; + FILE_SIZE bytes_read; + char size_label[256], geom_slice_label[256], slice_label[256], part_label[256]; + char iso_label[256], smoke_label[256], bound_label[256], geom_bound_label[256]; + char time_label[256], time_label2[256], time_label3[256]; + + show = 0; + strcpy(geom_slice_label, ""); + strcpy(slice_label, ""); + strcpy(part_label, ""); + strcpy(iso_label, ""); + strcpy(smoke_label, ""); + strcpy(bound_label, ""); + strcpy(geom_bound_label, ""); + + //*** slice files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0;i < nsliceinfo;i++){ + slicedata *slicei; + framedata *frameinfo=NULL; + + slicei = sliceinfo + i; + if(slicei->loaded == 0)continue; + if(slicei->slice_filetype == SLICE_GEOM)continue; + frameinfo = slicei->frameinfo; + if(frameinfo == NULL || frameinfo->update == 0)continue; + count++; + frameinfo->update = 0; + frames_read = MAX(frames_read, frameinfo->frames_read); + bytes_read += frameinfo->bytes_read; + total_time += frameinfo->load_time; + total_wrapup_time += frameinfo->total_time; + } + if(count > 0){ + sprintf(slice_label, "slice(structured): loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(slice_label, time_label); + show = 1; + } + + //*** geometry slice files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0; i < nsliceinfo; i++){ + slicedata *slicei; + framedata *frameinfo = NULL; + + slicei = sliceinfo + i; + if(slicei->loaded == 0 || slicei->slice_filetype != SLICE_GEOM)continue; + frameinfo = slicei->frameinfo; + if(slicei->patchgeom != NULL)frameinfo = slicei->patchgeom->frameinfo; + if(frameinfo == NULL || frameinfo->update == 0)continue; + frameinfo->update = 0; + count++; + frames_read = MAX(frames_read, frameinfo->frames_read); + bytes_read += frameinfo->bytes_read; + total_time += frameinfo->load_time; + total_wrapup_time += frameinfo->total_time; + } + if(count > 0){ + sprintf(geom_slice_label, "slice(geom): loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(geom_slice_label, time_label); + show = 1; + } + + //*** 3d smoke files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0;i < nsmoke3dinfo;i++){ + smoke3ddata *smoke3di; + + smoke3di = smoke3dinfo + i; + if(smoke3di->loaded == 0 || smoke3di->frameinfo == NULL || smoke3di->frameinfo->update == 0)continue; + smoke3di->frameinfo->update = 0; + count++; + frames_read = MAX(frames_read, smoke3di->frameinfo->frames_read); + bytes_read += smoke3di->frameinfo->bytes_read; + total_time += smoke3di->frameinfo->load_time; + total_wrapup_time += smoke3di->frameinfo->total_time; + } + if(count > 0){ + sprintf(smoke_label, "3D smoke: loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(smoke_label, time_label); + show = 1; + } + + //*** boundary files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0;i < npatchinfo;i++){ + patchdata *patchi; + + patchi = patchinfo + i; + if(patchi->loaded == 0)continue; + if(patchi->patch_filetype !=PATCH_STRUCTURED_NODE_CENTER && patchi->patch_filetype != PATCH_STRUCTURED_CELL_CENTER)continue; + if(patchi->frameinfo == NULL || patchi->frameinfo->update == 0)continue; + + patchi->frameinfo->update = 0; + count++; + frames_read = MAX(frames_read, patchi->frameinfo->frames_read); + bytes_read += patchi->frameinfo->bytes_read; + total_time += patchi->frameinfo->load_time; + total_wrapup_time += patchi->frameinfo->total_time; + } + if(count > 0){ + sprintf(bound_label, "boundary(structured): loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(bound_label, time_label); + show = 1; + } + + //*** geometry boundary files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0;i < npatchinfo;i++){ + patchdata *patchi; + + patchi = patchinfo + i; + if(patchi->loaded == 0 || patchi->patch_filetype != PATCH_GEOMETRY_BOUNDARY)continue; + if(patchi->frameinfo == NULL || patchi->frameinfo->update == 0)continue; + patchi->frameinfo->update = 0; + count++; + frames_read = MAX(frames_read, patchi->frameinfo->frames_read); + bytes_read += patchi->frameinfo->bytes_read; + total_time += patchi->frameinfo->load_time; + total_wrapup_time += patchi->frameinfo->total_time; + } + if(count > 0){ + sprintf(geom_bound_label, "boundary(geom): loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(geom_bound_label, time_label); + show = 1; + } + + //*** isosurface files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0;i < nisoinfo;i++){ + isodata *isoi; + + isoi = isoinfo + i; + if(isoi->loaded == 0 || isoi->frameinfo == NULL || isoi->frameinfo->update == 0)continue; + isoi->frameinfo->update = 0; + count++; + frames_read = MAX(frames_read, isoi->frameinfo->frames_read); + bytes_read += isoi->frameinfo->bytes_read; + total_time += isoi->frameinfo->load_time; + total_wrapup_time += isoi->frameinfo->total_time; + } + if(count > 0){ + sprintf(iso_label, "isosurface: loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(iso_label, time_label); + show = 1; + } + + //*** particle files + + count = 0; + bytes_read = 0; + frames_read = 0; + total_time = 0.0; + total_wrapup_time = 0.0; + for(i = 0;i < npartinfo;i++){ + partdata *parti; + + parti = partinfo + i; + if(parti->loaded == 0 || parti->frameinfo == NULL || parti->frameinfo->update == 0)continue; + parti->frameinfo->update = 0; + count++; + frames_read = MAX(frames_read, parti->frameinfo->frames_read); + bytes_read += parti->frameinfo->bytes_read; + total_time += parti->frameinfo->load_time; + total_wrapup_time += parti->frameinfo->total_time; + } + if(count > 0){ + sprintf(part_label, "particle: loaded %i frames, %i files, %s", frames_read, count, Bytes2Label(size_label, bytes_read)); + strcpy(time_label, ""); + Float2String(time_label2, total_time, ncolorlabel_digits, force_fixedpoint); + Float2String(time_label3, total_wrapup_time, ncolorlabel_digits, force_fixedpoint); + sprintf(time_label, " in %ss/%ss", time_label2, time_label3); + strcat(part_label, time_label); + show = 1; + } + if(show == 1){ + if(strlen(geom_bound_label) > 0)printf("%s\n", geom_bound_label); + if(strlen(bound_label) > 0)printf("%s\n", bound_label); + if(strlen(iso_label) > 0)printf("%s\n", iso_label); + if(strlen(part_label) > 0)printf("%s\n", part_label); + if(strlen(geom_slice_label) > 0)printf("%s\n", geom_slice_label); + if(strlen(slice_label) > 0)printf("%s\n", slice_label); + if(strlen(smoke_label) > 0)printf("%s\n", smoke_label); + } +} +#endif +#ifdef pp_SHOW_UPDATE +#define SHOW_UPDATE(var) printf("updating: %s\n", #var);INIT_PRINT_TIMER(update_timer); +#define END_SHOW_UPDATE(var) PRINT_TIMER(update_timer,#var) +#else +#define SHOW_UPDATE(var) +#define END_SHOW_UPDATE(var) +#endif + /* ------------------ UpdateShowScene ------------------------ */ void UpdateShowScene(void){ +#ifdef pp_SHOW_UPDATE + int updating = 0; +#endif + have_fire = HaveFireLoaded(); have_smoke = HaveSootLoaded(); - +#ifdef pp_FRAME + if(update_frame == 1){ + SHOW_UPDATE(update_frame); + update_frame = 0; + OutputFrameSteps(); + UpdateSliceNtimes(); + update_times = 1; + END_SHOW_UPDATE(update_frame); + } +#endif #ifdef pp_SMOKE_SPEEDUP if(update_smoke3dmenulabels == 1){ + SHOW_UPDATE(update_smoke3dmenulabels); update_smoke3dmenulabels = 0; UpdateSmoke3dMenuLabels(); + END_SHOW_UPDATE(update_smoke3dmenulabels); } - if(update_merge_smoke == 1){ - update_merge_smoke = 0; + if(update_glui_merge_smoke == 1){ + SHOW_UPDATE(update_glui_merge_smoke); + update_glui_merge_smoke = 0; GLUISmoke3dCB(MERGE_SMOKE); + END_SHOW_UPDATE(update_glui_merge_smoke); } #endif if(glui_meshclip_defined==1&&update_meshclip == 1){ + SHOW_UPDATE(update_meshclip); update_meshclip = 0; GLUIUpdateMeshBounds(); + END_SHOW_UPDATE(update_meshclip); } if(update_csv_load == 1){ + SHOW_UPDATE(update_csv_load); InitializeDeviceCsvData(LOAD); update_csv_load = 0; + END_SHOW_UPDATE(update_csv_load); } if(update_terrain_type == 1){ + SHOW_UPDATE(update_terrain_type); update_terrain_type = 0; GLUIUpdateTerrain(); + END_SHOW_UPDATE(update_terrain_type); } if(update_iso_ini == 1){ + SHOW_UPDATE(update_iso_ini); UpdateIsoIni(); update_iso_ini = 0; + END_SHOW_UPDATE(update_iso_ini); } if(check_colorbar == 1){ + SHOW_UPDATE(check_colorbar); CheckLab(); check_colorbar++; + END_SHOW_UPDATE(check_colorbar); } if(update_colorbar_orig == 1){ + SHOW_UPDATE(update_colorbar_orig); UpdateColorbarOrig(); update_colorbar_orig = 0; + END_SHOW_UPDATE(update_colorbar_orig); } if(update_loadall_textures == 1){ + SHOW_UPDATE(update_loadall_textures); update_loadall_textures = 0; TextureShowMenu(MENU_TEXTURE_SHOWALL2); + END_SHOW_UPDATE(update_loadall_textures); } if(update_plot2dini == 1){ + SHOW_UPDATE(update_plot2dini); update_plot2dini = 0; GLUIUpdatePlot2DINI(); + END_SHOW_UPDATE(update_plot2dini); } if(update_device_timeaverage == 1){ + SHOW_UPDATE(update_device_timeaverage); update_device_timeaverage = 0; GLUIDeviceCB(DEVICE_TIMEAVERAGE); + END_SHOW_UPDATE(update_device_timeaverage); } if(update_smoke_alphas==1){ + SHOW_UPDATE(update_smoke_alphas); update_smoke_alphas = 0; UpdateSmokeAlphas(); + END_SHOW_UPDATE(update_smoke_alphas); } if(update_slice2device==1){ + SHOW_UPDATE(update_slice2device); update_slice2device = 0; Slice2Device(); update_slicexyz = 1; + END_SHOW_UPDATE(update_slice2device); } if(update_slicexyz==1){ + SHOW_UPDATE(update_slicexyz); update_slicexyz = 0; GLUIUpdateSliceXYZ(); + END_SHOW_UPDATE(update_slicexyz); } if(update_vectorskip == 1){ + SHOW_UPDATE(update_vectorskip); update_vectorskip = 0; UpdateVectorSkip(vectorskip); + END_SHOW_UPDATE(update_vectorskip); } if(update_plot_label == 1){ + SHOW_UPDATE(update_plot_label); update_plot_label = 0; GLUIUpdatePlotLabel(); + END_SHOW_UPDATE(update_plot_label); } if(open_movie_dialog==1){ + SHOW_UPDATE(open_movie_dialog); open_movie_dialog = 0; if(have_slurm==1&&nmovie_queues>0){ GLUIShowMotion(DIALOG_MOVIE_BATCH); @@ -2027,141 +2374,219 @@ void UpdateShowScene(void){ else{ GLUIShowMotion(DIALOG_MOVIE); } + END_SHOW_UPDATE(open_movie_dialog); } if(terrain_update_normals==1&&ngeominfo>0){ + SHOW_UPDATE(terrain_update_normals); terrain_update_normals = 0; UpdateAllGeomTriangles(); if(auto_terrain==1){ GenerateTerrainGeom(&terrain_vertices, &terrain_indices, &terrain_nindices); } + END_SHOW_UPDATE(terrain_update_normals); } if(update_smokefire_colors==1){ + SHOW_UPDATE(update_smokefire_colors); update_smokefire_colors = 0; GLUISmoke3dCB(UPDATE_SMOKEFIRE_COLORS); GLUISmoke3dCB(UPDATE_SMOKEFIRE_COLORS2); GLUISmoke3dCB(USE_OPACITY_DEPTH); + END_SHOW_UPDATE(update_smokefire_colors); } if(update_splitcolorbar==1){ + SHOW_UPDATE(update_splitcolorbar); GLUISplitCB(SPLIT_COLORBAR); update_splitcolorbar = 0; + END_SHOW_UPDATE(update_splitcolorbar); } if(update_stept==1){ + SHOW_UPDATE(update_stept); update_stept = 0; SetTimeVal(time_paused); + END_SHOW_UPDATE(update_stept); } if(update_movie_parms==1){ + SHOW_UPDATE(update_movie_parms); update_movie_parms = 0; GLUIUpdateMovieParms(); + END_SHOW_UPDATE(update_movie_parms); } #ifdef pp_REFRESH if(update_refresh==1){ + SHOW_UPDATE(update_refresh); update_refresh = 0; PeriodicRefresh(refresh_interval); + END_SHOW_UPDATE(update_refresh); } #endif if(update_glui_devices==1){ + SHOW_UPDATE(update_glui_devices); update_glui_devices = 0; GLUIUpdateDevices(); + END_SHOW_UPDATE(update_glui_devices); } if(update_times==1){ + SHOW_UPDATE(update_times); update_times = 0; UpdateTimes(); + END_SHOW_UPDATE(update_times); } if(update_device==1){ + SHOW_UPDATE(update_device); update_device = 0; if(HaveSmokeSensor()==1){ use_lighting = 0; update_use_lighting = 1; } + END_SHOW_UPDATE(update_device); } if(update_use_lighting==1){ + SHOW_UPDATE(update_use_lighting); ColorbarMenu(USE_LIGHTING); update_use_lighting = 0; + END_SHOW_UPDATE(update_use_lighting); } if(update_playmovie==1){ + SHOW_UPDATE(update_playmovie); EnableDisablePlayMovie(); update_playmovie = 0; + END_SHOW_UPDATE(update_playmovie); } UpdateRenderStartButton(); - if(update_makemovie == 1||output_ffmpeg_command==1)MakeMovie(); + if(update_makemovie == 1||output_ffmpeg_command==1){ + SHOW_UPDATE(update_makemovie); + MakeMovie(); + update_makemovie = 0; + END_SHOW_UPDATE(update_makemovie); + } if(restart_time == 1){ + SHOW_UPDATE(restart_time); restart_time = 0; ResetItimes0(); + END_SHOW_UPDATE(restart_time); } if(loadfiles_at_startup==1&&update_load_files == 1){ + SHOW_UPDATE(update_load_files); LoadFiles(); + END_SHOW_UPDATE(update_load_files); } if(update_startup_view>0){ + SHOW_UPDATE(update_startup_view); GLUISetCurrentViewPoint(viewpoint_label_startup); update_rotation_center = 0; update_rotation_center_ini = 0; update_startup_view--; + END_SHOW_UPDATE(update_startup_view); } if(update_saving_viewpoint>0){ + SHOW_UPDATE(update_saving_viewpoint); GLUISetCurrentViewPoint(viewpoint_label_saved); update_saving_viewpoint--; + END_SHOW_UPDATE(update_saving_viewpoint); } if(update_viewpoint_script>0){ + SHOW_UPDATE(update_viewpoint_script); GLUISetCurrentViewPoint(viewpoint_script); update_viewpoint_script--; + END_SHOW_UPDATE(update_viewpoint_script); } if(update_tour_list == 1){ + SHOW_UPDATE(update_tour_list); GLUIUpdateTourList(); + END_SHOW_UPDATE(update_tour_list); } if(update_gslice == 1){ + SHOW_UPDATE(update_gslice); GLUIUpdateGsliceParms(); + END_SHOW_UPDATE(update_gslice); } if(update_rotation_center == 1){ + SHOW_UPDATE(update_rotation_center); camera_current->rotation_index = glui_rotation_index; GLUISceneMotionCB(ROTATE_ABOUT); update_rotation_center = 0; + END_SHOW_UPDATE(update_rotation_center); } if(update_rotation_center_ini == 1){ + SHOW_UPDATE(update_rotation_center_ini); camera_current->rotation_index = glui_rotation_index_ini; GLUISceneMotionCB(ROTATE_ABOUT); update_rotation_center_ini = 0; + END_SHOW_UPDATE(update_rotation_center_ini); } if(camera_current->dirty == 1){ + SHOW_UPDATE(camera_current->dirty); UpdateCamera(camera_current); + END_SHOW_UPDATE(camera_current->dirty); } if(updateclipvals == 1){ + SHOW_UPDATE(updateclipvals); Clip2Cam(camera_current); GLUIUpdateClipAll(); updateclipvals = 0; + END_SHOW_UPDATE(updateclipvals); } if(update_selectedtour_index == 1){ + SHOW_UPDATE(update_selectedtour_index); GLUIUpdateTourIndex(); + END_SHOW_UPDATE(update_selectedtour_index); + } + if(trainer_mode == 1 && fontindex != LARGE_FONT){ + SHOW_UPDATE(trainer_mode); + FontMenu(LARGE_FONT); + END_SHOW_UPDATE(trainer_mode); } - if(trainer_mode == 1 && fontindex != LARGE_FONT)FontMenu(LARGE_FONT); if(updateindexcolors == 1){ + SHOW_UPDATE(updateindexcolors); UpdateIndexColors(); + END_SHOW_UPDATE(updateindexcolors); } if(force_isometric == 1){ + SHOW_UPDATE(force_isometric); force_isometric = 0; projection_type = PROJECTION_ORTHOGRAPHIC; camera_current->projection_type = projection_type; ZoomMenu(UPDATE_PROJECTION); + END_SHOW_UPDATE(force_isometric); } if(convert_ini == 1){ + SHOW_UPDATE(convert_ini); WriteIni(SCRIPT_INI, ini_to); SMV_EXIT(0); + END_SHOW_UPDATE(convert_ini); } if(convert_ssf==1||update_ssf==1){ + SHOW_UPDATE(update_ssf); ConvertSsf(); SMV_EXIT(0); + END_SHOW_UPDATE(update_ssf); } UpdateShow(); - if(global_times!=NULL&&updateUpdateFrameRateMenu==1)FrameRateMenu(frameratevalue); + if(global_times!=NULL&&updateUpdateFrameRateMenu==1){ + SHOW_UPDATE(updateUpdateFrameRateMenu); + FrameRateMenu(frameratevalue); + END_SHOW_UPDATE(updateUpdateFrameRateMenu); + } if(updatefaces == 1){ + SHOW_UPDATE(updatefaces); INIT_PRINT_TIMER(timer_update_faces); UpdateFaces(); PRINT_TIMER(timer_update_faces, "UpdateFaces"); + END_SHOW_UPDATE(updatefaces); } if(updatefacelists == 1){ + SHOW_UPDATE(updatefacelists); INIT_PRINT_TIMER(timer_update_facelists); UpdateFaceLists(); PRINT_TIMER(timer_update_facelists, "UpdateFaceLists"); + END_SHOW_UPDATE(updatefacelists); } +#ifdef pp_SHOW_UPDATE + if(updating==1){ + printf("update complete\n\n"); + } +#endif + } /* ------------------ UpdateFlippedColorbar ------------------------ */ @@ -2306,7 +2731,7 @@ void OutputBounds(void){ valmax_smv = MAX(slicei->valmax_slice, valmax_smv); } } - OutputMinMax("global", label, unit, valmin_fds, valmax_fds, valmin_smv, valmax_smv); + OutputMinMax("slice min/max", label, unit, valmin_fds, valmax_fds, valmin_smv, valmax_smv); } // boundary file bounds @@ -2339,7 +2764,7 @@ void OutputBounds(void){ valmax_patch = MAX(patchi->valmax_patch, valmax_patch); } } - OutputMinMax("global", label, unit, valmin_patch, valmax_patch, valmin_patch, valmax_patch); + OutputMinMax("boundary min/max", label, unit, valmin_patch, valmax_patch, valmin_patch, valmax_patch); } // particle file bounds @@ -2394,7 +2819,7 @@ void OutputBounds(void){ valmax_part = MAX(parti->valmax_part[j], valmax_part); } } - OutputMinMax("global", label, unit, valmin_part, valmax_part, valmin_part, valmax_part); + OutputMinMax("particle min/max:", label, unit, valmin_part, valmax_part, valmin_part, valmax_part); } } @@ -2458,7 +2883,7 @@ void OutputBounds(void){ valmax_smv = MAX(plot3di->valmax_plot3d[j], valmax_smv); } } - OutputMinMax("global", label, unit, valmin_fds, valmax_fds, valmin_smv, valmax_smv); + OutputMinMax("PLOT3D min/max", label, unit, valmin_fds, valmax_fds, valmin_smv, valmax_smv); } } printf("\n"); diff --git a/Verification/Visualization/sphere_propanes.fds b/Verification/Visualization/sphere_propanes.fds new file mode 100644 index 0000000000..2df34099d5 --- /dev/null +++ b/Verification/Visualization/sphere_propanes.fds @@ -0,0 +1,44 @@ +&HEAD CHID='sphere_propanes', TITLE='Complex Geometry: Test propane burning around sphere.' / + +MESH IJK=32,16,16, XB=-2.0,2.0,-2.0,0.0,0.0,2.0, MULT_ID='mesh' / +MULT ID='mesh', DY=2, DZ=2, J_UPPER=1, K_UPPER=2 / +&MESH IJK=32,32,48, XB=-2.0,2.0,-2.0,2.0,0.0,6.0 / + +&TIME T_END=5.0 / +&MISC STRATIFICATION=.FALSE. / +&PRES SOLVER='UGLMAT' / +&RADI RADIATION=.FALSE. / + +# Vents: +&VENT MB='YMIN', SURF_ID='OPEN' / +&VENT MB='YMAX', SURF_ID='OPEN' / +&VENT MB='XMIN', SURF_ID='OPEN' / +&VENT MB='XMAX', SURF_ID='OPEN' / +&VENT MB='ZMAX', SURF_ID='OPEN' / + +# Species: +&REAC FUEL='PROPANE', SOOT_YIELD=0.02 / + +&SURF ID='BURNER', HRRPUA=3200., COLOR='RED' / +&SURF ID='SPHERE', COLOR='GREEN', MATL_ID='SPHERE', THICKNESS=0.1, BACKING='VOID' / +&MATL ID='SPHERE', DENSITY=100, CONDUCTIVITY=1, SPECIFIC_HEAT=1 / + +# Export Parameters: +# ------ ---------- +&SLCF PBX=0, QUANTITY='TEMPERATURE', SLICETYPE='INCLUDE_GEOM' / +&SLCF PBX=0, QUANTITY='TEMPERATURE' / + +&SLCF PBY=0, QUANTITY='VELOCITY', VECTOR=.TRUE. / +&SLCF PBY=0, QUANTITY='DENSITY', CELL_CENTERED=.TRUE. / +&SLCF PBY=0, QUANTITY='MASS FRACTION', SPEC_ID='PROPANE' / +&SLCF PBY=0, QUANTITY='TEMPERATURE' / +&SLCF PBY=0, QUANTITY='HRRPUV' / + +# Boundary colormap in &GEOM surface: +&BNDF QUANTITY='WALL TEMPERATURE' / + +# Geometries: +&OBST XB=-.5,.5,-.5,.5,0.2,.4, SURF_IDS='BURNER','INERT','INERT' / +&GEOM ID='SPHERE', SURF_ID='SPHERE', SPHERE_ORIGIN=0.,0.,2., SPHERE_RADIUS=1., N_LEVELS=3 / + +&TAIL / diff --git a/vistest/Voltest/m128plume64.fds b/vistest/Voltest/m128plume64.fds new file mode 100644 index 0000000000..cf443fe898 --- /dev/null +++ b/vistest/Voltest/m128plume64.fds @@ -0,0 +1,131 @@ +&HEAD CHID='m128plume64',TITLE='Plume whirl case' / + + same as plume5a except there is a blockage in the middle of the scene to block the flow + The purpose of this case is to demonstrate the curved flow (via streak lines) that results. + +&MULT ID='mesh array', DX=0.4,DY=0.4,DZ=0.4, I_UPPER=3,J_UPPER=3,K_UPPER=7 / +&MESH IJK=64,64,64, XB=0.0,0.4,0.0,0.4,0.0,0.4, MULT_ID='mesh array' / + +&MISC IBLANK_SMV=.TRUE. / + +&DUMP NFRAMES=300 DT_PL3D=2.0, DT_SL3D=0.03333 / + +&TIME T_END=10. / Total simulation time + +&MATL ID = 'FABRIC' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.1 + DENSITY = 100.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 3000. + HEAT_OF_COMBUSTION = 15000. / + +&MATL ID = 'FOAM' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.05 + DENSITY = 40.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 1500. + HEAT_OF_COMBUSTION = 30000. / + +&SURF ID = 'UPHOLSTERY_LOWER' + FYI = 'Properties completely fabricated' + RGB = 151,96,88 + BURN_AWAY = .FALSE. + MATL_ID(1:2,1) = 'FABRIC','FOAM' + THICKNESS(1:2) = 0.002,0.1 +/ + +&REAC SOOT_YIELD=0.02,FUEL='PROPANE'/ +&SURF ID='BURNER',HRRPUA=600.0,PART_ID='tracers' / Ignition source + +&OBST XB=0.5,1.1,0.5,1.1,0.0,0.1,SURF_ID='UPHOLSTERY_LOWER' / fire source on kitchen stove +&VENT XB=0.5,1.1,0.5,1.1,0.1,0.1,SURF_ID='BURNER' / fire source on kitchen stove + +&VENT XB=0.0,1.6,0.0,0.0,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=1.6,1.6,0.0,1.6,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=0.0,1.6,1.6,1.6,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=0.0,0.0,0.0,1.6,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=0.0,1.6,0.0,1.6,3.2,3.2,SURF_ID='OPEN'/ + +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=100.0 / Show 3D contours of temperature at 100 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=200.0 / Show 3D contours of temperature at 200 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=620.0 / Show 3D contours of temperature at 620 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1:2)=200.0,400.0 / Show 3D contours of temperature at 200 C + +&PART ID='tracers',MASSLESS=.TRUE., + QUANTITIES(1:3)='PARTICLE U','PARTICLE V','PARTICLE W' + SAMPLING_FACTOR=10 / Description of massless tracer particles. Apply at a + solid surface with the PART_ID='tracers' + + X slices + +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / Add vector slices colored by temperature +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + Y slices + +&SLCF PBY=0.801,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='PROPANE' / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='OXYGEN' / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON DIOXIDE' / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON MONOXIDE' / +&SLCF PBY=0.801,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + +&SLCF PBY=1.6,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON DIOXIDE' / +&SLCF PBY=1.6,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON MONOXIDE' / +&SLCF PBY=1.6,QUANTITY='VOLUME FRACTION' SPEC_ID='OXYGEN' / + + Z slices + +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=1.6,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=1.6,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=3.2,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=3.2,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + 3d slices + +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='TEMPERATURE' ,VECTOR=.TRUE. / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='HRRPUV' / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON DIOXIDE' / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON MONOXIDE' / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='VOLUME FRACTION' SPEC_ID='OXYGEN' / + +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2, QUANTITY='TEMPERATURE' / 3D slice +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2, QUANTITY='DENSITY',SPEC_ID='SOOT' / 3D slice + +&BNDF QUANTITY='GAUGE HEAT FLUX' / Common surface quantities. Good for monitoring fire spread. +&BNDF QUANTITY='BURNING RATE' / +&BNDF QUANTITY='WALL TEMPERATURE' / +&BNDF QUANTITY='WALL TEMPERATURE' CELL_CENTERED=.TRUE. / + +&DEVC XYZ=1.2,0.8,0.0 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.0 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.0 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.6 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.6 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.6 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.2 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.2 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.2 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.8 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.8 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.8 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,2.4 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,2.4 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,2.4 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,3.0 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,3.0 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,3.0 QUANTITY='W-VELOCITY' / + +&TAIL / diff --git a/vistest/Voltest/m512plume32.fds b/vistest/Voltest/m512plume32.fds new file mode 100644 index 0000000000..29b73666ab --- /dev/null +++ b/vistest/Voltest/m512plume32.fds @@ -0,0 +1,131 @@ +&HEAD CHID='m512plume32',TITLE='Plume whirl case' / + + same as plume5a except there is a blockage in the middle of the scene to block the flow + The purpose of this case is to demonstrate the curved flow (via streak lines) that results. + +&MULT ID='mesh array', DX=0.2,DY=0.2,DZ=0.4, I_UPPER=7,J_UPPER=7,K_UPPER=7 / +&MESH IJK=32,32,64, XB=0.0,0.2,0.0,0.2,0.0,0.4, MULT_ID='mesh array' / + +&MISC IBLANK_SMV=.TRUE. / + +&DUMP NFRAMES=300 DT_PL3D=2.0, DT_SL3D=0.03333 / + +&TIME T_END=10. / Total simulation time + +&MATL ID = 'FABRIC' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.1 + DENSITY = 100.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 3000. + HEAT_OF_COMBUSTION = 15000. / + +&MATL ID = 'FOAM' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.05 + DENSITY = 40.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 1500. + HEAT_OF_COMBUSTION = 30000. / + +&SURF ID = 'UPHOLSTERY_LOWER' + FYI = 'Properties completely fabricated' + RGB = 151,96,88 + BURN_AWAY = .FALSE. + MATL_ID(1:2,1) = 'FABRIC','FOAM' + THICKNESS(1:2) = 0.002,0.1 +/ + +&REAC SOOT_YIELD=0.02,FUEL='PROPANE'/ +&SURF ID='BURNER',HRRPUA=600.0,PART_ID='tracers' / Ignition source + +&OBST XB=0.5,1.1,0.5,1.1,0.0,0.1,SURF_ID='UPHOLSTERY_LOWER' / fire source on kitchen stove +&VENT XB=0.5,1.1,0.5,1.1,0.1,0.1,SURF_ID='BURNER' / fire source on kitchen stove + +&VENT XB=0.0,1.6,0.0,0.0,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=1.6,1.6,0.0,1.6,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=0.0,1.6,1.6,1.6,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=0.0,0.0,0.0,1.6,0.0,3.2,SURF_ID='OPEN'/ +&VENT XB=0.0,1.6,0.0,1.6,3.2,3.2,SURF_ID='OPEN'/ + +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=100.0 / Show 3D contours of temperature at 100 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=200.0 / Show 3D contours of temperature at 200 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=620.0 / Show 3D contours of temperature at 620 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1:2)=200.0,400.0 / Show 3D contours of temperature at 200 C + +&PART ID='tracers',MASSLESS=.TRUE., + QUANTITIES(1:3)='PARTICLE U','PARTICLE V','PARTICLE W' + SAMPLING_FACTOR=10 / Description of massless tracer particles. Apply at a + solid surface with the PART_ID='tracers' + + X slices + +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / Add vector slices colored by temperature +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + Y slices + +&SLCF PBY=0.801,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='PROPANE' / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='OXYGEN' / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON DIOXIDE' / +&SLCF PBY=0.801,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON MONOXIDE' / +&SLCF PBY=0.801,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + +&SLCF PBY=1.6,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON DIOXIDE' / +&SLCF PBY=1.6,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON MONOXIDE' / +&SLCF PBY=1.6,QUANTITY='VOLUME FRACTION' SPEC_ID='OXYGEN' / + + Z slices + +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=1.6,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=1.6,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=3.2,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=3.2,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + 3d slices + +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='TEMPERATURE' ,VECTOR=.TRUE. / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='HRRPUV' / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON DIOXIDE' / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='VOLUME FRACTION' SPEC_ID='CARBON MONOXIDE' / +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2,QUANTITY='VOLUME FRACTION' SPEC_ID='OXYGEN' / + +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2, QUANTITY='TEMPERATURE' / 3D slice +&SLCF XB=0.0,1.6,0.0,1.6,0.0,3.2, QUANTITY='DENSITY',SPEC_ID='SOOT' / 3D slice + +&BNDF QUANTITY='GAUGE HEAT FLUX' / Common surface quantities. Good for monitoring fire spread. +&BNDF QUANTITY='BURNING RATE' / +&BNDF QUANTITY='WALL TEMPERATURE' / +&BNDF QUANTITY='WALL TEMPERATURE' CELL_CENTERED=.TRUE. / + +&DEVC XYZ=1.2,0.8,0.0 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.0 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.0 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.6 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.6 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,0.6 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.2 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.2 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.2 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.8 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.8 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,1.8 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,2.4 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,2.4 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,2.4 QUANTITY='W-VELOCITY' / +&DEVC XYZ=1.2,0.8,3.0 QUANTITY='U-VELOCITY' / +&DEVC XYZ=1.2,0.8,3.0 QUANTITY='V-VELOCITY' / +&DEVC XYZ=1.2,0.8,3.0 QUANTITY='W-VELOCITY' / + +&TAIL / diff --git a/vistest/large/.gitignore b/vistest/large/.gitignore new file mode 100644 index 0000000000..4d6a3b44f4 --- /dev/null +++ b/vistest/large/.gitignore @@ -0,0 +1 @@ +ECHO is on. diff --git a/vistest/large/plume064/plume064.fds b/vistest/large/plume064/plume064.fds new file mode 100644 index 0000000000..b6c491cc9d --- /dev/null +++ b/vistest/large/plume064/plume064.fds @@ -0,0 +1,95 @@ +&HEAD CHID='plume064',TITLE='Plume whirl case' / + + same as plume5a except there is a blockage in the middle of the scene to block the flow + The purpose of this case is to demonstrate the curved flow (via streak lines) that results. + +&MESH IJK=16,16,16, XB=0.0,0.4,0.0,0.4,0.0,0.4, MULT_ID='mesh'/ +&MULT ID='mesh', DX=0.4, DY=0.4, DZ=0.4, I_UPPER=3, J_UPPER=3, K_UPPER=3 / + + +&DUMP NFRAMES=400 DT_PL3D=8.0, DT_SL3D=0.1 / + +&TIME T_END=1. / Total simulation time + +&MATL ID = 'FABRIC' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.1 + DENSITY = 100.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 3000. + HEAT_OF_COMBUSTION = 15000. / + +&MATL ID = 'FOAM' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.05 + DENSITY = 40.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 1500. + HEAT_OF_COMBUSTION = 30000. / + +&SURF ID = 'UPHOLSTERY' + FYI = 'Properties completely fabricated' + RGB = 151,96,88 + BURN_AWAY = .FALSE. + TMP_FRONT = 600.0 +/ +&REAC SOOT_YIELD=0.01,FUEL='PROPANE'/ +&SURF ID='BURNER',HRRPUA=600.0,PART_ID='tracers' / Ignition source + +&VENT XB=0.5,1.1,0.5,1.1,0.1,0.1,SURF_ID='BURNER' / fire source on kitchen stove +&OBST XB=0.5,1.1,0.5,1.1,0.0,0.1 / + +&OBST XB=0.5,1.1,0.5,1.1,0.6,1.0, SURF_ID='UPHOLSTERY' / +&HOLE XB=0.7,0.9,0.7,0.9,0.4,1.2 / + +&VENT MB='XMIN', SURF_ID='OPEN' / +&VENT MB='XMAX', SURF_ID='OPEN' / +&VENT MB='YMIN', SURF_ID='OPEN' / +&VENT MB='YMAX', SURF_ID='OPEN' / +&VENT MB='ZMAX', SURF_ID='OPEN' / + +&PART ID='tracers',MASSLESS=.TRUE., + QUANTITIES(1:3)='PARTICLE U','PARTICLE V','PARTICLE W' + SAMPLING_FACTOR=10 / Description of massless tracer particles. Apply at a + solid surface with the PART_ID='tracers' + + X slices + +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / Add vector slices colored by temperature +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + Y slices + +&SLCF PBY=0.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBY=0.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + Z slices + +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=1.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=1.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=1.2,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=1.2,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + boundary files + +&BNDF QUANTITY='WALL TEMPERATURE' / +&BNDF QUANTITY='WALL TEMPERATURE' CELL_CENTERED=.TRUE. / + + isosurface + +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=100.0 / Show 3D contours of temperature at 100 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=200.0 / Show 3D contours of temperature at 200 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=620.0 / Show 3D contours of temperature at 620 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1:2)=200.0,400.0 / Show 3D contours of temperature at 200 C + +&TAIL / diff --git a/vistest/large/plume512/plume512.fds b/vistest/large/plume512/plume512.fds new file mode 100644 index 0000000000..8bf41cc352 --- /dev/null +++ b/vistest/large/plume512/plume512.fds @@ -0,0 +1,103 @@ +&HEAD CHID='plume512',TITLE='Plume whirl case' / + + same as plume5a except there is a blockage in the middle of the scene to block the flow + The purpose of this case is to demonstrate the curved flow (via streak lines) that results. + +&MESH IJK=32,32,32, XB=0.0,0.2,0.0,0.2,0.0,0.2, MULT_ID='mesh'/ +&MULT ID='mesh', DX=0.2, DY=0.2, DZ=0.2, I_UPPER=7, J_UPPER=7, K_UPPER=7 / + + +&DUMP NFRAMES=4000 DT_PL3D=8.0, DT_SL3D=0.1 / + +&TIME T_END=10. / Total simulation time + +&MATL ID = 'FABRIC' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.1 + DENSITY = 100.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 3000. + HEAT_OF_COMBUSTION = 15000. / + +&MATL ID = 'FOAM' + FYI = 'Properties completely fabricated' + SPECIFIC_HEAT = 1.0 + CONDUCTIVITY = 0.05 + DENSITY = 40.0 + N_REACTIONS = 1 + NU_SPEC = 1. + SPEC_ID = 'PROPANE' + REFERENCE_TEMPERATURE = 350. + HEAT_OF_REACTION = 1500. + HEAT_OF_COMBUSTION = 30000. / + +&SURF ID = 'UPHOLSTERY_LOWER' + FYI = 'Properties completely fabricated' + RGB = 151,96,88 + BURN_AWAY = .FALSE. + MATL_ID(1:2,1) = 'FABRIC','FOAM' + THICKNESS(1:2) = 0.002,0.1 +/ + +&SURF ID = 'UPHOLSTERY' + FYI = 'Properties completely fabricated' + RGB = 151,96,88 + BURN_AWAY = .FALSE. + TMP_FRONT = 600.0 +/ +&REAC SOOT_YIELD=0.01,FUEL='PROPANE'/ +&SURF ID='BURNER',HRRPUA=600.0,PART_ID='tracers' / Ignition source + +&VENT XB=0.5,1.1,0.5,1.1,0.1,0.1,SURF_ID='BURNER' / fire source on kitchen stove +&OBST XB=0.5,1.1,0.5,1.1,0.0,0.1 / + +&OBST XB=0.5,1.1,0.5,1.1,0.6,1.0, SURF_ID='UPHOLSTERY' / +&HOLE XB=0.7,0.9,0.7,0.9,0.4,1.2 / + +&VENT MB='XMIN', SURF_ID='OPEN' / +&VENT MB='XMAX', SURF_ID='OPEN' / +&VENT MB='YMIN', SURF_ID='OPEN' / +&VENT MB='YMAX', SURF_ID='OPEN' / +&VENT MB='ZMAX', SURF_ID='OPEN' / + +&PART ID='tracers',MASSLESS=.TRUE., + QUANTITIES(1:3)='PARTICLE U','PARTICLE V','PARTICLE W' + SAMPLING_FACTOR=10 / Description of massless tracer particles. Apply at a + solid surface with the PART_ID='tracers' + + X slices + +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / Add vector slices colored by temperature +&SLCF PBX=0.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + Y slices + +&SLCF PBY=0.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBY=0.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + Z slices + +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=0.4,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=1.8,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=1.8,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / +&SLCF PBZ=1.2,QUANTITY='TEMPERATURE',VECTOR=.TRUE. / +&SLCF PBZ=1.2,QUANTITY='TEMPERATURE',CELL_CENTERED=.TRUE. / + + boundary files + +&BNDF QUANTITY='WALL TEMPERATURE' / +&BNDF QUANTITY='WALL TEMPERATURE' CELL_CENTERED=.TRUE. / + + isosurface + +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=100.0 / Show 3D contours of temperature at 100 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=200.0 / Show 3D contours of temperature at 200 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1)=620.0 / Show 3D contours of temperature at 620 C +&ISOF QUANTITY='TEMPERATURE',VALUE(1:2)=200.0,400.0 / Show 3D contours of temperature at 200 C + +&TAIL / diff --git a/vistest/timings/cases/plume_timing.fds b/vistest/timings/cases/plume_timing.fds index ff87a667e8..91769b8549 100644 --- a/vistest/timings/cases/plume_timing.fds +++ b/vistest/timings/cases/plume_timing.fds @@ -69,7 +69,7 @@ &ISOF QUANTITY='TEMPERATURE',VALUE(1)=620.0 / Show 3D contours of temperature at 620 C &PART ID='tracers',MASSLESS=.TRUE., - QUANTITIES(1:4)='U-VELOCITY','V-VELOCITY','W-VELOCITY' + QUANTITIES(1:4)='PARTICLE U','PARTICLE V','PARTICLE W' SAMPLING_FACTOR=10 / Description of massless tracer particles. Apply at a solid surface with the PART_ID='tracers'