10#include <boost/archive/text_iarchive.hpp>
16template <
int dim,
typename PropertiesIndex>
19 TimerOutput &computing_timer,
21 std::shared_ptr<SimulationControl> &simulation_control,
24 parallel::distributed::Triangulation<dim> &triangulation,
25 Particles::ParticleHandler<dim> &particle_handler,
33 TimerOutput::Scope timer(computing_timer,
"Read checkpoint");
34 std::string prefix = checkpoint_controller.
get_filename();
37 std::string checkpoint_controller_object_filename =
38 prefix +
".checkpoint_controller";
40 "checkpoint file of the checkpoint controller, given by "
41 "'subsection restart' - 'set filename'");
42 std::ifstream iss_checkpoint_controller_obj(
43 checkpoint_controller_object_filename);
45 boost::archive::text_iarchive ia_checkpoint_controller_obj(
46 iss_checkpoint_controller_obj, boost::archive::no_header);
47 checkpoint_controller.
deserialize(ia_checkpoint_controller_obj);
54 simulation_control->read(prefix);
55 particles_pvdhandler.
read(prefix);
59 grid_pvdhandler.
read(prefix +
"_lagrangian_postprocessing");
63 std::string particle_filename = prefix +
".particles";
65 "checkpoint file of the particles, given by "
66 "'subsection restart' - 'set filename'");
67 std::ifstream input(particle_filename.c_str());
70 std::getline(input, buffer);
71 std::istringstream iss(buffer);
72 boost::archive::text_iarchive ia(iss, boost::archive::no_header);
74 ia >> particle_handler;
76 const std::string filename = prefix +
".triangulation";
78 "checkpoint file of the triangulation, given by "
79 "'subsection restart' - 'set filename'");
83 triangulation.load(filename.c_str());
88 ExcMessage(
"Cannot open snapshot mesh file or read the "
89 "triangulation stored there."));
94 particle_handler.deserialize();
98 std::string insertion_object_filename = prefix +
".insertion_object";
100 "checkpoint file of the insertion object, given by "
101 "'subsection restart' - 'set filename'");
102 std::ifstream iss_insertion_obj(insertion_object_filename);
103 boost::archive::text_iarchive ia_insertion_obj(iss_insertion_obj,
104 boost::archive::no_header);
105 insertion_object->deserialize(ia_insertion_obj);
108 for (
unsigned int i = 0; i < solid_surfaces.size(); ++i)
110 solid_surfaces[i]->read_checkpoint(prefix);
116 TimerOutput &computing_timer,
118 std::shared_ptr<SimulationControl> &simulation_control,
121 parallel::distributed::Triangulation<2> &triangulation,
122 Particles::ParticleHandler<2> &particle_handler,
130 TimerOutput &computing_timer,
132 std::shared_ptr<SimulationControl> &simulation_control,
135 parallel::distributed::Triangulation<3> &triangulation,
136 Particles::ParticleHandler<3> &particle_handler,
144 TimerOutput &computing_timer,
146 std::shared_ptr<SimulationControl> &simulation_control,
149 parallel::distributed::Triangulation<2> &triangulation,
150 Particles::ParticleHandler<2> &particle_handler,
158 TimerOutput &computing_timer,
160 std::shared_ptr<SimulationControl> &simulation_control,
163 parallel::distributed::Triangulation<3> &triangulation,
164 Particles::ParticleHandler<3> &particle_handler,
172 TimerOutput &computing_timer,
174 std::shared_ptr<SimulationControl> &simulation_control,
177 parallel::distributed::Triangulation<2> &triangulation,
178 Particles::ParticleHandler<2> &particle_handler,
186 TimerOutput &computing_timer,
188 std::shared_ptr<SimulationControl> &simulation_control,
191 parallel::distributed::Triangulation<2> &triangulation,
192 Particles::ParticleHandler<2> &particle_handler,
200 TimerOutput &computing_timer,
202 std::shared_ptr<SimulationControl> &simulation_control,
205 parallel::distributed::Triangulation<3> &triangulation,
206 Particles::ParticleHandler<3> &particle_handler,
214 TimerOutput &computing_timer,
216 std::shared_ptr<SimulationControl> &simulation_control,
219 parallel::distributed::Triangulation<3> &triangulation,
220 Particles::ParticleHandler<3> &particle_handler,
unsigned int get_next_checkpoint_id() const
Return the next checkpoint id.
void deserialize(boost::archive::text_iarchive &ar)
Deserialize an input archive to the checkpoint controller object.
std::string get_filename() const
Return the prefix for the restart files.
static DEMActionManager * get_action_manager()
Getter of the unique instance of the DEMActionManager.
Handles all the parameters declared in the parameter handler file.
Parameters::Lagrangian::LagrangianPostProcessing post_processing
Base interface for classes that carry out the insertion of particles in the system.
The PVDHandler class manages the storage of the information required to write pvd file....
void read(const std::string &filename)
read Reads the content of a pvd times_and_names checpoint
void check_file_exists(const std::string &file_name, const std::string &file_description)
Verify that a file that Lethe must read exists and can be opened, and raise an error stated in the us...
void read_checkpoint(TimerOutput &computing_timer, const DEMSolverParameters< dim > ¶meters, std::shared_ptr< SimulationControl > &simulation_control, PVDHandler &particles_pvdhandler, PVDHandler &grid_pvdhandler, parallel::distributed::Triangulation< dim > &triangulation, Particles::ParticleHandler< dim > &particle_handler, std::shared_ptr< Insertion< dim, PropertiesIndex > > &insertion_object, std::vector< std::shared_ptr< SerialSolid< dim - 1, dim > > > &solid_surfaces, CheckpointControl &checkpoint_controller)
Read a DEM simulation checkpoint, allowing the simulation to restart from where it stopped.
bool lagrangian_post_processing_enabled
Enable Lagrangian post-processing.