Introduction
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 wikipedia page for more info.
Add a new Enum
If you want to add a new Enum, the ONLY file that needs to be changed is src/c/shared/Enum/EnumDefinitions.h
. Open it with you favorite editor (vim) and add your new Enum. Make sure that:
- It does not already exist (the compiler will tell you anyway)
- It finishes with
Enum,
- it is in the right section:
- if your Enum is for an Input, make sure it is between InputsSTARTEnum and InputsENDEnum
- if your Enum is for a parameter, make sure it is between ParametersSTARTEnum and ParametersENDEnum
Then you can run a synchronization script that will update the matlab and python Enum, StringToEnum and EnumToString automatically:
cd $ISSM_DIR/src/c/shared/Enum/ ./Synchronize.sh
You will then need to recompile src/c only, and there is no need to reconfigure:
cd $ISSM_DIR/src/c make install