Skip to content
Snippets Groups Projects
Commit a827dcb0 authored by Mladen Ivkovic's avatar Mladen Ivkovic
Browse files

added check for valid boxsize

parent 1639a1d4
No related branches found
No related tags found
1 merge request!1260added check for valid boxsize
...@@ -1071,6 +1071,17 @@ void space_init(struct space *s, struct swift_params *params, ...@@ -1071,6 +1071,17 @@ void space_init(struct space *s, struct swift_params *params,
s->sum_bpart_vel_norm = 0.f; s->sum_bpart_vel_norm = 0.f;
s->nr_queues = 1; /* Temporary value until engine construction */ s->nr_queues = 1; /* Temporary value until engine construction */
/* do a quick check that the box size has valid values */
#if defined HYDRO_DIMENSION_1D
if (dim[0] <= 0.) error("Invalid box size: [%f]", dim[0]);
#elif defined HYDRO_DIMENSION_2D
if (dim[0] <= 0. || dim[1] <= 0.)
error("Invalid box size: [%f, %f]", dim[0], dim[1]);
#else
if (dim[0] <= 0. || dim[1] <= 0. || dim[2] <= 0.)
error("Invalid box size: [%f, %f, %f]", dim[0], dim[1], dim[2]);
#endif
/* Initiate some basic randomness */ /* Initiate some basic randomness */
srand(42); srand(42);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment