Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make "enum" : "enum class" thus removing enum numbers #1242

Merged
merged 21 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5fb5bb2
Remove Enum number for streamwise periodic flow
TobiKattmann Mar 23, 2021
63ce3c4
Add addEnumClassOption to make enum class possible.
TobiKattmann Mar 23, 2021
62cad07
Make ENUM_STREAMWISE_PERIODIC an enum class.
TobiKattmann Mar 23, 2021
a5257d9
COptionEnum with 2 template params to avoid duplication. Map now a co…
TobiKattmann Mar 23, 2021
f3ac7b1
Revert const ref map because the tests didn't compile.
TobiKattmann Mar 24, 2021
8f17be4
spring cleaning
pcarruscag Mar 24, 2021
bd95226
thou shall not cast enum class
pcarruscag Mar 24, 2021
5492805
Merge branch 'develop' into remove_enum_numbers
TobiKattmann Mar 26, 2021
75d172c
Enum class OUTLET_TYPE -> INC_OUTLET_TYPE
TobiKattmann Mar 29, 2021
ad62f4c
Make INLET_TYPE enum class.
TobiKattmann Mar 29, 2021
094b75f
Resolve enum class compile error: enum value not handled switch state…
TobiKattmann Mar 29, 2021
bdf694d
Make SU2_COMPONENT enum class.
TobiKattmann Mar 30, 2021
e7d3d95
Enum class SU2_COMPONENT for UnitTests as well.
TobiKattmann Mar 30, 2021
cda58b7
Enum class SU2_COMPONENT for SU2_PY... i hope at least.
TobiKattmann Mar 31, 2021
c4ea172
Merge remote-tracking branch 'origin/develop' into remove_enum_numbers
TobiKattmann Mar 31, 2021
bb9c018
Made ENUM_REGIME an enum class
TobiKattmann Apr 1, 2021
f09ac34
Make INC_DENSITYMODEL an enum class.
TobiKattmann Apr 6, 2021
d93ab4f
Make CHT_COUPLING an enum class.
TobiKattmann Apr 6, 2021
bfb3c9f
Make TIME_MARCHING an enum class.
TobiKattmann Apr 6, 2021
61834c9
Merge branch 'develop' into remove_enum_numbers
pcarruscag Apr 7, 2021
e27da1d
minor build fix after develop merge
TobiKattmann Apr 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 48 additions & 47 deletions Common/include/CConfig.hpp

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Common/include/geometry/CGeometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,8 @@ class CGeometry {
* \param[in] search_limit - Max degree of neighborhood considered for neighbor search, avoids excessive work in fine regions.
* \param[in,out] values - On entry, the "raw" values, on exit, the filtered values.
*/
void FilterValuesAtElementCG(const vector<su2double> &filter_radius, const vector<pair<unsigned short,su2double> > &kernels,
void FilterValuesAtElementCG(const vector<su2double> &filter_radius,
const vector<pair<ENUM_FILTER_KERNEL,su2double> > &kernels,
const unsigned short search_limit, su2double *values) const;

/*!
Expand Down
172 changes: 86 additions & 86 deletions Common/include/option_structure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ using MapType = CEmptyMap<T,U>;
/*!
* \brief Different software components of SU2
*/
enum SU2_COMPONENT {
SU2_CFD = 1, /*!< \brief Running the SU2_CFD software. */
SU2_DEF = 2, /*!< \brief Running the SU2_DEF software. */
SU2_DOT = 3, /*!< \brief Running the SU2_DOT software. */
SU2_GEO = 5, /*!< \brief Running the SU2_GEO software. */
SU2_SOL = 6 /*!< \brief Running the SU2_SOL software. */
enum class SU2_COMPONENT {
SU2_CFD, /*!< \brief Running the SU2_CFD software. */
SU2_DEF, /*!< \brief Running the SU2_DEF software. */
SU2_DOT, /*!< \brief Running the SU2_DOT software. */
SU2_GEO, /*!< \brief Running the SU2_GEO software. */
SU2_SOL /*!< \brief Running the SU2_SOL software. */
};

const unsigned int EXIT_DIVERGENCE = 2; /*!< \brief Exit code (divergence). */
Expand Down Expand Up @@ -237,13 +237,13 @@ static const MapType<string, ENUM_MAIN_SOLVER> Solver_Map = {
/*!
* \brief Different solver types for multizone problems
*/
enum ENUM_MULTIZONE {
MZ_BLOCK_GAUSS_SEIDEL = 0, /*!< \brief Definition of a Block-Gauss-Seidel multizone solver. */
MZ_BLOCK_JACOBI = 1 /*!< \brief Definition of a Block-Jacobi solver. */
enum class ENUM_MULTIZONE {
MZ_BLOCK_GAUSS_SEIDEL, /*!< \brief Definition of a Block-Gauss-Seidel multizone solver. */
MZ_BLOCK_JACOBI, /*!< \brief Definition of a Block-Jacobi solver. */
};
static const MapType<string, ENUM_MULTIZONE> Multizone_Map = {
MakePair("BLOCK_GAUSS_SEIDEL", MZ_BLOCK_GAUSS_SEIDEL)
MakePair("BLOCK_JACOBI", MZ_BLOCK_JACOBI)
MakePair("BLOCK_GAUSS_SEIDEL", ENUM_MULTIZONE::MZ_BLOCK_GAUSS_SEIDEL)
MakePair("BLOCK_JACOBI", ENUM_MULTIZONE::MZ_BLOCK_JACOBI)
};

/*!
Expand Down Expand Up @@ -395,7 +395,7 @@ enum ENUM_TRANSFER {
/*!
* \brief different regime modes
*/
enum ENUM_REGIME {
enum class ENUM_REGIME {
COMPRESSIBLE = 0, /*!< \brief Definition of compressible solver. */
INCOMPRESSIBLE = 1, /*!< \brief Definition of incompressible solver. */
NO_FLOW = 2
Expand Down Expand Up @@ -594,15 +594,15 @@ MakePair("GUPTA-YOS", GUPTAYOS)
/*!
* \brief Types of density models
*/
enum ENUM_DENSITYMODEL {
CONSTANT = 0,
BOUSSINESQ = 1, /*!< \brief BoussinesQ density model. */
VARIABLE = 2 /*!< \brief Variable density model. */
enum class INC_DENSITYMODEL {
CONSTANT, /*!< \brief Constant density. */
BOUSSINESQ, /*!< \brief Boussinesq density model. */
VARIABLE, /*!< \brief Variable density model. */
};
static const MapType<string, ENUM_DENSITYMODEL> DensityModel_Map = {
MakePair("CONSTANT", CONSTANT)
MakePair("BOUSSINESQ", BOUSSINESQ)
MakePair("VARIABLE", VARIABLE)
static const MapType<string, INC_DENSITYMODEL> DensityModel_Map = {
MakePair("CONSTANT", INC_DENSITYMODEL::CONSTANT)
MakePair("BOUSSINESQ", INC_DENSITYMODEL::BOUSSINESQ)
MakePair("VARIABLE", INC_DENSITYMODEL::VARIABLE)
};

/*!
Expand Down Expand Up @@ -1239,17 +1239,17 @@ static const MapType<string, ENUM_P1_INIT> P1_Init_Map = {
* The first (temperature) part determines the BC method on the fluid side, the second (heatflux) part determines
* the BC method on the solid side of the CHT interface.
*/
enum ENUM_CHT_COUPLING {
DIRECT_TEMPERATURE_NEUMANN_HEATFLUX = 0,
AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX = 1,
DIRECT_TEMPERATURE_ROBIN_HEATFLUX = 2,
AVERAGED_TEMPERATURE_ROBIN_HEATFLUX = 3
enum CHT_COUPLING {
DIRECT_TEMPERATURE_NEUMANN_HEATFLUX,
AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX,
DIRECT_TEMPERATURE_ROBIN_HEATFLUX,
AVERAGED_TEMPERATURE_ROBIN_HEATFLUX,
};
static const MapType<string, ENUM_CHT_COUPLING> CHT_Coupling_Map = {
MakePair("DIRECT_TEMPERATURE_NEUMANN_HEATFLUX", DIRECT_TEMPERATURE_NEUMANN_HEATFLUX)
MakePair("AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX", AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX)
MakePair("DIRECT_TEMPERATURE_ROBIN_HEATFLUX", DIRECT_TEMPERATURE_ROBIN_HEATFLUX)
MakePair("AVERAGED_TEMPERATURE_ROBIN_HEATFLUX", AVERAGED_TEMPERATURE_ROBIN_HEATFLUX)
static const MapType<string, CHT_COUPLING> CHT_Coupling_Map = {
MakePair("DIRECT_TEMPERATURE_NEUMANN_HEATFLUX", CHT_COUPLING::DIRECT_TEMPERATURE_NEUMANN_HEATFLUX)
MakePair("AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX", CHT_COUPLING::AVERAGED_TEMPERATURE_NEUMANN_HEATFLUX)
MakePair("DIRECT_TEMPERATURE_ROBIN_HEATFLUX", CHT_COUPLING::DIRECT_TEMPERATURE_ROBIN_HEATFLUX)
MakePair("AVERAGED_TEMPERATURE_ROBIN_HEATFLUX", CHT_COUPLING::AVERAGED_TEMPERATURE_ROBIN_HEATFLUX)
};

/*!
Expand Down Expand Up @@ -1377,30 +1377,30 @@ enum TURBO_MARKER_TYPE{
* \brief Types inlet boundary treatments
*/
enum INLET_TYPE {
TOTAL_CONDITIONS = 1, /*!< \brief User specifies total pressure, total temperature, and flow direction. */
MASS_FLOW = 2, /*!< \brief User specifies density and velocity (mass flow). */
INPUT_FILE = 3, /*!< \brief User specifies an input file. */
VELOCITY_INLET = 4, /*!< \brief Velocity inlet for an incompressible flow. */
PRESSURE_INLET = 5 /*!< \brief Total pressure inlet for an incompressible flow. */
TOTAL_CONDITIONS, /*!< \brief User specifies total pressure, total temperature, and flow direction. */
MASS_FLOW, /*!< \brief User specifies density and velocity (mass flow). */
INPUT_FILE, /*!< \brief User specifies an input file. */
VELOCITY_INLET, /*!< \brief Velocity inlet for an incompressible flow. */
PRESSURE_INLET, /*!< \brief Total pressure inlet for an incompressible flow. */
};
static const MapType<string, INLET_TYPE> Inlet_Map = {
MakePair("TOTAL_CONDITIONS", TOTAL_CONDITIONS)
MakePair("MASS_FLOW", MASS_FLOW)
MakePair("INPUT_FILE", INPUT_FILE)
MakePair("VELOCITY_INLET", VELOCITY_INLET)
MakePair("PRESSURE_INLET", PRESSURE_INLET)
MakePair("TOTAL_CONDITIONS", INLET_TYPE::TOTAL_CONDITIONS)
MakePair("MASS_FLOW", INLET_TYPE::MASS_FLOW)
MakePair("INPUT_FILE", INLET_TYPE::INPUT_FILE)
MakePair("VELOCITY_INLET", INLET_TYPE::VELOCITY_INLET)
MakePair("PRESSURE_INLET", INLET_TYPE::PRESSURE_INLET)
};

/*!
* \brief Types outlet boundary treatments
*/
enum OUTLET_TYPE {
PRESSURE_OUTLET = 1, /*!< \brief Gauge pressure outlet for incompressible flow */
MASS_FLOW_OUTLET = 2, /*!< \brief Mass flow outlet for incompressible flow. */
enum class INC_OUTLET_TYPE {
PRESSURE_OUTLET, /*!< \brief Gauge pressure outlet for incompressible flow */
MASS_FLOW_OUTLET, /*!< \brief Mass flow outlet for incompressible flow. */
};
static const MapType<string, OUTLET_TYPE> Outlet_Map = {
MakePair("PRESSURE_OUTLET", PRESSURE_OUTLET)
MakePair("MASS_FLOW_OUTLET", MASS_FLOW_OUTLET)
static const MapType<string, INC_OUTLET_TYPE> Inc_Outlet_Map = {
MakePair("PRESSURE_OUTLET", INC_OUTLET_TYPE::PRESSURE_OUTLET)
MakePair("MASS_FLOW_OUTLET", INC_OUTLET_TYPE::MASS_FLOW_OUTLET)
};

/*!
Expand Down Expand Up @@ -1998,21 +1998,21 @@ static const MapType<string, ENUM_GEO_DESCRIPTION> Geo_Description_Map = {
/*!
* \brief Types of schemes for unsteady computations
*/
enum ENUM_UNSTEADY {
STEADY = 0, /*!< \brief A steady computation. */
TIME_STEPPING = 1, /*!< \brief Use a time stepping strategy for unsteady computations. */
DT_STEPPING_1ST = 2, /*!< \brief Use a dual time stepping strategy for unsteady computations (1st order). */
DT_STEPPING_2ND = 3, /*!< \brief Use a dual time stepping strategy for unsteady computations (2nd order). */
ROTATIONAL_FRAME = 4, /*!< \brief Use a rotational source term. */
HARMONIC_BALANCE = 5 /*!< \brief Use a harmonic balance source term. */
enum class TIME_MARCHING {
STEADY, /*!< \brief A steady computation. */
TIME_STEPPING, /*!< \brief Use a time stepping strategy for unsteady computations. */
DT_STEPPING_1ST, /*!< \brief Use a dual time stepping strategy for unsteady computations (1st order). */
DT_STEPPING_2ND, /*!< \brief Use a dual time stepping strategy for unsteady computations (2nd order). */
ROTATIONAL_FRAME, /*!< \brief Use a rotational source term. */
HARMONIC_BALANCE, /*!< \brief Use a harmonic balance source term. */
};
static const MapType<string, ENUM_UNSTEADY> TimeMarching_Map = {
MakePair("NO", STEADY)
MakePair("TIME_STEPPING", TIME_STEPPING)
MakePair("DUAL_TIME_STEPPING-1ST_ORDER", DT_STEPPING_1ST)
MakePair("DUAL_TIME_STEPPING-2ND_ORDER", DT_STEPPING_2ND)
MakePair("HARMONIC_BALANCE", HARMONIC_BALANCE)
MakePair("ROTATIONAL_FRAME", ROTATIONAL_FRAME)
static const MapType<string, TIME_MARCHING> TimeMarching_Map = {
MakePair("NO", TIME_MARCHING::STEADY)
MakePair("TIME_STEPPING", TIME_MARCHING::TIME_STEPPING)
MakePair("DUAL_TIME_STEPPING-1ST_ORDER", TIME_MARCHING::DT_STEPPING_1ST)
MakePair("DUAL_TIME_STEPPING-2ND_ORDER", TIME_MARCHING::DT_STEPPING_2ND)
MakePair("HARMONIC_BALANCE", TIME_MARCHING::HARMONIC_BALANCE)
MakePair("ROTATIONAL_FRAME", TIME_MARCHING::ROTATIONAL_FRAME)
};

/*!
Expand Down Expand Up @@ -2177,36 +2177,36 @@ static const MapType<string, COMM_LEVEL> Comm_Map = {
MakePair("FULL", COMM_FULL)
};

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

/*!
* \brief Types of projection function, initially intended for structural topology optimization applications
*/
enum ENUM_PROJECTION_FUNCTION {
NO_PROJECTION = 0, /*!< \brief No projection. */
HEAVISIDE_UP = 1, /*!< \brief Project values towards 1. */
HEAVISIDE_DOWN = 2, /*!< \brief Project values towards 0. */
enum class ENUM_PROJECTION_FUNCTION {
NONE, /*!< \brief No projection. */
HEAVISIDE_UP, /*!< \brief Project values towards 1. */
HEAVISIDE_DOWN, /*!< \brief Project values towards 0. */
};
static const MapType<string, ENUM_PROJECTION_FUNCTION> Projection_Function_Map = {
MakePair("NO_PROJECTION" , NO_PROJECTION)
MakePair("HEAVISIDE_UP" , HEAVISIDE_UP)
MakePair("HEAVISIDE_DOWN", HEAVISIDE_DOWN)
MakePair("NO_PROJECTION", ENUM_PROJECTION_FUNCTION::NONE)
MakePair("HEAVISIDE_UP", ENUM_PROJECTION_FUNCTION::HEAVISIDE_UP)
MakePair("HEAVISIDE_DOWN", ENUM_PROJECTION_FUNCTION::HEAVISIDE_DOWN)
};

/*!
Expand Down Expand Up @@ -2246,15 +2246,15 @@ static const MapType<string, ENUM_VERIFICATION_SOLUTIONS> Verification_Solution_
/*!
* \brief Types of streamwise periodicity.
*/
enum ENUM_STREAMWISE_PERIODIC {
NO_STREAMWISE_PERIODIC = 0, /*!< \brief No streamwise periodic flow. */
PRESSURE_DROP = 1, /*!< \brief Prescribed pressure drop. */
STREAMWISE_MASSFLOW = 2, /*!< \brief Prescribed massflow. */
enum class ENUM_STREAMWISE_PERIODIC {
NONE, /*!< \brief No streamwise periodic flow. */
PRESSURE_DROP, /*!< \brief Prescribed pressure drop. */
MASSFLOW, /*!< \brief Prescribed massflow. */
};
static const MapType<string, ENUM_STREAMWISE_PERIODIC> Streamwise_Periodic_Map = {
MakePair("NONE", NO_STREAMWISE_PERIODIC)
MakePair("PRESSURE_DROP", PRESSURE_DROP)
MakePair("MASSFLOW", STREAMWISE_MASSFLOW)
MakePair("NONE", ENUM_STREAMWISE_PERIODIC::NONE)
MakePair("PRESSURE_DROP", ENUM_STREAMWISE_PERIODIC::PRESSURE_DROP)
MakePair("MASSFLOW", ENUM_STREAMWISE_PERIODIC::MASSFLOW)
Comment on lines +2255 to +2257
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ends up being a little more verbose but you get to use "names" that would otherwise conflict with what is already in use for objective functions and things like that.

};

/*!
Expand Down
Loading