aboutsummaryrefslogtreecommitdiff
path: root/boltzgen.py
diff options
context:
space:
mode:
Diffstat (limited to 'boltzgen.py')
-rwxr-xr-xboltzgen.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/boltzgen.py b/boltzgen.py
index 5224942..34d641d 100755
--- a/boltzgen.py
+++ b/boltzgen.py
@@ -8,11 +8,12 @@ argparser = argparse.ArgumentParser(
argparser.add_argument('language', help = 'Target language (currently either "cl" or "cpp")')
-argparser.add_argument('--lattice', required = True, help = 'Lattice type (D2Q9, D3Q7, D3Q19, D3Q27)')
-argparser.add_argument('--layout', required = True, help = 'Memory layout ("AOS" or "SOA")')
-argparser.add_argument('--precision', required = True, help = 'Floating precision ("single" or "double")')
-argparser.add_argument('--geometry', required = True, help = 'Size of the block geometry ("x:y(:z)")')
-argparser.add_argument('--tau', required = True, help = 'BGK relaxation time')
+argparser.add_argument('--lattice', required = True, help = 'Lattice type (D2Q9, D3Q7, D3Q19, D3Q27)')
+argparser.add_argument('--layout', required = True, help = 'Memory layout ("AOS" or "SOA")')
+argparser.add_argument('--indexing', required = False, help = 'Cell indexing ("XYZ" or "ZYX")')
+argparser.add_argument('--precision', required = True, help = 'Floating precision ("single" or "double")')
+argparser.add_argument('--geometry', required = True, help = 'Size of the block geometry ("x:y(:z)")')
+argparser.add_argument('--tau', required = True, help = 'BGK relaxation time')
argparser.add_argument('--disable-cse', action = 'store_const', const = True, help = 'Disable common subexpression elimination')
argparser.add_argument('--functions', action = 'append', nargs = '+', default = [], help = 'Function templates to be generated')
@@ -28,6 +29,9 @@ generator = Generator(
moments = lbm.moments(optimize = not args.disable_cse),
collision = lbm.bgk(f_eq = lbm.equilibrium(), tau = float(args.tau), optimize = not args.disable_cse))
+if args.indexing is None:
+ args.indexing = 'XYZ'
+
geometry = Geometry.parse(args.geometry)
functions = sum(args.functions, [])
@@ -40,5 +44,5 @@ if 'default' in functions:
extras = sum(args.extras, [])
-src = generator.kernel(args.language, args.precision, args.layout, geometry, functions, extras)
+src = generator.kernel(args.language, args.precision, args.layout, args.indexing, geometry, functions, extras)
print(src)