Commit f2782a95 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Add option to switch uuid generation on/off.

parent bf584c07
......@@ -148,6 +148,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
lats[i] = ((double)(i * 180))/nlat - 90.0;
gridDefXvals ( gridID, lons );
gridDefYvals ( gridID, lats );
if (setup.create_uuid)
{
unsigned char uuid[CDI_UUID_SIZE];
if (rank == 0)
......@@ -197,6 +198,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
= zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev);
zaxisDefLevels(varDesc[varIdx].zaxisID, levs);
}
if (setup.create_uuid)
{
unsigned char uuid[16];
if (rank == 0)
......
......@@ -34,7 +34,7 @@ static const struct model_config default_setup
#else
= { .nlon = 12, .nts = 3, .nlat = 6, .nvars = 5,
.filetype = FILETYPE_GRB, .datatype = DATATYPE_PACK24,
.compute_checksum = 1,
.compute_checksum = 1, .create_uuid = 0,
.suffix = "grb",
.max_nlev = 5,
};
......@@ -96,11 +96,13 @@ parse_unsignedarg(const char msg[])
typedef int (*pioRoleFunc)(MPI_Comm commSuper, int IOMode, int nProcsIO);
static void
parse_long_option(int pioConfHandle, pioRoleFunc *pioRoleAssign,
parse_long_option(struct model_config *restrict setup,
int pioConfHandle, pioRoleFunc *pioRoleAssign,
const char *str)
{
static const char cacheRedistStr[] = "cache-redists",
pioRoleSchemeOptionStr[] = "pio-role-scheme";
pioRoleSchemeOptionStr[] = "pio-role-scheme",
uuidCreateOptionStr[] = "no-create-uuid";
if (!strncmp(str, cacheRedistStr, sizeof (cacheRedistStr) - 1))
{
#ifdef USE_MPI
......@@ -144,6 +146,14 @@ parse_long_option(int pioConfHandle, pioRoleFunc *pioRoleAssign,
pioRoleSchemeOptionStr);
#endif
}
else if (!strcmp(str, uuidCreateOptionStr + 3))
{
setup->create_uuid = true;
}
else if (!strcmp(str, uuidCreateOptionStr))
{
setup->create_uuid = false;
}
else
invalidOptionDie("unknown long option: %s\n", str);
}
......@@ -222,7 +232,7 @@ int main(int argc, char *argv[])
break;
#endif
case 'q':
parse_long_option(pioConfHandle, &pioRoleAssign, optarg);
parse_long_option(&setup, pioConfHandle, &pioRoleAssign, optarg);
break;
case 'f':
{
......
......@@ -11,7 +11,7 @@ struct model_config
{
int nlon, nlat, nts, max_nlev, nvars;
int filetype, datatype;
bool compute_checksum;
bool compute_checksum, create_uuid;
const char *suffix;
};
......
......@@ -116,6 +116,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
lats[i] = ((double)(i * 180))/nlat - 90.0;
gridDefXvals ( gridID, lons );
gridDefYvals ( gridID, lats );
if (setup.create_uuid)
{
unsigned char uuid[CDI_UUID_SIZE];
if (rank == 0)
......@@ -165,6 +166,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
= zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev);
zaxisDefLevels(varDesc[varIdx].zaxisID, levs);
}
if (setup.create_uuid)
{
unsigned char uuid[16];
if (rank == 0)
......
Markdown is supported
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