Skip to content

Commit d13be73

Browse files
committed
TensorProductElement: rename sub_elements factor_elements
1 parent 7d7145b commit d13be73

File tree

7 files changed

+12
-15
lines changed

7 files changed

+12
-15
lines changed

firedrake/embedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_embedding_method_for_checkpointing(element):
5959
'S', 'DPC', 'Real']:
6060
return "interpolate"
6161
elif isinstance(element, finat.ufl.TensorProductElement):
62-
methods = [get_embedding_method_for_checkpointing(elem) for elem in element.sub_elements]
62+
methods = [get_embedding_method_for_checkpointing(elem) for elem in element.factor_elements]
6363
if any(method == "project" for method in methods):
6464
return "project"
6565
else:

firedrake/extrusion_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def make_extruded_coords(extruded_topology, base_coords, ext_coords,
5050
coordinates on the extruded cell (to write to), the fixed layer
5151
height, and the current cell layer.
5252
"""
53-
_, vert_space = ext_coords.function_space().ufl_element().sub_elements[0].sub_elements
53+
_, vert_space = ext_coords.function_space().ufl_element().sub_elements[0].factor_elements
5454
if kernel is None and not (vert_space.degree() == 1
5555
and vert_space.family() in ['Lagrange',
5656
'Discontinuous Lagrange']):

firedrake/functionspaceimpl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def check_element(element, top=True):
6060
elif type(element) is finat.ufl.EnrichedElement:
6161
inner = element._elements
6262
elif type(element) is finat.ufl.TensorProductElement:
63-
inner = element.sub_elements
63+
inner = element.factor_elements
6464
elif isinstance(element, finat.ufl.MixedElement):
6565
if not top:
6666
raise ValueError(f"{type(element).__name__} modifier must be outermost")

firedrake/interpolation.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,9 +543,7 @@ def __init__(
543543
# input ordering VOM will only contain the points on rank 0!
544544
# QUESTION: Should any of the below have annotation turned off?
545545
ufl_scalar_element = V_dest.ufl_element()
546-
if ufl_scalar_element.num_sub_elements and not isinstance(
547-
ufl_scalar_element, finat.ufl.TensorProductElement
548-
):
546+
if isinstance(ufl_scalar_element, finat.ufl.MixedElement):
549547
if all(
550548
ufl_scalar_element.sub_elements[0] == e
551549
for e in ufl_scalar_element.sub_elements
@@ -558,7 +556,7 @@ def __init__(
558556
raise NotImplementedError(
559557
"Can't yet cross-mesh interpolate onto function spaces made from VectorElements or TensorElements made from sub elements with value shape other than ()."
560558
)
561-
elif type(ufl_scalar_element) is finat.ufl.MixedElement:
559+
else:
562560
# Build and save an interpolator for each sub-element
563561
# separately for MixedFunctionSpaces. NOTE: since we can't have
564562
# expressions for MixedFunctionSpaces we know that the input
@@ -597,10 +595,6 @@ def __init__(
597595
)
598596
self.sub_interpolators.append(sub_interpolator)
599597
return
600-
else:
601-
raise NotImplementedError(
602-
f"Unhandled cross-mesh interpolation ufl element type: {repr(ufl_scalar_element)}"
603-
)
604598

605599
from firedrake.assemble import assemble
606600
V_dest_vec = firedrake.VectorFunctionSpace(dest_mesh, ufl_scalar_element)

firedrake/mg/embedded.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ def __init__(self, *, native_transfers=None, use_averaging=True):
7070
def is_native(self, element, op):
7171
if element in self.native_transfers.keys():
7272
return self.native_transfers[element][op] is not None
73-
if isinstance(element.cell, ufl.TensorProductCell) and len(element.sub_elements) > 0:
74-
return all(self.is_native(e, op) for e in element.sub_elements)
73+
if isinstance(element.cell, ufl.TensorProductCell):
74+
if isinstance(element, finat.ufl.TensorProductElement):
75+
return all(self.is_native(e, op) for e in element.factor_elements)
76+
elif isinstance(element, finat.ufl.MixedElement):
77+
return all(self.is_native(e, op) for e in element.sub_elements)
7578
return (element.family() in native_families) and not (element.variant() in non_native_variants)
7679

7780
def _native_transfer(self, element, op):

firedrake/preconditioners/hiptmair.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def div_to_curl(ele):
250250
elif isinstance(ele, finat.ufl.EnrichedElement):
251251
return type(ele)(*(div_to_curl(e) for e in reversed(ele._elements)))
252252
elif isinstance(ele, finat.ufl.TensorProductElement):
253-
return type(ele)(*(div_to_curl(e) for e in ele.sub_elements), cell=ele.cell)
253+
return type(ele)(*(div_to_curl(e) for e in ele.factor_elements), cell=ele.cell)
254254
elif isinstance(ele, finat.ufl.WithMapping):
255255
return type(ele)(div_to_curl(ele.wrapee), ele.mapping())
256256
elif isinstance(ele, finat.ufl.BrokenElement):

firedrake/preconditioners/pmg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def reconstruct_degree(ele, degree):
423423
return type(ele)(*(PMGBase.reconstruct_degree(e, PMGBase.max_degree(e) + shift) for e in ele._elements))
424424
elif isinstance(ele, finat.ufl.TensorProductElement):
425425
shift = degree - PMGBase.max_degree(ele)
426-
return type(ele)(*(PMGBase.reconstruct_degree(e, PMGBase.max_degree(e) + shift) for e in ele.sub_elements), cell=ele.cell)
426+
return type(ele)(*(PMGBase.reconstruct_degree(e, PMGBase.max_degree(e) + shift) for e in ele.factor_elements), cell=ele.cell)
427427
elif isinstance(ele, finat.ufl.MixedElement):
428428
shift = degree - PMGBase.max_degree(ele)
429429
return type(ele)(*(PMGBase.reconstruct_degree(e, PMGBase.max_degree(e) + shift) for e in ele.sub_elements))

0 commit comments

Comments
 (0)