From 05e74fb112f5b5f645b649c587d18052c7b7f9df Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 2 Nov 2019 17:32:41 +0100 Subject: Improve lattice, model selection error reporting --- boltzgen.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/boltzgen.py b/boltzgen.py index 4317c68..57b3ed0 100755 --- a/boltzgen.py +++ b/boltzgen.py @@ -25,12 +25,19 @@ args = argparser.parse_args() if args.model is None: args.model = "BGK" -lattice = eval("lbm.lattice.%s" % args.lattice) -model = eval("lbm.model.%s" % args.model) - if args.index is None: args.index = 'XYZ' +try: + lattice = eval("lbm.lattice.%s" % args.lattice) +except AttributeError: + raise Exception("There is no lattice type called '%s'" % args.lattice) from None + +try: + model = eval("lbm.model.%s" % args.model) +except AttributeError: + raise Exception("There is no LBM model called '%s'" % args.model) from None + generator = Generator( model = model(lattice, tau = float(args.tau), optimize = not args.disable_cse), target = args.target, -- cgit v1.2.3