Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
5e73f171
Commit
5e73f171
authored
Mar 09, 2018
by
Peter W. Draper
Browse files
Don't attempt to fully initialise the cosmology struct when we are not using a cosmology
parent
e595df4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cosmology.c
View file @
5e73f171
...
...
@@ -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
);
}
src/cosmology.h
View file @
5e73f171
...
...
@@ -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 */
src/engine.c
View file @
5e73f171
...
...
@@ -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
...
...
Peter W. Draper
@pdraper
mentioned in issue
#387 (closed)
·
Mar 09, 2018
mentioned in issue
#387 (closed)
mentioned in issue #387
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment