Skip to content
Snippets Groups Projects
Commit 5ceefe71 authored by Thomas Jahns's avatar Thomas Jahns :cartwheel:
Browse files

Virtualize streamDefTimestep.

* This is needed in preparation to explicitly handle streamDefTimestep in
  the MPI parallelized version of the library.
parent 52f476eb
No related branches found
No related tags found
No related merge requests found
......@@ -368,6 +368,8 @@ void
cdiStreamCloseDefaultDelegate(stream_t *streamptr,
int recordBufIsToBeDeleted);
int cdiStreamDefTimestep_(stream_t *streamptr, int tsID);
void cdiStreamSync_(stream_t *streamptr);
char *cdiUnitNamePtr(int cdi_unit);
......
......@@ -40,6 +40,7 @@ static int activeNamespace = 0;
{ .func = (void (*)()) cdiStreamwriteVarChunk_ }, \
{ .data = NULL }, \
{ .func = (void (*)()) cdiStreamCloseDefaultDelegate }, \
{ .func = (void (*)()) cdiStreamDefTimestep_ }, \
{ .func = (void (*)()) cdiStreamSync_ }, \
CDI_NETCDF_SWITCHES \
}
......
......@@ -34,6 +34,7 @@ enum namespaceSwitch
NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
NSSWITCH_STREAM_WRITE_VAR_PART_,
NSSWITCH_STREAM_CLOSE_BACKEND,
NSSWITCH_STREAM_DEF_TIMESTEP_,
NSSWITCH_STREAM_SYNC,
#ifdef HAVE_LIBNETCDF
NSSWITCH_NC__CREATE,
......
......@@ -1287,37 +1287,18 @@ void streamSync(int streamID)
myStreamSync_(streamptr);
}
/*
@Function streamDefTimestep
@Title Define time step
@Prototype int streamDefTimestep(int streamID, int tsID)
@Parameter
@Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}.
@Item tsID Timestep identifier.
@Description
The function @func{streamDefTimestep} defines the time step of a stream.
@Result
@func{streamDefTimestep} returns the number of records of the time step.
@EndFunction
*/
int streamDefTimestep(int streamID, int tsID)
int cdiStreamDefTimestep_(stream_t *streamptr, int tsID)
{
int newtsID;
int taxisID;
int vlistID;
int time_is_varying;
stream_t *streamptr;
taxis_t *taxisptr1;
taxis_t *taxisptr2;
streamptr = stream_to_pointer(streamID);
if ( CDI_Debug )
Message("streamID = %d tsID = %d", streamID, tsID);
Message("streamID = %d tsID = %d", streamptr->self, tsID);
stream_check_ptr(__func__, streamptr);
......@@ -1330,7 +1311,7 @@ int streamDefTimestep(int streamID, int tsID)
taxisID = vlistInqTaxis(vlistID);
if ( taxisID == CDI_UNDEFID )
{
Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamID);
Warning("taxisID undefined for fileID = %d! Using absolute time axis.", streamptr->self);
taxisID = taxisCreate(TAXIS_ABSOLUTE);
vlistDefTaxis(vlistID, taxisID);
}
......@@ -1376,6 +1357,32 @@ int streamDefTimestep(int streamID, int tsID)
return (streamptr->ntsteps);
}
/*
@Function streamDefTimestep
@Title Define time step
@Prototype int streamDefTimestep(int streamID, int tsID)
@Parameter
@Item streamID Stream ID, from a previous call to @fref{streamOpenWrite}.
@Item tsID Timestep identifier.
@Description
The function @func{streamDefTimestep} defines the time step of a stream.
@Result
@func{streamDefTimestep} returns the number of records of the time step.
@EndFunction
*/
int streamDefTimestep(int streamID, int tsID)
{
stream_t *streamptr = stream_to_pointer(streamID);
int (*myStreamDefTimestep_)(stream_t *streamptr, int tsID)
= (int (*)(stream_t *, int))
namespaceSwitchGet(NSSWITCH_STREAM_DEF_TIMESTEP_).func;
return myStreamDefTimestep_(streamptr, tsID);
}
/*
@Function streamInqTimestep
@Title Get time step
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment