Improve Enum Names and Remove Unused Color Enum#298
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #298 +/- ##
=======================================
Coverage 95.67% 95.67%
=======================================
Files 79 79
Lines 8640 8640
=======================================
Hits 8266 8266
Misses 374 374 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
LevelType can be made const in lots of places but not on my prio list :) |
| Vector<double> rhs(); | ||
| ConstVector<double> rhs() const; | ||
| Vector<double> solution(); | ||
| ConstVector<double> solution() const; | ||
| Vector<double> residual(); | ||
| ConstVector<double> residual() const; | ||
| Vector<double> error_correction(); | ||
| ConstVector<double> error_correction() const; | ||
| Vector<double> rhs() const; | ||
| Vector<double> solution() const; | ||
| Vector<double> residual() const; | ||
| Vector<double> error_correction() const; |
There was a problem hiding this comment.
Why this change? Isn't it safer to return a ConstVector from a const object?
There was a problem hiding this comment.
I think
return Vector const is the correct one in our context.
It returns a const pointer of vector which entries can be modified.
There was a problem hiding this comment.
For me both getters are "const" so it only makes sense to keep the Vector one.
There was a problem hiding this comment.
From a purely IT standpoint I agree, however from a readability/beginner-friendly point of view I am not sure I agree.
Most people understand const to mean that the object and its contents cannot be modified. This is what is enforced in the version on main. In reality Vector<double> rhs(); can be marked const as it does not change the class (as the pointer points to the same thing), however adding it prevents us from separating out the case returning Vector<double> from the case returning ConstVector<double>. Given that the const annotation is mostly there to prevent developers from making changes to objects that are not expected to change, I think this separation is useful from a user-friendliness standpoint.
A similar change was made in the matrix getter/setters however there the case was slightly different. In that case the constness didn't come from GMGPolar developers trying to enforce correct usage of GMGPolar, rather it came from Kokkos making everything copied to GPU const to reflect the fact that modifications to members won't be auto-copied back to CPU. This made it impossible to avoid adding const to the setters.
There was a problem hiding this comment.
"Most people understand const to mean that the object and its contents cannot be modified."
Yes thats why I implemented it like that a year ago. Usually const means that also the entries cant be modified.
However with Kokkos we no longer interpret our vectors as objects.
They are interpreted as pointers.
Thus for me the new version reflects that correctly.
There was a problem hiding this comment.
However with Kokkos we no longer interpret our vectors as objects.
They are interpreted as pointers.
Thus for me the new version reflects that correctly.
This is why I say that I agree from an IT standpoint.
But in my experience most people (especially beginners) do not notice that a Kokkos view is simply a pointer. Your new version reflects the reality from an IT standpoint. But from experience in other code bases, this implementation is a trip hazard for beginners and doesn't bring any advantages for non-beginners
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):