29 std::vector<RestartableDataMap> & data,
30 const bool force =
false);
39 std::unique_ptr<InputStream>
data;
46 void setInput(std::unique_ptr<std::stringstream> header_stream,
47 std::unique_ptr<std::stringstream> data_stream);
51 void setInput(
const std::filesystem::path & folder_base);
105 template <
typename T,
typename... Args>
108 void *
const context =
nullptr,
130 static bool isAvailable(
const std::filesystem::path & folder_base);
138 template <
typename T>
141 return hasData(data_name,
typeid(T), tid);
169 hasData(
const std::string & data_name,
const std::type_info & type,
const THREAD_ID tid)
const;
174 std::vector<std::unordered_map<std::string, HeaderEntry>>
214 std::unique_ptr<RestartableDataValue> value,
220 std::vector<std::unordered_map<std::string, HeaderEntry>>
_header;
232 template <
typename T,
typename... Args>
236 void *
const context ,
239 std::unique_ptr<RestartableDataValue> T_data =
240 std::make_unique<RestartableData<T>>(data_name, context, std::forward<Args>(args)...);
243 mooseAssert(T_value,
"Bad cast");
244 return T_value->set();
Reader for restartable data written by the RestartableDataWriter.
void setInput(std::unique_ptr< std::stringstream > header_stream, std::unique_ptr< std::stringstream > data_stream)
Sets the input stream for reading from the stringstreams header_stream and data_stream for the header...
void requireRestoring() const
Checks whether or not we're currently restoring and errors if not.
Base class for MOOSE-based applications.
const HeaderEntry & getHeader(const std::string &data_name, const THREAD_ID tid) const
std::vector< std::unordered_map< std::string, HeaderEntry > > readHeader(InputStream &header_input) const
Internal method for reading the header (stored by RestartableDataWriter)
Storage for restartable data that is ordered based on insertion order.
const HeaderEntry * queryHeader(const std::string &data_name, const THREAD_ID tid) const
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
void setErrorOnLoadWithDifferentNumberOfProcessors(bool value)
bool isSameType(const HeaderEntry &header_entry, const std::type_info &type) const
RestartableDataReader(MooseApp &app, RestartableDataMap &data, const bool force=false)
bool restoreDataIfAvailable(RestartableDataValue &value, const THREAD_ID tid, Moose::PassKey< MooseApp >)
Restores value in place from the open reader if it is present in the checkpoint and has not yet been ...
T & restoreData(const std::string &data_name, const THREAD_ID tid=0, void *const context=nullptr, Args &&... args)
Restores the data with name data_name of type T.
bool _is_restoring
Whether or not we're currently restoring.
Concrete definition of a parameter value for a specified type.
const bool _force
Whether or not to forcefully attempt to read despite incompatibilities.
bool hasData(const std::string &data_name, const THREAD_ID tid=0) const
void deserializeValue(InputStream &data_input, RestartableDataValue &value, const HeaderEntry &header_entry) const
Internal method for deserializing (restoring from backup into a value)
std::unordered_set< std::string > DataNames
bool _error_on_different_number_of_processors
Whether or not to error with a different number of processors.
InputStreams clear()
Clears the contents of the reader (header stream, data stream, header)
void restore(const DataNames &filter_names={})
Restores the restartable data.
InputStreams _streams
The inputs for reading.
Abstract definition of a RestartableData value.
std::vector< std::unordered_map< std::string, HeaderEntry > > _header
The loaded headers from the restart.
static bool isAvailable(const std::filesystem::path &folder_base)