Commit 8ba12d1f authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Properly protect the periodic gravity code against the absence of the FFTW library.

parent e95331dd
...@@ -1991,6 +1991,7 @@ INCLUDE_FILE_PATTERNS = ...@@ -1991,6 +1991,7 @@ INCLUDE_FILE_PATTERNS =
PREDEFINED = "__attribute__(x)= " PREDEFINED = "__attribute__(x)= "
PREDEFINED += HAVE_HDF5 PREDEFINED += HAVE_HDF5
PREDEFINED += HAVE_FFTW
PREDEFINED += WITH_MPI PREDEFINED += WITH_MPI
PREDEFINED += WITH_VECTORIZATION PREDEFINED += WITH_VECTORIZATION
PREDEFINED += __GNUC__ PREDEFINED += __GNUC__
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include "runner.h" #include "runner.h"
#include "space.h" #include "space.h"
#ifdef HAVE_FFTW
/** /**
* @brief Returns 1D index of a 3D NxNxN array using row-major style. * @brief Returns 1D index of a 3D NxNxN array using row-major style.
* *
...@@ -264,6 +266,8 @@ void mesh_to_gparts_CIC(struct gpart* gp, const double* pot, int N, double fac, ...@@ -264,6 +266,8 @@ void mesh_to_gparts_CIC(struct gpart* gp, const double* pot, int N, double fac,
#endif #endif
} }
#endif
/** /**
* @brief Compute the potential, including periodic correction on the mesh. * @brief Compute the potential, including periodic correction on the mesh.
* *
...@@ -532,7 +536,7 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) { ...@@ -532,7 +536,7 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) {
restart_read_blocks((void*)mesh, sizeof(struct pm_mesh), 1, stream, NULL, restart_read_blocks((void*)mesh, sizeof(struct pm_mesh), 1, stream, NULL,
"gravity props"); "gravity props");
#ifdef HAVE_FFTW
const int N = mesh->N; const int N = mesh->N;
/* Allocate the memory for the combined density and potential array */ /* Allocate the memory for the combined density and potential array */
...@@ -540,7 +544,6 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) { ...@@ -540,7 +544,6 @@ void pm_mesh_struct_restore(struct pm_mesh* mesh, FILE* stream) {
if (mesh->potential == NULL) if (mesh->potential == NULL)
error("Error allocating memory for the long-range gravity mesh."); error("Error allocating memory for the long-range gravity mesh.");
#ifdef HAVE_FFTW
#else #else
error("No FFTW library found. Cannot compute periodic long-range forces."); error("No FFTW library found. Cannot compute periodic long-range forces.");
#endif #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