Skip to content

Commit 1f7f6bb

Browse files
authored
Merge pull request #1242 from su2code/remove_enum_numbers
Make "enum" : "enum class" thus removing enum numbers
2 parents 3b20982 + e27da1d commit 1f7f6bb

File tree

97 files changed

+800
-767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+800
-767
lines changed

Common/include/CConfig.hpp

Lines changed: 48 additions & 47 deletions
Large diffs are not rendered by default.

Common/include/geometry/CGeometry.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,8 @@ class CGeometry {
15451545
* \param[in] search_limit - Max degree of neighborhood considered for neighbor search, avoids excessive work in fine regions.
15461546
* \param[in,out] values - On entry, the "raw" values, on exit, the filtered values.
15471547
*/
1548-
void FilterValuesAtElementCG(const vector<su2double> &filter_radius, const vector<pair<unsigned short,su2double> > &kernels,
1548+
void FilterValuesAtElementCG(const vector<su2double> &filter_radius,
1549+
const vector<pair<ENUM_FILTER_KERNEL,su2double> > &kernels,
15491550
const unsigned short search_limit, su2double *values) const;
15501551

15511552
/*!

Common/include/option_structure.hpp

Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ using MapType = CEmptyMap<T,U>;
6363
/*!
6464
* \brief Different software components of SU2
6565
*/
66-
enum SU2_COMPONENT {
67-
SU2_CFD = 1, /*!< \brief Running the SU2_CFD software. */
68-
SU2_DEF = 2, /*!< \brief Running the SU2_DEF software. */
69-
SU2_DOT = 3, /*!< \brief Running the SU2_DOT software. */
70-
SU2_GEO = 5, /*!< \brief Running the SU2_GEO software. */
71-
SU2_SOL = 6 /*!< \brief Running the SU2_SOL software. */
66+
enum class SU2_COMPONENT {
67+
SU2_CFD, /*!< \brief Running the SU2_CFD software. */
68+
SU2_DEF, /*!< \brief Running the SU2_DEF software. */
69+
SU2_DOT, /*!< \brief Running the SU2_DOT software. */
70+
SU2_GEO, /*!< \brief Running the SU2_GEO software. */
71+
SU2_SOL /*!< \brief Running the SU2_SOL software. */
7272
};
7373

7474
const unsigned int EXIT_DIVERGENCE = 2; /*!< \brief Exit code (divergence). */
@@ -237,13 +237,13 @@ static const MapType<string, ENUM_MAIN_SOLVER> Solver_Map = {
237237
/*!
238238
* \brief Different solver types for multizone problems
239239
*/
240-
enum ENUM_MULTIZONE {
241-
MZ_BLOCK_GAUSS_SEIDEL = 0, /*!< \brief Definition of a Block-Gauss-Seidel multizone solver. */
242-
MZ_BLOCK_JACOBI = 1 /*!< \brief Definition of a Block-Jacobi solver. */
240+
enum class ENUM_MULTIZONE {
241+
MZ_BLOCK_GAUSS_SEIDEL, /*!< \brief Definition of a Block-Gauss-Seidel multizone solver. */
242+
MZ_BLOCK_JACOBI, /*!< \brief Definition of a Block-Jacobi solver. */
243243
};
244244
static const MapType<string, ENUM_MULTIZONE> Multizone_Map = {
245-
MakePair("BLOCK_GAUSS_SEIDEL", MZ_BLOCK_GAUSS_SEIDEL)
246-
MakePair("BLOCK_JACOBI", MZ_BLOCK_JACOBI)
245+
MakePair("BLOCK_GAUSS_SEIDEL", ENUM_MULTIZONE::MZ_BLOCK_GAUSS_SEIDEL)
246+
MakePair("BLOCK_JACOBI", ENUM_MULTIZONE::MZ_BLOCK_JACOBI)
247247
};
248248

249249
/*!
@@ -395,7 +395,7 @@ enum ENUM_TRANSFER {
395395
/*!
396396
* \brief different regime modes
397397
*/
398-
enum ENUM_REGIME {
398+
enum class ENUM_REGIME {
399399
COMPRESSIBLE = 0, /*!< \brief Definition of compressible solver. */
400400
INCOMPRESSIBLE = 1, /*!< \brief Definition of incompressible solver. */
401401
NO_FLOW = 2
@@ -594,15 +594,15 @@ MakePair("GUPTA-YOS", GUPTAYOS)
594594
/*!
595595
* \brief Types of density models
596596
*/
597-
enum ENUM_DENSITYMODEL {
598-
CONSTANT = 0,
599-
BOUSSINESQ = 1, /*!< \brief BoussinesQ density model. */
600-
VARIABLE = 2 /*!< \brief Variable density model. */
597+
enum class INC_DENSITYMODEL {
598+
CONSTANT, /*!< \brief Constant density. */
599+
BOUSSINESQ, /*!< \brief Boussinesq density model. */
600+
VARIABLE, /*!< \brief Variable density model. */
601601
};
602-
static const MapType<string, ENUM_DENSITYMODEL> DensityModel_Map = {
603-
MakePair("CONSTANT", CONSTANT)
604-
MakePair("BOUSSINESQ", BOUSSINESQ)
605-
MakePair("VARIABLE", VARIABLE)
602+
static const MapType<string, INC_DENSITYMODEL> DensityModel_Map = {
603+
MakePair("CONSTANT", INC_DENSITYMODEL::CONSTANT)
604+
MakePair("BOUSSINESQ", INC_DENSITYMODEL::BOUSSINESQ)
605+
MakePair("VARIABLE", INC_DENSITYMODEL::VARIABLE)
606606
};
607607

608608
/*!
@@ -1239,17 +1239,17 @@ static const MapType<string, ENUM_P1_INIT> P1_Init_Map = {
12391239
* The first (temperature) part determines the BC method on the fluid side, the second (heatflux) part determines
12401240
* the BC method on the solid side of the CHT interface.
12411241
*/
1242-
enum ENUM_CHT_COUPLING {
1243-
DIRECT_TEMPERATURE_NEUMANN_HEATFLUX = 0,
1244-
AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX = 1,
1245-
DIRECT_TEMPERATURE_ROBIN_HEATFLUX = 2,
1246-
AVERAGED_TEMPERATURE_ROBIN_HEATFLUX = 3
1242+
enum CHT_COUPLING {
1243+
DIRECT_TEMPERATURE_NEUMANN_HEATFLUX,
1244+
AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX,
1245+
DIRECT_TEMPERATURE_ROBIN_HEATFLUX,
1246+
AVERAGED_TEMPERATURE_ROBIN_HEATFLUX,
12471247
};
1248-
static const MapType<string, ENUM_CHT_COUPLING> CHT_Coupling_Map = {
1249-
MakePair("DIRECT_TEMPERATURE_NEUMANN_HEATFLUX", DIRECT_TEMPERATURE_NEUMANN_HEATFLUX)
1250-
MakePair("AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX", AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX)
1251-
MakePair("DIRECT_TEMPERATURE_ROBIN_HEATFLUX", DIRECT_TEMPERATURE_ROBIN_HEATFLUX)
1252-
MakePair("AVERAGED_TEMPERATURE_ROBIN_HEATFLUX", AVERAGED_TEMPERATURE_ROBIN_HEATFLUX)
1248+
static const MapType<string, CHT_COUPLING> CHT_Coupling_Map = {
1249+
MakePair("DIRECT_TEMPERATURE_NEUMANN_HEATFLUX", CHT_COUPLING::DIRECT_TEMPERATURE_NEUMANN_HEATFLUX)
1250+
MakePair("AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX", CHT_COUPLING::AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX)
1251+
MakePair("DIRECT_TEMPERATURE_ROBIN_HEATFLUX", CHT_COUPLING::DIRECT_TEMPERATURE_ROBIN_HEATFLUX)
1252+
MakePair("AVERAGED_TEMPERATURE_ROBIN_HEATFLUX", CHT_COUPLING::AVERAGED_TEMPERATURE_ROBIN_HEATFLUX)
12531253
};
12541254

12551255
/*!
@@ -1377,30 +1377,30 @@ enum TURBO_MARKER_TYPE{
13771377
* \brief Types inlet boundary treatments
13781378
*/
13791379
enum INLET_TYPE {
1380-
TOTAL_CONDITIONS = 1, /*!< \brief User specifies total pressure, total temperature, and flow direction. */
1381-
MASS_FLOW = 2, /*!< \brief User specifies density and velocity (mass flow). */
1382-
INPUT_FILE = 3, /*!< \brief User specifies an input file. */
1383-
VELOCITY_INLET = 4, /*!< \brief Velocity inlet for an incompressible flow. */
1384-
PRESSURE_INLET = 5 /*!< \brief Total pressure inlet for an incompressible flow. */
1380+
TOTAL_CONDITIONS, /*!< \brief User specifies total pressure, total temperature, and flow direction. */
1381+
MASS_FLOW, /*!< \brief User specifies density and velocity (mass flow). */
1382+
INPUT_FILE, /*!< \brief User specifies an input file. */
1383+
VELOCITY_INLET, /*!< \brief Velocity inlet for an incompressible flow. */
1384+
PRESSURE_INLET, /*!< \brief Total pressure inlet for an incompressible flow. */
13851385
};
13861386
static const MapType<string, INLET_TYPE> Inlet_Map = {
1387-
MakePair("TOTAL_CONDITIONS", TOTAL_CONDITIONS)
1388-
MakePair("MASS_FLOW", MASS_FLOW)
1389-
MakePair("INPUT_FILE", INPUT_FILE)
1390-
MakePair("VELOCITY_INLET", VELOCITY_INLET)
1391-
MakePair("PRESSURE_INLET", PRESSURE_INLET)
1387+
MakePair("TOTAL_CONDITIONS", INLET_TYPE::TOTAL_CONDITIONS)
1388+
MakePair("MASS_FLOW", INLET_TYPE::MASS_FLOW)
1389+
MakePair("INPUT_FILE", INLET_TYPE::INPUT_FILE)
1390+
MakePair("VELOCITY_INLET", INLET_TYPE::VELOCITY_INLET)
1391+
MakePair("PRESSURE_INLET", INLET_TYPE::PRESSURE_INLET)
13921392
};
13931393

13941394
/*!
13951395
* \brief Types outlet boundary treatments
13961396
*/
1397-
enum OUTLET_TYPE {
1398-
PRESSURE_OUTLET = 1, /*!< \brief Gauge pressure outlet for incompressible flow */
1399-
MASS_FLOW_OUTLET = 2, /*!< \brief Mass flow outlet for incompressible flow. */
1397+
enum class INC_OUTLET_TYPE {
1398+
PRESSURE_OUTLET, /*!< \brief Gauge pressure outlet for incompressible flow */
1399+
MASS_FLOW_OUTLET, /*!< \brief Mass flow outlet for incompressible flow. */
14001400
};
1401-
static const MapType<string, OUTLET_TYPE> Outlet_Map = {
1402-
MakePair("PRESSURE_OUTLET", PRESSURE_OUTLET)
1403-
MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET)
1401+
static const MapType<string, INC_OUTLET_TYPE> Inc_Outlet_Map = {
1402+
MakePair("PRESSURE_OUTLET", INC_OUTLET_TYPE::PRESSURE_OUTLET)
1403+
MakePair("MASS_FLOW_OUTLET", INC_OUTLET_TYPE::MASS_FLOW_OUTLET)
14041404
};
14051405

14061406
/*!
@@ -1998,21 +1998,21 @@ static const MapType<string, ENUM_GEO_DESCRIPTION> Geo_Description_Map = {
19981998
/*!
19991999
* \brief Types of schemes for unsteady computations
20002000
*/
2001-
enum ENUM_UNSTEADY {
2002-
STEADY = 0, /*!< \brief A steady computation. */
2003-
TIME_STEPPING = 1, /*!< \brief Use a time stepping strategy for unsteady computations. */
2004-
DT_STEPPING_1ST = 2, /*!< \brief Use a dual time stepping strategy for unsteady computations (1st order). */
2005-
DT_STEPPING_2ND = 3, /*!< \brief Use a dual time stepping strategy for unsteady computations (2nd order). */
2006-
ROTATIONAL_FRAME = 4, /*!< \brief Use a rotational source term. */
2007-
HARMONIC_BALANCE = 5 /*!< \brief Use a harmonic balance source term. */
2001+
enum class TIME_MARCHING {
2002+
STEADY, /*!< \brief A steady computation. */
2003+
TIME_STEPPING, /*!< \brief Use a time stepping strategy for unsteady computations. */
2004+
DT_STEPPING_1ST, /*!< \brief Use a dual time stepping strategy for unsteady computations (1st order). */
2005+
DT_STEPPING_2ND, /*!< \brief Use a dual time stepping strategy for unsteady computations (2nd order). */
2006+
ROTATIONAL_FRAME, /*!< \brief Use a rotational source term. */
2007+
HARMONIC_BALANCE, /*!< \brief Use a harmonic balance source term. */
20082008
};
2009-
static const MapType<string, ENUM_UNSTEADY> TimeMarching_Map = {
2010-
MakePair("NO", STEADY)
2011-
MakePair("TIME_STEPPING", TIME_STEPPING)
2012-
MakePair("DUAL_TIME_STEPPING-1ST_ORDER", DT_STEPPING_1ST)
2013-
MakePair("DUAL_TIME_STEPPING-2ND_ORDER", DT_STEPPING_2ND)
2014-
MakePair("HARMONIC_BALANCE", HARMONIC_BALANCE)
2015-
MakePair("ROTATIONAL_FRAME", ROTATIONAL_FRAME)
2009+
static const MapType<string, TIME_MARCHING> TimeMarching_Map = {
2010+
MakePair("NO", TIME_MARCHING::STEADY)
2011+
MakePair("TIME_STEPPING", TIME_MARCHING::TIME_STEPPING)
2012+
MakePair("DUAL_TIME_STEPPING-1ST_ORDER", TIME_MARCHING::DT_STEPPING_1ST)
2013+
MakePair("DUAL_TIME_STEPPING-2ND_ORDER", TIME_MARCHING::DT_STEPPING_2ND)
2014+
MakePair("HARMONIC_BALANCE", TIME_MARCHING::HARMONIC_BALANCE)
2015+
MakePair("ROTATIONAL_FRAME", TIME_MARCHING::ROTATIONAL_FRAME)
20162016
};
20172017

20182018
/*!
@@ -2177,36 +2177,36 @@ static const MapType<string, COMM_LEVEL> Comm_Map = {
21772177
MakePair("FULL", COMM_FULL)
21782178
};
21792179

2180-
/*
2180+
/*!
21812181
* \brief Types of filter kernels, initially intended for structural topology optimization applications
21822182
*/
2183-
enum ENUM_FILTER_KERNEL {
2184-
CONSTANT_WEIGHT_FILTER = 0, /*!< \brief Uniform weight. */
2185-
CONICAL_WEIGHT_FILTER = 1, /*!< \brief Linear decay with distance from center point [Bruns and Tortorelli, 2001]. */
2186-
GAUSSIAN_WEIGHT_FILTER = 2, /*!< \brief Bell shape around center point [Bruns and Tortorelli, 2003]. */
2187-
DILATE_MORPH_FILTER = 3, /*!< \brief Continuous version of the dilate morphology operator [Sigmund 2007]. */
2188-
ERODE_MORPH_FILTER = 4, /*!< \brief Continuous version of the erode morphology operator [Sigmund 2007].*/
2183+
enum class ENUM_FILTER_KERNEL {
2184+
CONSTANT_WEIGHT, /*!< \brief Uniform weight. */
2185+
CONICAL_WEIGHT, /*!< \brief Linear decay with distance from center point [Bruns and Tortorelli, 2001]. */
2186+
GAUSSIAN_WEIGHT, /*!< \brief Bell shape around center point [Bruns and Tortorelli, 2003]. */
2187+
DILATE_MORPH, /*!< \brief Continuous version of the dilate morphology operator [Sigmund 2007]. */
2188+
ERODE_MORPH, /*!< \brief Continuous version of the erode morphology operator [Sigmund 2007].*/
21892189
};
21902190
static const MapType<string, ENUM_FILTER_KERNEL> Filter_Kernel_Map = {
2191-
MakePair("CONSTANT", CONSTANT_WEIGHT_FILTER)
2192-
MakePair("CONICAL" , CONICAL_WEIGHT_FILTER)
2193-
MakePair("GAUSSIAN", GAUSSIAN_WEIGHT_FILTER)
2194-
MakePair("DILATE" , DILATE_MORPH_FILTER)
2195-
MakePair("ERODE" , ERODE_MORPH_FILTER)
2191+
MakePair("CONSTANT", ENUM_FILTER_KERNEL::CONSTANT_WEIGHT)
2192+
MakePair("CONICAL", ENUM_FILTER_KERNEL::CONICAL_WEIGHT)
2193+
MakePair("GAUSSIAN", ENUM_FILTER_KERNEL::GAUSSIAN_WEIGHT)
2194+
MakePair("DILATE", ENUM_FILTER_KERNEL::DILATE_MORPH)
2195+
MakePair("ERODE", ENUM_FILTER_KERNEL::ERODE_MORPH)
21962196
};
21972197

21982198
/*!
21992199
* \brief Types of projection function, initially intended for structural topology optimization applications
22002200
*/
2201-
enum ENUM_PROJECTION_FUNCTION {
2202-
NO_PROJECTION = 0, /*!< \brief No projection. */
2203-
HEAVISIDE_UP = 1, /*!< \brief Project values towards 1. */
2204-
HEAVISIDE_DOWN = 2, /*!< \brief Project values towards 0. */
2201+
enum class ENUM_PROJECTION_FUNCTION {
2202+
NONE, /*!< \brief No projection. */
2203+
HEAVISIDE_UP, /*!< \brief Project values towards 1. */
2204+
HEAVISIDE_DOWN, /*!< \brief Project values towards 0. */
22052205
};
22062206
static const MapType<string, ENUM_PROJECTION_FUNCTION> Projection_Function_Map = {
2207-
MakePair("NO_PROJECTION" , NO_PROJECTION)
2208-
MakePair("HEAVISIDE_UP" , HEAVISIDE_UP)
2209-
MakePair("HEAVISIDE_DOWN", HEAVISIDE_DOWN)
2207+
MakePair("NO_PROJECTION", ENUM_PROJECTION_FUNCTION::NONE)
2208+
MakePair("HEAVISIDE_UP", ENUM_PROJECTION_FUNCTION::HEAVISIDE_UP)
2209+
MakePair("HEAVISIDE_DOWN", ENUM_PROJECTION_FUNCTION::HEAVISIDE_DOWN)
22102210
};
22112211

22122212
/*!
@@ -2246,15 +2246,15 @@ static const MapType<string, ENUM_VERIFICATION_SOLUTIONS> Verification_Solution_
22462246
/*!
22472247
* \brief Types of streamwise periodicity.
22482248
*/
2249-
enum ENUM_STREAMWISE_PERIODIC {
2250-
NO_STREAMWISE_PERIODIC = 0, /*!< \brief No streamwise periodic flow. */
2251-
PRESSURE_DROP = 1, /*!< \brief Prescribed pressure drop. */
2252-
STREAMWISE_MASSFLOW = 2, /*!< \brief Prescribed massflow. */
2249+
enum class ENUM_STREAMWISE_PERIODIC {
2250+
NONE, /*!< \brief No streamwise periodic flow. */
2251+
PRESSURE_DROP, /*!< \brief Prescribed pressure drop. */
2252+
MASSFLOW, /*!< \brief Prescribed massflow. */
22532253
};
22542254
static const MapType<string, ENUM_STREAMWISE_PERIODIC> Streamwise_Periodic_Map = {
2255-
MakePair("NONE", NO_STREAMWISE_PERIODIC)
2256-
MakePair("PRESSURE_DROP", PRESSURE_DROP)
2257-
MakePair("MASSFLOW", STREAMWISE_MASSFLOW)
2255+
MakePair("NONE", ENUM_STREAMWISE_PERIODIC::NONE)
2256+
MakePair("PRESSURE_DROP", ENUM_STREAMWISE_PERIODIC::PRESSURE_DROP)
2257+
MakePair("MASSFLOW", ENUM_STREAMWISE_PERIODIC::MASSFLOW)
22582258
};
22592259

22602260
/*!

0 commit comments

Comments
 (0)