Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove automatic generation of one mesh .smv file #2094

Merged
merged 9 commits into from
Nov 13, 2024
2 changes: 0 additions & 2 deletions Source/smokebot_trigger.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


master: dummy text to trigger smokebot
devel: dummy text to trigger smokebot
devel2: dummy text to trigger smokebot
Expand Down
17 changes: 7 additions & 10 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 Expand Up @@ -3080,23 +3077,23 @@ void DrawObstsDebug(void){
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, block_specular2);
glEnable(GL_COLOR_MATERIAL);
}
for(i = 0; i < nmeshes; i++){
for(i = 1; i <= nmeshes; i++){
meshdata *meshi;
int j;
int jmin, jmax;

meshi = meshinfo + i;
meshi = meshinfo + i - 1;
jmin = 0;
jmax = meshi->nbptrs-1;
if(mesh_index_debug >= 0 && mesh_index_debug < nmeshes){
if(mesh_index_debug >= 1 && mesh_index_debug <= nmeshes){
int max_blockage_index_debug;
if(mesh_index_debug!=i)continue;
max_blockage_index_debug = min_blockage_index_debug + n_blockages_debug - 1;
if(min_blockage_index_debug >= 0 && min_blockage_index_debug < meshi->nbptrs){
if(max_blockage_index_debug >= 0 && max_blockage_index_debug < meshi->nbptrs){
if(min_blockage_index_debug >= 1 && min_blockage_index_debug <= meshi->nbptrs){
if(max_blockage_index_debug >= 1 && max_blockage_index_debug <= meshi->nbptrs){
if(min_blockage_index_debug <= max_blockage_index_debug){
jmin = min_blockage_index_debug;
jmax = max_blockage_index_debug;
jmin = min_blockage_index_debug-1;
jmax = max_blockage_index_debug-1;
}
}
}
Expand Down
28 changes: 24 additions & 4 deletions Source/smokeview/glui_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ GLUI_Spinner *SPINNER_spec_blue = NULL;
GLUI_Spinner *SPINNER_spec_grey = NULL;
GLUI_Spinner *SPINNER_shininess = NULL;
GLUI_Spinner *SPINNER_ngridloc_digits = NULL;
GLUI_Spinner *SPINNER_mesh_debug = NULL;
GLUI_Spinner *SPINNER_blockage_min_debug = NULL;
GLUI_Spinner *SPINNER_blockage_n_debug = NULL;

GLUI_Checkbox *CHECKBOX_visaxislabels = NULL;
GLUI_Checkbox *CHECKBOX_labels_showtick = NULL;
Expand Down Expand Up @@ -884,12 +887,13 @@ extern "C" void GLUIDisplaySetup(int main_window){
PANEL_blockage_drawing = glui_labels->add_panel_to_panel(PANEL_gen3,_("Blockage drawing"));
RADIOBUTTON_label_1 = glui_labels->add_radiogroup_to_panel(PANEL_blockage_drawing, &blockage_draw_option, LABELS_drawface, GLUILabelsCB);
glui_labels->add_radiobutton_to_group(RADIOBUTTON_label_1, _("original"));
glui_labels->add_radiobutton_to_group(RADIOBUTTON_label_1, _("new"));
glui_labels->add_radiobutton_to_group(RADIOBUTTON_label_1, _("default"));
glui_labels->add_radiobutton_to_group(RADIOBUTTON_label_1, _("debug"));
glui_labels->add_radiobutton_to_group(RADIOBUTTON_label_1, _("debug - draw only hidden faces"));
glui_labels->add_spinner_to_panel(PANEL_blockage_drawing, "mesh:", GLUI_SPINNER_INT, &mesh_index_debug);
glui_labels->add_spinner_to_panel(PANEL_blockage_drawing, "min blockage index:", GLUI_SPINNER_INT, &min_blockage_index_debug);
glui_labels->add_spinner_to_panel(PANEL_blockage_drawing, "number of blockages:", GLUI_SPINNER_INT, &n_blockages_debug);
SPINNER_mesh_debug = glui_labels->add_spinner_to_panel(PANEL_blockage_drawing, "mesh:", GLUI_SPINNER_INT, &mesh_index_debug);
SPINNER_blockage_min_debug = glui_labels->add_spinner_to_panel(PANEL_blockage_drawing, "min blockage index:", GLUI_SPINNER_INT, &min_blockage_index_debug);
SPINNER_blockage_n_debug = glui_labels->add_spinner_to_panel(PANEL_blockage_drawing, "number of blockages:", GLUI_SPINNER_INT, &n_blockages_debug);
GLUILabelsCB(LABELS_drawface);

CHECKBOX_label_2=glui_labels->add_checkbox_to_panel(PANEL_gen3,_("Sort transparent faces"),&sort_transparent_faces,LABELS_drawface,GLUILabelsCB);
CHECKBOX_label_3=glui_labels->add_checkbox_to_panel(PANEL_gen3,_("Hide overlaps"),&hide_overlaps,LABELS_hide_overlaps,GLUILabelsCB);
Expand Down Expand Up @@ -1276,6 +1280,22 @@ extern "C" void GLUILabelsCB(int var){
break;
case LABELS_drawface:
updatefacelists=1;
if(
SPINNER_mesh_debug != NULL &&
SPINNER_blockage_min_debug != NULL &&
SPINNER_blockage_n_debug != NULL
){
if(blockage_draw_option == 0 || blockage_draw_option == 1){
SPINNER_mesh_debug->disable();
SPINNER_blockage_min_debug->disable();
SPINNER_blockage_n_debug->disable();
}
else{
SPINNER_mesh_debug->enable();
SPINNER_blockage_min_debug->enable();
SPINNER_blockage_n_debug->enable();
}
}
break;
case CB_USE_LIGHTING:
case LABELS_shownorth:
Expand Down
6 changes: 0 additions & 6 deletions Source/smokeview/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,12 +819,6 @@ int main(int argc, char **argv){

smv_filename = ParseCommandline(argc, argv);

#ifdef WIN32
if(Which("fds_local.bat", &fdsprog) != NULL)strcpy(fdsprog, "fds_local.bat");
#else
Which("fds", &fdsprog);
#endif

if(smv_filename == NULL && show_version == 1){
InitStartupDirs();
DisplayVersionInfo("Smokeview ");
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

#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)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
12 changes: 3 additions & 9 deletions Source/smokeview/smokeviewvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +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);
#endif

//***isosurface
SVEXTERN int SVDECL(n_isosurface_threads, 1), SVDECL(use_isosurface_threads, 1);
SVEXTERN threaderdata SVDECL(*isosurface_threads, NULL);
Expand Down Expand Up @@ -1812,8 +1806,8 @@ SVEXTERN float texture_origin[3];

SVEXTERN int vslicecolorbarflag;
SVEXTERN int SVDECL(blockage_draw_option, 1);
SVEXTERN int SVDECL(mesh_index_debug, -1);
SVEXTERN int SVDECL(min_blockage_index_debug, -1);
SVEXTERN int SVDECL(mesh_index_debug, 0);
SVEXTERN int SVDECL(min_blockage_index_debug, 0);
SVEXTERN int SVDECL(n_blockages_debug, 0);
#ifdef INMAIN
SVEXTERN unsigned char rgb_below_min[3]={255-64,255-64,255-64}, rgb_above_max[3]={0,0,0};
Expand Down Expand Up @@ -1968,7 +1962,7 @@ 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), SVDECL(*fdsprog, NULL);
SVEXTERN char SVDECL(*smokezippath,NULL), SVDECL(*smokeviewpath,NULL);
SVEXTERN char SVDECL(*INI_fds_filein,NULL), SVDECL(*fds_filein,NULL);
SVEXTERN char SVDECL(*caseini_filename,NULL);
#ifdef pp_FRAME
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
2 changes: 1 addition & 1 deletion scripts/fds_smv_env.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if exist %userprofile%\.bundle\smv_revision.txt (

:: ---- log entry date ----

set smvlogdate="7-Nov-2024"
set smvlogdate="12-Nov-2024"

:: ---- repo locations ----

Expand Down
Loading