Changes between Version 8 and Version 9 of addnewenum


Ignore:
Timestamp:
12/11/18 12:52:03 (5 years ago)
Author:
Mathieu Morlighem
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • addnewenum

    v8 v9  
    11== Introduction ==
    22
    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.
     3The 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.
    44
    55== Add a new Enum ==
     
    88 - It does not already exist (the compiler will tell you anyway)
    99 - 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
    1013
    1114Then you can run a synchronization script that will update the matlab and python Enum, StringToEnum and EnumToString automatically: