diff --git a/src/engine.c b/src/engine.c index 27fcb118102e86efb2e05beb9fb0a8647234b480..330e626ae4e8bbbadf497475850db3feff806dad 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5643,6 +5643,7 @@ void engine_struct_dump(struct engine *e, FILE *stream) { e->s->e = e; units_struct_dump(e->internal_units, stream); units_struct_dump(e->snapshotUnits, stream); + partition_struct_dump(e->reparttype, stream); /* repartition */ /* physical constants */ @@ -5685,10 +5686,10 @@ void engine_struct_restore(struct engine *e, FILE *stream) { /* Now for the other pointers, these use their own save functions. */ space_struct_restore(e->s, stream); + units_struct_restore(e->internal_units, stream); + units_struct_restore(e->snapshotUnits, stream); + partition_struct_restore(e->reparttype, stream); - /* internal units */ - /* snapshot units */ - /* repartition */ /* physical constants */ /* hydro props */ /* gravity props */ diff --git a/src/partition.c b/src/partition.c index 297ac71ac75ea4a5c5446033418b1bb4352b116b..70777fe1a6f7d70688605747cd89437e29c48801 100644 --- a/src/partition.c +++ b/src/partition.c @@ -50,6 +50,7 @@ #include "debug.h" #include "error.h" #include "partition.h" +#include "restart.h" #include "space.h" #include "tools.h" @@ -1250,3 +1251,27 @@ int partition_space_to_space(double *oldh, double *oldcdim, int *oldnodeIDs, /* Check we have all nodeIDs present in the resample. */ return check_complete(s, 1, nr_nodes + 1); } + +/** + * @brief Write a repartition struct to the given FILE as a stream of bytes. + * + * @param reparttype the struct + * @param stream the file stream + */ +void partition_struct_dump(struct repartition *reparttype, FILE *stream) { + restart_write_blocks(reparttype, sizeof(struct repartition), 1, stream, + "repartition params"); +} + + +/** + * @brief Restore a repartition struct from the given FILE as a stream of + * bytes. + * + * @param reparttype the struct + * @param stream the file stream + */ +void partition_struct_restore(struct repartition *reparttype, FILE *stream) { + restart_read_blocks(reparttype, sizeof(struct repartition), 1, stream, + "repartition params"); +} diff --git a/src/partition.h b/src/partition.h index c3eade190c9514efb4c44011e3990745e20846fd..50a4456a2c30d6641643f5d9f296e93b815ca139 100644 --- a/src/partition.h +++ b/src/partition.h @@ -74,4 +74,8 @@ void partition_init(struct partition *partition, struct repartition *repartition, const struct swift_params *params, int nr_nodes); +/* Dump/restore. */ +void partition_struct_dump(struct repartition *reparttype, FILE *stream); +void partition_struct_restore(struct repartition *reparttype, FILE *stream); + #endif /* SWIFT_PARTITION_H */