diff options
author | Adrian Kummerlaender | 2019-10-27 14:05:21 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2019-10-27 14:05:21 +0100 |
commit | 18c54d79699db7554faa851c87d7113db67a8a08 (patch) | |
tree | c89243b5796bb8f1e6a8cea241f3a5e1bf934ba1 /boltzgen.py | |
parent | 7fa72d8718d96727bcfd60cc3bcb1609526d3c9b (diff) | |
download | boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.tar boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.tar.gz boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.tar.bz2 boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.tar.lz boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.tar.xz boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.tar.zst boltzgen-18c54d79699db7554faa851c87d7113db67a8a08.zip |
Separate functions into separate template files
Selection of the desired templates is possible via a new `functions` parameter.
Diffstat (limited to 'boltzgen.py')
-rwxr-xr-x | boltzgen.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/boltzgen.py b/boltzgen.py index 2b32661..5224942 100755 --- a/boltzgen.py +++ b/boltzgen.py @@ -15,7 +15,8 @@ argparser.add_argument('--geometry', required = True, help = 'Size of the block 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('--extra', action = 'append', nargs = '+', default = [], help = 'Additional generator parameters') +argparser.add_argument('--functions', action = 'append', nargs = '+', default = [], help = 'Function templates to be generated') +argparser.add_argument('--extras', action = 'append', nargs = '+', default = [], help = 'Additional generator parameters') args = argparser.parse_args() @@ -29,5 +30,15 @@ generator = Generator( geometry = Geometry.parse(args.geometry) -src = generator.kernel(args.language, args.precision, args.layout, geometry, sum(args.extra, [])) +functions = sum(args.functions, []) +if len(functions) == 0: + functions += ['default'] +if 'default' in functions: + for f in ['collide_and_stream', 'equilibrilize', 'collect_moments', 'momenta_boundary']: + functions.insert(functions.index('default'), f) + functions.remove('default') + +extras = sum(args.extras, []) + +src = generator.kernel(args.language, args.precision, args.layout, geometry, functions, extras) print(src) |