Skip to content

Commit

Permalink
Merge pull request firemodels#1783 from gforney/devel
Browse files Browse the repository at this point in the history
fixes to file bounds if fds is running
  • Loading branch information
gforney authored Jan 11, 2024
2 parents 64c32d4 + dedd42a commit 468da92
Show file tree
Hide file tree
Showing 20 changed files with 363 additions and 145 deletions.
39 changes: 37 additions & 2 deletions Manuals/SMV_User_Guide/SMV_User_Guide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1983,11 +1983,46 @@ \part{Controlling and Customizing Smokeview}
\chapter{Setting Options}
\label{chapter:settingoptions}
%---------------------------------------------------------------------------------
%---------------------------------------------------------------------------------
\section{Loading Data}
Data is loaded in smokeview by clicking the right mouse button and selecting one of the data types
under the Load/Unload menu. Smokeview loads data for all available times and meshes by default.
For large cases, it is useful to reduce the amount of data loaded in order to shorten load times .
To do this, one uses the Data loading options tab of the Files/Data/Coloring dialog box
illustrated in Figure \ref{figDataloading}.
To open this dialog box select the Dialogs>File/Data/Coloring menu entry then select the Data loading options tab.
To shorten the time interval over which
data is loaded, specify a min and/or max time in this dialog box.
To reduce the number of meshes over which
data is loaded specify an intersection box.
The intersection box may be viewed by selecting the show intersection box checkbox.
The intersection box is colored red. The meshes that are contained within this box
are drawn as outlines and colored black. Mesh indices (1 to number of meshes) may be displayed and used
to set the intersection box to that mesh.
Only data in meshes within the intersection box will
then be loaded.
If the `Load a file only if unloaded` checkbox is selected and if the intersection box
is expanded to include more meshes then only data in these extra meshes where data was not loaded before will be loaded
(data will not be loaded twice).
\begin{figure}[bph]
\centerline{
\includegraphics[width=4.0in]{\SMVfigdir/figDataloading}}
\caption[Dialog box for setting data loading constraints.]
{Dialog box for setting data loading constraints.
A subset of data files may be loaded by specifying min and/or max load times.
Data may also be loaded on a selected subset of meshes.
}\ \label{figDataloading}
\end{figure}
%---------------------------------------------------------------------------------
%---------------------------------------------------------------------------------
\section{Data Bounds}
Smokeview visualizes data by mapping data values to color
Smokeview visualizes data by mapping data values to color indices
ranging from 0 to 255 using a mapping of the form
\begin{eqnarray*}
Expand All @@ -2014,7 +2049,7 @@ \section{Data Bounds}
\begin{figure}[bph]
\centerline{
\includegraphics[width=5.4028in]{\SMVfigdir/figBOUNDset}}
\includegraphics[width=4.0in]{\SMVfigdir/figBOUNDset}}
\caption[Dialog box for setting Slice file data bounds.]
{Dialog box for setting Slice file data bounds.
Select a variable and bound type (set, global or percentile). Enter a lower
Expand Down
3 changes: 3 additions & 0 deletions Source/shared/datadefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
#define SMV2FDS_Y(y) (ybar0+(y)*xyzmaxdiff)
#define SMV2FDS_Z(z) (zbar0+(z)*xyzmaxdiff)

#define DONOT_SET_MINMAX_FLAG 0
#define SET_MINMAX_FLAG 1

#define VERT_AVG2(v1,v2,vavg) \
vavg[0]=(v1[0]+v2[0])/2.0;\
vavg[1]=(v1[1]+v2[1])/2.0;\
Expand Down
2 changes: 1 addition & 1 deletion Source/smokebot_trigger.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
master: dummy text to trigger smokebot
devel: dummy text to trigger smokebot
devel: dummy text to trigger smokebot
devel2: dummy text to trigger smokebot
test: dummy text to trigger smokebot
10 changes: 5 additions & 5 deletions Source/smokeview/IOboundary.c
Original file line number Diff line number Diff line change
Expand Up @@ -2361,20 +2361,19 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){
patchi->display = 1;
patchi->hist_update = 1;

int recompute = 0;
if(patchi->finalize==1){
GLUIUpdateBoundaryListIndex(patchfilenum);
#define BOUND_UPDATE_COLORS 110
#define BOUND_DONTUPDATE_COLORS 128
#define BOUND_COMPUTE_PERCENTILES 116
cpp_boundsdata *bounds;

if(runscript == 0){
THREADcontrol(patchbound_threads, THREAD_JOIN);
}
if(force_bound_update==1||patch_bounds_defined==0){
GetGlobalPatchBounds(1);
if(force_bound_update==1||patch_bounds_defined==0 || IsFDSRunning(&last_size_for_boundary) == 1){
GetGlobalPatchBounds(1,DONOT_SET_MINMAX_FLAG);
SetLoadedPatchBounds(NULL, 0);
GLUIPatchBoundsCPP_CB(BOUND_DONTUPDATE_COLORS);
recompute = 1;
}
else{
bounds = GLUIGetBoundsData(BOUND_PATCH);
Expand Down Expand Up @@ -2427,6 +2426,7 @@ FILE_SIZE ReadBoundaryBndf(int ifile, int flag, int *errorcode){
else{
PRINTF(" - %.0f kB in %.1f s\n", (float)return_filesize / 1000., total_time);
}
if(recompute == 1)printf("***recomputing bounds\n");

update_patch_bounds = ifile;

Expand Down
17 changes: 17 additions & 0 deletions Source/smokeview/IOgeometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -3029,6 +3029,7 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int
else{
slicefile_labelindex = GetSliceBoundsIndexFromLabel(patchi->label.shortlabel);
}
int recompute = 0;
if((slicei==NULL&&patchi->finalize==1)||(slicei!=NULL&&slicei->finalize==1)){
plotstate = GetPlotState(DYNAMIC_PLOTS);
if(patchi->boundary==1)UpdateBoundaryType();
Expand All @@ -3044,6 +3045,21 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int

bounds = GLUIGetBoundsData(bound_type);
INIT_PRINT_TIMER(geom_bounds_timer);
if(patchi->boundary == 1){
if(force_bound_update==1||patch_bounds_defined==0 || IsFDSRunning(&last_size_for_boundary) == 1){
GetGlobalPatchBounds(1,DONOT_SET_MINMAX_FLAG);
SetLoadedPatchBounds(NULL, 0);
GLUIPatchBoundsCPP_CB(BOUND_DONTUPDATE_COLORS);
recompute = 1;
}
}
else{
if(force_bound_update==1||slice_bounds_defined==0||IsFDSRunning(&last_size_for_slice)==1){
GetGlobalSliceBounds(1, DONOT_SET_MINMAX_FLAG);
SetLoadedSliceBounds(NULL, 0);
recompute = 1;
}
}
if(bounds->set_valmin==BOUND_SET_MIN||bounds->set_valmax==BOUND_SET_MAX){
if(patchi->boundary==1){
}
Expand Down Expand Up @@ -3079,6 +3095,7 @@ FILE_SIZE ReadGeomData(patchdata *patchi, slicedata *slicei, int load_flag, int
PRINTF(" - %.1f MB/%.1f s\n", (float)return_filesize/1000000., total_time);
}
PrintMemoryInfo;
if(recompute == 1)printf("***recomputing bounds\n");
return return_filesize;
}

Expand Down
7 changes: 5 additions & 2 deletions Source/smokeview/IOslice.c
Original file line number Diff line number Diff line change
Expand Up @@ -5041,15 +5041,17 @@ FILE_SIZE ReadSlice(const char *file, int ifile, int time_frame, float *time_val

slicefile_labelindex = GetSliceBoundsIndex(sd);
plotstate = GetPlotState(DYNAMIC_PLOTS);
int recompute = 0;
if(sd->finalize==1){
int set_valmin, set_valmax;

update_slice2device = 1;
if(runscript == 0){
THREADcontrol(slicebound_threads, THREAD_JOIN);
}
if(force_bound_update==1||slice_bounds_defined==0){
GetGlobalSliceBounds(1);
if(force_bound_update==1||slice_bounds_defined==0||IsFDSRunning(&last_size_for_slice)==1){
recompute = 1;
GetGlobalSliceBounds(1, DONOT_SET_MINMAX_FLAG);
SetLoadedSliceBounds(NULL, 0);
}
GLUIGetMinMax(BOUND_SLICE, sd->label.shortlabel, &set_valmin, &qmin, &set_valmax, &qmax);
Expand Down Expand Up @@ -5132,6 +5134,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);
}
}
if(recompute==1)printf("***recomputing bounds\n");

update_flipped_colorbar=1;

Expand Down
20 changes: 10 additions & 10 deletions Source/smokeview/getdatabounds.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ int GetBounds(char *file, float *valmin, float *valmax,

/* ------------------ GetGlobalPatchBounds ------------------------ */

void GetGlobalPatchBounds(int flag){
void GetGlobalPatchBounds(int flag, int set_flag){
int i;

if(npatchinfo==0)return;
Expand Down Expand Up @@ -351,7 +351,7 @@ void GetGlobalPatchBounds(int flag){
boundscppi->cache = cache_boundary_data;
boundscppi->set_valtype = 0;

boundscppi->set_valmin = 0;
if(set_flag==1)boundscppi->set_valmin = 0;
boundscppi->valmin[BOUND_SET_MIN] = boundi->dlg_global_valmin;
boundscppi->valmin[BOUND_LOADED_MIN] = boundi->dlg_global_valmin;
boundscppi->valmin[BOUND_GLOBAL_MIN] = boundi->dlg_global_valmin;
Expand All @@ -361,7 +361,7 @@ void GetGlobalPatchBounds(int flag){
boundscppi->valmax[BOUND_LOADED_MAX] = boundi->dlg_global_valmax;
boundscppi->valmax[BOUND_GLOBAL_MAX] = boundi->dlg_global_valmax;
boundscppi->valmax[BOUND_PERCENTILE_MAX] = boundi->dlg_global_valmax;
boundscppi->set_valmax = 0;
if(set_flag==1)boundscppi->set_valmax = 0;

boundscppi->set_chopmin = boundi->setchopmin;
boundscppi->set_chopmax = boundi->setchopmax;
Expand All @@ -376,15 +376,15 @@ void GetGlobalPatchBounds(int flag){

void *GetGlobalPatchBoundsFull(void *arg){
THREADcontrol(patchbound_threads, THREAD_LOCK);
GetGlobalPatchBounds(1);
GetGlobalPatchBounds(1,SET_MINMAX_FLAG);
THREADcontrol(patchbound_threads, THREAD_UNLOCK);
THREAD_EXIT(patchbound_threads);
}

/* ------------------ GetGlobalPatchBoundsReduced ------------------------ */

void GetGlobalPatchBoundsReduced(void){
GetGlobalPatchBounds(0);
GetGlobalPatchBounds(0,SET_MINMAX_FLAG);
}

/* ------------------ GetPlot3DFileBounds ------------------------ */
Expand Down Expand Up @@ -541,7 +541,7 @@ void GetLoadedPlot3dBounds(int *compute_loaded, float *loaded_min, float *loaded

/* ------------------ GetGlobalSliceBounds ------------------------ */

void GetGlobalSliceBounds(int flag){
void GetGlobalSliceBounds(int flag, int set_flag){
int i;

if(nsliceinfo==0)return;
Expand Down Expand Up @@ -617,13 +617,13 @@ void GetGlobalSliceBounds(int flag){
boundscppi->cache = cache_slice_data;
boundscppi->set_valtype = 0;

boundscppi->set_valmin = 0;
if(set_flag == 1)boundscppi->set_valmin = 0;
boundscppi->valmin[BOUND_SET_MIN] = boundi->dlg_global_valmin;
boundscppi->valmin[BOUND_LOADED_MIN] = boundi->dlg_global_valmin;
boundscppi->valmin[BOUND_GLOBAL_MIN] = boundi->dlg_global_valmin;
boundscppi->valmin[BOUND_PERCENTILE_MIN] = boundi->dlg_global_valmin;

boundscppi->set_valmax = 0;
if(set_flag == 1)boundscppi->set_valmax = 0;
boundscppi->valmax[BOUND_SET_MAX] = boundi->dlg_global_valmax;
boundscppi->valmax[BOUND_LOADED_MAX] = boundi->dlg_global_valmax;
boundscppi->valmax[BOUND_GLOBAL_MAX] = boundi->dlg_global_valmax;
Expand All @@ -642,15 +642,15 @@ void GetGlobalSliceBounds(int flag){

void *GetGlobalSliceBoundsFull(void *arg){
THREADcontrol(slicebound_threads, THREAD_LOCK);
GetGlobalSliceBounds(1);
GetGlobalSliceBounds(1,SET_MINMAX_FLAG);
THREADcontrol(slicebound_threads, THREAD_UNLOCK);
THREAD_EXIT(slicebound_threads);
}

/* ------------------ GetGlobalSliceBoundsReduced ------------------------ */

void GetGlobalSliceBoundsReduced(void){
GetGlobalSliceBounds(0);
GetGlobalSliceBounds(0,SET_MINMAX_FLAG);
}
/* ------------------ GetHVACDuctBounds ------------------------ */

Expand Down
Loading

0 comments on commit 468da92

Please sign in to comment.