-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
88 lines (77 loc) · 3.25 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#-----------------------------------------------------------------------
# Copyright (C) 2021, All rights reserved
#
# Peng Wang
#
#-----------------------------------------------------------------------
#=======================================================================
#
# DESCRIPTION:
# This software is developed to analyze and visualize evacuation simulation results from Fire Dynamics Simulator with Evacuation (FDS+Evac).
# FDS+Evac is an open source software package developed by NIST. The source
# code is available at: https://github.com/firemodels/fds
#
import os
from sys import argv, exit
from read_evac import *
print("================================")
print ("Length of input parameters:", len(argv))
print("================================")
# The program will first read prt5 data and then visualize it.
if len(argv)==2:
file1 = argv[1]
if file1:
if os.path.exists(file1):
print ('load .fds file and extract evac-related information', file1)
CHID=readCHID(file1)
print CHID
# The following lines are effective only for the latest version of fds as well as fds6_dump205.exe
# If you are using the old version of fds, please modify the code to read evac prt5 file.
readPRTfile(CHID+'_evac_0001.prt5')
visualizeEvac(CHID+'_evac_0001.npz', file1)
else:
print ("Input file %s does not exist!" %file1)
exit(-1)
else
print ('Show help info in readme.txt!')
if os.path.exists("readme.txt"):
for line in open("readme.txt"):
print (line)
else:
print ("The file readme.txt is not in this folder.")
print ("Please search readme.txt in other folders and read it.")
exit(-1)
# flag is either /readonly or /showonly
# If no flag is given, the program will first read prt5 data and then visualize it.
if len(argv)==3:
file1 = argv[1]
flag = argv[2]
if file1:
if os.path.exists(file1):
print ('load .fds file and extract evac-related information', file1)
CHID=readCHID(file1)
print CHID
# The following lines are effective only for the latest version of fds as well as fds6_dump205.exe
# If you are using the old version of fds, please modify the code to read evac prt5 file.
if flag == '/readonly':
readPRTfile(CHID+'_evac_0001.prt5')
elif flag == '/showonly':
visualizeEvac(CHID+'_evac_0001.npz', file1)
else:
print ("The parameter is not accepted. Please browse readme.txt.")
else:
print ("Input file %s does not exist!" %file1)
exit(-1)
else:
print ('Show help info in readme.txt!')
if os.path.exists("readme.txt"):
for line in open("readme.txt"):
print (line)
else:
print ("The file readme.txt is not in this folder.")
print ("Please search readme.txt in other folders and read it.")
exit(-1)
if len(argv)>3:
print("Too many input parameters!")
print("Please browse readme.txt.")
exit(-1)