diff --git a/src/cooling/Compton/cooling.h b/src/cooling/Compton/cooling.h index 3b5325e9ef25d3153baa9025f00f59b340094776..9c3cfe41e8b7f5c679b877f7120db32ca2ab491c 100644 --- a/src/cooling/Compton/cooling.h +++ b/src/cooling/Compton/cooling.h @@ -368,4 +368,35 @@ static INLINE void cooling_print_backend( */ static INLINE void cooling_clean(struct cooling_function_data* cooling) {} +/** + * @brief Write a cooling struct to the given FILE as a stream of bytes. + * + * Nothing to do beyond writing the structure from the stream. + * + * @param cooling the struct + * @param stream the file stream + */ +static INLINE void cooling_struct_dump( + const struct cooling_function_data* cooling, FILE* stream) { + restart_write_blocks((void*)cooling, sizeof(struct cooling_function_data), 1, + stream, "cooling", "cooling function"); +} + +/** + * @brief Restore a hydro_props struct from the given FILE as a stream of + * bytes. + * + * Nothing to do beyond reading the structure from the stream. + * + * @param cooling the struct + * @param stream the file stream + * @param cosmo #cosmology structure + */ +static INLINE void cooling_struct_restore(struct cooling_function_data* cooling, + FILE* stream, + const struct cosmology* cosmo) { + restart_read_blocks((void*)cooling, sizeof(struct cooling_function_data), 1, + stream, NULL, "cooling function"); +} + #endif /* SWIFT_COOLING_COMPTON_H */ diff --git a/src/cooling/const_du/cooling.h b/src/cooling/const_du/cooling.h index 0253682aa51993568349df9ebb5e32f42c518dff..d981b91ef9b92ccb7212d800af67ed5d11f5a84d 100644 --- a/src/cooling/const_du/cooling.h +++ b/src/cooling/const_du/cooling.h @@ -275,4 +275,35 @@ static INLINE void cooling_print_backend( */ static INLINE void cooling_clean(struct cooling_function_data* cooling) {} +/** + * @brief Write a cooling struct to the given FILE as a stream of bytes. + * + * Nothing to do beyond writing the structure from the stream. + * + * @param cooling the struct + * @param stream the file stream + */ +static INLINE void cooling_struct_dump( + const struct cooling_function_data* cooling, FILE* stream) { + restart_write_blocks((void*)cooling, sizeof(struct cooling_function_data), 1, + stream, "cooling", "cooling function"); +} + +/** + * @brief Restore a hydro_props struct from the given FILE as a stream of + * bytes. + * + * Nothing to do beyond reading the structure from the stream. + * + * @param cooling the struct + * @param stream the file stream + * @param cosmo #cosmology structure + */ +static INLINE void cooling_struct_restore(struct cooling_function_data* cooling, + FILE* stream, + const struct cosmology* cosmo) { + restart_read_blocks((void*)cooling, sizeof(struct cooling_function_data), 1, + stream, NULL, "cooling function"); +} + #endif /* SWIFT_COOLING_CONST_DU_H */ diff --git a/src/cooling/const_lambda/cooling.h b/src/cooling/const_lambda/cooling.h index 963723785a1bf85fad4dd9ddbd2eb9927eedf9ea..84d8745b608476b4847bad85bdf3f6387b3aa0d2 100644 --- a/src/cooling/const_lambda/cooling.h +++ b/src/cooling/const_lambda/cooling.h @@ -355,4 +355,36 @@ static INLINE void cooling_print_backend( */ static INLINE void cooling_clean(struct cooling_function_data* cooling) {} +/** + * @brief Write a cooling struct to the given FILE as a stream of bytes. + * + * Nothing to do beyond writing the structure from the stream. + * + * @param cooling the struct + * @param stream the file stream + */ +static INLINE void cooling_struct_dump( + const struct cooling_function_data* cooling, FILE* stream) { + restart_write_blocks((void*)cooling, sizeof(struct cooling_function_data), 1, + stream, "cooling", "cooling function"); +} + +/** + * @brief Restore a hydro_props struct from the given FILE as a stream of + * bytes. + * + * Nothing to do beyond reading the structure from the stream. + * + * @param cooling the struct + * @param stream the file stream + * @param cosmo #cosmology structure + */ +static INLINE void cooling_struct_restore(struct cooling_function_data* cooling, + FILE* stream, + const struct cosmology* cosmo) { + restart_read_blocks((void*)cooling, sizeof(struct cooling_function_data), 1, + stream, NULL, "cooling function"); +} + + #endif /* SWIFT_COOLING_CONST_LAMBDA_H */