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

Port code to generate UUIDs from 1D to 2D decomposed test.

parent 4d5ad270
...@@ -31,6 +31,7 @@ typedef int MPI_Comm; ...@@ -31,6 +31,7 @@ typedef int MPI_Comm;
#include "pio_write.h" #include "pio_write.h"
#include "simple_model_helper.h" #include "simple_model_helper.h"
#include "create_uuid.h"
enum { enum {
ntfiles = 2, ntfiles = 2,
...@@ -145,7 +146,15 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -145,7 +146,15 @@ modelRun(struct model_config setup, MPI_Comm comm)
lats[i] = ((double)(i * 180))/nlat - 90.0; lats[i] = ((double)(i * 180))/nlat - 90.0;
gridDefXvals ( gridID, lons ); gridDefXvals ( gridID, lons );
gridDefYvals ( gridID, lats ); gridDefYvals ( gridID, lats );
{
unsigned char uuid[CDI_UUID_SIZE];
if (rank == 0)
create_uuid(uuid);
#if USE_MPI
MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm);
#endif
gridDefUUID(gridID, uuid);
}
levs = xmalloc((size_t)setup.max_nlev * sizeof (levs[0])); levs = xmalloc((size_t)setup.max_nlev * sizeof (levs[0]));
for (i = 0; i < setup.max_nlev; ++i) for (i = 0; i < setup.max_nlev; ++i)
levs[i] = 101300.0 levs[i] = 101300.0
...@@ -177,9 +186,23 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -177,9 +186,23 @@ modelRun(struct model_config setup, MPI_Comm comm)
varDesc[varIdx].zaxisID = varDesc[i].zaxisID; varDesc[varIdx].zaxisID = varDesc[i].zaxisID;
goto zaxisIDset; goto zaxisIDset;
} }
varDesc[varIdx].zaxisID if (varLevs == 1)
= zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev); varDesc[varIdx].zaxisID = zaxisCreate(ZAXIS_SURFACE, 1);
zaxisDefLevels(varDesc[varIdx].zaxisID, levs); else
{
varDesc[varIdx].zaxisID
= zaxisCreate(ZAXIS_PRESSURE, varDesc[varIdx].nlev);
zaxisDefLevels(varDesc[varIdx].zaxisID, levs);
}
{
unsigned char uuid[16];
if (rank == 0)
create_uuid(uuid);
#if USE_MPI
MPI_Bcast(uuid, CDI_UUID_SIZE, MPI_UNSIGNED_CHAR, 0, comm);
#endif
zaxisDefUUID(varDesc[varIdx].zaxisID, uuid);
}
zaxisIDset: zaxisIDset:
varDesc[varIdx].id varDesc[varIdx].id
= vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE); = vlistDefVar(vlistID, gridID, varDesc[varIdx].zaxisID, TIME_VARIABLE);
......
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