Conversation
and replace pointers by containers
SU2_CFD/src/solvers/CHeatSolver.cpp
Outdated
| } | ||
|
|
||
| SU2_MPI::Allreduce(Local_Surface_Areas, Surface_Areas, config->GetnMarker_HeatFlux(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); | ||
| SU2_MPI::Allreduce(Local_Surface_Areas, Surface_Areas.data(), config->GetnMarker_HeatFlux(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); |
There was a problem hiding this comment.
Could this be problematic (MPI + containers)?
There was a problem hiding this comment.
not that I am aware of :)
There was a problem hiding this comment.
There is no problem, memory is memory, but when doing this I prefer to use the .size() of the container for the MPI count rather than reading it from config or somewhere else.
| *Primitive, *Primitive_Flow_i, *Primitive_Flow_j, | ||
| *Surface_Areas, Total_HeatFlux_Areas, Total_HeatFlux_Areas_Monitor; | ||
| su2double ***ConjugateVar, ***InterfaceVar; | ||
| vector<vector<su2double> > HeatFlux; |
There was a problem hiding this comment.
Maybe someone could add /*!< \brief comments */.
There was a problem hiding this comment.
Hmm yes I can do that, I already worked on the output of the heatsolver ... but I put that on the long bench. I am not sure if all those containers are necessary.
I'll add a commit tomorrow 👍
|
This pull request fixes 6 alerts when merging 84e0585 into e823be7 - view on LGTM.com fixed alerts:
|
TobiKattmann
left a comment
There was a problem hiding this comment.
Thanks for this @maxaehle 💐 lgtm
SU2_CFD/src/solvers/CHeatSolver.cpp
Outdated
| } | ||
|
|
||
| SU2_MPI::Allreduce(Local_Surface_Areas, Surface_Areas, config->GetnMarker_HeatFlux(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); | ||
| SU2_MPI::Allreduce(Local_Surface_Areas, Surface_Areas.data(), config->GetnMarker_HeatFlux(), MPI_DOUBLE, MPI_SUM, SU2_MPI::GetComm()); |
There was a problem hiding this comment.
not that I am aware of :)
| *Primitive, *Primitive_Flow_i, *Primitive_Flow_j, | ||
| *Surface_Areas, Total_HeatFlux_Areas, Total_HeatFlux_Areas_Monitor; | ||
| su2double ***ConjugateVar, ***InterfaceVar; | ||
| vector<vector<su2double> > HeatFlux; |
There was a problem hiding this comment.
Hmm yes I can do that, I already worked on the output of the heatsolver ... but I put that on the long bench. I am not sure if all those containers are necessary.
I'll add a commit tomorrow 👍
|
This pull request fixes 6 alerts when merging dad20d7 into 1f7f6bb - view on LGTM.com fixed alerts:
|
|
This pull request fixes 6 alerts when merging e1896e6 into 1f7f6bb - view on LGTM.com fixed alerts:
|
| auto M = N.size(); | ||
| AllocVectorOfVectors(M, N, X, val); |
There was a problem hiding this comment.
Good idea with the overload 👍
| X.resize(M); | ||
| for(size_t i = 0; i < M; ++i){ | ||
| X[i].resize(N[i]); | ||
| for (auto& x : X[i]) x = val; |
There was a problem hiding this comment.
I changed it a bit to try to make it compatible with more types. If I broke anything I'll fix it.
Thanks for all the cleanup.
|
This pull request fixes 6 alerts when merging 026fbff into 1f7f6bb - view on LGTM.com fixed alerts:
|
|
This pull request fixes 6 alerts when merging 0e250e1 into 7fa0763 - view on LGTM.com fixed alerts:
|
Proposed Changes
The following members of
CHeatSolverwere allocated but never freed:Primitive_Flow_i,Primitive_Flow_j,HeatFlux_per_Marker,AverageT_per_Marker,Surface_Areas,ConjugateVar.I propose to correct this in the spirit of #1225, using containers (
std::vector) instead of pointers. There is a bit of additional cleanup.Related Work
#1225
PR Checklist
Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.