Commit 2c825d3e authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replaced plain enum to enum struct ModelMode.

parent 939c2091
......@@ -35,7 +35,7 @@ double *vlist_hybrid_vct(int vlistID, int *rzaxisIDh, int *rnvct, int *rnhlevf);
void *Derivepar(void *argument)
{
int mode;
ModelMode mode(ModelMode::UNDEF);
int nrecs;
int i, offset;
int varID, levelID;
......@@ -123,12 +123,12 @@ void *Derivepar(void *argument)
{
if ( tableNum == 2 )
{
mode = WMO_MODE;
mode = ModelMode::WMO;
wmo_gribcodes(&gribcodes);
}
else if ( tableNum == 128 || tableNum == 0 )
{
mode = ECHAM_MODE;
mode = ModelMode::ECHAM;
echam_gribcodes(&gribcodes);
}
// KNMI: HIRLAM model version 7.2 uses tableNum=1 (LAMH_D11*)
......@@ -136,20 +136,18 @@ void *Derivepar(void *argument)
// KNMI: HARMONIE model version 38 uses tableNum=253 (grib,grib_md) and tableNum=1 (grib_sfx) (research version)
else if ( tableNum == 1 || tableNum == 253 )
{
mode = HIRLAM_MODE;
mode = ModelMode::HIRLAM;
hirlam_harmonie_gribcodes(&gribcodes);
}
else
mode = -1;
}
else
{
mode = ECHAM_MODE;
mode = ModelMode::ECHAM;
echam_gribcodes(&gribcodes);
}
if ( cdoVerbose )
cdoPrint("Mode = %d Center = %d Param = %s", mode, instNum, paramstr);
cdoPrint("Mode = %d Center = %d Param = %s", static_cast<int>(mode), instNum, paramstr);
if ( code <= 0 || code == 255 )
{
......
......@@ -35,7 +35,7 @@
void *Pressure(void *argument)
{
int mode;
ModelMode mode(ModelMode::UNDEF);
int nrecs;
int i, k, offset;
int varID, levelID;
......@@ -127,12 +127,12 @@ void *Pressure(void *argument)
{
if ( tableNum == 2 )
{
mode = WMO_MODE;
mode = ModelMode::WMO;
wmo_gribcodes(&gribcodes);
}
else if ( tableNum == 128 )
{
mode = ECHAM_MODE;
mode = ModelMode::ECHAM;
echam_gribcodes(&gribcodes);
}
// KNMI: HIRLAM model version 7.2 uses tableNum=1 (LAMH_D11*)
......@@ -140,15 +140,13 @@ void *Pressure(void *argument)
// KNMI: HARMONIE model version 38 uses tableNum=253 (grib,grib_md) and tableNum=1 (grib_sfx) (research version)
else if ( tableNum == 1 || tableNum == 253 )
{
mode = HIRLAM_MODE;
mode = ModelMode::HIRLAM;
hirlam_harmonie_gribcodes(&gribcodes);
}
else
mode = -1;
}
else
{
mode = ECHAM_MODE;
mode = ModelMode::ECHAM;
echam_gribcodes(&gribcodes);
}
......@@ -174,16 +172,12 @@ void *Pressure(void *argument)
/* else if ( strcmp(varname, "geopoth") == 0 ) code = 156; */
}
if ( mode == ECHAM_MODE )
if ( mode == ModelMode::ECHAM )
{
if ( code == gribcodes.ps && nlevel == 1 ) psID = varID;
else if ( code == gribcodes.lsp && nlevel == 1 ) lnpsID = varID;
}
else if ( mode == WMO_MODE )
{
if ( code == gribcodes.ps && nlevel == 1 ) psID = varID;
}
else if ( mode == HIRLAM_MODE )
else if ( mode == ModelMode::WMO || mode == ModelMode::HIRLAM )
{
if ( code == gribcodes.ps && nlevel == 1 ) psID = varID;
}
......
......@@ -61,7 +61,7 @@ void change_hybrid_zaxis(int vlistID1, int vlistID2, int nvct, double *vct, int
void *Vertintml(void *argument)
{
int mode;
ModelMode mode(ModelMode::UNDEF);
enum {func_pl, func_hl};
enum {type_lin, type_log};
int nrecs;
......@@ -275,12 +275,12 @@ void *Vertintml(void *argument)
{
if ( tableNum == 2 )
{
mode = WMO_MODE;
mode = ModelMode::WMO;
wmo_gribcodes(&gribcodes);
}
else if ( tableNum == 128 || tableNum == 0 )
{
mode = ECHAM_MODE;
mode = ModelMode::ECHAM;
echam_gribcodes(&gribcodes);
}
// KNMI: HIRLAM model version 7.2 uses tableNum=1 (LAMH_D11*)
......@@ -288,15 +288,13 @@ void *Vertintml(void *argument)
// KNMI: HARMONIE model version 38 uses tableNum=253 (grib,grib_md) and tableNum=1 (grib_sfx) (research version)
else if ( tableNum == 1 || tableNum == 253 )
{
mode = HIRLAM_MODE;
mode = ModelMode::HIRLAM;
hirlam_harmonie_gribcodes(&gribcodes);
}
else
mode = -1;
}
else
{
mode = ECHAM_MODE;
mode = ModelMode::ECHAM;
echam_gribcodes(&gribcodes);
}
......@@ -329,7 +327,7 @@ void *Vertintml(void *argument)
}
}
if ( mode == ECHAM_MODE )
if ( mode == ModelMode::ECHAM )
{
if ( code == gribcodes.geopot && nlevel == 1 ) sgeopotID = varID;
else if ( code == gribcodes.geopot && nlevel == nhlevf ) geopotID = varID;
......@@ -338,7 +336,7 @@ void *Vertintml(void *argument)
else if ( code == gribcodes.lsp && nlevel == 1 ) lnpsID = varID;
else if ( code == gribcodes.gheight && nlevel == nhlevf ) gheightID = varID;
}
else if ( mode == WMO_MODE || mode == HIRLAM_MODE )
else if ( mode == ModelMode::WMO || mode == ModelMode::HIRLAM )
{
if ( code == gribcodes.geopot && nlevel == 1 ) sgeopotID = varID;
else if ( code == gribcodes.geopot && nlevel == nhlevf ) geopotID = varID;
......
......@@ -31,7 +31,7 @@ typedef struct
int vwind;
} gribcode_t;
enum {ECHAM_MODE, WMO_MODE, HIRLAM_MODE};
enum struct ModelMode {UNDEF, ECHAM, WMO, HIRLAM};
void echam_gribcodes(gribcode_t *gribcodes);
void wmo_gribcodes(gribcode_t *gribcodes);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment