Replace DirectSolverGive macros with type-safe functions#168
Replace DirectSolverGive macros with type-safe functions#168julianlitz wants to merge 2 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
+ Coverage 89.41% 91.12% +1.71%
==========================================
Files 91 91
Lines 5241 6254 +1013
==========================================
+ Hits 4686 5699 +1013
Misses 555 555 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if (DirBC_Interior_) { | ||
| applySymmetryShiftInnerBoundary(x); |
There was a problem hiding this comment.
I wonder if we should make DirBC_Interior_ constexpr in the future. Do you have an opinion?
There was a problem hiding this comment.
I am not that experienced with constexpr yet, but if you like to make this modification feel free to.
I would guess there is no performance gain due to the branch predictor disregarding the other path.
There was a problem hiding this comment.
I would guess there is no performance gain due to the branch predictor disregarding the other path.
I have never studied the branch predictor in detail but you may well be right, especially after the first iteration.
I am not that experienced with constexpr yet, but if you like to make this modification feel free to.
In any case this would be for a separate PR
Summary
This PR replaces the macros with inline functions to improve type safety and code maintainability without sacrificing performance. This is part of the broader effort to eliminate macro usage throughout GMGPolar.
Motivation
As discussed in #149, macros are error-prone and bypass C++'s type system, making bugs harder to catch at compile time. Macros in GMGPolar are currently used for code inlining, but modern C++ compilers handle inline functions just as efficiently in release builds while providing:
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):