Skip to content

Commit

Permalink
Merge pull request #355 from gforney/master
Browse files Browse the repository at this point in the history
preliminary incorporation of dem2fds into smokebot
  • Loading branch information
gforney authored Aug 10, 2017
2 parents 3b8dc1e + 4ede13f commit 274a429
Show file tree
Hide file tree
Showing 24 changed files with 298 additions and 96 deletions.
9 changes: 9 additions & 0 deletions Manuals/Bibliography/FDS_general.bib
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,15 @@ @BOOK{Siegel:1
year = {2002},
}

@ARTICLE{Simms:1963,
author = {D.L. Simms and J.E. Coiley},
title = {{Some radiation characteristics of a gas-fired panel}},
journal = {British Journal of Applied Physics},
volume = 14,
pages = {292-294},
year = 1963
}

@PHDTHESIS{Sippola:2002,
author = {M. Sippola},
title = {{Particle Deposition in Ventilation Ducts}},
Expand Down
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Manuals/SMV_Utilities_Guide/FIGURES/doc.pdf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -259,27 +259,27 @@ \chapter{Introduction}

%------------------------ background ------------------------------------------------

\input{background}
\input{../SMV_User_Guide/background}

%------------------------ bots ------------------------------------------------

\chapter{bots - firebot, smokebot and cfastbot, scripts for verifying fds, smokeview and cfast}

%------------------------ dem2fds ------------------------------------------------

\input{dem2fds}
\input{../SMV_User_Guide/dem2fds}

%------------------------ smokediff ------------------------------------------------

\input{smokediff}
\input{../SMV_User_Guide/smokediff}

%------------------------ smokezip ------------------------------------------------

\input{smokezip}
\input{../SMV_User_Guide/smokezip}

%------------------------ wind2fds ------------------------------------------------

\input{wind2fds}
\input{../SMV_User_Guide/wind2fds}


%---------------------------------------------------------------------------------
Expand Down
26 changes: 26 additions & 0 deletions Manuals/SMV_Utilities_Guide/make_guide.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@echo off
set paper=SMV_Utilities_Guide

Title Building %paper%

git describe --long --dirty > gitinfo.txt
set /p gitrevision=<gitinfo.txt
echo \newcommand^{\gitrevision^}^{%gitrevision%^} > ..\Bibliography\gitrevision.tex

echo pass 1
pdflatex -interaction nonstopmode %paper% > %paper%.err
bibtex %paper% > %paper%.err
echo pass 2
pdflatex -interaction nonstopmode %paper% > %paper%.err
echo pass 3
pdflatex -interaction nonstopmode %paper% > %paper%.err

find "! LaTeX Error:" %paper%.err
find "Fatal error" %paper%.err
find "Error:" %paper%.err

if exist ..\Bibliography\gitrevision.tex erase ..\Bibliography\gitrevision.tex
echo %paper% build complete
pause


47 changes: 47 additions & 0 deletions Manuals/SMV_Utilities_Guide/make_guide.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# Add LaTeX search path; Paths are ':' separated
export TEXINPUTS=".:../LaTeX_Style_Files:"

clean_build=1
GUIDE=SMV_Utilities_Guide

# Build SMV Utilities Guide

gitrevision=`git describe --long --dirty`
echo "\\newcommand{\\gitrevision}{$gitrevision}" > ../Bibliography/gitrevision.tex

pdflatex -interaction nonstopmode $GUIDE &> $GUIDE.err
bibtex $GUIDE &> $GUIDE.err
pdflatex -interaction nonstopmode $GUIDE &> $GUIDE.err
pdflatex -interaction nonstopmode $GUIDE &> $GUIDE.err

# Scan and report any errors in the LaTeX build process
if [[ `grep -E "Undefined control sequence|Error:|Fatal error|! LaTeX Error:|Paragraph ended before|Missing \\\$ inserted|Misplaced" -I $GUIDE.err | grep -v "xpdf supports version 1.5"` == "" ]]
then
# Continue along
:
else
echo "LaTeX errors detected:"
grep -A 1 -E "Undefined control sequence|Error:|Fatal error|! LaTeX Error:|Paragraph ended before|Missing \\\$ inserted|Misplaced" -I $GUIDE.err | grep -v "xpdf supports version 1.5"
clean_build=0
fi

# Check for LaTeX warnings (undefined references or duplicate labels)
if [[ `grep -E "undefined|multiply defined|multiply-defined" -I $GUIDE.err` == "" ]]
then
# Continue along
:
else
echo "LaTeX warnings detected:"
grep -E "undefined|multiply defined|multiply-defined" -I $GUIDE.err
clean_build=0
fi

if [[ $clean_build == 0 ]]
then
:
else
echo "SMV Utilities Guide built successfully!"
fi
rm -f ../Bibliography/gitrevision.tex
49 changes: 31 additions & 18 deletions Source/shared/file_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,41 +436,42 @@ void OutputFileBuffer(filedata *fileinfo){
}
}

/* ------------------ MergeFileBuffers ------------------------ */
/* ------------------ AppendFileBuffer ------------------------ */

int MergeFileBuffers(filedata *fileto, filedata *filefrom){
char *new_buffer, *new_buffer2, **new_lines;
int AppendFileBuffer(filedata *file1, filedata *file2){
char *new_buffer, *new_buffer1, *new_buffer2, **new_lines;
int new_filesize, new_nlines, i;

new_filesize = filefrom->filesize+fileto->filesize;
new_filesize = file1->filesize + file2->filesize;
if(NewMemory((void **)&new_buffer, new_filesize)==0){
readfile_option = READFILE;
return -1;
}
new_buffer2 = new_buffer+fileto->filesize;
memcpy(new_buffer, fileto->buffer, fileto->filesize);
memcpy(new_buffer2, filefrom->buffer, filefrom->filesize);
new_buffer1 = new_buffer;
new_buffer2 = new_buffer + file1->filesize;
memcpy(new_buffer1, file1->buffer, file1->filesize);
memcpy(new_buffer2, file2->buffer, file2->filesize);

new_nlines = filefrom->nlines+fileto->nlines;
new_nlines = file1->nlines+file2->nlines;
if(NewMemory((void **)&new_lines, new_nlines*sizeof(char *))==0){
FREEMEMORY(new_buffer);
readfile_option = READFILE;
return -1;
}

for(i = 0;i<fileto->nlines;i++){
new_lines[i] = new_buffer+(fileto->lines[i]-fileto->buffer);
for(i = 0;i<file1->nlines;i++){
new_lines[i] = file1->lines[i] + (new_buffer - file1->buffer);
}
for(i = 0;i<filefrom->nlines;i++){
new_lines[i+fileto->nlines] = new_buffer2+(filefrom->lines[i]-filefrom->buffer);
for(i = 0;i<file2->nlines;i++){
new_lines[i+file1->nlines] = file2->lines[i] + (new_buffer2 - file2->buffer);
}

FREEMEMORY(fileto->buffer);
FREEMEMORY(fileto->lines);
fileto->buffer = new_buffer;
fileto->lines = new_lines;
fileto->filesize = new_filesize;
fileto->nlines = new_nlines;
FREEMEMORY(file1->buffer);
FREEMEMORY(file1->lines);
file1->buffer = new_buffer;
file1->lines = new_lines;
file1->filesize = new_filesize;
file1->nlines = new_nlines;
return 0;
}

Expand Down Expand Up @@ -543,7 +544,19 @@ filedata *File2Buffer(char *filename){
}
#endif

/* ------------------ FileExistsOrig ------------------------ */

int FileExistsOrig(char *filename){
if(ACCESS(filename, F_OK) == -1){
return NO;
}
else{
return YES;
}
}

/* ------------------ FileExists ------------------------ */

#ifdef pp_FILELIST
int FileExists(char *filename, filelistdata *filelist, int nfilelist, filelistdata *filelist2, int nfilelist2){
#else
Expand Down
12 changes: 11 additions & 1 deletion Source/shared/file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
#ifdef pp_LINUX
#include <unistd.h>
#endif
#ifndef WIN32
#include <sys/stat.h>
#endif

#ifdef WIN32
#define UNLINK _unlink
Expand Down Expand Up @@ -86,7 +89,7 @@ else{\
#endif

#ifdef pp_READBUFFER
EXTERNCPP int MergeFileBuffers(filedata *fileto, filedata *filefrom);
EXTERNCPP int AppendFileBuffer(filedata *file1, filedata *file2);
EXTERNCPP int FeofBuffer(filedata *fileinfo);
EXTERNCPP char *FgetsBuffer(filedata *fileinfo,char *buffer,int size);
EXTERNCPP void RewindFileBuffer(filedata *fileinfo);
Expand Down Expand Up @@ -119,6 +122,13 @@ EXTERNCPP int Writable(char *dir);
#define FILE_EXISTS(a) FileExists(a)
#define FILE_EXISTS_CASEDIR(a) FileExists(a)
#endif
int FileExistsOrig(char *filename);

#ifdef WIN32
#define MKDIR(a) CreateDirectory(a,NULL)
#else
#define MKDIR(a) mkdir(a,S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
#endif

#ifdef WIN32
#define ACCESS _access
Expand Down
1 change: 0 additions & 1 deletion Source/smokeview/IOpart.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,6 @@ void get_partdata(partdata *parti, int partframestep_local, int nf_all, float *r
fclose(PART5FILE);
}


/* ------------------ write_part_histogram ------------------------ */

void write_part_histogram(partdata *parti){
Expand Down
62 changes: 52 additions & 10 deletions Source/smokeview/IOzone.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ void readzone(int ifile, int flag, int *errorcode){
FREEMEMORY(zonefdiam);
FREEMEMORY(zonefbase);
FREEMEMORY(izonetu);
#ifdef pp_ZONETL
FREEMEMORY(izonetl);
#endif
FREEMEMORY(zoneodl);
FREEMEMORY(zoneodu);
FREEMEMORY(zoneslab_n);
Expand Down Expand Up @@ -785,6 +788,13 @@ void readzone(int ifile, int flag, int *errorcode){
*errorcode=1;
return;
}
#ifdef pp_ZONETL
FREEMEMORY(izonetl);
if(NewMemory((void **)&izonetl, ntotal * sizeof(unsigned char)) == 0){
*errorcode = 1;
return;
}
#endif
}
else{
return;
Expand Down Expand Up @@ -851,6 +861,10 @@ void readzone(int ifile, int flag, int *errorcode){
update_glui_zonebounds();
GetZoneColors(zonetu, ntotal, izonetu, zonemin, zonemax, nrgb, nrgb_full,
colorlabelzone, zonescale, zonelevels256);
#ifdef pp_ZONETL
GetZoneColors(zonetl, ntotal, izonetl, zonemin, zonemax, nrgb, nrgb_full,
colorlabelzone, zonescale, zonelevels256);
#endif

ReadZoneFile=1;
visZone=1;
Expand Down Expand Up @@ -1957,11 +1971,17 @@ void drawfiredata(void){
void drawroomdata(void){
float xroom0, yroom0, zroom0, xroom, yroom, zroom;
float *zoneylaybase,dy;
unsigned char *hazardcolorbase, *zonecolorbase;
unsigned char *hazardcolorbase, *zonecolorbaseU;
#ifdef pp_ZONETL
unsigned char *zonecolorbaseL;
#endif
float ylay;
float *colorv;
unsigned char color;
float *colorvU;
unsigned char *izonetubase;
#ifdef pp_ZONETL
unsigned char *izonetlbase;
float *colorvL;
#endif
int i;

if(zone_times[0]>global_times[itimes])return;
Expand All @@ -1970,14 +1990,20 @@ void drawroomdata(void){
if(use_transparency_data==1)TransparentOn();

izonetubase = izonetu + izone*nrooms;
#ifdef pp_ZONETL
izonetlbase = izonetl + izone*nrooms;
#endif
hazardcolorbase = hazardcolor + izone*nrooms;
zoneylaybase = zoneylay + izone*nrooms;

if(zonecolortype==ZONEHAZARD_COLOR){
zonecolorbase=hazardcolorbase;
zonecolorbaseU=hazardcolorbase;
}
else{
zonecolorbase=izonetubase;
zonecolorbaseU=izonetubase;
#ifdef pp_ZONETL
zonecolorbaseL = izonetlbase;
#endif
}

#ifdef pp_GPU
Expand All @@ -1987,16 +2013,24 @@ void drawroomdata(void){
#endif
for(i=0;i<nrooms;i++){
roomdata *roomi;
unsigned char colorU;
#ifdef pp_ZONETL
unsigned char colorL;
#endif

roomi = roominfo + i;

ylay = *(zoneylaybase+i);
color = *(zonecolorbase+i);
colorU = *(zonecolorbaseU+i);
if(zonecolortype==ZONEHAZARD_COLOR){
colorv = rgbhazard[color];
colorvU = rgbhazard[colorU];
}
else{
colorv = rgb_full[color];
colorvU = rgb_full[colorU];
#ifdef pp_ZONETL
colorL = *(zonecolorbaseL+i);
colorvL = rgb_full[colorL];
#endif
}
xroom0 = roomi->x0;
yroom0 = roomi->y0;
Expand All @@ -2020,7 +2054,7 @@ void drawroomdata(void){
}
else{
if(visHZone==1){
glColor4fv(colorv);
glColor4fv(colorvU);
glBegin(GL_QUADS);
glVertex3f(xroom0,yroom0,ylay+zroom0);
glVertex3f(xroom,yroom0,ylay+zroom0);
Expand All @@ -2029,12 +2063,20 @@ void drawroomdata(void){
glEnd();
}
if(visVZone==1){
glColor4fv(colorv);
glBegin(GL_QUADS);
glColor4fv(colorvU);
glVertex3f(xroom0,yroom0+dy,ylay+zroom0);
glVertex3f(xroom,yroom0+dy,ylay+zroom0);
glVertex3f(xroom, yroom0+dy,zroom);
glVertex3f(xroom0,yroom0+dy,zroom);

if(show_zonelower == 1&&zonecolortype!=ZONEHAZARD_COLOR){
glColor4fv(colorvL);
glVertex3f(xroom0, yroom0 + dy, zroom0);
glVertex3f(xroom, yroom0 + dy, zroom0);
glVertex3f(xroom, yroom0 + dy, zroom0 + ylay);
glVertex3f(xroom0, yroom0 + dy, zroom0 + ylay);
}
glEnd();
}
}
Expand Down
Loading

0 comments on commit 274a429

Please sign in to comment.