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

Commit

Permalink
Browse files Browse the repository at this point in the history
Improved param file formatting in swiftest.io
  • Loading branch information
daminton committed Jul 7, 2021
1 parent 770429f commit 3adb448
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile.Defines
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ GPAR = -fopenmp -ftree-parallelize-loops=4
GMEM = -fsanitize=undefined -fsanitize=address -fsanitize=leak
GWARNINGS = -Wall -Warray-bounds -Wimplicit-interface -Wextra -Warray-temporaries

FFLAGS = $(IDEBUG) $(HEAPARR)
#FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(SIMDVEC) $(PAR)
#FFLAGS = $(IDEBUG) $(HEAPARR)
FFLAGS = -init=snan,arrays -no-wrap-margin -O3 $(STRICTREAL) $(SIMDVEC) $(PAR)
FORTRAN = ifort
#AR = xiar

Expand Down
31 changes: 30 additions & 1 deletion python/swiftest/swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,36 @@ def write_swift_param(param, param_file_name):

def write_labeled_param(param, param_file_name):
outfile = open(param_file_name, 'w')
for key, val in sorted(param.items()):
keylist = ['! VERSION',
'T0',
'TSTOP',
'DT',
'ISTEP_OUT',
'ISTEP_DUMP',
'OUT_FORM',
'OUT_TYPE',
'OUT_STAT',
'IN_TYPE',
'PL_IN',
'TP_IN',
'CB_IN',
'BIN_OUT',
'ENC_OUT',
'CHK_QMIN',
'CHK_RMAX',
'CHK_EJECT',
'CHK_QMIN_COORD',
'CHK_QMIN_RANGE',
'MU2KG',
'TU2S',
'DU2M' ]
ptmp = param.copy()
# Print the list of key/value pairs in the preferred order
for key in keylist:
val = ptmp.pop(key)
print(f"{key:<16} {val}", file=outfile)
# Print the remaining key/value pairs in whatever order
for key, val in ptmp.items():
print(f"{key:<16} {val}", file=outfile)
outfile.close()
return
Expand Down

0 comments on commit 3adb448

Please sign in to comment.