forked from calculix/CalculiX-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
executable file
·40 lines (39 loc) · 1.11 KB
/
test.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
#!/usr/bin/python
"""
Test for the pillow example
"""
#from subprocess import call
import os
import pylab
import numpy
import re
# The example is run for four element types
eltyps={"S8":"qu8",
"S8R":"qu8r",
"S4":"qu4",
"S4R":"qu4r"}
# read the template fbd file
f = open("run.fbd","r")
lines=f.readlines()
f.close()
# loop over element types
for elty in eltyps.keys():
# open results summary file
print elty
# read pre.fbd and write it to pre-auto.fbd
fout = open("run_auto.fbd", "w")
fout.write("text "+elty+"\n")
for line in lines:
# set element type
if line.startswith("valu Etyp"):
line="valu Etyp "+eltyps[elty]+"\n"
fout.write(line)
fout.write("quit\n")
fout.close()
# run run_auto.fbd (preprocessing, solving and postprocessing)
os.system("cgx -b run_auto.fbd")
# store the images.
os.system("../Scripts/monitor.py static")
os.system("mv expanded.png Refs/expanded-"+elty.lower()+".png")
os.system("mv cuty0.png Refs/cuty0-"+elty.lower()+".png")
os.system("mv static.png Refs/static-"+elty.lower()+".png")