28 std::vector<RestartableDataMap> & data,
29 const bool force =
false);
38 std::unique_ptr<InputStream>
data;
45 void setInput(std::unique_ptr<std::stringstream> header_stream,
46 std::unique_ptr<std::stringstream> data_stream);
50 void setInput(
const std::filesystem::path & folder_base);
91 template <
typename T,
typename... Args>
94 void *
const context =
nullptr,
116 static bool isAvailable(
const std::filesystem::path & folder_base);
124 template <
typename T>
127 return hasData(data_name,
typeid(T), tid);
155 hasData(
const std::string & data_name,
const std::type_info & type,
const THREAD_ID tid)
const;
160 std::vector<std::unordered_map<std::string, HeaderEntry>>
200 std::unique_ptr<RestartableDataValue> value,
206 std::vector<std::unordered_map<std::string, HeaderEntry>>
_header;
218 template <
typename T,
typename... Args>
222 void *
const context ,
225 std::unique_ptr<RestartableDataValue> T_data =
226 std::make_unique<RestartableData<T>>(data_name, context, std::forward<Args>(args)...);
229 mooseAssert(T_value,
"Bad cast");
230 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)
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)