Conversation
|
This pull request introduces 2 alerts and fixes 6 when merging 690c98c into b6b2e55 - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 2 alerts and fixes 6 when merging e35a5e2 into b6b2e55 - view on LGTM.com new alerts:
fixed alerts:
|
|
Why is it good C++ to use containers (instead of raw arrays):
|
|
"But wait there's more"
|
|
This pull request fixes 4 alerts when merging 2d0b349 into 0a219b1 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 4 alerts when merging d4653a1 into 0a219b1 - view on LGTM.com fixed alerts:
|
TobiKattmann
left a comment
There was a problem hiding this comment.
LGTM 💐 and thanks for the passionate plea for using containers instead of pointers. The jury withdraws for its final deliberations 🧑⚖️ . Jokes aside, it is really good to get some insights
In order to nag about sth: I would appreciate a few more words in the PR description beyond bullying language features (Not sure what the pointer union has to say about that). Like using config->GetSolid_Wall instead of individual listings in several spaces; RMS_RES & BGS_RES vars now in containers for all(?) solvers (and all necessary work around that). Just some (more) highlights
(And have fun furthermore with deleting 'em all :) )
| if ((config->GetMarker_All_KindBC(iMarker) == HEAT_FLUX) || | ||
| (config->GetMarker_All_KindBC(iMarker) == ISOTHERMAL) || | ||
| (config->GetMarker_All_KindBC(iMarker) == EULER_WALL) ) | ||
| if (config->GetSolid_Wall(iMarker)) |
There was a problem hiding this comment.
👍 good catch (here and elsewhere). I have to admit I don't really understand what this method is doing after briefly looking at it, and grepping the repo indicates that is is unused ...
| SlidingStateNodes.resize(nMarker); | ||
|
|
||
| for (iMarker = 0; iMarker < nMarker; iMarker++) { | ||
| for (unsigned long iMarker = 0; iMarker < nMarker; iMarker++) { |
There was a problem hiding this comment.
any particular reason not to use auto iMarker = 0ul. asking out of curiosity
There was a problem hiding this comment.
hmmmm ah yes, I cut and pasted it from the declaration at the top of the function :)
| su2activematrix Point_Max_Coord; /*!< \brief Vector with pointers to the coords of the maximal residual for each variable. */ | ||
| su2activematrix Point_Max_Coord_BGS; /*!< \brief Vector with pointers to the coords of the maximal residual for each variable. */ | ||
|
|
||
| /*--- Variables that need to go. ---*/ |
There was a problem hiding this comment.
:) The pointer-killer already found his next victims. Only a matter of time until he strikes again ...
| inline void SetResToZero() { | ||
| SU2_OMP_MASTER { | ||
| for (auto& r : Residual_RMS) r = 0; | ||
| for (auto& r : Residual_Max) r = 0; |
There was a problem hiding this comment.
👍 Range-based for loops are a thing in c++ since 11 but I rarely ever used them, whilst in python I use them all the time. I really need to pay more attention when I can use them
There was a problem hiding this comment.
There is a type in graph_toolbox.hpp called DummyGridColor with which one can write:
for (const auto iPoint : DummyGridColor<>(nPoint)) {
// awesome code
}Should have given it a better name like idk... Range 🤦
Anyway having that const auto iPoint is real useful when we go for them record breaking nested loops 👍
| su2double *Residual_RMS, /*!< \brief Vector with the mean residual for each variable. */ | ||
| *Residual_Max, /*!< \brief Vector with the maximal residual for each variable. */ | ||
| *Residual, /*!< \brief Auxiliary nVar vector. */ | ||
| vector<su2double> Residual_RMS; /*!< \brief Vector with the mean residual for each variable. */ | ||
| vector<su2double> Residual_Max; /*!< \brief Vector with the maximal residual for each variable. */ | ||
| vector<su2double> Residual_BGS; /*!< \brief Vector with the mean residual for each variable for BGS subiterations. */ |
There was a problem hiding this comment.
Summary of what this PR is about.
Proposed Changes
Pointers are pure evil.
PR Checklist