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

Remove the validity code

It was nonsense, as it did everything done lateron anyway.
parent b8b82c01
No related branches found
No related tags found
No related merge requests found
......@@ -33,11 +33,7 @@ def read_ufl(uflfile):
# We do not expect more than one form
assert len(data.forms) == 1
# TODO As validity is implemented right now, this is nonsense.
# Might as well formulate it as a try statement!
# from dune.perftool.ufl.validity import check_validity
# if not check_validity(form):
# apply some transformations unconditionally!
# apply some transformations unconditionally!
from dune.perftool.ufl.transformations import transform_form
from dune.perftool.ufl.transformations.splitarguments import split_arguments
from dune.perftool.ufl.transformations.indexpushdown import pushdown_indexed
......
from __future__ import absolute_import
from ufl.algorithms import MultiFunction
def check_validity(uflexpr):
""" check an UFL expression (usually an integrand) for
compatibility with the dune-pdelab code generation tool chain.
The assumptions made are the following:
- The expression is the sum of subtrees, where the number of test
function terms in such subtree is equal the rank of the entire expression.
"""
from ufl import Form
from ufl.classes import Expr
def check(term):
try:
from dune.perftool.ufl.transformations.extract_accumulation_terms import split_into_accumulation_terms
split_into_accumulation_terms(term)
return True
except AssertionError:
from dune.perftool.ufl.transformations import print_expression
print_expression(term)
return False
if isinstance(uflexpr, Form):
for integral in uflexpr.integrals():
if not check(integral.integrand()):
return False
return True
if isinstance(uflexpr, Expr):
return check(uflexpr)
raise TypeError("Unknown object type in check_validity: {}".format(type(uflexpr)))
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