1 """Copyright (C) 2016 Joakim A. Taby 3 This program is free software: you can redistribute it and/or modify 4 it under the terms of the GNU General Public License as published by 5 the Free Software Foundation, either version 3 of the License. 7 This program is distributed in the hope that it will be useful, 8 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 GNU General Public License for more details. 12 You should have received a copy of the GNU General Public License 13 along with this program. If not, see <http://www.gnu.org/licenses/>.""" 20 obligatory_keyword = [
"LayerType"]
21 optional_keyword = [
"TypicalCurvature",
"LayerRadii",
"TypicalTension",
22 "LayAngle",
"CompNumber",
"YoungsModulus",
"Thickness",
23 "Width",
"Poisson",
"InitialGap",
"FrictionFactor",
24 "InternalPressureLayer",
"ExternalPressureLayer"]
39 typical_curvature =
None 40 typical_tension =
None 43 inputfile_object = open(inputfile,
'r') 44 tmp_input_content = inputfile_object.readlines() 46 for line
in tmp_input_content:
47 tmp=line.split(commentchar,1)[0]
49 input_content.append(line.split(commentchar,1)[0])
51 for line
in input_content:
52 if line[0] == commentchar:
54 elif line[0:1] ==
"\n":
57 elif line.find(
"LayerRadii") > -1:
58 index = line.find(delimiter)
59 tmp = line[index + 1: len(line) - 1]
65 layer_radii.append(float(i))
67 elif line.find(
"LayerType") > -1:
68 index = line.find(delimiter)
69 tmp = line[index + 1: len(line) - 1]
75 layer_type.append(str(i))
77 elif line.find(
"Thickness") > -1:
78 index = line.find(delimiter)
79 tmp = line[index + 1: len(line) - 1]
85 thickness.append(float(i))
87 elif line.find(
"InitialGap") > -1:
88 index = line.find(delimiter)
89 tmp = line[index + 1: len(line) - 1]
95 gap_ini.append(float(i))
97 elif line.find(
"YoungsModulus") > -1:
98 index = line.find(delimiter)
99 tmp = line[index + 1: len(line) - 1]
105 youngs_modulus.append(float(i))
107 elif line.find(
"Poisson") > -1:
108 index = line.find(delimiter)
109 tmp = line[index + 1: len(line) - 1]
115 poisson.append(float(i))
117 elif line.find(
"FrictionFactor") > -1:
118 index = line.find(delimiter)
119 tmp = line[index + 1: len(line) - 1]
125 fric_fac.append(float(i))
127 elif line.find(
"LayAngle") > -1:
128 index = line.find(delimiter)
129 tmp = line[index + 1:len(line) - 1]
135 lay_angle.append(float(i))
137 elif line.find(
"CompNumber") > -1:
138 index = line.find(delimiter)
139 tmp = line[index + 1:len(line) - 1]
145 comp_number.append(float(i))
147 elif line.find(
"Width") > -1:
148 index = line.find(delimiter)
149 tmp = line[index + 1:len(line) - 1]
155 width.append(float(i))
157 elif line.find(
"InternalPressureLayer") > -1:
158 index = line.find(delimiter)
159 intpresslayer = int(line[index + 1:len(line) - 1])
161 elif line.find(
"ExternalPressureLayer") > -1:
162 index = line.find(delimiter)
163 extpresslayer = int(line[index + 1:len(line) - 1])
165 elif line.find(
"TypicalTension") > -1:
166 index = line.find(delimiter)
167 typical_tension = float(line[index + 1:len(line) - 1])
169 elif line.find(
"TypicalCurvature") > -1:
170 index = line.find(delimiter)
171 typical_curvature = float(line[index + 1:len(line) - 1])
174 tmp = line.split(delimiter)
175 print(
'Keyword "%s" not recognized' % (tmp[0]))
176 inputfile_object.close()
178 thickness, gap_ini, youngs_modulus, poisson, fric_fac,
179 lay_angle, comp_number, width,
180 intpresslayer, extpresslayer,
181 typical_tension, typical_curvature)
186 def parser(arguments, delimiter, commentchar):
187 if arguments[1] ==
"-a":
189 print(
"Analytical results anticipated")
192 elif arguments[1] ==
"n":
193 print(
"Results from local analyses anticipated")
195 print(
"Not a valid option (yet)")
def parser(arguments, delimiter, commentchar)
def analytical_input(inputfile, delimiter, commentchar)