Skip to content

Commit

Permalink
smokeview source: remove pp_FDS directive
Browse files Browse the repository at this point in the history
  • Loading branch information
gforney committed Nov 12, 2024
1 parent da38f2b commit 3a846c9
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 207 deletions.
3 changes: 0 additions & 3 deletions Source/smokeview/drawGeometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,6 @@ void DrawOrigObstOutlines(void){
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);
Expand Down
1 change: 0 additions & 1 deletion Source/smokeview/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define pp_FAST // set fast startup by default
#define pp_GPU // support the GPU
#define pp_THREAD // turn on multi-threading
#define pp_FDS // create a 1 mesh input file for cases <= 100 meshes

#ifdef pp_FRAME // turn on each frame type if pp_FRAME is set
#define pp_BOUNDFRAME // turn on frame code for boundary files
Expand Down
192 changes: 0 additions & 192 deletions Source/smokeview/readsmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6469,188 +6469,6 @@ 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 || nmeshes > MAX_MESHES)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){
Expand Down Expand Up @@ -7053,9 +6871,6 @@ int ReadSMV_Init(){
use_ffmpeg_threads = 0;
use_readallgeom_threads = 0;
use_isosurface_threads = 0;
#ifdef pp_FDS
use_readsmvorig_threads = 0;
#endif
use_mergesmoke_threads = 0;
use_meshnabors_threads = 0;
}
Expand Down Expand Up @@ -11826,13 +11641,6 @@ int ReadSMV_Configure(){
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;
Expand Down
9 changes: 0 additions & 9 deletions Source/smokeview/smokeviewvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ SVEXTERN smokethreaddata smokethreadinfo[MAX_THREADS];
SVEXTERN int SVDECL(n_mergesmoke_glui_threads, 4), SVDECL(use_mergesmoke_glui_threads, 1);
SVEXTERN int SVDECL(update_glui_merge_smoke, 1);

//***readsmvorig
#ifdef pp_FDS
SVEXTERN int SVDECL(n_readsmvorig_threads, 1), SVDECL(use_readsmvorig_threads, 1);
SVEXTERN threaderdata SVDECL(*readsmvorig_threads, NULL);
#ifndef MAX_MESHES
#define MAX_MESHES 100
#endif
#endif

//***isosurface
SVEXTERN int SVDECL(n_isosurface_threads, 1), SVDECL(use_isosurface_threads, 1);
SVEXTERN threaderdata SVDECL(*isosurface_threads, NULL);
Expand Down
2 changes: 0 additions & 2 deletions Source/smokeview/startup.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,7 @@ 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();
Expand Down

0 comments on commit 3a846c9

Please sign in to comment.