Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Changed so that a fresh swiftest_driver binary is always copied when …
Browse files Browse the repository at this point in the history
…save or run is executed
  • Loading branch information
daminton committed Jan 15, 2023
1 parent 0b449b6 commit d0b1075
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,20 +488,13 @@ def run(self,**kwargs):
warnings.warn(f"Running an integration is not yet supported for {self.codename}",stacklevel=2)
return

if self.driver_executable is None or self.binary_source is None:
if not self.binary_source.exists():
msg = "Path to swiftest_driver has not been set!"
msg += f"\nMake sure swiftest_driver is compiled and the executable is in {str(self.binary_path)}"
warnings.warn(msg,stacklevel=2)
return

if not self.driver_executable.exists():
if not self.binary_source.exists():
msg = "Path to swiftest_driver has not been set!"
msg += f"\nMake sure swiftest_driver is compiled and the executable is in {str(self.binary_path)}"
warnings.warn(msg,stacklevel=2)
return
else:
shutil.copy(self.binary_source, self.driver_executable)
else:
shutil.copy(self.binary_source, self.driver_executable)

if not self.restart:
self.clean()
Expand Down Expand Up @@ -2897,23 +2890,20 @@ def save(self,
if param is None:
param = self.param

self.simdir.mkdir(parents=True, exist_ok=True)

if not self.simdir.exists():
self.simdir.mkdir(parents=True, exist_ok=True)

if codename == "Swiftest":
infile_name = Path(self.simdir) / param['NC_IN']
io.swiftest_xr2infile(ds=self.data, param=param, in_type=self.param['IN_TYPE'], infile_name=infile_name, framenum=framenum, verbose=verbose)
self.write_param(param_file=param_file,**kwargs)

if not self.driver_executable.exists():
if not self.binary_source.exists():
msg = "Path to swiftest_driver has not been set!"
msg += f"\nMake sure swiftest_driver is compiled and the executable is in {str(self.binary_path)}"
warnings.warn(msg,stacklevel=2)
return
else:
shutil.copy(self.binary_source, self.driver_executable)

if not self.binary_source.exists():
msg = "Path to swiftest_driver has not been set!"
msg += f"\nMake sure swiftest_driver is compiled and the executable is in {str(self.binary_path)}"
warnings.warn(msg,stacklevel=2)
return
else:
shutil.copy2(self.binary_source, self.driver_executable)
elif codename == "Swifter":
if codename == "Swiftest":
swifter_param = io.swiftest2swifter_param(param)
Expand Down

0 comments on commit d0b1075

Please sign in to comment.