Skip to content

Commit 33f01eb

Browse files
committed
Clean up logic that is no longer needed
1 parent 1639103 commit 33f01eb

2 files changed

Lines changed: 7 additions & 27 deletions

File tree

include/openPMD/IO/ADIOS/ADIOS2File.hpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ class ADIOS2File
407407

408408
size_t currentStep();
409409
void setStepSelection(std::optional<size_t>);
410-
[[nodiscard]] std::optional<size_t> stepSelection() const;
410+
[[nodiscard]] std::optional<size_t> const &stepSelection() const;
411411

412412
[[nodiscard]] detail::AdiosAttributes const &attributes() const
413413
{
@@ -431,13 +431,9 @@ class ADIOS2File
431431
std::optional<adios2::Engine> m_engine; //! ADIOS engine
432432

433433
/*
434-
* Not all engines support the CurrentStep() call, so we have to
435-
* implement this manually.
436-
* Note: We don't use a std::optional<size_t> here since the currentStep
437-
* is always being counted.
434+
* Used for selecting steps in adios2::Mode::ReadRandomAccesss.
438435
*/
439-
size_t m_currentStep = 0;
440-
bool useStepSelection = false;
436+
std::optional<size_t> m_stepSelection;
441437
std::optional<size_t> m_max_steps_bp5 = std::make_optional<size_t>(100);
442438

443439
/*

src/IO/ADIOS/ADIOS2File.cpp

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -381,28 +381,12 @@ void ADIOS2File::setStepSelection(std::optional<size_t> step)
381381
"ADIOS2 backend: Cannot only use random-access step selections "
382382
"when reading without streaming mode.");
383383
}
384-
if (!step.has_value())
385-
{
386-
m_currentStep = 0;
387-
useStepSelection = false;
388-
}
389-
else
390-
{
391-
m_currentStep = *step;
392-
useStepSelection = true;
393-
}
384+
m_stepSelection = step;
394385
}
395386

396-
std::optional<size_t> ADIOS2File::stepSelection() const
387+
std::optional<size_t> const &ADIOS2File::stepSelection() const
397388
{
398-
if (useStepSelection)
399-
{
400-
return {m_currentStep};
401-
}
402-
else
403-
{
404-
return std::nullopt;
405-
}
389+
return m_stepSelection;
406390
}
407391

408392
void ADIOS2File::configure_IO_Read()
@@ -1402,7 +1386,7 @@ ADIOS2File::availableVariablesPrefixed(std::string const &prefix)
14021386
ADIOS2File::AttributeMap_t const &ADIOS2File::availableVariables()
14031387
{
14041388
return m_variables.availableVariables(
1405-
currentStep(), useStepSelection, m_IO);
1389+
currentStep(), stepSelection().has_value(), m_IO);
14061390
}
14071391

14081392
void ADIOS2File::markActive(Writable *writable)

0 commit comments

Comments
 (0)