-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
base: main
Are you sure you want to change the base?
Add FiniteElement
python wrapper
#3542
Conversation
"""Function space finite element.""" | ||
return self._cpp_object.element # type: ignore | ||
return FiniteElement(self._cpp_object.element) |
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 creates a new FiniteElement
wrapper each time. Would it be better to wrap the element in the initialiser?
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.
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
.
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.
Perhaps this is naive, but could https://docs.python.org/3/library/functools.html#functools.cached_property be used?
…rapper' into add_finiteelement_wrapper
Together with #3509 fixes #3483.