mirror of
https://gitlab.com/scemama/eplf
synced 2024-12-22 04:14:17 +01:00
Improved eplf_edit
This commit is contained in:
parent
7f41a82af0
commit
ce393c8324
@ -191,11 +191,6 @@ def write_main_file(file,inp):
|
|||||||
print >>file, "# %s"%(inp.name)
|
print >>file, "# %s"%(inp.name)
|
||||||
print >>file, "####################"
|
print >>file, "####################"
|
||||||
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)
|
compute = filter(lambda x: x.startswith("compute"),rw_data)
|
||||||
print >>file, "# Clear"
|
print >>file, "# Clear"
|
||||||
print >>file, "# --------------------\n"
|
print >>file, "# --------------------\n"
|
||||||
@ -205,12 +200,18 @@ def write_main_file(file,inp):
|
|||||||
print >>file, ""
|
print >>file, ""
|
||||||
print >>file, "# Computation"
|
print >>file, "# Computation"
|
||||||
print >>file, "# --------------------\n"
|
print >>file, "# --------------------\n"
|
||||||
compute = filter(lambda x: not x.endswith("_grad"),compute)
|
print >>file, "nproc = %d"%(inp.nproc)
|
||||||
compute = filter(lambda x: not x.endswith("_lapl"),compute)
|
print >>file, ""
|
||||||
for p in compute:
|
for p in compute:
|
||||||
x = ' '
|
x = ' '
|
||||||
exec "if inp.%s: x = 'X'"%(p)
|
exec "if inp.%s: x = 'X'"%(p)
|
||||||
print >>file, "(%s) %s"%(x,p[8:])
|
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
|
## Execute temporary input file
|
||||||
@ -221,7 +222,7 @@ def read_main_file(file,inp):
|
|||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
if line == "":
|
if line == "" or line[0] == "#":
|
||||||
pass
|
pass
|
||||||
elif line[0] == "(":
|
elif line[0] == "(":
|
||||||
line = line.replace("( ) ","=False inp.compute_")
|
line = line.replace("( ) ","=False inp.compute_")
|
||||||
@ -232,6 +233,8 @@ def read_main_file(file,inp):
|
|||||||
elif line.startswith("edit") \
|
elif line.startswith("edit") \
|
||||||
or line.startswith("clear"):
|
or line.startswith("clear"):
|
||||||
line = line.replace("(","('").replace(")","',inp)").lower()
|
line = line.replace("(","('").replace(")","',inp)").lower()
|
||||||
|
else:
|
||||||
|
line = "inp."+line
|
||||||
exec line
|
exec line
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user