Skip to content
Snippets Groups Projects
Commit 21836158 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Prevent users from using an FFT mesh with more than 2^31 cells, which would...

Prevent users from using an FFT mesh with more than 2^31 cells, which would cause an integer over-flow in the loops.
parent ea1970d6
No related branches found
No related tags found
No related merge requests found
......@@ -624,6 +624,11 @@ void pm_mesh_init(struct pm_mesh* mesh, const struct gravity_props* props,
mesh->r_cut_max = mesh->r_s * props->r_cut_max_ratio;
mesh->r_cut_min = mesh->r_s * props->r_cut_min_ratio;
if (mesh->N > 1290)
error(
"Mesh too big. The number of cells is larger than 2^31. "
"Use a mesh side-length <= 1290.");
if (2. * mesh->r_cut_max > box_size)
error("Mesh too small or r_cut_max too big for this box size");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment