Commit 86c9c3e3 authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Make further variable descriptors dynamic.

parent b631fb7c
...@@ -83,8 +83,8 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -83,8 +83,8 @@ modelRun(struct model_config setup, MPI_Comm comm)
int rank = 0; int rank = 0;
char filename[1024]; char filename[1024];
int nlon = setup.nlon, nlat = setup.nlat; int nlon = setup.nlon, nlat = setup.nlat;
uint32_t checksum_state[nVars]; uint32_t *checksum_state;
size_t varSize[nVars], varslice_size = 0; size_t *varSize, varslice_size = 0;
#if USE_MPI #if USE_MPI
int *chunks = NULL, *displs = NULL, comm_size = 1; int *chunks = NULL, *displs = NULL, comm_size = 1;
struct var1DDeco { struct var1DDeco {
...@@ -162,6 +162,7 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -162,6 +162,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
vlistID = vlistCreate (); vlistID = vlistCreate ();
varIDs = nlev + 2 * nVars; varIDs = nlev + 2 * nVars;
varSize = xmalloc(nVars * sizeof (varSize[0]));
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 );
...@@ -200,9 +201,10 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -200,9 +201,10 @@ modelRun(struct model_config setup, MPI_Comm comm)
pioEndDef (); pioEndDef ();
#endif #endif
checksum_state = xmalloc(nVars * sizeof(checksum_state[0]));
for ( tfID = 0; tfID < ntfiles; tfID++ ) for ( tfID = 0; tfID < ntfiles; tfID++ )
{ {
memset(checksum_state, 0, sizeof(checksum_state)); memset(checksum_state, 0, sizeof(checksum_state[0]) * nVars);
if ( tfID > 0 ) if ( tfID > 0 )
{ {
streamClose ( streamID ); streamClose ( streamID );
...@@ -304,7 +306,9 @@ modelRun(struct model_config setup, MPI_Comm comm) ...@@ -304,7 +306,9 @@ modelRun(struct model_config setup, MPI_Comm comm)
} }
} }
} }
free(checksum_state);
free(varslice); free(varslice);
free(varSize);
#ifdef USE_MPI #ifdef USE_MPI
pioEndTimestepping (); pioEndTimestepping ();
#endif #endif
......
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