diff --git a/examples/main.c b/examples/main.c index 419461a74a8585ee360574f501fcbcaaf3fe26f4..b48b056e39eb43bb60bc164cd36d281bdf775725 100644 --- a/examples/main.c +++ b/examples/main.c @@ -496,11 +496,11 @@ int main(int argc, char *argv[]) { if (restart) { /* Attempting a restart. */ - message("Restarting SWIFT"); char **restartfiles = NULL; int nrestartfiles = 0; if (myrank == 0) { + message("Restarting SWIFT"); /* Locate the restart files. */ restartfiles = restart_locate(restartdir, restartname, &nrestartfiles); diff --git a/src/restart.c b/src/restart.c index 4a0f5f86ec4fc16533bbd9c9876f581949f0df71..e284eaea5c64e34284e9eec4814806a5134b6d08 100644 --- a/src/restart.c +++ b/src/restart.c @@ -50,8 +50,7 @@ */ int restart_genname(const char *dir, const char *basename, int nodeID, char *name, int size) { - int n = snprintf(name, size, "%s/%s_%04d.rst", dir, basename, nodeID); - message("name = %s", name); + int n = snprintf(name, size, "%s/%s_%06d.rst", dir, basename, nodeID); return (n >= size); } @@ -63,7 +62,9 @@ int restart_genname(const char *dir, const char *basename, int nodeID, * @param nfiles the number of restart files located. * * @result pointer to an array of strings with all the filenames found, - * release by calling restart_locate_free(). + * these should be collated using the current locale, i.e. sorted + * alphabetically (so make sure the filenames are zero padded to get + * numeric ordering). Release by calling restart_locate_free(). */ char **restart_locate(const char *dir, const char *basename, int *nfiles) { *nfiles = 0; @@ -123,7 +124,7 @@ void restart_write(struct engine *e, const char *filename) { } /** - * @brief Read a restart file to construct an saved engine. + * @brief Read a restart file to construct a saved engine. */ void restart_read(struct engine *e, const char *filename) {