-
Notifications
You must be signed in to change notification settings - Fork 3
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
Homogenize Python Bindings for DirichletValues + Support for fixing Subspace Basis #305
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #305 +/- ##
=======================================
Coverage 91.37% 91.38%
=======================================
Files 64 64
Lines 2262 2263 +1
=======================================
+ Hits 2067 2068 +1
Misses 195 195
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
7bed952
to
b3a4f96
Compare
8c15ba7
to
64a9c9b
Compare
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 looks already quite nice thanks! My suggestions are more or less only small cosmetic changes.
using FixBoundaryDOFsWithIntersectionFunction = | ||
std::function<void(Eigen::Ref<Eigen::VectorX<bool>>, int, LocalViewWrapper&, const Intersection&)>; | ||
|
||
// Disambiguate by number of arguments, as casting doesn't properly work with functions |
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.
can you give a reference, where it is indicated that casting does not work? this is s bold statement that ther is some bug in pybind11 without more explanation, since this should work. maybe crwte a small godbolt ex?
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.
So what I tried was to try catch the casts into the different function types. This didn't really work well because the function always got casted into the first possible function without throwing a conversion error, there was then a runtime error later when calling said function.
This issue thread supports this: pybind/pybind11#3035
It looks like py::function is always being casted to first overload in resolution order.
In this case I think disambiguating by number of arguments works quite well, I can of course shorten the comment
So this should be more or less ready. |
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.
Can you have a look at these final comments please
a814144
to
390f2e1
Compare
homogenize Python Dirichlet interface + subspace basis fixing Fix material fix3 docs
fix changelog fixBoundaryDOFs now with treepath fix reworked python interface
a2fa763
to
c12a365
Compare
def fixDOFFunction(basis, vec): | ||
vec[0] = True | ||
|
||
dirichletValues2.fixDOFs(fixDOFFunction) |
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.
nice. thanks
fixBoundaryDOFs
functionsize
andcontainer
toDirichletValues
in PythonDirichletValues
in Python (fixIthDOF
)DirichletValues
into C++DirichletValues
This also relates to issue #277