Skip to content

Commit

Permalink
Pass more variants around (#141)
Browse files Browse the repository at this point in the history
* add variant for MixedElement (#129)

* Allow VectorElement to take a variant argument. (#17)

Co-authored-by: Patrick Farrell <[email protected]>

Co-authored-by: Pablo Brubeck <[email protected]>
Co-authored-by: Patrick E. Farrell <[email protected]>
Co-authored-by: Patrick Farrell <[email protected]>
  • Loading branch information
4 people authored Jan 6, 2023
1 parent f762039 commit 8382ed0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ufl/finiteelement/mixedelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ def degree(self, component=None):
def reconstruct(self, **kwargs):
return MixedElement(*[e.reconstruct(**kwargs) for e in self.sub_elements()])

def variant(self):
try:
variant, = {e.variant() for e in self.sub_elements()}
return variant
except ValueError:
return None

def __str__(self):
"Format as string for pretty printing."
tmp = ", ".join(str(element) for element in self._sub_elements)
Expand Down

0 comments on commit 8382ed0

Please sign in to comment.