Skip to content

Commit 4f11b35

Browse files
authored
Merge pull request #1138 from su2code/fix_warnings
Fix compiler warnings
2 parents ceedff4 + 93158fe commit 4f11b35

17 files changed

Lines changed: 61 additions & 89 deletions

Common/src/geometry/CMultiGridGeometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ void CMultiGridGeometry::SetControlVolume(CConfig *config, CGeometry *fine_grid,
10841084

10851085
unsigned long iFinePoint, iCoarsePoint, iEdge, iParent;
10861086
long FineEdge, CoarseEdge;
1087-
unsigned short iChildren, iDim;
1087+
unsigned short iChildren;
10881088
bool change_face_orientation;
10891089
su2double Coarse_Volume, Area;
10901090

Common/src/toolboxes/CSquareMatrixCM.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void CSquareMatrixCM::MatMatMult(const char side,
8787
/*--- Left side: mat_out = this * mat_in. Set some sizes
8888
and allocate the memory for mat_out. ---*/
8989
const int M = Size(), N = mat_in.cols();
90-
assert(M == mat_in.rows());
90+
assert(M == static_cast<int>(mat_in.rows()));
9191

9292
mat_out.resize(M,N);
9393

@@ -117,7 +117,7 @@ void CSquareMatrixCM::MatMatMult(const char side,
117117
/*--- Right_side: mat_out = mat_in * this. Set some sizes
118118
and allocate the memory for mat_out. ---*/
119119
const int M = mat_in.rows(), N = Size();
120-
assert(N == mat_in.cols());
120+
assert(N == static_cast<int>(mat_in.cols()));
121121

122122
mat_out.resize(M,N);
123123

SU2_CFD/include/solvers/CFVMFlowSolverBase.inl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ template <class V, ENUM_REGIME FlowRegime>
16961696
void CFVMFlowSolverBase<V, FlowRegime>::Momentum_Forces(const CGeometry* geometry, const CConfig* config) {
16971697
unsigned long iVertex, iPoint;
16981698
unsigned short iDim, iMarker, Boundary, Monitoring, iMarker_Monitoring;
1699-
su2double Area, factor, RefVel2 = 0.0, RefTemp, RefDensity = 0.0, Mach2Vel, Mach_Motion, MassFlow, Density;
1699+
su2double factor, RefVel2 = 0.0, RefTemp, RefDensity = 0.0, Mach2Vel, Mach_Motion, MassFlow, Density;
17001700
const su2double *Normal = nullptr, *Coord = nullptr;
17011701
string Marker_Tag, Monitoring_Tag;
17021702
su2double AxiFactor;
@@ -1790,7 +1790,6 @@ void CFVMFlowSolverBase<V, FlowRegime>::Momentum_Forces(const CGeometry* geometr
17901790
Normal = geometry->vertex[iMarker][iVertex]->GetNormal();
17911791
Coord = geometry->nodes->GetCoord(iPoint);
17921792
Density = nodes->GetDensity(iPoint);
1793-
Area = GeometryToolbox::Norm(nDim, Normal);
17941793
MassFlow = 0.0;
17951794
su2double Velocity[MAXNDIM] = {0.0}, MomentDist[MAXNDIM] = {0.0};
17961795
for (iDim = 0; iDim < nDim; iDim++) {

SU2_CFD/src/interfaces/cht/CConjugateHeatInterface.cpp

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -40,45 +40,28 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
4040
const CConfig *donor_config, unsigned long Marker_Donor,
4141
unsigned long Vertex_Donor, unsigned long Point_Donor) {
4242

43-
unsigned short nDim, iDim;
44-
unsigned long iPoint, PointNormal;
43+
const auto nDim = donor_geometry->GetnDim();
4544

46-
su2double *Coord, *Coord_Normal, *Normal, *Edge_Vector, dist, dist2, Area,
47-
Twall, Tnormal, dTdn, rho_cp_solid, Prandtl_Lam, laminar_viscosity,
45+
su2double Twall, Tnormal, dTdn, rho_cp_solid, Prandtl_Lam, laminar_viscosity,
4846
thermal_diffusivity, thermal_conductivity=0.0, thermal_conductivityND,
4947
heat_flux_density=0.0, conductivity_over_dist=0.0;
5048

51-
nDim = donor_geometry->GetnDim();
52-
53-
Edge_Vector = new su2double[nDim];
54-
5549
/*--- Check whether the current zone is a solid zone or a fluid zone ---*/
5650

57-
bool compressible_flow = ((donor_config->GetKind_Solver() == NAVIER_STOKES)
58-
|| (donor_config->GetKind_Solver() == RANS)
59-
|| (donor_config->GetKind_Solver() == DISC_ADJ_NAVIER_STOKES)
60-
|| (donor_config->GetKind_Solver() == DISC_ADJ_RANS));
61-
bool incompressible_flow = (((donor_config->GetKind_Solver() == INC_NAVIER_STOKES)
62-
|| (donor_config->GetKind_Solver() == INC_RANS)
63-
|| (donor_config->GetKind_Solver() == DISC_ADJ_INC_NAVIER_STOKES)
64-
|| (donor_config->GetKind_Solver() == DISC_ADJ_INC_RANS))
65-
&& (donor_config->GetEnergy_Equation()));
66-
bool heat_equation = ((donor_config->GetKind_Solver() == HEAT_EQUATION)
67-
|| (donor_config->GetKind_Solver() == DISC_ADJ_HEAT));
51+
const bool compressible_flow = (donor_config->GetKind_Regime() == COMPRESSIBLE);
52+
const bool incompressible_flow = (donor_config->GetKind_Regime() == INCOMPRESSIBLE) && donor_config->GetEnergy_Equation();
53+
const bool heat_equation = (donor_config->GetKind_Solver() == HEAT_EQUATION) ||
54+
(donor_config->GetKind_Solver() == DISC_ADJ_HEAT);
6855

69-
Coord = donor_geometry->nodes->GetCoord(Point_Donor);
56+
const auto Coord = donor_geometry->nodes->GetCoord(Point_Donor);
57+
const auto PointNormal = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNormal_Neighbor();
58+
const auto Coord_Normal = donor_geometry->nodes->GetCoord(PointNormal);
7059

71-
Normal = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNormal();
72-
PointNormal = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNormal_Neighbor();
73-
Coord_Normal = donor_geometry->nodes->GetCoord(PointNormal);
60+
Twall = 0.0; Tnormal = 0.0; dTdn = 0.0;
7461

75-
Twall = 0.0; Tnormal = 0.0; dTdn = 0.0; dist2 = 0.0; Area = 0.0;
76-
77-
for (iDim = 0; iDim < nDim; iDim++) {
78-
Edge_Vector[iDim] = Coord_Normal[iDim] - Coord[iDim];
79-
}
80-
dist = GeometryToolbox::Norm(nDim, Edge_Vector);
81-
Area = GeometryToolbox::Norm(nDim, Normal);
62+
su2double Edge_Vector[3] = {0.0};
63+
GeometryToolbox::Distance(nDim, Coord_Normal, Coord, Edge_Vector);
64+
su2double dist = GeometryToolbox::Norm(nDim, Edge_Vector);
8265

8366
/*--- Retrieve temperature solution and its gradient ---*/
8467

@@ -101,6 +84,8 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
10184
Tnormal = donor_solution->GetNodes()->GetSolution(PointNormal,0);
10285

10386
// TODO: Check if these improve accuracy, if needed at all
87+
// const auto Normal = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNormal();
88+
// su2double Area = GeometryToolbox::Norm(nDim, Normal);
10489
// for (iDim = 0; iDim < nDim; iDim++) {
10590
// dTdn += (Twall - Tnormal)/dist * (Edge_Vector[iDim]/dist) * (Normal[iDim]/Area);
10691
// }
@@ -136,7 +121,7 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
136121
}
137122
else if (incompressible_flow) {
138123

139-
iPoint = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNode();
124+
const auto iPoint = donor_geometry->vertex[Marker_Donor][Vertex_Donor]->GetNode();
140125

141126
thermal_conductivityND = donor_solution->GetNodes()->GetThermalConductivity(iPoint);
142127
heat_flux_density = thermal_conductivityND*dTdn;
@@ -188,10 +173,6 @@ void CConjugateHeatInterface::GetDonor_Variable(CSolver *donor_solution, CGeomet
188173
Donor_Variable[3] = Tnormal*donor_config->GetTemperature_Ref();
189174
}
190175

191-
192-
193-
delete [] Edge_Vector;
194-
195176
}
196177

197178
void CConjugateHeatInterface::SetTarget_Variable(CSolver *target_solution, CGeometry *target_geometry,

SU2_CFD/src/numerics/NEMO/convection/lax.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ CCentLax_NEMO::CCentLax_NEMO(unsigned short val_nDim,
3232
unsigned short val_nVar,
3333
unsigned short val_nPrimVar,
3434
unsigned short val_nPrimVarGrad,
35-
CConfig *config) : CNEMONumerics(val_nDim, val_nVar,
36-
val_nPrimVar,
35+
CConfig *config) : CNEMONumerics(val_nDim, val_nVar,
36+
val_nPrimVar,
3737
val_nPrimVarGrad,
3838
config) {
3939

@@ -47,14 +47,14 @@ CCentLax_NEMO::CCentLax_NEMO(unsigned short val_nDim,
4747
MeanV = new su2double[nPrimVar];
4848
MeandPdU = new su2double[nVar];
4949
ProjFlux = new su2double[nVar];
50-
Flux = new su2double[nVar];
50+
Flux = new su2double[nVar];
5151

5252
mean_eves.resize(nSpecies,0.0);
5353

5454
}
5555

5656
CCentLax_NEMO::~CCentLax_NEMO(void) {
57-
57+
5858
delete [] Diff_U;
5959
delete [] MeanU;
6060
delete [] MeanV;
@@ -65,7 +65,7 @@ CCentLax_NEMO::~CCentLax_NEMO(void) {
6565

6666
CNumerics::ResidualType<> CCentLax_NEMO::ComputeResidual(const CConfig *config) {
6767

68-
unsigned short iDim, iSpecies, iVar;
68+
unsigned short iDim, iVar;
6969
su2double rho_i, rho_j, h_i, h_j, a_i, a_j;
7070
su2double ProjVel_i, ProjVel_j;
7171

@@ -87,7 +87,7 @@ CNumerics::ResidualType<> CCentLax_NEMO::ComputeResidual(const CConfig *config)
8787
MeanV[iVar] = 0.5*(V_i[iVar]+V_j[iVar]);
8888

8989
/*--- Compute NonEq specific variables ---*/
90-
vector<su2double> mean_eves = fluidmodel->ComputeSpeciesEve(MeanV[TVE_INDEX]);
90+
vector<su2double> mean_eves = fluidmodel->ComputeSpeciesEve(MeanV[TVE_INDEX]);
9191
fluidmodel->ComputedPdU(MeanV, mean_eves, MeandPdU);
9292

9393
/*--- Get projected flux tensor ---*/
@@ -104,12 +104,12 @@ CNumerics::ResidualType<> CCentLax_NEMO::ComputeResidual(const CConfig *config)
104104
/*--- Dissipation --*/
105105
Local_Lambda_i = (fabs(ProjVel_i)+a_i*Area);
106106
Local_Lambda_j = (fabs(ProjVel_j)+a_j*Area);
107-
MeanLambda = 0.5*(Local_Lambda_i+Local_Lambda_j);
107+
MeanLambda = 0.5*(Local_Lambda_i+Local_Lambda_j);
108108

109109
Phi_i = pow(Lambda_i/(4.0*MeanLambda+EPS),Param_p);
110110
Phi_j = pow(Lambda_j/(4.0*MeanLambda+EPS),Param_p);
111111
StretchingFactor = 4.0*Phi_i*Phi_j/(Phi_i+Phi_j+EPS);
112-
112+
113113
/*--- Computes differences btw. conservative variables ---*/
114114
for (iVar = 0; iVar < nVar; iVar++)
115115
Diff_U[iVar] = U_i[iVar] - U_j[iVar];

SU2_CFD/src/output/CFlowOutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ void CFlowOutput::Add_CpInverseDesignOutput(CConfig *config){
811811

812812
void CFlowOutput::Set_CpInverseDesign(CSolver *solver, CGeometry *geometry, CConfig *config){
813813

814-
unsigned short iMarker, icommas, Boundary, iDim;
814+
unsigned short iMarker, icommas, Boundary;
815815
unsigned long iVertex, iPoint, (*Point2Vertex)[2], nPointLocal = 0, nPointGlobal = 0;
816816
su2double XCoord, YCoord, ZCoord, Pressure, PressureCoeff = 0, Cp, CpTarget, *Normal = nullptr, Area, PressDiff = 0.0;
817817
bool *PointInDomain;

SU2_CFD/src/python_wrapper_structure.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,6 @@ passivedouble CDriver::GetThermalConductivity(unsigned short iMarker, unsigned l
634634

635635
vector<passivedouble> CDriver::GetVertexUnitNormal(unsigned short iMarker, unsigned long iVertex){
636636

637-
unsigned short iDim;
638637
su2double *Normal;
639638
su2double Area;
640639
vector<su2double> ret_Normal(3, 0.0);

SU2_CFD/src/solvers/CAdjEulerSolver.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ CAdjEulerSolver::CAdjEulerSolver(CGeometry *geometry, CConfig *config, unsigned
5656
unsigned short iDim, iVar, iMarker, nLineLets;
5757
ifstream restart_file;
5858
string filename, AdjExt;
59-
su2double myArea_Monitored, Area, *Normal;
59+
su2double myArea_Monitored, *Normal;
6060

6161
adjoint = true;
6262

@@ -4385,7 +4385,7 @@ void CAdjEulerSolver::BC_Engine_Inflow(CGeometry *geometry, CSolver **solver_con
43854385
void CAdjEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {
43864386

43874387
unsigned long iVertex, iPoint, Point_Normal;
4388-
su2double Area, *Normal, *V_domain, *V_exhaust, *Psi_domain, *Psi_exhaust;
4388+
su2double *Normal, *V_domain, *V_exhaust, *Psi_domain, *Psi_exhaust;
43894389
unsigned short iVar, iDim;
43904390

43914391
bool implicit = (config->GetKind_TimeIntScheme() == EULER_IMPLICIT);
@@ -4409,8 +4409,6 @@ void CAdjEulerSolver::BC_Engine_Exhaust(CGeometry *geometry, CSolver **solver_co
44094409
for (iDim = 0; iDim < nDim; iDim++) Normal[iDim] = -Normal[iDim];
44104410
conv_numerics->SetNormal(Normal);
44114411

4412-
Area = GeometryToolbox::Norm(nDim, Normal);
4413-
44144412
/*--- Index of the closest interior node ---*/
44154413

44164414
Point_Normal = geometry->vertex[val_marker][iVertex]->GetNormal_Neighbor();

SU2_CFD/src/solvers/CAdjNSSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CAdjNSSolver::CAdjNSSolver(CGeometry *geometry, CConfig *config, unsigned short
4343
su2double RefDensity = config->GetDensity_FreeStreamND();
4444
su2double Gas_Constant = config->GetGas_ConstantND();
4545
su2double Mach_Motion = config->GetMach_Motion();
46-
su2double Area=0.0, *Normal = nullptr, myArea_Monitored;
46+
su2double *Normal = nullptr, myArea_Monitored;
4747
su2double RefVel2, Mach2Vel, Weight_ObjFunc, factor;
4848
su2double *Velocity_Inf;
4949

SU2_CFD/src/solvers/CFEM_DG_EulerSolver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6699,7 +6699,7 @@ void CFEM_DG_EulerSolver::MultiplyResidualByInverseMassMatrix(
66996699

67006700
/* Multiply the residual with the inverse of the mass matrix.
67016701
Use the array workArray as temporary storage. */
6702-
for(unsigned long mm=0; mm<nVar*volElem[l].nDOFsSol; ++mm)
6702+
for(unsigned short mm=0; mm<nVar*volElem[l].nDOFsSol; ++mm)
67036703
workArray[mm] = res[mm];
67046704

67056705
blasFunctions->gemm(volElem[l].nDOFsSol, nVar, volElem[l].nDOFsSol,

0 commit comments

Comments
 (0)