-
Notifications
You must be signed in to change notification settings - Fork 36
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
Deprecate VoronoiFVM.Physics callbacks without data
argument
#122
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #122 +/- ##
==========================================
- Coverage 85.33% 83.78% -1.56%
==========================================
Files 24 24
Lines 2803 2911 +108
==========================================
+ Hits 2392 2439 +47
- Misses 411 472 +61 ☔ View full report in Codecov by Sentry. |
3609644
to
46d076a
Compare
Was not aware of |
BTW the failure on nightly is due to some problems with RecursiveFactorizations.jl. |
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.
May be instead of testing for !applicable(f,nn,nn,nn,nn)
we can test for applicable(f,nn,nn,nn)
?
Also this works only if the callback functions are completely generic.
Im case a user has callbacks with some typed parameters, the proposed version would create false negatives which may be tolerable, while the implemented one would create false positives.
I second that. The |
Indeed, this is a better way. I will change that. |
After some thinking I had another idea. Instead of testing the signature of the callback functions, we directly check with
|
The simplified examples are good. However the test is not static, as the assembly code calls the fwrap, so the check is done all the time, and the warning is called as well. I had the idea to use
and define
After the test with applicable, the isdata flag in NoData could be overwritten. |
Yes, the The name of the proposed helper struct |
MaybeData is good. I think the |
As for the failing tests:
|
0638d98
to
f323857
Compare
Ok, I think I have a working solution with
|
|
All warnings are now fixed, as far as I saw on my local machine. A changelog entry is also added. |
From my side I am now happy with the PR. I will squash this into less commits once it is approved. |
I am happy as well - good to go! |
This patch implements a warning that is triggered if the user constructs a VoronoiFVM.Physics object with a callback function that uses only three or two arguments, respectively. All examples were overhauled to comply with the new interface. A MaybeData dummy struct was added. This helper struct represents data or not. The purpose is to control whether we call the Physics callbacks with or without data. A heuristic check is performed to detect the signature of the callbacks. This can safely be removed once the deprecation phase is over. With MaybeData the dummies nofunc2, nosrc2 and default_storage2 can be removed.
a891754
to
c8377f4
Compare
data
argumentdata
argument
Ok, squashed into 2 commits. There was a double entry in the changelog. I fixed that in the second commit. |
This patch implements a warning that is triggered if the user constructs a VoronoiFVM.Physics object with a callback function that uses only three or two arguments, respectively.
All examples were overhauled to comply with the new interface. Hereby, the data=nothing default has to be set to allow calls with and without the data argument. This needs to be done to preserve the current checks for isdata() and hasdata().
The default can be removed once the deprecated code is removed.