Commit 25025541 authored by James Willis's avatar James Willis
Browse files

Pad particle caches with sensible values for the smoothing length to prevent...

Pad particle caches with sensible values for the smoothing length to prevent floating point exceptions.
parent 8293e81e
......@@ -600,13 +600,14 @@ cache_read_two_partial_cells_sorted_force(
const float max_dx = max(ci->dx_max_part, cj->dx_max_part);
const float pos_padded[3] = {-(2. * ci->width[0] + max_dx), -(2. * ci->width[1] + max_dx),
-(2. * ci->width[2] + max_dx)};
const float h_padded = ci->parts[0].h;
for (int i = ci->count - first_pi_align;
i < ci->count - first_pi_align + VEC_SIZE; i++) {
x[i] = pos_padded[0];
y[i] = pos_padded[1];
z[i] = pos_padded[2];
h[i] = FLT_MIN;
h[i] = h_padded;
m[i] = 1.f;
vx[i] = 1.f;
......@@ -663,12 +664,13 @@ cache_read_two_partial_cells_sorted_force(
* interact.*/
const float pos_padded_j[3] = {-(2. * cj->width[0] + max_dx), -(2. * cj->width[1] + max_dx),
-(2. * cj->width[2] + max_dx)};
const float h_padded_j = cj->parts[0].h;
for (int i = last_pj_align + 1; i < last_pj_align + 1 + VEC_SIZE; i++) {
xj[i] = pos_padded_j[0];
yj[i] = pos_padded_j[1];
zj[i] = pos_padded_j[2];
hj[i] = FLT_MIN;
hj[i] = h_padded_j;
mj[i] = 1.f;
vxj[i] = 1.f;
......
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