56 const std::string& rDirectory,
68 boost::archive::text_oarchive* p_main_archive = archive_opener.
GetCommonArchive();
71 PROBLEM_CLASS*
const p_simulation_to_archive = &rSimulationToArchive;
72 (*p_main_archive) & p_simulation_to_archive;
79 std::ofstream info_file(info_path.c_str());
80 if (!info_file.is_open())
84 EXCEPTION(
"Unable to open archive information file: " + info_path);
87 unsigned archive_version = 0;
95 EXCEPTION(
"Unable to open archive information file");
123 EXCEPTION(
"Checkpoint directory does not exist: " + dir_path);
125 assert(*(dir_path.end()-1) ==
'/');
128 std::string info_path = dir_path +
"archive.info";
129 std::ifstream info_file(info_path.c_str());
130 if (!info_file.is_open())
132 EXCEPTION(
"Unable to open archive information file: " + info_path);
134 unsigned num_procs, archive_version;
135 info_file >> num_procs >> archive_version;
137 PROBLEM_CLASS *p_unarchived_simulation = NULL;
154 boost::archive::text_iarchive* p_main_archive = archive_opener.
GetCommonArchive();
155 (*p_main_archive) >> p_unarchived_simulation;
159 assert(p_factory != NULL);
161 assert(original_num_procs == num_procs);
164 for (
unsigned archive_num=0; archive_num<original_num_procs; archive_num++)
166 if (archive_num != initial_archive)
169 std::ifstream ifs(archive_path.c_str());
170 boost::archive::text_iarchive archive(ifs);
171 p_unarchived_simulation->LoadExtraArchive(archive, archive_version);
178 if (p_unarchived_simulation)
180 delete p_unarchived_simulation;
187 return p_unarchived_simulation;