From 0924747b430e2fe94d7fc0a87db0b3cd20e4ba6f Mon Sep 17 00:00:00 2001 From: Pedro Gomes Date: Wed, 3 Nov 2021 10:50:47 +0000 Subject: [PATCH] remove initializers, make sure the ctor that inits the values is the only available --- SU2_CFD/include/solvers/CScalarSolver.hpp | 13 ++++--------- SU2_CFD/include/solvers/CScalarSolver.inl | 3 --- SU2_CFD/include/solvers/CTransLMSolver.hpp | 6 +----- SU2_CFD/include/solvers/CTurbSASolver.hpp | 7 +------ SU2_CFD/include/solvers/CTurbSSTSolver.hpp | 15 +++------------ SU2_CFD/include/solvers/CTurbSolver.hpp | 6 ------ SU2_CFD/src/solvers/CTransLMSolver.cpp | 8 ++++---- SU2_CFD/src/solvers/CTurbSASolver.cpp | 2 -- SU2_CFD/src/solvers/CTurbSSTSolver.cpp | 2 -- SU2_CFD/src/solvers/CTurbSolver.cpp | 4 ---- 10 files changed, 13 insertions(+), 53 deletions(-) diff --git a/SU2_CFD/include/solvers/CScalarSolver.hpp b/SU2_CFD/include/solvers/CScalarSolver.hpp index 764f2f2ae2d..4f7cc2492da 100644 --- a/SU2_CFD/include/solvers/CScalarSolver.hpp +++ b/SU2_CFD/include/solvers/CScalarSolver.hpp @@ -49,11 +49,11 @@ class CScalarSolver : public CSolver { unsigned long omp_chunk_size; /*!< \brief Chunk size used in light point loops. */ - su2double lowerlimit[MAXNVAR] = {0.0}; /*!< \brief contains lower limits for turbulence variables. Note that ::min() - returns the smallest positive value for floats. */ - su2double upperlimit[MAXNVAR] = {0.0}; /*!< \brief contains upper limits for turbulence variables. */ + su2double lowerlimit[MAXNVAR]; /*!< \brief contains lower limits for turbulence variables. Note that ::min() + returns the smallest positive value for floats. */ + su2double upperlimit[MAXNVAR]; /*!< \brief contains upper limits for turbulence variables. */ - su2double Solution_Inf[MAXNVAR] = {0.0}; /*!< \brief Far-field solution. */ + su2double Solution_Inf[MAXNVAR]; /*!< \brief Far-field solution. */ const bool Conservative; /*!< \brief Transported Variable is conservative. Solution has to be multiplied with rho. */ @@ -171,11 +171,6 @@ class CScalarSolver : public CSolver { virtual void ComputeUnderRelaxationFactor(const CConfig* config) {} public: - /*! - * \brief Constructor of the class. - */ - CScalarSolver(bool conservative); - /*! * \brief Destructor of the class. */ diff --git a/SU2_CFD/include/solvers/CScalarSolver.inl b/SU2_CFD/include/solvers/CScalarSolver.inl index 734fed57b47..8cc4e044ee9 100644 --- a/SU2_CFD/include/solvers/CScalarSolver.inl +++ b/SU2_CFD/include/solvers/CScalarSolver.inl @@ -29,9 +29,6 @@ #include "../../include/solvers/CScalarSolver.hpp" #include "../../include/variables/CFlowVariable.hpp" -template -CScalarSolver::CScalarSolver(bool conservative) : CSolver(), Conservative(conservative) {} - template CScalarSolver::CScalarSolver(CGeometry* geometry, CConfig* config, bool conservative) : CSolver(), Conservative(conservative) { diff --git a/SU2_CFD/include/solvers/CTransLMSolver.hpp b/SU2_CFD/include/solvers/CTransLMSolver.hpp index 11dfe9562aa..6ee4fb7347a 100644 --- a/SU2_CFD/include/solvers/CTransLMSolver.hpp +++ b/SU2_CFD/include/solvers/CTransLMSolver.hpp @@ -39,12 +39,8 @@ class CTransLMSolver final : public CTurbSolver { private: su2double Intermittency_Inf, REth_Inf; -public: - /*! - * \brief Constructor of the class. - */ - CTransLMSolver(void); +public: /*! * \overload * \param[in] geometry - Geometrical definition of the problem. diff --git a/SU2_CFD/include/solvers/CTurbSASolver.hpp b/SU2_CFD/include/solvers/CTurbSASolver.hpp index 46c811b3147..5d361afe3aa 100644 --- a/SU2_CFD/include/solvers/CTurbSASolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSASolver.hpp @@ -74,12 +74,7 @@ class CTurbSASolver final : public CTurbSolver { public: /*! - * \brief Constructor of the class. - */ - CTurbSASolver(); - - /*! - * \overload + * \brief Constructor. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. * \param[in] iMesh - Index of the mesh in multigrid computations. diff --git a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp index faf73bbcb55..c64ea95fe8c 100644 --- a/SU2_CFD/include/solvers/CTurbSSTSolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSSTSolver.hpp @@ -37,10 +37,7 @@ */ class CTurbSSTSolver final : public CTurbSolver { private: - su2double - constants[10] = {0.0}; /*!< \brief Constants for the model. */ - - + su2double constants[10] = {0.0}; /*!< \brief Constants for the model. */ /*! * \brief Compute nu tilde from the wall functions. @@ -56,15 +53,9 @@ class CTurbSSTSolver final : public CTurbSolver { const CConfig *config, unsigned short val_marker); - public: /*! - * \brief Constructor of the class. - */ - CTurbSSTSolver(void); - - /*! - * \overload + * \brief Constructor. * \param[in] geometry - Geometrical definition of the problem. * \param[in] config - Definition of the particular problem. * \param[in] iMesh - Index of the mesh in multigrid computations. @@ -310,5 +301,5 @@ class CTurbSSTSolver final : public CTurbSolver { */ inline su2double GetOmega_Inf(void) const override { return Solution_Inf[1]; } - + }; diff --git a/SU2_CFD/include/solvers/CTurbSolver.hpp b/SU2_CFD/include/solvers/CTurbSolver.hpp index d8dc5768cf6..66ae5602c62 100644 --- a/SU2_CFD/include/solvers/CTurbSolver.hpp +++ b/SU2_CFD/include/solvers/CTurbSolver.hpp @@ -49,12 +49,6 @@ class CTurbSolver : public CScalarSolver { public: - - /*! - * \brief Constructor of the class. - */ - CTurbSolver(bool conservative); - /*! * \brief Destructor of the class. */ diff --git a/SU2_CFD/src/solvers/CTransLMSolver.cpp b/SU2_CFD/src/solvers/CTransLMSolver.cpp index 9f5d8f373bf..29a1e3e0b74 100644 --- a/SU2_CFD/src/solvers/CTransLMSolver.cpp +++ b/SU2_CFD/src/solvers/CTransLMSolver.cpp @@ -30,13 +30,13 @@ #include "../../include/variables/CTurbSAVariable.hpp" /*--- This is the implementation of the Langtry-Menter transition model. - The main reference for this model is:Langtry, Menter, AIAA J. 47(12) 2009 + The main reference for this model is:Langtry, Menter, AIAA J. 47(12) 2009 DOI: https://doi.org/10.2514/1.42362 ---*/ - + // Note: TransLM seems to use rho*gamma, rho*Re_sigma as Solution variables, thus Conservative=true -CTransLMSolver::CTransLMSolver(void) : CTurbSolver(true) {} -CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CTurbSolver(true) { +CTransLMSolver::CTransLMSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) + : CTurbSolver(geometry, config, true) { unsigned short iVar, nLineLets; unsigned long iPoint, index; su2double tu_Inf, dull_val, rey; diff --git a/SU2_CFD/src/solvers/CTurbSASolver.cpp b/SU2_CFD/src/solvers/CTurbSASolver.cpp index 5cf7c8ca6f5..1c8fbec34c4 100644 --- a/SU2_CFD/src/solvers/CTurbSASolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSASolver.cpp @@ -32,8 +32,6 @@ #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" -CTurbSASolver::CTurbSASolver(void) : CTurbSolver(false) { } - CTurbSASolver::CTurbSASolver(CGeometry *geometry, CConfig *config, unsigned short iMesh, CFluidModel* FluidModel) : CTurbSolver(geometry, config, false) { diff --git a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp index 3d37eb3dbfd..965380938f1 100644 --- a/SU2_CFD/src/solvers/CTurbSSTSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSSTSolver.cpp @@ -32,8 +32,6 @@ #include "../../../Common/include/toolboxes/geometry_toolbox.hpp" -CTurbSSTSolver::CTurbSSTSolver(void) : CTurbSolver(true) { } - CTurbSSTSolver::CTurbSSTSolver(CGeometry *geometry, CConfig *config, unsigned short iMesh) : CTurbSolver(geometry, config, true) { unsigned short nLineLets; diff --git a/SU2_CFD/src/solvers/CTurbSolver.cpp b/SU2_CFD/src/solvers/CTurbSolver.cpp index 972121cbf0f..518de259392 100644 --- a/SU2_CFD/src/solvers/CTurbSolver.cpp +++ b/SU2_CFD/src/solvers/CTurbSolver.cpp @@ -33,16 +33,12 @@ /*--- Explicit instantiation of the parent class of CTurbSolver. ---*/ template class CScalarSolver; -CTurbSolver::CTurbSolver(bool conservative) : CScalarSolver(conservative) { } - CTurbSolver::CTurbSolver(CGeometry* geometry, CConfig *config, bool conservative) : CScalarSolver(geometry, config, conservative) { } CTurbSolver::~CTurbSolver() { - for (auto& mat : SlidingState) { for (auto ptr : mat) delete [] ptr; } - } void CTurbSolver::BC_Riemann(CGeometry *geometry, CSolver **solver_container, CNumerics *conv_numerics, CNumerics *visc_numerics, CConfig *config, unsigned short val_marker) {