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

Commit

Permalink
Finished making compact output that can easily be turned into a Pytho…
Browse files Browse the repository at this point in the history
…n dictionary
  • Loading branch information
daminton committed Nov 22, 2022
1 parent 5afb1ea commit 3fb5fff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
19 changes: 12 additions & 7 deletions python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def _run_swiftest_driver(self):
f.write(f"#{self._shell_full} -l\n")
f.write(f"source ~/.{self._shell}rc\n")
f.write(f"cd {self.sim_dir}\n")
f.write(f"{str(self.driver_executable)} {self.integrator} {str(self.param_file)} progress\n")
f.write(f"{str(self.driver_executable)} {self.integrator} {str(self.param_file)} compact\n")

cmd = f"{env['SHELL']} -l {driver_script}"

Expand All @@ -375,13 +375,18 @@ def _run_swiftest_driver(self):
stderr=subprocess.PIPE,
env=env,
universal_newlines=True) as p:
process_output = False
for line in p.stdout:
if '[' in line:
print(line.replace('\n', '\r'), end='')
elif "Normal termination" in line:
print(line.replace("Normal termination", "\n\nNormal termination"), end='')
else:
print(line, end='')
if "SWIFTEST STOP" in line:
process_output = False

if process_output:
kvstream=line.replace('\n','').strip().split(';') # Removes the newline character,
output_data = {kv.split()[0]: kv.split()[1] for kv in kvstream[:-1]}

if "SWIFTEST START" in line:
process_output = True

res = p.communicate()
if p.returncode != 0:
for line in res[1]:
Expand Down
5 changes: 0 additions & 5 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ module subroutine io_compact_output(self, param, timer)
class(swiftest_parameters), intent(in) :: param !! Input colleciton of user-defined parameters
class(*), intent(in) :: timer !! Object used for computing elapsed wall time (must be unlimited polymorphic because the walltimer module requires swiftest_classes)
! Internals
!character(*), parameter :: COMPACTFMT = '("ILOOP",I,";T",ES23.16,";WT",ES23.16,";IWT",ES23.16,";WTPS",ES23.16,";NPL",I,";NTP",I,";"$)'
!character(*), parameter :: SYMBAFMT = '(";NPLM",I,$)'
!character(*), parameter :: EGYFMT = '("LTOTERR",ES24.16,";ETOTERR",ES24.16,";MTOTERR",ES24.16,";KEOERR",ES24.16,";KESERR",ES24.16,";PEERR",ES24.16' &
! // '";EORBERR",ES24.16,";ECOLERR",ES24.16,";EUNTRERR",ES24.16,";LSPINERR",ES24.16,";LESCERR",ES24.16' &
! // '";MESCERR",ES24.16,$)'
character(len=:), allocatable :: formatted_output

select type(timer)
Expand Down

0 comments on commit 3fb5fff

Please sign in to comment.