10
0
mirror of https://gitlab.com/scemama/eplf synced 2024-12-22 04:14:17 +01:00

Improved eplf_edit

This commit is contained in:
Anthony Scemama 2010-06-29 13:47:45 +02:00
parent 7f41a82af0
commit ce393c8324

View File

@ -191,11 +191,6 @@ def write_main_file(file,inp):
print >>file, "# %s"%(inp.name)
print >>file, "####################"
print >>file, ""
print >>file, "# Edit"
print >>file, "# --------------------\n"
print >>file, '# edit(geometry)'
print >>file, '# edit(grid_parameters)'
print >>file, ""
compute = filter(lambda x: x.startswith("compute"),rw_data)
print >>file, "# Clear"
print >>file, "# --------------------\n"
@ -205,12 +200,18 @@ def write_main_file(file,inp):
print >>file, ""
print >>file, "# Computation"
print >>file, "# --------------------\n"
compute = filter(lambda x: not x.endswith("_grad"),compute)
compute = filter(lambda x: not x.endswith("_lapl"),compute)
print >>file, "nproc = %d"%(inp.nproc)
print >>file, ""
for p in compute:
x = ' '
exec "if inp.%s: x = 'X'"%(p)
print >>file, "(%s) %s"%(x,p[8:])
print >>file, ""
print >>file, "# Edit"
print >>file, "# --------------------\n"
print >>file, '# edit(geometry)'
print >>file, '# edit(grid_parameters)'
print >>file, ""
## Execute temporary input file
@ -221,7 +222,7 @@ def read_main_file(file,inp):
lines = file.readlines()
for line in lines:
line = line.lstrip()
if line == "":
if line == "" or line[0] == "#":
pass
elif line[0] == "(":
line = line.replace("( ) ","=False inp.compute_")
@ -232,6 +233,8 @@ def read_main_file(file,inp):
elif line.startswith("edit") \
or line.startswith("clear"):
line = line.replace("(","('").replace(")","',inp)").lower()
else:
line = "inp."+line
exec line