-
-
Notifications
You must be signed in to change notification settings - Fork 228
Add FiniteElement python wrapper
#3542
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
Conversation
…rapper' into add_finiteelement_wrapper
garth-wells
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wrapping of the C++ FiniteElement needs to be sorted out. See comment on cached_property in the discussion.
|
The discussed case has been changed in 02d03f2. |
| cell_permutations: Permutation data for the cell. | ||
| dim: Number of columns in `data`. | ||
| Note: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schnellerhase This is not correct. These functions have loop access in the python wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type hint should be npt.NDArray[np.int32].
dolfinx/python/dolfinx/wrappers/fem.cpp
Lines 187 to 196 in fcc7719
| const std::size_t data_per_cell | |
| = x.size() / cell_permutations.size(); | |
| std::span<T> x_span(x.data(), x.size()); | |
| std::span<const std::uint32_t> perm_span( | |
| cell_permutations.data(), cell_permutations.size()); | |
| for (std::size_t i = 0; i < cell_permutations.size(); i++) | |
| { | |
| self.Tt_apply(x_span.subspan(i * data_per_cell, data_per_cell), | |
| perm_span[i], dim); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catches and fixes - my bad!
| Exposed for testing. Function is not vectorised across multiple cells. Please see | ||
| ``basix.numba_helpers`` for performant versions. | ||
| """ | ||
| self._cpp_object.Tt_apply(x, cell_permutations, dim) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also wrong, as this should apply the inverse transform.
* Start to wrap FiniteElement * Ruff * Ufl naming * More wrapping * ruff * last one? * Misse done * nomatching * Add docstrings * Add tpye hints * Remove returns for properties * Add argument doc strings * more document args * Rename: dtype -> FiniteElement_dtype * finite_element -> finiteelement * Ruff * Apply suggestion * Switch to cached_propert for element access * FixreStructured text * Fix return type descriptions
Together with #3509 fixes #3483.