aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/WarpX.py
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pywarpx/WarpX.py')
-rw-r--r--Python/pywarpx/WarpX.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/pywarpx/WarpX.py b/Python/pywarpx/WarpX.py
index 4701fcfb0..175917ab6 100644
--- a/Python/pywarpx/WarpX.py
+++ b/Python/pywarpx/WarpX.py
@@ -5,6 +5,8 @@
#
# License: BSD-3-Clause-LBNL
+import re
+
from . import Particles
from .Algo import algo
from .Amr import amr
@@ -103,7 +105,17 @@ class WarpX(Bucket):
with open(filename, 'w') as ff:
+ prefix_old = ''
for arg in argv:
+ # This prints the name of the input group (prefix) as a header
+ # before each group to make the input file more human readable
+ prefix_new = re.split(' |\.', arg)[0]
+ if prefix_new != prefix_old:
+ if prefix_old != '':
+ ff.write('\n')
+ ff.write(f'# {prefix_new}\n')
+ prefix_old = prefix_new
+
ff.write(f'{arg}\n')
warpx = WarpX('warpx')