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

Set the unnecessary dimensions of the box in 1D or 2D to safe values to...

Set the unnecessary dimensions of the box in 1D or 2D to safe values to prevent unnecessary crashes due to lack of cells along this particular axis.
parent fe18b735
Branches
Tags
No related merge requests found
......@@ -445,6 +445,12 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
dim[2] = (boxSize[2] < 0) ? boxSize[0] : boxSize[2];
/* Change box size in the 1D and 2D case */
if (hydro_dimension == 2)
dim[2] = min(dim[0], dim[1]);
else if (hydro_dimension == 1)
dim[2] = dim[1] = dim[0];
/* message("Found %lld particles in a %speriodic box of size [%f %f %f].", */
/* N_total[0], (periodic ? "": "non-"), dim[0], */
/* dim[1], dim[2]); */
......
......@@ -493,10 +493,17 @@ void read_ic_serial(char* fileName, const struct unit_system* internal_units,
N_total[ptype] =
(numParticles[ptype]) + (numParticles_highWord[ptype] << 32);
/* Get the box size if not cubic */
dim[0] = boxSize[0];
dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
dim[2] = (boxSize[2] < 0) ? boxSize[0] : boxSize[2];
/* Change box size in the 1D and 2D case */
if (hydro_dimension == 2)
dim[2] = min(dim[0], dim[1]);
else if (hydro_dimension == 1)
dim[2] = dim[1] = dim[0];
/* message("Found %lld particles in a %speriodic box of size [%f %f %f].",
*/
/* N_total, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
......
......@@ -400,10 +400,17 @@ void read_ic_single(char* fileName, const struct unit_system* internal_units,
N[ptype] = ((long long)numParticles[ptype]) +
((long long)numParticles_highWord[ptype] << 32);
/* Get the box size if not cubic */
dim[0] = boxSize[0];
dim[1] = (boxSize[1] < 0) ? boxSize[0] : boxSize[1];
dim[2] = (boxSize[2] < 0) ? boxSize[0] : boxSize[2];
/* Change box size in the 1D and 2D case */
if (hydro_dimension == 2)
dim[2] = min(dim[0], dim[1]);
else if (hydro_dimension == 1)
dim[2] = dim[1] = dim[0];
/* message("Found %d particles in a %speriodic box of size [%f %f %f].", */
/* *N, (periodic ? "": "non-"), dim[0], dim[1], dim[2]); */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment