Support inp in energy, emitter

This commit is contained in:
WQY\qiong
2023-03-15 23:47:06 +08:00
parent f79a9cdae8
commit b35fccad49
4 changed files with 47 additions and 3 deletions

View File

@@ -89,6 +89,19 @@ def inp_in_emitter(section: list[str]) -> ChangeSet:
return cs
def inp_in_emitter_new(name: str, line: str) -> None:
tokens = line.split()
num = len(tokens)
has_desc = tokens[-1].startswith(';')
num_without_desc = (num - 1) if has_desc else num
junction = str(tokens[0])
coefficient = float(tokens[1])
write(name, f"\ninsert into emitters (junction, coefficient) values ('{junction}', {coefficient});")
def inp_out_emitter(name: str) -> list[str]:
lines = []
objs = read_all(name, 'select * from emitters')