Skip to content

Commit

Permalink
Merge pull request #3216 from eisenhauer/StepStatus
Browse files Browse the repository at this point in the history
Add access to internal m_BetweenStepPairs member
  • Loading branch information
eisenhauer authored May 16, 2022
2 parents 0ad97e1 + 2c9840c commit b3fcd0b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bindings/C/adios2/c/adios2_c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,27 @@ adios2_error adios2_begin_step(adios2_engine *engine,
}
}

adios2_error adios2_between_step_pairs(size_t *between_step_pairs,
const adios2_engine *engine)
{
try
{
adios2::helper::CheckForNullptr(
engine, "for adios2_engine, in call to adios2_between_step_pairs");

const adios2::core::Engine *engineCpp =
reinterpret_cast<const adios2::core::Engine *>(engine);

*between_step_pairs = engineCpp->BetweenStepPairs();
return adios2_error_none;
}
catch (...)
{
return static_cast<adios2_error>(
adios2::helper::ExceptionToError("adios2_between_step_pairs"));
}
}

adios2_error adios2_current_step(size_t *current_step,
const adios2_engine *engine)
{
Expand Down
9 changes: 9 additions & 0 deletions bindings/C/adios2/c/adios2_c_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ adios2_error adios2_begin_step(adios2_engine *engine,
adios2_error adios2_current_step(size_t *current_step,
const adios2_engine *engine);

/**
* Inspect current between step status
* @param between_step_pairs output boolean
* @param engine input handler
* @return adios2_error 0: success, see enum adios2_error for errors
*/
adios2_error adios2_between_step_pairs(size_t *between_step_pairs,
const adios2_engine *engine);

/**
* Inspect total number of available steps, use for file engines in read mode
* only
Expand Down
6 changes: 6 additions & 0 deletions bindings/CXX11/adios2/cxx11/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ StepStatus Engine::BeginStep()
return m_Engine->BeginStep();
}

bool Engine::BetweenStepPairs()
{
helper::CheckForNullptr(m_Engine, "in call to Engine::BetweenStepPairs");
return m_Engine->BetweenStepPairs();
}

StepStatus Engine::BeginStep(const StepMode mode, const float timeoutSeconds)
{
helper::CheckForNullptr(
Expand Down
6 changes: 6 additions & 0 deletions bindings/CXX11/adios2/cxx11/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ class Engine
*/
void EndStep();

/**
* Returns True if engine status is between BeginStep()/EndStep() pair,
* False otherwise.
*/
bool BetweenStepPairs();

/**
* Manually flush to underlying transport to guarantee data is moved
* @param transportIndex
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ void Engine::LockWriterDefinitions() noexcept
m_WriterDefinitionsLocked = true;
}

bool Engine::BetweenStepPairs() const { return m_BetweenStepPairs; }

void Engine::LockReaderSelections() noexcept
{
m_ReaderSelectionsLocked = true;
Expand Down
6 changes: 6 additions & 0 deletions source/adios2/core/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ class Engine
*/
virtual size_t CurrentStep() const;

/**
* Returns current status information for each engine.
* @return if between BeginStep/EndStep() pair
*/
bool BetweenStepPairs() const;

/**
* Put signature that pre-allocates a Variable in Buffer returning a Span of
* the payload memory from variable.m_Count
Expand Down

0 comments on commit b3fcd0b

Please sign in to comment.