-
Notifications
You must be signed in to change notification settings - Fork 2
StdFileContext
Context objection for the StdFile backend.
Header File: StdFileContext.hpp
template <typename Backend>
class StdFileContext : public ContextBase {
public:
explicit StdFileContext(std::string const &filename, Config &cfg)
: ContextBase(cfg), m_backend(*this, filename), m_filename(filename) {}
StdFileContext(const StdFileContext &) = delete;
StdFileContext(StdFileContext &&) = default;
StdFileContext &operator=(const StdFileContext &) = delete;
StdFileContext &operator=(StdFileContext &&) = default;
virtual ~StdFileContext()
std::string const &filename() const noexcept
Backend &backend()
void register_hashes(
const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>> &views,
const std::vector<Detail::CrefImpl> &crefs) override
bool restart_available(const std::string &label, int version) override
void restart(const std::string &label, int version,
const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>>
&views) override
void checkpoint(const std::string &label, int version,
const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>>
&views) override
int latest_version(const std::string &label) const noexcept override
void reset() override
void register_alias( const std::string &original, const std::string &alias ) override
};
-
explicit StdFileContext(std::string const &filename, Config &cfg) : ContextBase(cfg), m_backend(*this, filename), m_filename(filename) {}
Construct a
StdFileContext
with the suppliedfilename
andConfig
object. -
StdFileContext(const StdFileContext &) = delete;
Copy constructor is deleted.
-
StdFileContext(StdFileContext &&) = default;
Move constructor.
-
StdFileContext &operator=(const StdFileContext &) = delete;
Copy constructor is deleted.
-
StdFileContext &operator=(StdFileContext &&) = default;
Move constructor.
-
std::string const &filename() const noexcept
Access the underlying
filename
. -
Backend &backend()
Access the underlying
Backend
. Returns a reference. -
void register_hashes( const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>> &views, const std::vector<Detail::CrefImpl> &crefs) override
Register Views. Overrides the
ContextBase
implementation. -
bool restart_available(const std::string &label, int version) override
Check if an existing restart is available. Searches based on the supplied label.
version
determines the most recent version to search for. For example, settingversion
to 5 will search for any restart up to version 5. Settingversion
to 0 will search for the most recent restart. -
void restart(const std::string &label, int version, const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>> &views) override
Restart the specified Views from the checkpoint determined by the
label
andversion
. -
void checkpoint(const std::string &label, int version, const std::vector<std::unique_ptr<Kokkos::ViewHolderBase>> &views) override
Create a checkpoint of the specified Views.
-
int latest_version(const std::string &label) const noexcept override
Get the latest version of the checkpoint with the name
label
. -
void register_alias( const std::string &original, const std::string &alias ) override
Register a new alias.
-
void reset() override
Reset the context.