Skip to content

Commit 8642dcd

Browse files
committed
no more pointer, except all the turbo stuff
1 parent 4502861 commit 8642dcd

15 files changed

Lines changed: 95 additions & 324 deletions

SU2_CFD/include/numerics_simd/flow/diffusion/common.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ FORCEINLINE void correctGradient(const PrimitiveType& V,
7171
*/
7272
template<size_t nVar, size_t nDim>
7373
FORCEINLINE MatrixDbl<nDim> stressTensor(Double viscosity,
74-
const MatrixDbl<nVar,nDim> grad) {
74+
const MatrixDbl<nVar,nDim>& grad) {
7575
/*--- Hydrostatic term. ---*/
7676
Double velDiv = 0.0;
7777
for (size_t iDim = 0; iDim < nDim; ++iDim) {
@@ -154,7 +154,7 @@ FORCEINLINE void addQCR(const MatrixType& grad, MatrixDbl<nDim>& tau) {
154154
*/
155155
template<size_t nVar, size_t nDim, class PrimitiveType>
156156
FORCEINLINE MatrixDbl<nDim,nVar> stressTensorJacobian(const PrimitiveType& V,
157-
const VectorDbl<nDim> normal,
157+
const VectorDbl<nDim>& normal,
158158
Double dist_ij) {
159159
Double viscosity = V.laminarVisc() + V.eddyVisc();
160160
Double xi = viscosity / (V.density() * dist_ij);

SU2_CFD/include/solvers/CEulerSolver.hpp

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,42 +43,38 @@ class CEulerSolver : public CFVMFlowSolverBase<CEulerVariable, COMPRESSIBLE> {
4343
Prandtl_Lam = 0.0, /*!< \brief Laminar Prandtl number. */
4444
Prandtl_Turb = 0.0; /*!< \brief Turbulent Prandtl number. */
4545

46+
su2double AllBound_CEquivArea_Inv=0.0; /*!< \brief equivalent area coefficient (inviscid contribution) for all the boundaries. */
47+
vector<su2double> CEquivArea_Mnt; /*!< \brief Equivalent area (inviscid contribution) for each boundary. */
48+
vector<su2double> CEquivArea_Inv; /*!< \brief Equivalent area (inviscid contribution) for each boundary. */
49+
50+
vector<su2double> Inflow_MassFlow; /*!< \brief Mass flow rate for each boundary. */
51+
vector<su2double> Exhaust_MassFlow; /*!< \brief Mass flow rate for each boundary. */
52+
vector<su2double> Inflow_Pressure; /*!< \brief Fan face pressure for each boundary. */
53+
vector<su2double> Inflow_Mach; /*!< \brief Fan face mach number for each boundary. */
54+
vector<su2double> Inflow_Area; /*!< \brief Boundary total area. */
55+
vector<su2double> Exhaust_Area; /*!< \brief Boundary total area. */
56+
vector<su2double> Exhaust_Pressure; /*!< \brief Fan face pressure for each boundary. */
57+
vector<su2double> Exhaust_Temperature; /*!< \brief Fan face mach number for each boundary. */
4658
su2double
47-
AllBound_CEquivArea_Inv = 0.0, /*!< \brief equivalent area coefficient (inviscid contribution) for all the boundaries. */
48-
*CEquivArea_Mnt = nullptr, /*!< \brief Equivalent area (inviscid contribution) for each boundary. */
49-
*CEquivArea_Inv = nullptr; /*!< \brief Equivalent area (inviscid contribution) for each boundary. */
50-
51-
su2double
52-
*Inflow_MassFlow = nullptr, /*!< \brief Mass flow rate for each boundary. */
53-
*Exhaust_MassFlow = nullptr, /*!< \brief Mass flow rate for each boundary. */
54-
*Inflow_Pressure = nullptr, /*!< \brief Fan face pressure for each boundary. */
55-
*Inflow_Mach = nullptr, /*!< \brief Fan face mach number for each boundary. */
56-
*Inflow_Area = nullptr, /*!< \brief Boundary total area. */
57-
*Exhaust_Area = nullptr, /*!< \brief Boundary total area. */
58-
*Exhaust_Pressure = nullptr, /*!< \brief Fan face pressure for each boundary. */
59-
*Exhaust_Temperature = nullptr,/*!< \brief Fan face mach number for each boundary. */
6059
Inflow_MassFlow_Total = 0.0, /*!< \brief Mass flow rate for each boundary. */
6160
Exhaust_MassFlow_Total = 0.0, /*!< \brief Mass flow rate for each boundary. */
6261
Inflow_Pressure_Total = 0.0, /*!< \brief Fan face pressure for each boundary. */
6362
Inflow_Mach_Total = 0.0, /*!< \brief Fan face mach number for each boundary. */
6463
InverseDesign = 0.0; /*!< \brief Inverse design functional for each boundary. */
65-
unsigned long
66-
**DonorGlobalIndex = nullptr; /*!< \brief Value of the donor global index. */
67-
su2double
68-
***DonorPrimVar = nullptr, /*!< \brief Value of the donor variables at each boundary. */
69-
**ActDisk_DeltaP = nullptr, /*!< \brief Value of the Delta P. */
70-
**ActDisk_DeltaT = nullptr; /*!< \brief Value of the Delta T. */
64+
vector<vector<unsigned long> > DonorGlobalIndex; /*!< \brief Value of the donor global index. */
65+
vector<su2activematrix> DonorPrimVar; /*!< \brief Value of the donor variables at each boundary. */
66+
vector<vector<su2double> > ActDisk_DeltaP; /*!< \brief Value of the Delta P. */
67+
vector<vector<su2double> > ActDisk_DeltaT; /*!< \brief Value of the Delta T. */
7168

7269
su2activevector
7370
ActDisk_R; /*!< \brief Value of the actuator disk Radius. */
7471
su2activematrix
7572
ActDisk_C, /*!< \brief Value of the actuator disk Center. */
7673
ActDisk_Axis; /*!< \brief Value of the actuator disk Axis. */
77-
su2double
78-
**ActDisk_Fa, /*!< \brief Value of the actuator disk Axial Force per Unit Area. */
79-
**ActDisk_Fx, /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */
80-
**ActDisk_Fy, /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */
81-
**ActDisk_Fz; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */
74+
vector<vector<su2double> > ActDisk_Fa; /*!< \brief Value of the actuator disk Axial Force per Unit Area. */
75+
vector<vector<su2double> > ActDisk_Fx; /*!< \brief Value of the actuator disk X component of the radial and tangential forces per Unit Area resultant. */
76+
vector<vector<su2double> > ActDisk_Fy; /*!< \brief Value of the actuator disk Y component of the radial and tangential forces per Unit Area resultant. */
77+
vector<vector<su2double> > ActDisk_Fz; /*!< \brief Value of the actuator disk Z component of the radial and tangential forces per Unit Area resultant. */
8278

8379
su2double
8480
Total_CL_Prev = 0.0, /*!< \brief Total lift coefficient for all the boundaries (fixed lift mode). */

SU2_CFD/include/solvers/CFVMFlowSolverBase.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class CFVMFlowSolverBase : public CSolver {
166166

167167
/*--- Sliding meshes variables ---*/
168168

169-
su2double**** SlidingState = nullptr;
169+
vector<su2matrix<su2double*> > SlidingState; // vector of matrix of pointers... inner dim alloc'd elsewhere (welcome, to the twilight zone)
170170
vector<vector<int> > SlidingStateNodes;
171171

172172
/*--- Shallow copy of grid coloring for OpenMP parallelization. ---*/

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void CFVMFlowSolverBase<V, R>::AeroCoeffsArray::setZero(int i) {
8585
template <class V, ENUM_REGIME R>
8686
void CFVMFlowSolverBase<V, R>::Allocate(const CConfig& config) {
8787
unsigned short iVar;
88-
unsigned long iPoint, iMarker;
88+
unsigned long iMarker;
8989

9090
/*--- Define some auxiliar vector related with the residual ---*/
9191

@@ -173,16 +173,13 @@ void CFVMFlowSolverBase<V, R>::Allocate(const CConfig& config) {
173173

174174
/*--- Initializate quantities for SlidingMesh Interface ---*/
175175

176-
SlidingState = new su2double***[nMarker]();
176+
SlidingState.resize(nMarker);
177177
SlidingStateNodes.resize(nMarker);
178178

179179
for (iMarker = 0; iMarker < nMarker; iMarker++) {
180180
if (config.GetMarker_All_KindBC(iMarker) == FLUID_INTERFACE) {
181-
SlidingState[iMarker] = new su2double**[nVertex[iMarker]]();
181+
SlidingState[iMarker].resize(nVertex[iMarker], nPrimVar+1) = nullptr;
182182
SlidingStateNodes[iMarker].resize(nVertex[iMarker],0);
183-
184-
for (iPoint = 0; iPoint < nVertex[iMarker]; iPoint++)
185-
SlidingState[iMarker][iPoint] = new su2double*[nPrimVar + 1]();
186183
}
187184
}
188185

@@ -372,21 +369,9 @@ void CFVMFlowSolverBase<V, R>::HybridParallelInitialization(const CConfig& confi
372369

373370
template <class V, ENUM_REGIME R>
374371
CFVMFlowSolverBase<V, R>::~CFVMFlowSolverBase() {
375-
unsigned short iVar;
376-
unsigned long iMarker, iVertex;
377372

378-
if (SlidingState != nullptr) {
379-
for (iMarker = 0; iMarker < nMarker; iMarker++) {
380-
if (SlidingState[iMarker] != nullptr) {
381-
for (iVertex = 0; iVertex < nVertex[iMarker]; iVertex++)
382-
if (SlidingState[iMarker][iVertex] != nullptr) {
383-
for (iVar = 0; iVar < nPrimVar + 1; iVar++) delete[] SlidingState[iMarker][iVertex][iVar];
384-
delete[] SlidingState[iMarker][iVertex];
385-
}
386-
delete[] SlidingState[iMarker];
387-
}
388-
}
389-
delete[] SlidingState;
373+
for (auto& mat : SlidingState) {
374+
for (auto ptr : mat) delete [] ptr;
390375
}
391376

392377
delete nodes;

SU2_CFD/include/solvers/CNEMONSSolver.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,13 @@
3838
* \brief Main class for defining the NEMO Navier-Stokes flow solver.
3939
* \ingroup Navier_Stokes_Equations
4040
* \author S. R. Copeland, F. Palacios, W. Maier.
41-
* \version 7.0.8
4241
*
4342
*/
4443
class CNEMONSSolver final : public CNEMOEulerSolver {
4544
private:
4645

4746
su2double Prandtl_Lam, /*!< \brief Laminar Prandtl number. */
4847
Prandtl_Turb; /*!< \brief Turbulent Prandtl number. */
49-
50-
su2double StrainMag_Max,
51-
Omega_Max; /*!< \brief Maximum Strain Rate magnitude and Omega. */
52-
su2double *primitives_aux; /*!< \brief Primitive auxiliary variables (Y_s, T, Tve, ...) in compressible flows. */
5348

5449
/*!
5550
* \brief Compute the velocity^2, SoundSpeed, Pressure, Enthalpy, Viscosity.
@@ -77,7 +72,7 @@ class CNEMONSSolver final : public CNEMOEulerSolver {
7772
/*!
7873
* \brief Destructor of the class.
7974
*/
80-
~CNEMONSSolver(void) override;
75+
~CNEMONSSolver() = default;
8176

8277
/*!
8378
* \brief Compute the gradient of the primitive variables using Green-Gauss method,

SU2_CFD/include/solvers/CNSSolver.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
*/
3838
class CNSSolver final : public CEulerSolver {
3939
private:
40-
su2double
41-
*Surface_Buffet_Metric = nullptr, /*!< \brief Integrated separation sensor for each monitoring surface. */
42-
*Buffet_Metric = nullptr, /*!< \brief Integrated separation sensor for each boundary. */
43-
**Buffet_Sensor = nullptr, /*!< \brief Separation sensor for each boundary and vertex. */
44-
Total_Buffet_Metric = 0.0; /*!< \brief Integrated separation sensor for all the boundaries. */
40+
41+
vector<su2double> Surface_Buffet_Metric; /*!< \brief Integrated separation sensor for each monitoring surface. */
42+
vector<su2double> Buffet_Metric; /*!< \brief Integrated separation sensor for each boundary. */
43+
vector<vector<su2double> > Buffet_Sensor; /*!< \brief Separation sensor for each boundary and vertex. */
44+
su2double Total_Buffet_Metric = 0.0; /*!< \brief Integrated separation sensor for all the boundaries. */
4545

4646
/*!
4747
* \brief A virtual member.
@@ -131,7 +131,7 @@ class CNSSolver final : public CEulerSolver {
131131
/*!
132132
* \brief Destructor of the class.
133133
*/
134-
~CNSSolver(void) override;
134+
~CNSSolver() = default;
135135

136136
/*!
137137
* \brief Provide the buffet metric.

SU2_CFD/include/solvers/CTurbSASolver.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class CTurbSASolver final : public CTurbSolver {
7171
/*!
7272
* \brief Constructor of the class.
7373
*/
74-
CTurbSASolver(void);
74+
CTurbSASolver();
7575

7676
/*!
7777
* \overload
@@ -85,7 +85,7 @@ class CTurbSASolver final : public CTurbSolver {
8585
/*!
8686
* \brief Destructor of the class.
8787
*/
88-
~CTurbSASolver(void) override;
88+
~CTurbSASolver() = default;
8989

9090
/*!
9191
* \brief Restart residual and compute gradients.

SU2_CFD/include/solvers/CTurbSSTSolver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class CTurbSSTSolver final : public CTurbSolver {
5959
/*!
6060
* \brief Destructor of the class.
6161
*/
62-
~CTurbSSTSolver(void) override;
62+
~CTurbSSTSolver() = default;
6363

6464
/*!
6565
* \brief Restart residual and compute gradients.

SU2_CFD/include/solvers/CTurbSolver.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ class CTurbSolver : public CSolver {
5252
lowerlimit[MAXNVAR] = {0.0}, /*!< \brief contains lower limits for turbulence variables. */
5353
upperlimit[MAXNVAR] = {0.0}, /*!< \brief contains upper limits for turbulence variables. */
5454
Gamma, /*!< \brief Fluid's Gamma constant (ratio of specific heats). */
55-
Gamma_Minus_One, /*!< \brief Fluids's Gamma - 1.0 . */
56-
***Inlet_TurbVars = nullptr; /*!< \brief Turbulence variables at inlet profiles */
55+
Gamma_Minus_One; /*!< \brief Fluids's Gamma - 1.0 . */
56+
vector<su2activematrix> Inlet_TurbVars; /*!< \brief Turbulence variables at inlet profiles */
5757

5858
/*--- Sliding meshes variables. ---*/
5959

60-
su2double ****SlidingState = nullptr;
61-
int **SlidingStateNodes = nullptr;
60+
vector<su2matrix<su2double*> > SlidingState; // vector of matrix of pointers... inner dim alloc'd elsewhere (welcome, to the twilight zone)
61+
vector<vector<int> > SlidingStateNodes;
6262

6363
/*--- Shallow copy of grid coloring for OpenMP parallelization. ---*/
6464

@@ -371,8 +371,6 @@ class CTurbSolver : public CSolver {
371371
* checking to prevent segmentation faults ---*/
372372
if (val_marker >= nMarker)
373373
SU2_MPI::Error("Out-of-bounds marker index used on inlet.", CURRENT_FUNCTION);
374-
else if (Inlet_TurbVars == nullptr || Inlet_TurbVars[val_marker] == nullptr)
375-
SU2_MPI::Error("Tried to set custom inlet BC on an invalid marker.", CURRENT_FUNCTION);
376374
else if (val_vertex >= nVertex[val_marker])
377375
SU2_MPI::Error("Out-of-bounds vertex index used on inlet.", CURRENT_FUNCTION);
378376
else if (val_dim >= nVar)

0 commit comments

Comments
 (0)