Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add void* to tabulate_tensor kernel #749

Closed
wants to merge 11 commits into from

Conversation

sclaus2
Copy link

@sclaus2 sclaus2 commented Feb 19, 2025

Add void* user_data to tabulate_tensor kernel to allow for easier extensions of non-standard integration kernels such as runtime kernels. Depends on dolfinx PR FEniCS/dolfinx#3643 .

@sclaus2 sclaus2 changed the title sclaus/add void to kernels Add void* to tabulate_tensor kernel Feb 19, 2025

Returns:
A Numba signature and a code generation function that returns a void pointer.
""" # noqa: D205
Copy link
Member

Choose a reason for hiding this comment

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

It should be enough to add a new line after Custom intrinsic to return an empty void* pointer. to drop the noqa

Copy link
Author

Choose a reason for hiding this comment

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

You are right. Done.

def get_void_pointer(typingctx, arr):
"""Custom intrinsic to get a void* pointer from a NumPy array.

This function takes a NumPy array and returns a void pointer to the array's data.
Copy link
Member

Choose a reason for hiding this comment

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

I actually don't know how numpy lays out its data in an ndarray - could we be a bit more precise here on what this void ptr points to?

arr: The NumPy array to get the void pointer from.

Returns:
A Numba signature and a code generation function that returns a void pointer
Copy link
Member

Choose a reason for hiding this comment

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

Again, more precision on array's data.

Copy link
Author

Choose a reason for hiding this comment

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

I have expanded on the comment and I have added a test.

@jhale
Copy link
Member

jhale commented Feb 26, 2025

This looks fine to me, modulo the two comments on the docstrings related to 'numpy's data'.

@sclaus2
Copy link
Author

sclaus2 commented Mar 7, 2025

Has been replaced by #753

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.

4 participants