205 std::string(
"Error while writing " +
classname +
" checkpoint: ");
207 auto const &comm = context.
get_comm();
211 auto failure =
false;
212 std::shared_ptr<CheckpointFile>
cpfile;
215 std::make_shared<CheckpointFile>(
filename, std::ios_base::out,
binary);
216 failure = !
cpfile->stream;
217 boost::mpi::broadcast(comm, failure, 0);
221 cpfile->stream.exceptions(std::ios_base::failbit | std::ios_base::badbit);
223 cpfile->stream.precision(16);
224 cpfile->stream << std::fixed;
227 boost::mpi::broadcast(comm, failure, 0);
236 }
catch (std::exception
const &error) {
240 if (
dynamic_cast<std::ios_base::failure
const *
>(&error)) {
ScriptInterface::Context decorates ScriptInterface::ObjectHandle objects with a context: a creation p...
Context of an object handle.
virtual bool is_head_node() const =0
virtual boost::mpi::communicator const & get_comm() const =0
void save_checkpoint_common(Context const &context, std::string const classname, std::string const &filename, int mode, F1 const write_metadata, F2 const write_data, F3 const on_failure)
void load_checkpoint_common(Context const &context, std::string const classname, std::string const &filename, int mode, F1 const read_metadata, F2 const read_data, F3 const on_success)