Commit 2c52a42b authored by Thomas Jahns's avatar Thomas Jahns 🤸
Browse files

Remove data dependency in cdfDefComplex.

parent b938aa13
...@@ -107,8 +107,7 @@ void cdfDefTimestep(stream_t *streamptr, int tsID) ...@@ -107,8 +107,7 @@ void cdfDefTimestep(stream_t *streamptr, int tsID)
static static
void cdfDefComplex(stream_t *streamptr, int gridID, int gridindex) void cdfDefComplex(stream_t *streamptr, int gridID, int gridindex)
{ {
int dimID = CDI_UNDEFID; int dimID;
int fileID = streamptr->fileID;
ncgrid_t *ncgrid = streamptr->ncgrid; ncgrid_t *ncgrid = streamptr->ncgrid;
for ( int index = 0; index < gridindex; ++index ) for ( int index = 0; index < gridindex; ++index )
...@@ -120,23 +119,22 @@ void cdfDefComplex(stream_t *streamptr, int gridID, int gridindex) ...@@ -120,23 +119,22 @@ void cdfDefComplex(stream_t *streamptr, int gridID, int gridindex)
if ( gridtype0 == GRID_SPECTRAL || gridtype0 == GRID_FOURIER ) if ( gridtype0 == GRID_SPECTRAL || gridtype0 == GRID_FOURIER )
{ {
dimID = ncgrid[index].ncIDs[CDF_DIMID_X]; dimID = ncgrid[index].ncIDs[CDF_DIMID_X];
break; goto dimIDEstablished;
} }
} }
} }
if ( dimID == CDI_UNDEFID ) {
{ static const char axisname[] = "nc2";
static const char axisname[] = "nc2"; size_t dimlen = 2;
size_t dimlen = 2; int fileID = streamptr->fileID;
if ( streamptr->ncmode == 2 ) cdf_redef(fileID); if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
cdf_def_dim(fileID, axisname, dimlen, &dimID); cdf_def_dim(fileID, axisname, dimlen, &dimID);
cdf_enddef(fileID); cdf_enddef(fileID);
streamptr->ncmode = 2;
streamptr->ncmode = 2; }
} dimIDEstablished:
ncgrid[gridindex].gridID = gridID; ncgrid[gridindex].gridID = gridID;
ncgrid[gridindex].ncIDs[CDF_DIMID_X] = dimID; ncgrid[gridindex].ncIDs[CDF_DIMID_X] = dimID;
} }
......
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