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

fixes to boundary file show/hide menus, dialog box entries #2078

Merged
merged 5 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 43 additions & 53 deletions Source/smokeview/drawGeometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -2586,80 +2586,66 @@ int CompareColorFaces(const void *arg1, const void *arg2){

/* ------------------ ShowHideInternalFaces ------------------------ */

void ShowHideInternalFaces(void){
int i;
int show;
//***need to update
void ShowHideInternalFaces(meshdata *meshi, int show){
int j;

show = GetInternalFaceShow();
for(i = 0;i < nmeshes;i++){
int j;
meshdata *meshi;
for(j = 0;j < meshi->nbptrs;j++){
facedata *facej;

meshi = meshinfo + i;
for(j = 0;j < meshi->nbptrs;j++){
facedata *facej;
blockagedata *bc;
facej = meshi->faceinfo + 6 * j;
facej->hidden = 0; facej++;
facej->hidden = 0; facej++;
facej->hidden = 0; facej++;
facej->hidden = 0; facej++;
facej->hidden = 0; facej++;
facej->hidden = 0; facej++;
}
if(show == 1)return;
for(j = 0;j < meshi->nbptrs;j++){
facedata *facej;
blockagedata *bc;

bc = meshi->blockageinfoptrs[j];
facej = meshi->faceinfo + 6 * j;

bc = meshi->blockageinfoptrs[j];
facej = meshi->faceinfo + 6 * j;

/* down y 2
up x 1
up y 3
down x 0
down z 4
up z 5
*/
#define EPS 0.01
//down y
facej->hidden = 0;
// if(bc->inside_domain[2]==1)facej->hidden = 1;
if(show==0 && bc->xyzEXACT[2] > ybar0FDS + EPS)facej->hidden = 1;
facej++;
if(bc->xyzEXACT[2] > ybar0FDS + EPS)facej->hidden = 1;
facej++;

// up x
facej->hidden = 0;
// if(bc->inside_domain[1] == 1)facej->hidden = 1;
if(show == 0 && bc->xyzEXACT[1] < xbarFDS - EPS)facej->hidden = 1;
facej++;
if(bc->xyzEXACT[1] < xbarFDS - EPS)facej->hidden = 1;
facej++;

//up y
facej->hidden = 0;
// if(bc->inside_domain[3] == 1)facej->hidden = 1;
if(show == 0 && bc->xyzEXACT[3] < ybarFDS - EPS)facej->hidden = 1;
facej++;
if(bc->xyzEXACT[3] < ybarFDS - EPS)facej->hidden = 1;
facej++;

// down x
facej->hidden = 0;
// if(bc->inside_domain[0] == 1)facej->hidden = 1;
if(show == 0 && bc->xyzEXACT[0] > xbar0FDS + EPS)facej->hidden = 1;
facej++;
if(bc->xyzEXACT[0] > xbar0FDS + EPS)facej->hidden = 1;
facej++;

// down z
facej->hidden = 0;
// if(bc->inside_domain[4] == 1)facej->hidden = 1;
if(show == 0 && bc->xyzEXACT[4] > zbar0FDS + EPS)facej->hidden = 1;
facej++;
if(bc->xyzEXACT[4] > zbar0FDS + EPS)facej->hidden = 1;
facej++;

// up z
facej->hidden = 0;
// if(bc->inside_domain[5] == 1)facej->hidden = 1;
if(show == 0 && bc->xyzEXACT[5] < zbarFDS - EPS)facej->hidden = 1;
facej++;
}
if(bc->xyzEXACT[5] < zbarFDS - EPS)facej->hidden = 1;
facej++;
}
}

/* ------------------ IsVentVisible ------------------------ */

int IsVentVisible(ventdata *vi){
if(boundary_loaded == 1){
if(vi->isExterior == DOWN_X && vis_boundary_type[LEFTwall] == 0)return 1;
if(vi->isExterior == UP_X && vis_boundary_type[RIGHTwall] == 0)return 1;
if(vi->isExterior == DOWN_Y && vis_boundary_type[FRONTwall] == 0)return 1;
if(vi->isExterior == UP_Y && vis_boundary_type[BACKwall] == 0)return 1;
if(vi->isExterior == DOWN_Z && vis_boundary_type[DOWNwall] == 0)return 1;
if(vi->isExterior == UP_Z && vis_boundary_type[UPwall] == 0)return 1;
if(vi->wall_type == LEFTwall && vis_boundary_type[LEFTwall] == 0)return 1;
if(vi->wall_type == RIGHTwall && vis_boundary_type[RIGHTwall] == 0)return 1;
if(vi->wall_type == FRONTwall && vis_boundary_type[FRONTwall] == 0)return 1;
if(vi->wall_type == BACKwall && vis_boundary_type[BACKwall] == 0)return 1;
if(vi->wall_type == DOWNwall && vis_boundary_type[DOWNwall] == 0)return 1;
if(vi->wall_type == UPwall && vis_boundary_type[UPwall] == 0)return 1;
return 0;
}
return 1;
Expand All @@ -2686,6 +2672,10 @@ void UpdateFaceLists(void){
if(opengldefined==1){
glutPostRedisplay();
}

int show;
show = GetInternalFaceShow();

// if we are not showing boundary files then don't try to hide blockages
for(i=0;i<nmeshes;i++){
meshdata *meshi;
Expand All @@ -2705,7 +2695,7 @@ void UpdateFaceLists(void){
patchfilenum=meshi->patchfilenum;
patchi=NULL;
if(showplot3d == 0 && patchfilenum>=0 && patchfilenum<npatchinfo)patchi = patchinfo + patchfilenum;
ShowHideInternalFaces();
ShowHideInternalFaces(meshi, show);

n_normals_single=0;
n_normals_double=0;
Expand Down
2 changes: 1 addition & 1 deletion Source/smokeview/glui_bounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5117,8 +5117,8 @@ extern "C" void GLUIBoundsSetup(int main_window){

PANEL_boundary_exterior_data = glui_bounds->add_panel_to_panel(ROLLOUT_boundary_settings,"exterior data");
CHECKBOX_show_all_exterior_patch_data = glui_bounds->add_checkbox_to_panel(PANEL_boundary_exterior_data, _("Show all"), &show_all_exterior_patch_data, SHOW_ALL_EXTERIOR_PATCH_DATA, BoundBoundCB);
CHECKBOX_show_exterior_walls[FRONTwall] = glui_bounds->add_checkbox_to_panel(PANEL_boundary_exterior_data, _("front wall"), vis_boundary_type + FRONTwall, SHOW_EXTERIOR_PATCH_DATA, BoundBoundCB);
CHECKBOX_show_exterior_walls[LEFTwall] = glui_bounds->add_checkbox_to_panel(PANEL_boundary_exterior_data, _("left wall"), vis_boundary_type + LEFTwall, SHOW_EXTERIOR_PATCH_DATA, BoundBoundCB);
CHECKBOX_show_exterior_walls[FRONTwall] = glui_bounds->add_checkbox_to_panel(PANEL_boundary_exterior_data, _("front wall"), vis_boundary_type + FRONTwall, SHOW_EXTERIOR_PATCH_DATA, BoundBoundCB);
CHECKBOX_show_exterior_walls[DOWNwall] = glui_bounds->add_checkbox_to_panel(PANEL_boundary_exterior_data, _("lower wall"), vis_boundary_type + DOWNwall, SHOW_EXTERIOR_PATCH_DATA, BoundBoundCB);
glui_bounds->add_column_to_panel(PANEL_boundary_exterior_data, false);

Expand Down
36 changes: 24 additions & 12 deletions Source/smokeview/menus.c
Original file line number Diff line number Diff line change
Expand Up @@ -9162,18 +9162,30 @@ static int menu_count=0;
glutAddMenuEntry(_("#Hide all"), HIDE_EXTERIOR_WALL_MENU);
}
UpdateShowExtPatch(show_all_exterior_patch_data, hide_all_exterior_patch_data);
if(IsBoundaryType(FRONTwall) == 1 && vis_boundary_type[FRONTwall] == 1)glutAddMenuEntry(_("*Front"), FRONTwallmenu);
if(IsBoundaryType(FRONTwall) == 1 && vis_boundary_type[FRONTwall] == 0)glutAddMenuEntry(_("Front"), FRONTwallmenu);
if(IsBoundaryType(BACKwall) == 1 && vis_boundary_type[BACKwall] == 1)glutAddMenuEntry(_("*Back"), BACKwallmenu);
if(IsBoundaryType(BACKwall) == 1 && vis_boundary_type[BACKwall] == 0)glutAddMenuEntry(_("Back"), BACKwallmenu);
if(IsBoundaryType(LEFTwall) == 1 && vis_boundary_type[LEFTwall] == 1)glutAddMenuEntry(_("*Left"), LEFTwallmenu);
if(IsBoundaryType(LEFTwall) == 1 && vis_boundary_type[LEFTwall] == 0)glutAddMenuEntry(_("Left"), LEFTwallmenu);
if(IsBoundaryType(RIGHTwall) == 1 && vis_boundary_type[RIGHTwall] == 1)glutAddMenuEntry(_("*Right"), RIGHTwallmenu);
if(IsBoundaryType(RIGHTwall) == 1 && vis_boundary_type[RIGHTwall] == 0)glutAddMenuEntry(_("Right"), RIGHTwallmenu);
if(IsBoundaryType(UPwall) == 1 && vis_boundary_type[UPwall] == 1)glutAddMenuEntry(_("*Up"), UPwallmenu);
if(IsBoundaryType(UPwall) == 1 && vis_boundary_type[UPwall] == 0)glutAddMenuEntry(_("Up"), UPwallmenu);
if(IsBoundaryType(DOWNwall) == 1 && vis_boundary_type[DOWNwall] == 1)glutAddMenuEntry(_("*Down"), DOWNwallmenu);
if(IsBoundaryType(DOWNwall) == 1 && vis_boundary_type[DOWNwall] == 0)glutAddMenuEntry(_("Down"), DOWNwallmenu);
if(IsBoundaryType(FRONTwall) == 1){
if(vis_boundary_type[FRONTwall] == 1)glutAddMenuEntry(_("*Front"), FRONTwallmenu);
if(vis_boundary_type[FRONTwall] == 0)glutAddMenuEntry(_("Front"), FRONTwallmenu);
}
if(IsBoundaryType(BACKwall) == 1){
if(vis_boundary_type[BACKwall] == 1)glutAddMenuEntry(_("*Back"), BACKwallmenu);
if(vis_boundary_type[BACKwall] == 0)glutAddMenuEntry(_("Back"), BACKwallmenu);
}
if(IsBoundaryType(LEFTwall) == 1){
if(vis_boundary_type[LEFTwall] == 1)glutAddMenuEntry(_("*Left"), LEFTwallmenu);
if(vis_boundary_type[LEFTwall] == 0)glutAddMenuEntry(_("Left"), LEFTwallmenu);
}
if(IsBoundaryType(RIGHTwall) == 1){
if(vis_boundary_type[RIGHTwall] == 1)glutAddMenuEntry(_("*Right"), RIGHTwallmenu);
if(vis_boundary_type[RIGHTwall] == 0)glutAddMenuEntry(_("Right"), RIGHTwallmenu);
}
if(IsBoundaryType(UPwall) == 1){
if(vis_boundary_type[UPwall] == 1)glutAddMenuEntry(_("*Up"), UPwallmenu);
if(vis_boundary_type[UPwall] == 0)glutAddMenuEntry(_("Up"), UPwallmenu);
}
if(IsBoundaryType(DOWNwall) == 1){
if(vis_boundary_type[DOWNwall] == 1)glutAddMenuEntry(_("*Down"), DOWNwallmenu);
if(vis_boundary_type[DOWNwall] == 0)glutAddMenuEntry(_("Down"), DOWNwallmenu);
}

CREATEMENU(showpatchmenu,ShowBoundaryMenu);
if(npatchloaded>0){
Expand Down
36 changes: 18 additions & 18 deletions Source/smokeview/readsmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7352,46 +7352,46 @@ void SetExternalVents(void){
float xyz[3];

vj = meshi->ventinfo + j;
vj->isExterior = -1;
vj->wall_type = INTERIORwall;
switch(vj->dir){
case UP_X:
xyz[0] = vj->xvent1_orig + VENT_EPS;
xyz[0] = vj->xvent1_orig - VENT_EPS;
xyz[1] = (vj->yvent1_orig + vj->yvent2_orig) / 2.0;
xyz[2] = (vj->zvent1_orig + vj->zvent2_orig) / 2.0;
if(InExterior(xyz)==1)vj->isExterior = UP_X;
if(InExterior(xyz)==1)vj->wall_type = LEFTwall;
break;
case DOWN_X:
xyz[0] = vj->xvent1_orig - VENT_EPS;
xyz[0] = vj->xvent1_orig + VENT_EPS;
xyz[1] = (vj->yvent1_orig + vj->yvent2_orig) / 2.0;
xyz[2] = (vj->zvent1_orig + vj->zvent2_orig) / 2.0;
if(InExterior(xyz) == 1)vj->isExterior = DOWN_X;
if(InExterior(xyz) == 1)vj->wall_type = RIGHTwall;
break;
case UP_Y:
xyz[0] = (vj->xvent1_orig - vj->xvent2_orig) / 2.0;
xyz[1] = vj->yvent1_orig - VENT_EPS;
xyz[0] = (vj->xvent1_orig + vj->xvent2_orig) / 2.0;
xyz[1] = vj->yvent1_orig - VENT_EPS;
xyz[2] = (vj->zvent1_orig + vj->zvent2_orig) / 2.0;
if(InExterior(xyz)==1)vj->isExterior = UP_Y;
if(InExterior(xyz)==1)vj->wall_type = FRONTwall;
break;
case DOWN_Y:
xyz[0] = (vj->xvent1_orig - vj->xvent2_orig) / 2.0;
xyz[1] = vj->yvent1_orig + VENT_EPS;
xyz[0] = (vj->xvent1_orig + vj->xvent2_orig) / 2.0;
xyz[1] = vj->yvent1_orig + VENT_EPS;
xyz[2] = (vj->zvent1_orig + vj->zvent2_orig) / 2.0;
if(InExterior(xyz)==1)vj->isExterior = DOWN_Y;
if(InExterior(xyz)==1)vj->wall_type = BACKwall;
break;
case UP_Z:
xyz[0] = (vj->xvent1_orig + vj->xvent2_orig) / 2.0;
xyz[1] = (vj->yvent1_orig + vj->yvent2_orig) / 2.0;
xyz[2] = vj->zvent1_orig + VENT_EPS;
if(InExterior(xyz)==1)vj->isExterior = UP_Z;
xyz[2] = vj->zvent1_orig - VENT_EPS;
if(InExterior(xyz)==1)vj->wall_type = DOWNwall;
break;
case DOWN_Z:
xyz[0] = (vj->xvent1_orig - vj->xvent2_orig) / 2.0;
xyz[0] = (vj->xvent1_orig + vj->xvent2_orig) / 2.0;
xyz[1] = (vj->yvent1_orig + vj->yvent2_orig) / 2.0;
xyz[2] = vj->zvent1_orig + VENT_EPS;
if(InExterior(xyz)==1)vj->isExterior = DOWN_Z;
xyz[2] = vj->zvent1_orig + VENT_EPS;
if(InExterior(xyz)==1)vj->wall_type = UPwall;
break;
default:
vj->isExterior = -1;
vj->wall_type = INTERIORwall;
}
}
}
Expand Down Expand Up @@ -11092,7 +11092,7 @@ typedef struct {
vi->usecolorindex=0;
vi->nshowtime=0;
vi->isOpenvent=0;
vi->isExterior = -1;
vi->wall_type = INTERIORwall;
vi->isMirrorvent = 0;
vi->hideboundary=0;
vi->surf[0]=vent_surfacedefault;
Expand Down
9 changes: 3 additions & 6 deletions Source/smokeview/smv_geometry.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,12 +475,9 @@ int InExterior(float *xyz){
x = xyz[0];
y = xyz[1];
z = xyz[2];
if(x < xbar0FDS - MESH_EPS)return 1;
if(x > xbarFDS + MESH_EPS)return 1;
if(y < ybar0FDS - MESH_EPS)return 1;
if(y > ybarFDS + MESH_EPS)return 1;
if(z < zbar0FDS - MESH_EPS)return 1;
if(z > zbarFDS + MESH_EPS)return 1;
if(x < xbar0FDS - MESH_EPS || x > xbarFDS + MESH_EPS)return 1;
if(y < ybar0FDS - MESH_EPS || y > ybarFDS + MESH_EPS)return 1;
if(z < zbar0FDS - MESH_EPS || z > zbarFDS + MESH_EPS)return 1;
for(i = 0;i < nmeshes;i++){
meshdata *meshi;

Expand Down
2 changes: 1 addition & 1 deletion Source/smokeview/structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ typedef struct _ventdata {
int dir,dir2,vent_id;
int useventcolor;
int isOpenvent, isMirrorvent;
int isExterior;
int wall_type;
float xvent1_orig, xvent2_orig;
float yvent1_orig, yvent2_orig;
float zvent1_orig, zvent2_orig;
Expand Down
Loading