From 18c54d79699db7554faa851c87d7113db67a8a08 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 27 Oct 2019 14:05:21 +0100 Subject: Separate functions into separate template files Selection of the desired templates is possible via a new `functions` parameter. --- boltzgen.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'boltzgen.py') 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) -- cgit v1.2.3