Changes between Version 8 and Version 9 of addnewenum
- Timestamp:
- 12/11/18 12:52:03 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
addnewenum
v8 v9 1 1 == Introduction == 2 2 3 The idea is that comparing integers in C++ is easier and faster than comparing strings . So each model input is assigned an enum. In the code you will see `IceVolumeAboveFloatationEnum` but the code interpret this word as the integer 682. Each enum has a number associated to it automatically by the compiler. See this [http://en.wikipedia.org/wiki/Enumerated_type wikipedia page] for more info.3 The idea is that comparing integers in C++ is easier and faster than comparing strings (which do not have a fixed size). So each model input/parameter is assigned an enum. In the code, you will see `IceVolumeAboveFloatationEnum` but the code interprets this "word" as the integer 68: each enum has a number associated to it by the compiler, at compile time. See this [http://en.wikipedia.org/wiki/Enumerated_type wikipedia page] for more info. 4 4 5 5 == Add a new Enum == … … 8 8 - It does not already exist (the compiler will tell you anyway) 9 9 - It finishes with `Enum,` 10 - it is in the right section: 11 - if your Enum is for an Input, make sure it is between InputsSTARTEnum and InputsENDEnum 12 - if your Enum is for a parameter, make sure it is between ParametersSTARTEnum and ParametersENDEnum 10 13 11 14 Then you can run a synchronization script that will update the matlab and python Enum, StringToEnum and EnumToString automatically: