Commit 60282037 authored by rttw52's avatar rttw52
Browse files

Added LOS structures to restart files

parent 5f06c8b2
......@@ -5374,12 +5374,14 @@ void engine_clean(struct engine *e, const int fof, const int restart) {
#ifdef WITH_FOF
free((void *)e->fof_properties);
#endif
free((void *)e->los_properties);
#ifdef WITH_MPI
free((void *)e->reparttype);
#endif
if (e->output_list_snapshots) free((void *)e->output_list_snapshots);
if (e->output_list_stats) free((void *)e->output_list_stats);
if (e->output_list_stf) free((void *)e->output_list_stf);
if (e->output_list_los) free((void *)e->output_list_los);
#ifdef WITH_LOGGER
if (e->policy & engine_policy_logger) free((void *)e->logger);
#endif
......@@ -5428,12 +5430,14 @@ void engine_struct_dump(struct engine *e, FILE *stream) {
#ifdef WITH_FOF
fof_struct_dump(e->fof_properties, stream);
#endif
los_struct_dump(e->los_properties, stream);
parser_struct_dump(e->parameter_file, stream);
if (e->output_list_snapshots)
output_list_struct_dump(e->output_list_snapshots, stream);
if (e->output_list_stats)
output_list_struct_dump(e->output_list_stats, stream);
if (e->output_list_stf) output_list_struct_dump(e->output_list_stf, stream);
if (e->output_list_los) output_list_struct_dump(e->output_list_los, stream);
#ifdef WITH_LOGGER
if (e->policy & engine_policy_logger) {
......@@ -5559,6 +5563,11 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e->fof_properties = fof_props;
#endif
struct los_props *los_properties =
(struct los_props *)malloc(sizeof(struct los_props));
los_struct_restore(los_properties, stream);
e->los_properties = los_properties;
struct swift_params *parameter_file =
(struct swift_params *)malloc(sizeof(struct swift_params));
parser_struct_restore(parameter_file, stream);
......@@ -5585,6 +5594,13 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e->output_list_stf = output_list_stf;
}
if (e->output_list_los) {
struct output_list *output_list_los =
(struct output_list *)malloc(sizeof(struct output_list));
output_list_struct_restore(output_list_los, stream);
e->output_list_los = output_list_los;
}
#ifdef WITH_LOGGER
if (e->policy & engine_policy_logger) {
struct logger_writer *log =
......
......@@ -725,3 +725,29 @@ void write_hdf5_header(hid_t h_file, const struct engine *e, const struct los_pr
io_write_attribute(h_grp, "Maxz", DOUBLE, &LOS_params->zmax, 1);
H5Gclose(h_grp);
}
/**
* @brief Write a los_props struct to the given FILE as a stream of bytes.
*
* @param internal_los the struct
* @param stream the file stream
*/
void los_struct_dump(const struct los_props *internal_los,
FILE *stream) {
restart_write_blocks((void *)internal_los, sizeof(struct los_props), 1,
stream, "losparams", "los params");
}
/**
* @brief Restore a los_props struct from the given FILE as a stream of
* bytes.
*
* @param internal_los the struct
* @param stream the file stream
*/
void los_struct_restore(const struct los_props *internal_los,
FILE *stream) {
restart_read_blocks((void *)internal_los, sizeof(struct los_props), 1,
stream, NULL, "los params");
}
......@@ -44,3 +44,7 @@ void write_hdf5_header(hid_t h_file, const struct engine *e, const struct los_pr
void create_line_of_sight(const double Xpos, const double Ypos,
const int xaxis, const int yaxis, const int zaxis,
const int periodic, const double dim[3], struct line_of_sight *los);
void los_struct_dump(const struct los_props *internal_los,
FILE *stream);
void los_struct_restore(const struct los_props *internal_los,
FILE *stream);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment