Skip to content
Snippets Groups Projects
Commit 9cae1a76 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

[!372] [bugfix] Remove some codegen time evaluation of predicates

Merge branch 'bugfix/conditionals-with-function-calls' into 'master'

ref:extensions/dune-codegen This does not work if the predicate contains a
function call (you cannot infer the possible return values at codegen time).

See merge request [extensions/dune-codegen!372]

  [extensions/dune-codegen!372]: gitlab.dune-project.org/extensions/dune-codegen/merge_requests/372
parents 8f6e713d b316cfc7
No related branches found
No related tags found
No related merge requests found
......@@ -305,7 +305,7 @@ def boundary_predicates(measure, subdomain_id):
subdomains = []
for integral in original_form.integrals():
if integral.integral_type() == measure:
if integral.integral_type() == measure and integral.subdomain_id() == subdomain_id:
subdomains.append(integral.subdomain_data())
subdomain_data, = set(subdomains)
......@@ -315,17 +315,6 @@ def boundary_predicates(measure, subdomain_id):
visitor = get_visitor(measure, subdomain_id)
subdomain_data = visitor(subdomain_data, do_predicates=True)
# Often, boundary predicates are just nested conditionals. We try to find
# out which of these are unfulfillable in the first place.
def possible_values(expr):
if isinstance(expr, prim.If):
return set(possible_values(expr.then)).union(possible_values(expr.else_))
else:
return set({expr})
if subdomain_id not in possible_values(subdomain_data):
return frozenset({False})
p = prim.Comparison(subdomain_data, '==', subdomain_id)
# Try to find conditions that are always 0 or always 1
......
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