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

Move storage of variable-related IDs to heap in test program.

parent e9ac69b4
...@@ -72,8 +72,8 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -72,8 +72,8 @@ modelRun(struct model_config setup, MPI_Comm comm)
{ {
static const char * const fname_prefix = "example"; static const char * const fname_prefix = "example";
int gridID, zaxisID[nVars], taxisID; int gridID, *zaxisID, taxisID;
int vlistID, varIDs[nVars], streamID, tsID, tfID = 0; int vlistID, *varIDs, streamID, tsID, tfID = 0;
int i, nmiss = 0; int i, nmiss = 0;
double *lons, *lats; double *lons, *lats;
double *var = NULL, *varslice = NULL; double *var = NULL, *varslice = NULL;
...@@ -126,7 +126,8 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -126,7 +126,8 @@ modelRun(struct model_config setup, MPI_Comm comm)
levs[i] = 101300.0 levs[i] = 101300.0
- 3940.3 * (exp(1.3579 * (double)(i)/(setup.max_nlev - 1)) - 1.0); - 3940.3 * (exp(1.3579 * (double)(i)/(setup.max_nlev - 1)) - 1.0);
nlev = xmalloc(2 * nVars * sizeof (nlev[0])); nlev = xmalloc(4 * nVars * sizeof (nlev[0]));
zaxisID = nlev + 3 * nVars;
for (int varIdx = 0; varIdx < nVars; varIdx++ ) for (int varIdx = 0; varIdx < nVars; varIdx++ )
{ {
int varLevs = random()%4; int varLevs = random()%4;
...@@ -162,6 +163,7 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -162,6 +163,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
vlistID = vlistCreate (); vlistID = vlistCreate ();
varIDs = nlev + 2 * nVars;
for ( i = 0; i < nVars; i++ ) for ( i = 0; i < nVars; i++ )
{ {
varIDs[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], TIME_VARIABLE ); varIDs[i] = vlistDefVar ( vlistID, gridID, zaxisID[i], 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