Commit 99103105 authored by Matthieu Schaller's avatar Matthieu Schaller

Added missing #ifdef related to the FFTW library in the mesh_gravity.c file.

parent 967f5dc7
......@@ -682,6 +682,7 @@ void pm_mesh_interpolate_forces(const struct pm_mesh* mesh,
*/
void pm_mesh_allocate(struct pm_mesh* mesh) {
#ifdef HAVE_FFTW
if (mesh->potential != NULL) error("Mesh already allocated!");
const int N = mesh->N;
......@@ -692,6 +693,9 @@ void pm_mesh_allocate(struct pm_mesh* mesh) {
error("Error allocating memory for the long-range gravity mesh.");
memuse_log_allocation("fftw_mesh.potential", mesh->potential, 1,
sizeof(double) * N * N * N);
#else
error("No FFTW library found. Cannot compute periodic long-range forces.");
#endif
}
/**
......@@ -701,11 +705,16 @@ void pm_mesh_allocate(struct pm_mesh* mesh) {
*/
void pm_mesh_free(struct pm_mesh* mesh) {
#ifdef HAVE_FFTW
if (mesh->potential) {
memuse_log_allocation("fftw_mesh.potential", mesh->potential, 0, 0);
free(mesh->potential);
}
mesh->potential = NULL;
#else
error("No FFTW library found. Cannot compute periodic long-range forces.");
#endif
}
/**
......
Markdown is supported
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