Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse multiple expressions #74

Merged
merged 5 commits into from
Feb 3, 2022
Merged

Parse multiple expressions #74

merged 5 commits into from
Feb 3, 2022

Conversation

michalhabera
Copy link
Contributor

This expects expressions gobal name in UFL files be list of expressions (ufl.core.expr.Expr and evaluation points). Needed to parse multiple expressions on FFCx side. Not affecting FEniCS(old) nor Firedrake.

@@ -204,7 +204,7 @@ def get_form(name):
# Validate types
if not isinstance(ufd.expressions, (list, tuple)):
error("Expecting 'expressions' to be a list or tuple, not '%s'." % type(ufd.expressions))
if not all(isinstance(e, Expr) for e in ufd.expressions):
if not all(isinstance(e[0], Expr) for e in ufd.expressions):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I don't know how the form files work, but should one not write:

all(isinstance(e, Expr) for e in itertools.chain(*ufd.expressions))

Rather than implicitly indicating that the ufd.expressions variable is a list of singleton lists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, "expressions" is a list of tuples of different type, List[Tuple(ufl.core.expr.Expression, numpy.ndarray)], but this is not standardised within UFL. We only need to know that first item in the tuple is of UFL Expression type. The second item in the tuple is used to tell what reference points expression is evaluated.

@jhale jhale merged commit cba4d86 into main Feb 3, 2022
@jhale jhale deleted the michal/expressions branch February 3, 2022 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants