Read about our upcoming Code of Conduct on this issue

Commit 6f68f3df authored by Pierre Augier's avatar Pierre Augier
Browse files

Extend simul even without state_phys file (debug)

parent 61213cb6d794
Pipeline #26523 passed with stage
in 14 minutes and 43 seconds
......@@ -253,9 +253,12 @@ def load_sim_for_plot(
path_file = Path(path_dir) / name_file_from_time_approx(path_dir)
except ValueError:
# no state_phys file to extend the simul class. Let's try with info_solver.xml
path_file = "info_solver.xml"
path_file = Path(path_dir) / "info_solver.xml"
Simul = _extend_simul_class_from_path(solver.Simul, path_file)
if path_file.exists():
Simul = _extend_simul_class_from_path(solver.Simul, path_file)
else:
Simul = solver.Simul
with stdout_redirected(hide_stdout):
sim = Simul(params)
......
......@@ -91,14 +91,17 @@ def _extend_simul_class_from_path(Simul, path_file):
if mpi.rank == 0:
if path_file.suffix == ".xml":
info_solver = ParamContainer(path_file="info_solver.xml")
# we assume that it is a info_solver.xml file
info_solver = ParamContainer(path_file=path_file)
if hasattr(info_solver, "extenders"):
extenders = info_solver.extenders
else:
extenders = []
else:
with h5py.File(path_file, "r") as file:
extenders = list(file["/info_simul/solver"].attrs.get("extenders", []))
extenders = list(
file["/info_simul/solver"].attrs.get("extenders", [])
)
else:
extenders = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment