Skip to content

Allocate the tabulation buffer in FiniteElement::tabulate - #4656

Open
garth-wells wants to merge 1 commit into
mainfrom
garth/tabulate-output-buffer
Open

garth-wells wants to merge 1 commit into
mainfrom
garth/tabulate-output-buffer

Conversation

@garth-wells

Copy link
Copy Markdown
Member

fem::FiniteElement::tabulate forwarded to the Basix overload that allocates and returns a buffer. It now allocates the buffer itself, sizing it with basix::FiniteElement::tabulate_shape and passing it to the Basix overload that takes output storage.

The public DOLFINx API and the values returned are unchanged. This is exactly what the Basix overload did internally, so the allocation only moves across the library boundary.

Why

Basix removes its allocating tabulate overloads in FEniCS/basix#1093, which currently fails its DOLFINx integration check with

dolfinx/fem/FiniteElement.cpp:464: error: no matching function for call to
'basix::FiniteElement<float>::tabulate(int&, std::span<const float>&, std::array<unsigned long, 2>&)'

This is the only call into a removed overload in DOLFINx. CoordinateElement.cpp already uses the out-argument overloads, and cpp/demo/custom_kernel/main.cpp already uses tabulate_shape.

Testing

tabulate_shape and the out-argument overload exist in Basix with and without FEniCS/basix#1093, so this compiles either way and can be merged before it. Verified by compiling all 45 translation units of the DOLFINx library against both: Basix main and the remove-allocating-tabulate branch. Without this change, fem/FiniteElement.cpp fails against that branch and builds against main.

🤖 Generated with Claude Code

FiniteElement::tabulate forwarded to the Basix overload that allocates
and returns a buffer. Allocate the buffer here instead, sizing it with
basix::FiniteElement::tabulate_shape and passing it to the overload that
takes output storage.

The public DOLFINx API and the values returned are unchanged. This is
what the Basix overload did internally, so the allocation only moves
across the library boundary.

Basix removes the allocating overloads in FEniCS/basix#1093. This change
compiles against Basix with and without that PR, so it can be merged
first.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
garth-wells added a commit to FEniCS/basix that referenced this pull request Oct 17, 2026
Removing the allocating tabulate overloads breaks DOLFINx main, which
calls one of them. Build the DOLFINx integration job against the branch
that updates the call site, FEniCS/dolfinx#4656.

Revert to main once that pull request has merged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant