Skip to content

Bugfix: Curve dual support - #76

Merged
krcools merged 2 commits into
krcools:masterfrom
paresula:bugfix/curve-dual-support
Oct 6, 2026
Merged

krcools merged 2 commits into
krcools:masterfrom
paresula:bugfix/curve-dual-support

Conversation

@paresula

@paresula paresula commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Fixes that were needed to build dual Lagrange spaces on one-dimensional meshes:

Fixes

  • isinclosure on a zero-dimensional simplex threw, because isinside.jl takes T=eltype(u) which is Union{} for point cells, so eps(T) failed. In practice this means that no junction predicate could be built from boundary(curve). Fix is using coordtype(cell) for the tolerance.
  • barycentric_refinement on a curve returns a plain Meshand has no method for a one-dimensional SubMesh. The result is not tagged as a refinement, so refines(barycentric_refinement(curve),curve) is false, and hence downstream code cannot tell that the two meshes are related. This is now replaced by writing barycentric_refinement(::AbstractMesh{U,2}) against the generic mesh API and the return type is now a BarycentricRefinement, with a matching parent method. This also allows SubMesh input.

Compatibility

Since the return type for one-dimensional input changes from Meshto BarycentricRefinement, code annotated concretely as ::Mesh or reaching for .faces breaks. Generic code is unaffected since BarycenrticRefinement <: AbstractRefinement <: AbstractMesh.
Unfortunately, the current BEAST master contains such code: duallagrangec0d1(..., Val{2}) accesses mesh2.faces, so merging this alone breaks curve duals in BEAST.
The BEAST PR that rewrite this function follows shortly.

I have not bumped the version yet, but one will be needed before BEAST can pin it in [compat].

The type for the tolerance came from the barycentric coordinates of the
point, which are empty for a cell of dimension zero, so eltype returned
Union{} and eps threw a MethodError.
Now take the type from the cell instead. The rest of the function
already treats a point cell correctly.

This makes inclosure_gpredicate usable on the boundary of a curve, which
is a mesh of nodes.
Refining a curve returned a plain Mesh, so refines reported false and
callers pairing a dual space on the refinement with a primal space on the
coarse curve silently fell back to conforming quadrature, which applies
singular rules to overlapping segments. Build the refinement through the
generic mesh interface so it also accepts a submesh, return a
BarycentricRefinement as the surface and volume versions do, and add the
parent override, since the generic one returns the child index rather than
the parent cell.
@krcools

krcools commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Thanks. I'll bump and release once BEAST can handle these changes.

@krcools
krcools merged commit e364146 into krcools:master Oct 6, 2026
4 checks passed
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.

2 participants