Skip to content
Snippets Groups Projects
Commit 7d1c671c authored by Thomas Jahns's avatar Thomas Jahns :cartwheel: Committed by Sergey Kosukhin
Browse files

Extract function to open test streams.

parent 1097d35d
No related branches found
No related tags found
2 merge requests!34Version 2.2.0,!13Consolidation with CDI-PIO (develop)
......@@ -239,9 +239,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
{
for (size_t varIdx = 0; varIdx < nVars; ++varIdx) varDesc[varIdx].checksum_state = 0;
composeFilename(&filename, fname_prefix, tfID, setup.suffix);
int streamID = streamOpenWrite(filename, setup.filetype);
xassert(streamID >= 0);
int streamID = composeStream(&filename, fname_prefix, tfID, setup.suffix, setup.filetype);
streamDefVlist(streamID, vlistID);
vdate = 19850101;
......
......@@ -179,9 +179,7 @@ modelRun(struct model_config setup, MPI_Comm comm)
{
for (size_t varIdx = 0; varIdx < nVars; ++varIdx) varDesc[varIdx].checksum_state = 0;
composeFilename(&filename, fname_prefix, tfID, setup.suffix);
int streamID = streamOpenWrite(filename, setup.filetype);
xassert(streamID >= 0);
int streamID = composeStream(&filename, fname_prefix, tfID, setup.suffix, setup.filetype);
streamDefVlist(streamID, vlistID);
vdate = 19850101;
......
......@@ -82,6 +82,19 @@ composeFilename(char **buf, const char *fname_prefix, int tfID, const char *suff
*buf = filename;
}
int
composeStream(char **buf, const char *fname_prefix, int tfID, const char *suffix, int filetype)
{
composeFilename(buf, fname_prefix, tfID, suffix);
int streamID = streamOpenWrite(*buf, filetype);
if (streamID < 0)
{
fprintf(stderr, "Failed to open stream: %s\n", cdiStringError(streamID));
abort();
}
return streamID;
}
#if defined USE_MPI && !defined HAVE_PPM_CORE
static int32_t uniform_partition_start(struct PPM_extent set_interval, int nparts, int part_idx);
......
......@@ -38,6 +38,8 @@ void time_t2cditime(time_t t, int *date, int *timeofday);
void composeFilename(char **buf, const char *fname_prefix, int tfID, const char *suffix);
int composeStream(char **buf, const char *fname_prefix, int tfID, const char *suffix, int filetype);
#if defined(USE_MPI) && !defined(HAVE_PPM_CORE)
struct PPM_extent
{
......
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