Skip to content
Snippets Groups Projects
Commit 8931a86b authored by René Heß's avatar René Heß Committed by Dominic Kempf
Browse files

Make it possible to pass mutliple option statements to option_switch

Probably not the solution we want to have in the long run but right
now it is not possible to have a backend switch for
default/blockstructured/sumfact. This way the old code should behave
the same way as before and it is possible to switch between those
three things.
parent f0c48b5b
No related branches found
No related tags found
No related merge requests found
......@@ -235,14 +235,19 @@ def get_form_option(key, form=None):
def option_switch(opt):
def _switch():
if isinstance(opt, tuple):
opts = opt
else:
assert isinstance(opt, str)
opts = (opt,)
try:
if get_option(opt):
return opt
else:
return "default"
for o in opts:
if get_option(o):
return o
return "default"
except AttributeError:
if get_form_option(opt):
return opt
else:
return "default"
for o in opts:
if get_form_option(o):
return o
return "default"
return _switch
......@@ -338,7 +338,7 @@ def define_jacobian_inverse_transposed(name, restriction):
dim = world_dimension()
temporary_variable(name, decl_method=define_jacobian_inverse_transposed_temporary(restriction), shape=(dim, dim))
geo = name_cell_geometry(restriction)
pos = get_backend("qp_in_cell", selector=option_switch("blockstructured"))(restriction)
pos = get_backend("qp_in_cell", selector=option_switch(("blockstructured", "sumfact")))(restriction)
return quadrature_preamble("{} = {}.jacobianInverseTransposed({});".format(name,
geo,
str(pos),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment