Commit 399b5a1a authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Only attempt to allocate the gravity mesh on restart if we are running with periodic BCs.

parent e8ea7062
......@@ -686,6 +686,9 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) {
restart_read_blocks((void*)mesh, sizeof(struct pm_mesh), 1, stream, NULL,
"gravity props");
if (mesh->periodic) {
#ifdef HAVE_FFTW
const int N = mesh->N;
......@@ -693,8 +696,8 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) {
mesh->potential = (double*)fftw_malloc(sizeof(double) * N * N * N);
if (mesh->potential == NULL)
error("Error allocating memory for the long-range gravity mesh.");
#else
error("No FFTW library found. Cannot compute periodic long-range forces.");
#endif
}
}
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