Skip to content

Commit 577c546

Browse files
committed
Rename new enums for tape debug mode and make them enum classes.
1 parent b5680c8 commit 577c546

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

Common/include/CConfig.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,8 @@ class CConfig {
598598

599599
bool AD_Mode; /*!< \brief Algorithmic Differentiation support. */
600600
bool AD_Preaccumulation; /*!< \brief Enable or disable preaccumulation in the AD mode. */
601-
unsigned short AD_CheckTapeType; /*!< \brief Type of tape that is checked in a tape debug run. */
602-
unsigned short AD_CheckTapeVariables; /*!< \brief Type of variables that are checked in a tape debug run. */
601+
CHECK_TAPE_TYPE AD_CheckTapeType; /*!< \brief Type of tape that is checked in a tape debug run. */
602+
CHECK_TAPE_VARIABLES AD_CheckTapeVariables; /*!< \brief Type of variables that are checked in a tape debug run. */
603603
STRUCT_COMPRESS Kind_Material_Compress; /*!< \brief Determines if the material is compressible or incompressible (structural analysis). */
604604
STRUCT_MODEL Kind_Material; /*!< \brief Determines the material model to be used (structural analysis). */
605605
STRUCT_DEFORMATION Kind_Struct_Solver; /*!< \brief Determines the geometric condition (small or large deformations) for structural analysis. */
@@ -9233,12 +9233,12 @@ class CConfig {
92339233
/*!
92349234
* \brief Get the type of tape that will be checked in a tape debug run.
92359235
*/
9236-
unsigned short GetAD_CheckTapeType(void) const { return AD_CheckTapeType; }
9236+
CHECK_TAPE_TYPE GetAD_CheckTapeType(void) const { return AD_CheckTapeType; }
92379237

92389238
/*!
92399239
* \brief Get the type of variables that will be checked for in a tape debug run.
92409240
*/
9241-
unsigned short GetAD_CheckTapeVariables(void) const { return AD_CheckTapeVariables; }
9241+
CHECK_TAPE_VARIABLES GetAD_CheckTapeVariables(void) const { return AD_CheckTapeVariables; }
92429242

92439243
/*!
92449244
* \brief Get if AD preaccumulation should be performed.

Common/include/option_structure.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2546,25 +2546,25 @@ static const MapType<std::string, ENUM_DIRECTDIFF_VAR> DirectDiff_Var_Map = {
25462546
/*!
25472547
* \brief Types of tapes that can be checked in a tape debug run.
25482548
*/
2549-
enum ENUM_CHECK_TAPE_TYPE {
2550-
OBJECTIVE_FUNCTION = 0, /*!< \brief Tape that only includes dependencies and objective function calculation. */
2551-
FULL_SOLVER = 1 /*!< \brief Tape that includes dependencies and all solvers. */
2549+
enum class CHECK_TAPE_TYPE {
2550+
OBJECTIVE_FUNCTION, /*!< \brief Tape that only includes dependencies and objective function calculation. */
2551+
FULL_SOLVER /*!< \brief Tape that includes dependencies and all solvers. */
25522552
};
2553-
static const MapType<std::string, ENUM_CHECK_TAPE_TYPE> CheckTapeType_Map = {
2554-
MakePair("OBJECTIVE_FUNCTION_TAPE", OBJECTIVE_FUNCTION)
2555-
MakePair("FULL_SOLVER_TAPE", FULL_SOLVER)
2553+
static const MapType<std::string, CHECK_TAPE_TYPE> CheckTapeType_Map = {
2554+
MakePair("OBJECTIVE_FUNCTION_TAPE", CHECK_TAPE_TYPE::OBJECTIVE_FUNCTION)
2555+
MakePair("FULL_SOLVER_TAPE", CHECK_TAPE_TYPE::FULL_SOLVER)
25562556
};
25572557

25582558
/*!
25592559
* \brief Types of variables that can be checked for in a tape debug run.
25602560
*/
2561-
enum ENUM_CHECK_TAPE_VARIABLES {
2562-
SOLVER_VARIABLES = 0, /*!< \brief A (debug) tag will be assigned to solver/conservative variables. */
2563-
MESH_COORDINATES = 1 /*!< \brief A (debug) tag will be assigned to solver/conservative variables and mesh coordinates. */
2561+
enum class CHECK_TAPE_VARIABLES {
2562+
SOLVER_VARIABLES, /*!< \brief A (debug) tag will be assigned to solver/conservative variables. */
2563+
MESH_COORDINATES /*!< \brief A (debug) tag will be assigned to solver/conservative variables and mesh coordinates. */
25642564
};
2565-
static const MapType<std::string, ENUM_CHECK_TAPE_VARIABLES> CheckTapeVariables_Map = {
2566-
MakePair("SOLVER_VARIABLES", SOLVER_VARIABLES)
2567-
MakePair("SOLVER_VARIABLES_AND_MESH_COORDINATES", MESH_COORDINATES)
2565+
static const MapType<std::string, CHECK_TAPE_VARIABLES> CheckTapeVariables_Map = {
2566+
MakePair("SOLVER_VARIABLES", CHECK_TAPE_VARIABLES::SOLVER_VARIABLES)
2567+
MakePair("SOLVER_VARIABLES_AND_MESH_COORDINATES", CHECK_TAPE_VARIABLES::MESH_COORDINATES)
25682568
};
25692569

25702570
enum class RECORDING {

Common/src/CConfig.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,10 +2798,10 @@ void CConfig::SetConfig_Options() {
27982798
addBoolOption("PREACC", AD_Preaccumulation, YES);
27992799

28002800
/* DESCRIPTION: Specify the tape which is checked in a tape debug run. */
2801-
addEnumOption("CHECK_TAPE_TYPE", AD_CheckTapeType, CheckTapeType_Map, FULL_SOLVER);
2801+
addEnumOption("CHECK_TAPE_TYPE", AD_CheckTapeType, CheckTapeType_Map, CHECK_TAPE_TYPE::FULL_SOLVER);
28022802

28032803
/* DESCRIPTION: Specify the tape which is checked in a tape debug run. */
2804-
addEnumOption("CHECK_TAPE_VARIABLES", AD_CheckTapeVariables, CheckTapeVariables_Map, SOLVER_VARIABLES);
2804+
addEnumOption("CHECK_TAPE_VARIABLES", AD_CheckTapeVariables, CheckTapeVariables_Map, CHECK_TAPE_VARIABLES::SOLVER_VARIABLES);
28052805

28062806
/*--- options that are used in the python optimization scripts. These have no effect on the c++ toolsuite ---*/
28072807
/*!\par CONFIG_CATEGORY:Python Options\ingroup Config*/

SU2_CFD/src/drivers/CDiscAdjMultizoneDriver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ void CDiscAdjMultizoneDriver::DebugRun() {
246246
/*--- This recording will assign the initial (same) tag to each registered variable.
247247
* During the recording, each dependent variable will be assigned the same tag. ---*/
248248

249-
if(driver_config->GetAD_CheckTapeType() == OBJECTIVE_FUNCTION) {
250-
if(driver_config->GetAD_CheckTapeVariables() == MESH_COORDINATES) {
249+
if(driver_config->GetAD_CheckTapeType() == CHECK_TAPE_TYPE::OBJECTIVE_FUNCTION) {
250+
if(driver_config->GetAD_CheckTapeVariables() == CHECK_TAPE_VARIABLES::MESH_COORDINATES) {
251251
if (rank == MASTER_NODE) cout << "\nChecking OBJECTIVE_FUNCTION_TAPE for SOLVER_VARIABLES_AND_MESH_COORDINATES." << endl;
252252
SetRecording(RECORDING::TAG_INIT_SOLVER_AND_MESH, Kind_Tape::OBJECTIVE_FUNCTION_TAPE, ZONE_0);
253253
}
@@ -257,7 +257,7 @@ void CDiscAdjMultizoneDriver::DebugRun() {
257257
}
258258
}
259259
else {
260-
if(driver_config->GetAD_CheckTapeVariables() == MESH_COORDINATES) {
260+
if(driver_config->GetAD_CheckTapeVariables() == CHECK_TAPE_VARIABLES::MESH_COORDINATES) {
261261
if (rank == MASTER_NODE) cout << "\nChecking FULL_SOLVER_TAPE for SOLVER_VARIABLES_AND_MESH_COORDINATES." << endl;
262262
SetRecording(RECORDING::TAG_INIT_SOLVER_AND_MESH, Kind_Tape::FULL_SOLVER_TAPE, ZONE_0);
263263
}
@@ -277,14 +277,14 @@ void CDiscAdjMultizoneDriver::DebugRun() {
277277
* In such a case, a possible reason could be that such a variable is set by a post-processing routine while
278278
* for a mathematically correct recording this dependency must be included earlier. ---*/
279279

280-
if(driver_config->GetAD_CheckTapeType() == OBJECTIVE_FUNCTION) {
281-
if(driver_config->GetAD_CheckTapeVariables() == MESH_COORDINATES)
280+
if(driver_config->GetAD_CheckTapeType() == CHECK_TAPE_TYPE::OBJECTIVE_FUNCTION) {
281+
if(driver_config->GetAD_CheckTapeVariables() == CHECK_TAPE_VARIABLES::MESH_COORDINATES)
282282
SetRecording(RECORDING::TAG_CHECK_SOLVER_AND_MESH, Kind_Tape::OBJECTIVE_FUNCTION_TAPE, ZONE_0);
283283
else
284284
SetRecording(RECORDING::TAG_CHECK_SOLVER_VARIABLES, Kind_Tape::OBJECTIVE_FUNCTION_TAPE, ZONE_0);
285285
}
286286
else {
287-
if(driver_config->GetAD_CheckTapeVariables() == MESH_COORDINATES)
287+
if(driver_config->GetAD_CheckTapeVariables() == CHECK_TAPE_VARIABLES::MESH_COORDINATES)
288288
SetRecording(RECORDING::TAG_CHECK_SOLVER_AND_MESH, Kind_Tape::FULL_SOLVER_TAPE, ZONE_0);
289289
else
290290
SetRecording(RECORDING::TAG_CHECK_SOLVER_VARIABLES, Kind_Tape::FULL_SOLVER_TAPE, ZONE_0);

0 commit comments

Comments
 (0)