diff --git a/Source/smokeview/IOboundary.c b/Source/smokeview/IOboundary.c index b452d77df..41bd98908 100644 --- a/Source/smokeview/IOboundary.c +++ b/Source/smokeview/IOboundary.c @@ -31,7 +31,11 @@ /* ------------------ OutputBoundaryData ------------------------ */ +#ifdef pp_BNDF_DEBUG +void OutputBoundaryData(patchdata *patchi, int output_patch, int output_ipatch){ +#else void OutputBoundaryData(patchdata *patchi){ +#endif int iframe; float *vals; float *xplt, *yplt, *zplt; @@ -51,7 +55,6 @@ void OutputBoundaryData(patchdata *patchi){ fprintf(csvstream,"time interval:,%f,%f\n",patchout_tmin,patchout_tmax); fprintf(csvstream,"region:,%f,%f,%f,%f,%f,%f\n\n",patchout_xmin,patchout_xmax,patchout_ymin,patchout_ymax,patchout_zmin,patchout_zmax); - vals = meshi->patchval; xplt = meshi->xplt_fds; yplt = meshi->yplt_fds; zplt = meshi->zplt_fds; @@ -61,10 +64,9 @@ void OutputBoundaryData(patchdata *patchi){ float pt; pt = meshi->patch_times[iframe]; - if(ptpatchout_tmax){ - vals+=meshi->npatchsize; - continue; - } + if(ptpatchout_tmax)break; + vals = meshi->patchval + iframe*meshi->npatchsize; for(ipatch=0;ipatchnpatches;ipatch++){ @@ -72,6 +74,7 @@ void OutputBoundaryData(patchdata *patchi){ int imin, imax, jmin, jmax, kmin, kmax; int i, j, k; patchfacedata *pfi; + int framesize; pfi = patchi->patchfaceinfo + ipatch; @@ -81,15 +84,49 @@ void OutputBoundaryData(patchdata *patchi){ j2 = pfi->ib[3]; k1 = pfi->ib[4]; k2 = pfi->ib[5]; - if(patchout_xminxplt[i2]))continue; - if(patchout_yminyplt[j2]))continue; - if(patchout_zminzplt[k2]))continue; + framesize = (i2 + 1 - i1) * (j2 + 1 - j1) * (k2 + 1 - k1); + int skip = 0; +#ifdef pp_BNDF_DEBUG + if(output_patch == 1 && output_ipatch != ipatch + 1){ + vals += framesize; + continue; + } + if(output_patch == 0){ + if(patchout_xminxplt[i2]))skip = 1; + if(patchout_yminyplt[j2]))skip = 1; + if(patchout_zminzplt[k2]))skip = 1; + } +#else + if(patchout_xminxplt[i2]))skip = 1; + if(patchout_yminyplt[j2]))skip = 1; + if(patchout_zminzplt[k2]))skip = 1; +#endif + if(skip == 1){ + vals += framesize; + continue; + } imin=i1; imax=i2; jmin=j1; jmax=j2; kmin=k1; kmax=k2; +#ifdef pp_BNDF_DEBUG + if(output_patch == 0){ + for(i=i1;inpatches); fprintf(csvstream,"region:,%i,%i,%i,%i,%i,%i\n",i1,i2,j1,j2,k1,k2); @@ -1919,7 +1957,11 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int load_flag, int *errorcode){ ShowInternalBlockages(); update_boundary_loaded = 1; +#ifdef pp_BNDF_DEBUG + if(loadpatchbysteps==UNCOMPRESSED_ALLFRAMES && (output_patchdata==1||glui_output_patch==1)){ +#else if(loadpatchbysteps==UNCOMPRESSED_ALLFRAMES && output_patchdata==1){ +#endif int j; for(j=0; jloaded == 0)continue; +#ifdef pp_BNDF_DEBUG + OutputBoundaryData(patchj, glui_output_patch, glui_output_ipatch); +#else OutputBoundaryData(patchj); +#endif } } @@ -3153,7 +3199,10 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ nn = 0; glBegin(GL_TRIANGLES); - for(n = 0;nnpatches;n++){ +#ifdef pp_BNDF_DEBUG + if(bf_patch1 == 1) +#endif + for(n = 0; n < patchi->npatches; n++){ int drawit; patchfacedata *pfi; @@ -3172,6 +3221,9 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ if(pfi->vis==1&&pfi->dir==0)drawit = 1; if(pfi->type==INTERIORwall)drawit = 1; if(pfi->obst == NULL && pfi->internal_mesh_face==1)drawit = 0; +#ifdef pp_BNDF_DEBUG + if(bndf_vis_patch[n] == 0)drawit = 0; +#endif if(drawit==1){ nrow = pfi->nrow; ncol = pfi->ncol; @@ -3227,7 +3279,10 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ nn = 0; glBegin(GL_TRIANGLES); - for(n = 0;nnpatches;n++){ +#ifdef pp_BNDF_DEBUG + if(bf_patch2 == 1) +#endif + for(n = 0; n < patchi->npatches; n++){ int drawit; patchfacedata *pfi; @@ -3248,6 +3303,9 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ drawit = 1; } } +#ifdef pp_BNDF_DEBUG + if(bndf_vis_patch[n] == 0)drawit = 0; +#endif if(pfi->obst == NULL && pfi->internal_mesh_face==1)drawit = 0; if(drawit==1){ nrow = pfi->nrow; @@ -3301,6 +3359,9 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ /* if a contour boundary DOES match a blockage face then draw "one sides" of boundary */ nn = 0; +#ifdef pp_BNDF_DEBUG + if(bf_patch3==1) +#endif for(n = 0;nnpatches;n++){ int drawit; patchfacedata *pfi; @@ -3319,6 +3380,9 @@ void DrawBoundaryCellCenter(const meshdata *meshi){ } } if(pfi->obst == NULL && pfi->internal_mesh_face==1)drawit = 0; +#ifdef pp_BNDF_DEBUG + if(bndf_vis_patch[n] == 0)drawit = 0; +#endif if(drawit==1){ nrow = pfi->nrow; ncol = pfi->ncol; diff --git a/Source/smokeview/glui_bounds.cpp b/Source/smokeview/glui_bounds.cpp index c8b84e402..467de064d 100644 --- a/Source/smokeview/glui_bounds.cpp +++ b/Source/smokeview/glui_bounds.cpp @@ -2734,6 +2734,9 @@ GLUI_Panel *PANEL_addremovemesh = NULL; GLUI_Panel *PANEL_boundary_temp_threshold=NULL; GLUI_Panel *PANEL_boundary_exterior_data = NULL; GLUI_Panel *PANEL_boundary_interior_data = NULL; +#ifdef pp_BNDF_DEBUG +GLUI_Panel *PANEL_boundary_patch_debug=NULL; +#endif GLUI_Panel *PANEL_slice_buttonsA = NULL; GLUI_Panel *PANEL_boundary_outline_type = NULL; GLUI_Panel *PANEL_iso1 = NULL; @@ -2863,6 +2866,9 @@ GLUI_Checkbox *CHECKBOX_show_exterior_walls[7]; GLUI_Checkbox *CHECKBOX_show_mesh_geom[256]; GLUI_Checkbox *CHECKBOX_show_mesh_data[256]; +#ifdef pp_BNDF_DEBUG +GLUI_Checkbox *CHECKBOX_patch_debug[NPATCHES_DEBUG]; +#endif GLUI_Checkbox *CHECKBOX_use_partload_threads = NULL; GLUI_Checkbox *CHECKBOX_partfast = NULL; GLUI_Checkbox *CHECKBOX_show_slice_shaded = NULL; @@ -4858,6 +4864,36 @@ void AddMeshCheckbox(int icol,int nm, GLUI_Panel *PANEL, GLUI_Checkbox **CHECKBO } } +#ifdef pp_BNDF_DEBUG +#define SHOW_ALL_PATCHES 0 +#define HIDE_ALL_PATCHES 1 +/* ------------------ BoundDebugCB ------------------------ */ + + +void BoundDebugCB(int var){ + int i; + + switch(var){ + case SHOW_ALL_PATCHES: + for(i=0;iset_int_val(bndf_vis_patch[i]); + } +} +#endif + /* ------------------ GLUIBoundsSetup ------------------------ */ extern "C" void GLUIBoundsSetup(int main_window){ @@ -5061,6 +5097,10 @@ extern "C" void GLUIBoundsSetup(int main_window){ TOGGLE_ROLLOUT(subboundprocinfo, nsubboundprocinfo, ROLLOUT_outputpatchdata, BOUNDARY_OUTPUT_ROLLOUT, glui_bounds); glui_bounds->add_checkbox_to_panel(ROLLOUT_outputpatchdata, "Output data to file", &output_patchdata); +#ifdef pp_BNDF_DEBUG + glui_bounds->add_checkbox_to_panel(ROLLOUT_outputpatchdata, "Output patch", &glui_output_patch); + glui_bounds->add_spinner_to_panel(ROLLOUT_outputpatchdata, "patch index", GLUI_SPINNER_INT, &glui_output_ipatch); +#endif PANEL_outputpatchdata = glui_bounds->add_panel_to_panel(ROLLOUT_outputpatchdata, "", GLUI_PANEL_NONE); @@ -5129,6 +5169,24 @@ extern "C" void GLUIBoundsSetup(int main_window){ CHECKBOX_hide_all_interior_patch_data = glui_bounds->add_checkbox_to_panel(PANEL_boundary_interior_data, "Hide all", &show_all_interior_patch_data, HIDE_ALL_INTERIOR_PATCH_DATA, BoundBoundCB); glui_bounds->add_checkbox_to_panel(ROLLOUT_boundary_settings, "output patch info when loading", &outout_patch_faces); +#ifdef pp_BNDF_DEBUG + PANEL_boundary_patch_debug = glui_bounds->add_panel_to_panel(ROLLOUT_boundary_settings, "debug settings"); + glui_bounds->add_checkbox_to_panel(PANEL_boundary_patch_debug, "draw 1", &bf_patch1); + glui_bounds->add_checkbox_to_panel(PANEL_boundary_patch_debug, "draw 2", &bf_patch2); + glui_bounds->add_checkbox_to_panel(PANEL_boundary_patch_debug, "draw 3", &bf_patch3); + glui_bounds->add_separator_to_panel(PANEL_boundary_patch_debug); + + for(i = 0; i < NPATCHES_DEBUG; i++){ + char vislabel[50]; + + bndf_vis_patch[i] = 1; + sprintf(vislabel, "patch %i", i+1); + CHECKBOX_patch_debug[i] = glui_bounds->add_checkbox_to_panel(PANEL_boundary_patch_debug, vislabel, bndf_vis_patch+i); + + } + glui_bounds->add_button_to_panel(PANEL_boundary_patch_debug, "Show all patches", SHOW_ALL_PATCHES, BoundDebugCB); + glui_bounds->add_button_to_panel(PANEL_boundary_patch_debug, "Hide all patches", HIDE_ALL_PATCHES, BoundDebugCB); +#endif if(nboundaryslicedups > 0){ ROLLOUT_boundary_duplicates = glui_bounds->add_rollout_to_panel(ROLLOUT_bound, "Duplicates", false, BOUNDARY_DUPLICATE_ROLLOUT, SubBoundRolloutCB); diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index 25702e57b..1314d8e0d 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -16,6 +16,7 @@ //#define pp_OPACITY_DEBUG // output hrrpuv opacity in center of each mesh //#define pp_GLUT_DEBUG // add debug print for glut debugging //#define pp_OSX_CWD // turn on initial getcwd call for OSX smokeview's +#define pp_BNDF_DEBUG // add 3 checkboxes for controlling different types of boundary file output //*** options: windows diff --git a/Source/smokeview/smokeviewvars.h b/Source/smokeview/smokeviewvars.h index 4392ea6ef..af0fb93b2 100644 --- a/Source/smokeview/smokeviewvars.h +++ b/Source/smokeview/smokeviewvars.h @@ -146,6 +146,13 @@ SVEXTERN int SVDECL(slice_plot_bound_option, 1); SVEXTERN int SVDECL(update_viewpoint_list, 0), SVDECL(update_camera_label, 0); +#ifdef pp_BNDF_DEBUG +SVEXTERN int SVDECL(bf_patch1, 0), SVDECL(bf_patch2, 1), SVDECL(bf_patch3, 1); +#define NPATCHES_DEBUG 18 +SVEXTERN int bndf_vis_patch[NPATCHES_DEBUG]; +SVEXTERN int SVDECL(glui_output_patch, 0), SVDECL(glui_output_ipatch, 0); +#endif + #ifdef pp_GLUT_DEBUG #ifdef INMAIN #ifdef _WIN32