Skip to content

Commit 7e11ca5

Browse files
committed
k
1 parent 807e1bc commit 7e11ca5

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

finat/ufl/mixedelement.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,25 @@ def embedded_superdegree(self):
248248
def reconstruct(self, **kwargs):
249249
"""Doc."""
250250
cell = kwargs.pop('cell', None)
251-
if not isinstance(cell, CellSequence):
252-
raise TypeError(f"Expecting a CellSequence: got {cells}")
253-
return MixedElement(*[e.reconstruct(cell=c, **kwargs) for c, e in zip(cell.cells, self.sub_elements)])
251+
if isinstance(self.cell, CellSequence):
252+
if cell is None:
253+
cell = self.cell
254+
else:
255+
if not isinstance(cell, CellSequence):
256+
# Allow for passing a single base cell.
257+
cell = CellSequence([cell] * len(self.sub_elements))
258+
cells = cell.cells
259+
else:
260+
if cell is None:
261+
cell = self.cell
262+
else:
263+
if isinstance(cell, CellSequence):
264+
raise TypeError(f"Input cell(={cell}) must not be CellSequence")
265+
cells = [cell] * len(self.sub_elements)
266+
return MixedElement(
267+
*[e.reconstruct(cell=c, **kwargs) for c, e in zip(cells, self.sub_elements)],
268+
make_cell_sequence=isinstance(self.cell, CellSequence),
269+
)
254270

255271
def variant(self):
256272
"""Doc."""

0 commit comments

Comments
 (0)