-
Notifications
You must be signed in to change notification settings - Fork 4
Use operator() instead of rhs_f function in SourceTerms #138
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #138 +/- ##
=======================================
Coverage 88.28% 88.29%
=======================================
Files 89 89
Lines 5276 5280 +4
=======================================
+ Hits 4658 4662 +4
Misses 618 618 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
There is only a single SourceTermFunctions instance available. Since it is used exclusively at level_depth = 0 we can provide the grid at that level and your approach works perfectly as implemented here.
However, this assumption may not hold for DomainGeometry or DensityProfiles if they are invoked across multiple refinement levels (when we would switch to integers there as well).
In those cases, one option would be to always provide the grid at level = 0 and provide an additional argument
operator(i_r, i_theta, level_depth)
and convert internally
double r = grid.radius(i_r << level_depth);
double theta = grid.radius(i_theta << level_depth);.
Another option would be to make PolarGrid a template parameter of
operator<PolarGrid>(i_r, i_theta),
though this could potentially conflict with Kokkos.
Another option:
operator(const PolarGrid& grid, int i_r, int i_theta);
1 Seems a bit hacky
2 Best performance but strange looking template
3 Clear and easy but additional argument
Use
operator()(std::size_t i_r, std::size_t i_theta)instead ofrhs_f(double r, double theta)function inSourceTerms. In Pyccel the RHS is known at the grid points. If we pass integers then this information can be used directly. Otherwise an unnecessary interpolation must be added to make the RHS available at every point in space. Otherwise a function must be added to find the nearest grid point to the coordinate. This is also costly when handling non-uniform points. The function is renamed tooperator()as this means that when inheritance is removed (see #131) a Kokkos::Vector would be accepted as aSourceTerm. This removes unnecessary function calls.Merge Request - GuideLine Checklist
Guideline to check code before resolve WIP and approval, respectively.
As many checkboxes as possible should be ticked.
Checks by code author:
Always to be checked:
If functions were changed or functionality was added:
If new functionality was added:
If new third party software is used:
If new mathematical methods or epidemiological terms are used:
Checks by code reviewer(s):