Further tweak to handle pml formulation and CLI

这个提交包含在:
Craig Warren
2023-09-04 11:38:15 +01:00
父节点 fb14166e1d
当前提交 e33163bbf9

查看文件

@@ -121,7 +121,6 @@ def process_singlecmds(singlecmds):
scene_objects.append(tw) scene_objects.append(tw)
cmd = "#pml_formulation" cmd = "#pml_formulation"
pml_formulation = None
if singlecmds[cmd] is not None: if singlecmds[cmd] is not None:
tmp = singlecmds[cmd].split() tmp = singlecmds[cmd].split()
if len(tmp) != 1: if len(tmp) != 1:
@@ -137,16 +136,24 @@ def process_singlecmds(singlecmds):
logger.exception(f"{cmd} requires either one or six parameter(s)") logger.exception(f"{cmd} requires either one or six parameter(s)")
raise ValueError raise ValueError
if len(tmp) == 1: if pml_formulation in locals():
pml_cells = PMLProps(formulation=pml_formulation, thickness=int(tmp[0])) if len(tmp) == 1:
pml_props = PMLProps(formulation=pml_formulation, thickness=int(tmp[0]))
else:
pml_props = PMLProps(
formulation=pml_formulation,
x0=int(tmp[0]), y0=int(tmp[1]), z0=int(tmp[2]),
xmax=int(tmp[3]), ymax=int(tmp[4]), zmax=int(tmp[5])
)
else: else:
pml_cells = PMLProps( if len(tmp) == 1:
formulation=pml_formulation, pml_props = PMLProps(thickness=int(tmp[0]))
x0=int(tmp[0]), y0=int(tmp[1]), z0=int(tmp[2]), else:
xmax=int(tmp[3]), ymax=int(tmp[4]), zmax=int(tmp[5]) pml_props = PMLProps(
) x0=int(tmp[0]), y0=int(tmp[1]), z0=int(tmp[2]), xmax=int(tmp[3]), ymax=int(tmp[4]), zmax=int(tmp[5])
)
scene_objects.append(pml_cells) scene_objects.append(pml_props)
cmd = "#src_steps" cmd = "#src_steps"
if singlecmds[cmd] is not None: if singlecmds[cmd] is not None: