Skip to content

Commit

Permalink
CI fixes, docs failure????
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Jul 5, 2022
1 parent 89cf80c commit 5c2bbfb
Showing 1 changed file with 60 additions and 62 deletions.
122 changes: 60 additions & 62 deletions src/IO/ADIOS/ADIOS2IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,68 +65,6 @@ namespace openPMD

#if openPMD_HAVE_MPI

namespace
{
using FlushTarget = ADIOS2IOHandlerImpl::FlushTarget;
FlushTarget flushTargetFromString(std::string const &str)
{
if (str == "buffer")
{
return FlushTarget::Buffer;
}
else if (str == "disk")
{
return FlushTarget::Disk;
}
else if (str == "buffer_override")
{
return FlushTarget::Buffer_Override;
}
else if (str == "disk_override")
{
return FlushTarget::Disk_Override;
}
else
{
throw error::BackendConfigSchema(
{"adios2", "engine", ADIOS2Defaults::str_flushtarget},
"Flush target must be either 'disk' or 'buffer', but "
"was " +
str + ".");
}
}

FlushTarget &overrideFlushTarget(FlushTarget &inplace, FlushTarget new_val)
{
auto allowsOverride = [](FlushTarget ft) {
switch (ft)
{
case FlushTarget::Buffer:
case FlushTarget::Disk:
return true;
case FlushTarget::Buffer_Override:
case FlushTarget::Disk_Override:
return false;
}
return true;
};

if (allowsOverride(inplace))
{
inplace = new_val;
}
else
{
if (!allowsOverride(new_val))
{
inplace = new_val;
}
// else { keep the old value, no-op }
}
return inplace;
}
} // namespace

ADIOS2IOHandlerImpl::ADIOS2IOHandlerImpl(
AbstractIOHandler *handler,
MPI_Comm communicator,
Expand Down Expand Up @@ -315,6 +253,66 @@ std::string ADIOS2IOHandlerImpl::fileSuffix() const
}
}

using FlushTarget = ADIOS2IOHandlerImpl::FlushTarget;
static FlushTarget flushTargetFromString(std::string const &str)
{
if (str == "buffer")
{
return FlushTarget::Buffer;
}
else if (str == "disk")
{
return FlushTarget::Disk;
}
else if (str == "buffer_override")
{
return FlushTarget::Buffer_Override;
}
else if (str == "disk_override")
{
return FlushTarget::Disk_Override;
}
else
{
throw error::BackendConfigSchema(
{"adios2", "engine", ADIOS2Defaults::str_flushtarget},
"Flush target must be either 'disk' or 'buffer', but "
"was " +
str + ".");
}
}

static FlushTarget &
overrideFlushTarget(FlushTarget &inplace, FlushTarget new_val)
{
auto allowsOverride = [](FlushTarget ft) {
switch (ft)
{
case FlushTarget::Buffer:
case FlushTarget::Disk:
return true;
case FlushTarget::Buffer_Override:
case FlushTarget::Disk_Override:
return false;
}
return true;
};

if (allowsOverride(inplace))
{
inplace = new_val;
}
else
{
if (!allowsOverride(new_val))
{
inplace = new_val;
}
// else { keep the old value, no-op }
}
return inplace;
}

std::future<void>
ADIOS2IOHandlerImpl::flush(internal::ParsedFlushParams &flushParams)
{
Expand Down

0 comments on commit 5c2bbfb

Please sign in to comment.