Skip to content

Commit

Permalink
Rename BufferedActions -> ADIOS2File
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 22, 2023
1 parent e6cedc7 commit a0bd5b3
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 82 deletions.
32 changes: 16 additions & 16 deletions include/openPMD/IO/ADIOS/ADIOS2File.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ADIOS2IOHandlerImpl;
#if openPMD_HAVE_ADIOS2
namespace openPMD::detail
{
class BufferedActions;
class ADIOS2File;

/*
* IO-heavy action to be executed upon flushing.
Expand All @@ -60,15 +60,15 @@ struct BufferedAction
BufferedAction &operator=(BufferedAction const &other) = delete;
BufferedAction &operator=(BufferedAction &&other) = default;

virtual void run(BufferedActions &) = 0;
virtual void run(ADIOS2File &) = 0;
};

struct BufferedGet : BufferedAction
{
std::string name;
Parameter<Operation::READ_DATASET> param;

void run(BufferedActions &) override;
void run(ADIOS2File &) override;
};

struct DatasetReader
Expand All @@ -89,13 +89,13 @@ struct BufferedPut : BufferedAction
std::string name;
Parameter<Operation::WRITE_DATASET> param;

void run(BufferedActions &) override;
void run(ADIOS2File &) override;
};

struct WriteDataset
{
template <typename T>
static void call(BufferedActions &ba, BufferedPut &bp);
static void call(ADIOS2File &ba, BufferedPut &bp);

template <int n, typename... Params>
static void call(Params &&...);
Expand All @@ -109,7 +109,7 @@ struct BufferedUniquePtrPut
UniquePtrWithLambda<void> data;
Datatype dtype = Datatype::UNDEFINED;

void run(BufferedActions &);
void run(ADIOS2File &);
};

struct I_UpdateSpan
Expand All @@ -133,7 +133,7 @@ struct UpdateSpan : I_UpdateSpan
* (1) the file's IO and Engine objects
* (2) the file's deferred IO-heavy actions
*/
class BufferedActions
class ADIOS2File
{
friend struct BufferedGet;
friend struct BufferedPut;
Expand All @@ -144,7 +144,7 @@ class BufferedActions
using FlushTarget = adios_defs::FlushTarget;

public:
BufferedActions(BufferedActions const &) = delete;
ADIOS2File(ADIOS2File const &) = delete;

/**
* The full path to the file created on disk, including the
Expand Down Expand Up @@ -177,7 +177,7 @@ class BufferedActions
adios2::IO m_IO;
/**
* The default queue for deferred actions.
* Drained upon BufferedActions::flush().
* Drained upon ADIOS2File::flush().
*/
std::vector<std::unique_ptr<BufferedAction>> m_buffer;
/**
Expand Down Expand Up @@ -219,7 +219,7 @@ class BufferedActions
* iteration. If the following boolean is true, old attributes will be
* removed upon CLOSE_GROUP.
* Should not be set to true in persistent backends.
* Will be automatically set by BufferedActions::configure_IO depending
* Will be automatically set by ADIOS2File::configure_IO depending
* on chosen ADIOS2 engine and can not be explicitly overridden by user.
*/
bool optimizeAttributesStreaming = false;
Expand All @@ -229,9 +229,9 @@ class BufferedActions

using AttributeMap_t = std::map<std::string, adios2::Params>;

BufferedActions(ADIOS2IOHandlerImpl &impl, InvalidatableFile file);
ADIOS2File(ADIOS2IOHandlerImpl &impl, InvalidatableFile file);

~BufferedActions();
~ADIOS2File();

/**
* Implementation of destructor, will only run once.
Expand Down Expand Up @@ -295,7 +295,7 @@ class BufferedActions
*/
void flush_impl(
ADIOS2FlushParams flushParams,
std::function<void(BufferedActions &, adios2::Engine &)> const
std::function<void(ADIOS2File &, adios2::Engine &)> const
&performPutGets,
bool writeLatePuts,
bool flushUnconditionally);
Expand Down Expand Up @@ -346,13 +346,13 @@ class BufferedActions

/*
* streamStatus is NoStream for file-based ADIOS engines.
* This is relevant for the method BufferedActions::requireActiveStep,
* This is relevant for the method ADIOS2File::requireActiveStep,
* where a step is only opened if the status is OutsideOfStep, but not
* if NoStream. The rationale behind this is that parsing a Series
* works differently for file-based and for stream-based engines:
* * stream-based: Iterations are parsed as they arrive. For parsing an
* iteration, the iteration must be awaited.
* BufferedActions::requireActiveStep takes care of this.
* ADIOS2File::requireActiveStep takes care of this.
* * file-based: The Series is parsed up front. If no step has been
* opened yet, ADIOS2 gives access to all variables and attributes
* from all steps. Upon opening a step, only the variables from that
Expand Down Expand Up @@ -461,7 +461,7 @@ class BufferedActions
};

template <typename... Args>
void BufferedActions::flush(Args &&...args)
void ADIOS2File::flush(Args &&...args)
{
try
{
Expand Down
10 changes: 4 additions & 6 deletions include/openPMD/IO/ADIOS/ADIOS2IOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace detail
template <typename>
struct DatasetTypes;
struct WriteDataset;
class BufferedActions;
class ADIOS2File;
struct BufferedPut;
struct BufferedGet;
struct BufferedAttributeRead;
Expand All @@ -105,7 +105,7 @@ class ADIOS2IOHandlerImpl
template <typename>
friend struct detail::DatasetTypes;
friend struct detail::WriteDataset;
friend class detail::BufferedActions;
friend class detail::ADIOS2File;
friend struct detail::BufferedAttributeRead;
friend struct detail::RunUniquePtrPut;

Expand Down Expand Up @@ -331,9 +331,7 @@ class ADIOS2IOHandlerImpl
* IO and Engine object.
* Not to be accessed directly, use getFileData().
*/
std::unordered_map<
InvalidatableFile,
std::unique_ptr<detail::BufferedActions>>
std::unordered_map<InvalidatableFile, std::unique_ptr<detail::ADIOS2File>>
m_fileData;

std::map<std::string, adios2::Operator> m_operators;
Expand Down Expand Up @@ -381,7 +379,7 @@ class ADIOS2IOHandlerImpl
ThrowError
};

detail::BufferedActions &
detail::ADIOS2File &
getFileData(InvalidatableFile const &file, IfFileNotOpen);

void dropFileData(InvalidatableFile const &file);
Expand Down
4 changes: 2 additions & 2 deletions include/openPMD/IO/AbstractIOHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ namespace internal

namespace detail
{
struct BufferedActions;
class ADIOS2File;
}

/** Interface for communicating between logical and physically persistent data.
Expand All @@ -186,7 +186,7 @@ class AbstractIOHandler
{
friend class Series;
friend class ADIOS2IOHandlerImpl;
friend struct detail::BufferedActions;
friend class detail::ADIOS2File;

private:
IterationEncoding m_encoding = IterationEncoding::groupBased;
Expand Down
4 changes: 2 additions & 2 deletions include/openPMD/backend/Writable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace internal
} // namespace internal
namespace detail
{
struct BufferedActions;
class ADIOS2File;
}

/** @brief Layer to mirror structure of logical data and persistent data in
Expand Down Expand Up @@ -83,7 +83,7 @@ class Writable final
friend class Record;
friend class AbstractIOHandlerImpl;
friend class ADIOS2IOHandlerImpl;
friend struct detail::BufferedActions;
friend class detail::ADIOS2File;
friend class HDF5IOHandlerImpl;
friend class ParallelHDF5IOHandlerImpl;
template <typename>
Expand Down
Loading

0 comments on commit a0bd5b3

Please sign in to comment.