Skip to content

Conversation

@leo-collins
Copy link
Contributor

@leo-collins leo-collins commented Jan 5, 2026

Implement cross-mesh interpolate into non-point evaluation spaces.

To do this we first construct a quadrature space which has point-evaluation dofs at the quadrature points of the target element. We then cross-mesh interpolate into this space. Finally, we interpolate from this quadrature space into the target space.

@leo-collins leo-collins force-pushed the leo/cross-mesh-non-lagrange branch from 8e05539 to 416fcde Compare January 20, 2026 10:15

point_eval, point_eval_input_ordering = self._get_symbolic_expressions()
# Interpolate into intermediate quadrature space for non-identity mapped elements
if into_quadrature_space := V_dest.ufl_element().mapping() != "identity":
Copy link
Contributor

Choose a reason for hiding this comment

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

Careful here with symmetric TensorElements

weights = numpy.full(len(points.points), numpy.nan) # These can be any number since we never integrate
quad_scheme = QuadratureRule(points, weights, ref_el=V_element.cell)
element = FiniteElement("Quadrature", degree=V_element.degree, quad_scheme=quad_scheme)
return self._fs_type(V)(V.mesh(), element)
Copy link
Contributor

Choose a reason for hiding this comment

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

The Quadrature space is always scalar-valued, even if it came from a vector-valued space like RT. You should grab the value_shape, and not the Tensorness of the ufl element.

This should be generic enough, although it might be better to special case the scalar case

Suggested change
return self._fs_type(V)(V.mesh(), element)
return TensorFunctionSpace(V.mesh(), "Quadrature", degree=V_element.degree, quad_scheme=quad_scheme, shape=V.value_shape)

Comment on lines 473 to 474
"Can't yet cross-mesh interpolate onto function spaces made from VectorElements "
"or TensorElements made from sub elements with value shape other than ()."
Copy link
Contributor

Choose a reason for hiding this comment

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

This should no longer be the case after this PR

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.

3 participants