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

Move PIO client part of streamWriteVarPart to pio_client.c.

parent a1280218
......@@ -34,6 +34,7 @@ static int activeNamespace = 0;
cdiStreamDefVlist_, \
cdiStreamWriteVar_, \
cdiStreamwriteVarChunk_, \
NULL, \
cdiStreamCloseDefaultDelegate, \
cdiStreamSync_, \
CDI_NETCDF_SWITCHES \
......
......@@ -32,6 +32,7 @@ enum namespaceSwitch
NSSWITCH_STREAM_DEF_VLIST_,
NSSWITCH_STREAM_WRITE_VAR_,
NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
NSSWITCH_STREAM_WRITE_VAR_PART_,
NSSWITCH_STREAM_CLOSE_BACKEND,
NSSWITCH_STREAM_SYNC,
#ifdef HAVE_LIBNETCDF
......
......@@ -93,6 +93,26 @@ cdiPioClientStreamWriteVarChunk_(int streamID, int varID, int memtype,
xt_idxlist_delete(chunkDesc);
}
static void
cdiPioClientStreamWriteVarPart(int streamID, int varID, const void *data,
int nmiss, Xt_idxlist partDesc)
{
switch (namespaceInqResStatus())
{
case STAGE_DEFINITION:
xabort("DEFINITION STAGE: PARALLEL WRITING NOT POSSIBLE.");
break;
case STAGE_TIMELOOP:
pioBufferPartData(streamID, varID, data, nmiss, partDesc);
return;
case STAGE_CLEANUP:
xabort("CLEANUP STAGE: PARALLEL WRITING NOT POSSIBLE.");
break;
default:
xabort("INTERNAL ERROR");
}
}
#if defined HAVE_LIBNETCDF
static void
cdiPioCdfDefTimestepNOP(stream_t *streamptr, int tsID)
......@@ -139,6 +159,8 @@ cdiPioClientSetup(int *pioNamespace_, int *pioNamespace)
namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_, cdiPioClientStreamWriteVar_);
namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_CHUNK_,
cdiPioClientStreamWriteVarChunk_);
namespaceSwitchSet(NSSWITCH_STREAM_WRITE_VAR_PART_,
cdiPioClientStreamWriteVarPart);
namespaceSwitchSet(NSSWITCH_STREAM_CLOSE_BACKEND, cdiPioClientStreamClose);
namespaceSwitchSet(NSSWITCH_STREAM_SYNC, cdiPioClientStreamNOP);
#ifdef HAVE_LIBNETCDF
......
......@@ -909,23 +909,14 @@ streamWriteVarPart(int streamID, int varID, const void *data,
check_parg(data);
if (namespaceHasLocalFile(namespaceGetActive ()))
xabort("local part writing is unsupported!");
void (*myStreamWriteVarPart)(int streamID, int varID, const void *data,
int nmiss, Xt_idxlist partDesc)
= namespaceSwitchGet(NSSWITCH_STREAM_WRITE_VAR_PART_);
switch (namespaceInqResStatus())
{
case STAGE_DEFINITION:
xabort("DEFINITION STAGE: PARALLEL WRITING NOT POSSIBLE.");
break;
case STAGE_TIMELOOP:
pioBufferPartData(streamID, varID, data, nmiss, partDesc);
return;
case STAGE_CLEANUP:
xabort("CLEANUP STAGE: PARALLEL WRITING NOT POSSIBLE.");
break;
default:
xabort("INTERNAL ERROR");
}
if (!myStreamWriteVarPart)
xabort("local part writing is unsupported!");
myStreamWriteVarPart(streamID, varID, data, nmiss, partDesc);
}
#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