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 FiniteElement python wrapper #3542

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

schnellerhase
Copy link
Contributor

@schnellerhase schnellerhase commented Nov 29, 2024

Together with #3509 fixes #3483.

@schnellerhase schnellerhase marked this pull request as ready for review November 29, 2024 21:44
python/dolfinx/fem/element.py Outdated Show resolved Hide resolved
python/dolfinx/fem/element.py Show resolved Hide resolved
python/dolfinx/fem/element.py Outdated Show resolved Hide resolved
python/dolfinx/fem/element.py Outdated Show resolved Hide resolved
python/dolfinx/fem/element.py Show resolved Hide resolved
python/dolfinx/fem/element.py Outdated Show resolved Hide resolved
"""Function space finite element."""
return self._cpp_object.element # type: ignore
return FiniteElement(self._cpp_object.element)
Copy link
Member

@garth-wells garth-wells Nov 30, 2024

Choose a reason for hiding this comment

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

This creates a new FiniteElement wrapper each time. Would it be better to wrap the element in the initialiser?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would require an additional state variable of the wrapper class FunctionSpace keeping track of the FiniteElement, which contradicts it being a wrapper to provide access only to the cpp_object, as we would then have two finite_element's around to manage.

Also the FiniteElement object itself is only a wrapper, it performs no computations or produces additional states, so it's fine to be created whenever we expose a FiniteElement.

Copy link
Contributor

Choose a reason for hiding this comment

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

python/dolfinx/fem/element.py Outdated Show resolved Hide resolved
python/dolfinx/fem/element.py Show resolved Hide resolved
python/dolfinx/fem/element.py Outdated Show resolved Hide resolved
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.

Python wrappers for AdjacencyList and FiniteElement missing
4 participants