Skip to content

Commit

Permalink
Merge pull request #2086 from gforney/patch
Browse files Browse the repository at this point in the history
parse OBST keyword for blockage face visiblity info
  • Loading branch information
gforney authored Nov 1, 2024
2 parents 413d9a5 + 84d4329 commit 73e6a9c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 19 deletions.
8 changes: 3 additions & 5 deletions Source/shared/shared_structures.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ typedef struct _meshdata {
int zdist_flag;
unsigned char *iblank_smoke3d;
int iblank_smoke3d_defined;
struct _blockagedata **blockageinfoptrs;
struct _blockagedata **bc_faces[6];
struct _blockagedata **blockageinfoptrs, *blockageinfo, **bc_faces[6];
int n_bc_faces[6];
int *obst_bysize;
struct _ventdata *ventinfo;
Expand Down Expand Up @@ -277,10 +276,9 @@ typedef struct _meshdata {
float norm[3];
float dplane_min[4], dplane_max[4];

struct _meshdata *skip_nabors[6];

struct _meshdata *nabors[6];
struct _meshdata *skip_nabors[6], *nabors[6];
struct _supermeshdata *super;

int *ptype;
unsigned int *zipoffset, *zipsize;

Expand Down
1 change: 1 addition & 0 deletions Source/smokeview/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define pp_GPU // support the GPU
#define pp_THREAD // turn on multi-threading
//#define pp_FDS // create a 1 mesh input file
#define pp_HIDDEN6 // handle hidden6 info on obst line

#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
26 changes: 16 additions & 10 deletions Source/smokeview/readsmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ void InitMesh(meshdata *meshi){
meshi->zheat = NULL;
meshi->theat = NULL;
meshi->blockageinfoptrs = NULL;
meshi->blockageinfo = NULL;

meshi->faceinfo = NULL;
meshi->face_normals_single = NULL;
Expand Down Expand Up @@ -9251,14 +9252,6 @@ int ReadSMV_Parse(bufferstreamdata *stream){
float *xplt_cen, *yplt_cen,*zplt_cen;
int *imap, *jmap, *kmap;

// int lenbuffer;

// TrimBack(buffer);
// lenbuffer=strlen(buffer);
// if(lenbuffer>4){
// if(buffer[5]!=' ')continue;
// }

igrid++;
if(meshinfo!=NULL){
size_t len_meshlabel;
Expand Down Expand Up @@ -10593,6 +10586,7 @@ typedef struct {
meshi->blockageinfoptrs=NULL;
if(n_blocks_normal>0){
NewMemory((void **)&meshi->blockageinfoptrs,sizeof(blockagedata *)*n_blocks_normal);
NewMemory(( void ** )&meshi->blockageinfo, sizeof(blockagedata) *n_blocks_normal);
}

ntotal_blockages+=n_blocks_normal;
Expand All @@ -10606,8 +10600,7 @@ typedef struct {
continue;
}
nn++;
meshi->blockageinfoptrs[nn]=NULL;
NewMemory((void **)&meshi->blockageinfoptrs[nn],sizeof(blockagedata));
meshi->blockageinfoptrs[nn] = meshi->blockageinfo + nn;
bc=meshi->blockageinfoptrs[nn];
InitObst(bc,surfacedefault,nn+1,iobst-1);
FGETS(buffer,255,stream);
Expand Down Expand Up @@ -10747,12 +10740,25 @@ typedef struct {
FGETS(buffer,255,stream);
{
char *exclaim;
int hidden6[6] = {-1,-1,-1,-1,-1,-1};

memcpy(bc->hidden6, hidden6, 6*sizeof(int));
exclaim = strchr(buffer, '!');
if(exclaim != NULL){
exclaim[0] = 0;
exclaim = TrimFront(exclaim + 1);
if(exclaim[0] == 'T' || exclaim[0] == 't')have_removable_obsts = 1;
exclaim++;
if(strlen(exclaim) > 0){
sscanf(exclaim, "%i %i %i %i %i %i",
hidden6, hidden6 + 1, hidden6 + 2, hidden6 + 3, hidden6 + 4, hidden6 + 5);
int ii;
for(ii = 0; ii < 6; ii++){
if(hidden6[i] >= 0)hidden6[ii] = 1 - hidden6[ii];
}
memcpy(bc->hidden6, hidden6, 6*sizeof(int));
if(hidden6[0] >= 0)have_hidden6 = 1;
}
}
}
ijk = bc->ijk;
Expand Down
2 changes: 0 additions & 2 deletions Source/smokeview/smokeheaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,6 @@ EXTERNCPP void CreatePartBoundFile(partdata *parti);
EXTERNCPP void InitRolloutList(void);
EXTERNCPP void GetTourXYZ(float t, tourdata *this_tour, float *xyz);
EXTERNCPP int GetTourFrame(tourdata *touri, int itime);
EXTERNCPP int MeshConnect(meshdata *mesh_from, int val, meshdata *mesh_to);
EXTERNCPP int IsBottomMesh(meshdata *mesh_from);
EXTERNCPP void *InitNabors(void *arg);
EXTERNCPP int Smv2Html(char *html_out, int option, int from_where);
EXTERNCPP int Smv2Geom(char *html_file);
Expand Down
1 change: 1 addition & 0 deletions Source/smokeview/smokeviewvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ SVEXTERN int SVDECL(cullfaces,1);
SVEXTERN int SVDECL(showonly_hiddenfaces,0);
SVEXTERN int SVDECL(have_removable_obsts, 0);
SVEXTERN int SVDECL(update_bound_chop_data, 0);
SVEXTERN int SVDECL(have_hidden6, 0);

SVEXTERN int SVDECL(windowresized,0);

Expand Down
12 changes: 10 additions & 2 deletions Source/smokeview/update.c
Original file line number Diff line number Diff line change
Expand Up @@ -3024,14 +3024,21 @@ void UpdateDisplay(void){
meshi->c_iblank_z0 = meshi->c_iblank_z0_temp;
}
INIT_PRINT_TIMER(timer_hidden_blockages);
int nhidden_faces = 0;
int nhidden_faces = 0, ntotal_obsts = 0;
for(ig = 0; ig < nmeshes; ig++){
meshdata *meshi;
int j;

meshi = meshinfo + ig;
void SetHiddenBlockages(meshdata *meshi);
#ifdef pp_HIDDEN6
if(have_hidden6 == 0){
if(ig == 0)printf("setting hidden blockages\n");
SetHiddenBlockages(meshi);
}
#else
SetHiddenBlockages(meshi);
#endif
for(j = 0; j < meshi->nbptrs; j++){
blockagedata *bc;

Expand All @@ -3043,8 +3050,9 @@ void UpdateDisplay(void){
if(bc->hidden6[4] == 1)nhidden_faces++;
if(bc->hidden6[5] == 1)nhidden_faces++;
}
ntotal_obsts += meshi->nbptrs;
}
if(nhidden_faces > 0)printf("%i blockage faces out of %i hidden\n", nhidden_faces, 6*ntotal_blockages);
if(nhidden_faces > 0)printf("%i blockage faces out of %i hidden\n", nhidden_faces, 6*ntotal_obsts);
PRINT_TIMER(timer_hidden_blockages, "SetHiddenBlockages");
update_make_iblank = 0;
update_setvents = 1;
Expand Down

0 comments on commit 73e6a9c

Please sign in to comment.