Move title attribute from FDTDGrid to Model

Title should be a global attribute owned by the model, whereas each grid
oir subgrid has a name. Default value for grid name remains as
'main_grid'.
这个提交包含在:
nmannall
2024-05-13 13:20:39 +01:00
父节点 14456dbb17
当前提交 fdd2811c8a
共有 6 个文件被更改,包括 132 次插入52 次删除

查看文件

@@ -53,6 +53,8 @@ class Model:
"""Builds and runs (solves) a model."""
def __init__(self):
self.title = ""
self.G = self._create_grid()
# Monitor memory usage
self.p = None
@@ -118,7 +120,7 @@ class Model:
file=sys.stdout,
disable=not config.sim_config.general["progressbars"],
)
go.write_hdf5(G, pbar)
go.write_hdf5(self.title, self.G, pbar)
pbar.close()
logger.info("")
@@ -149,7 +151,9 @@ class Model:
sg_rxs = [True for sg in self.G.subgrids if sg.rxs]
sg_tls = [True for sg in self.G.subgrids if sg.transmissionlines]
if self.G.rxs or sg_rxs or self.G.transmissionlines or sg_tls:
write_hdf5_outputfile(config.get_model_config().output_file_path_ext, self.G)
write_hdf5_outputfile(
config.get_model_config().output_file_path_ext, self.title, self.G
)
# Write any snapshots to file for each grid
for grid in [self.G] + self.G.subgrids: