Commit 5e73f171 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Don't attempt to fully initialise the cosmology struct when we are not using a cosmology

parent e595df4c
......@@ -667,13 +667,15 @@ void cosmology_struct_dump(const struct cosmology *cosmology, FILE *stream) {
* @brief Restore a cosmology struct from the given FILE as a stream of
* bytes.
*
* @param enabled whether cosmology is enabled.
* @param cosmology the struct
* @param stream the file stream
*/
void cosmology_struct_restore(struct cosmology *cosmology, FILE *stream) {
void cosmology_struct_restore(int enabled, struct cosmology *cosmology,
FILE *stream) {
restart_read_blocks((void *)cosmology, sizeof(struct cosmology), 1, stream,
NULL, "cosmology function");
/* Re-initialise the tables */
cosmology_init_tables(cosmology);
/* Re-initialise the tables if using a cosmology. */
if (enabled) cosmology_init_tables(cosmology);
}
......@@ -192,6 +192,6 @@ void cosmology_write_model(hid_t h_grp, const struct cosmology *c);
/* Dump/restore. */
void cosmology_struct_dump(const struct cosmology *cosmology, FILE *stream);
void cosmology_struct_restore(struct cosmology *cosmology, FILE *stream);
void cosmology_struct_restore(int enabled, struct cosmology *cosmology, FILE *stream);
#endif /* SWIFT_COSMOLOGY_H */
......@@ -5921,7 +5921,7 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
struct cosmology *cosmo =
(struct cosmology *)malloc(sizeof(struct cosmology));
cosmology_struct_restore(cosmo, stream);
cosmology_struct_restore(e->policy & engine_policy_cosmology, cosmo, stream);
e->cosmology = cosmo;
#ifdef WITH_MPI
......
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