From e33163bbf9d18818cc9bd5b9c30b3ee389341534 Mon Sep 17 00:00:00 2001 From: Craig Warren Date: Mon, 4 Sep 2023 11:38:15 +0100 Subject: [PATCH] Further tweak to handle pml formulation and CLI --- gprMax/hash_cmds_singleuse.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/gprMax/hash_cmds_singleuse.py b/gprMax/hash_cmds_singleuse.py index 76456174..61145e13 100644 --- a/gprMax/hash_cmds_singleuse.py +++ b/gprMax/hash_cmds_singleuse.py @@ -121,7 +121,6 @@ def process_singlecmds(singlecmds): scene_objects.append(tw) cmd = "#pml_formulation" - pml_formulation = None if singlecmds[cmd] is not None: tmp = singlecmds[cmd].split() if len(tmp) != 1: @@ -137,16 +136,24 @@ def process_singlecmds(singlecmds): logger.exception(f"{cmd} requires either one or six parameter(s)") raise ValueError - if len(tmp) == 1: - pml_cells = PMLProps(formulation=pml_formulation, thickness=int(tmp[0])) + if pml_formulation in locals(): + 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: - pml_cells = 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]) - ) + if len(tmp) == 1: + pml_props = PMLProps(thickness=int(tmp[0])) + else: + 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" if singlecmds[cmd] is not None: