Skip to content

Commit

Permalink
fix indexing bug when creating null collisions grid that do not fit i…
Browse files Browse the repository at this point in the history
…nto the domain a int number of times
  • Loading branch information
MennoVeerman committed Dec 11, 2024
1 parent 8e12095 commit dc2c741
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src_cuda_rt/Raytracer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ namespace
const Float fz = Float(grid_cells.z) / Float(kn_grid.z);

const int x0 = grid_x*fx;
const int x1 = floor((grid_x+1)*fx);
const int x1 = min(grid_cells.x-1, int(floor((grid_x+1)*fx)));
const int y0 = grid_y*fy;
const int y1 = floor((grid_y+1)*fy);
const int y1 = min(grid_cells.y-1, int(floor((grid_y+1)*fy)));
const int z0 = grid_z*fz;
const int z1 = floor((grid_z+1)*fz);
const int z1 = min(grid_cells.z-1, int(floor((grid_z+1)*fz)));

const int ijk_grid = grid_x + grid_y*kn_grid.x + grid_z*kn_grid.y*kn_grid.x;
Float k_null = k_ext_null_min;

for (int k=z0; k<z1; ++k)
for (int j=y0; j<y1; ++j)
for (int i=x0; i<x1; ++i)
for (int k=z0; k<=z1; ++k)
for (int j=y0; j<=y1; ++j)
for (int i=x0; i<=x1; ++i)
{
const int ijk_in = i + j*grid_cells.x + k*grid_cells.x*grid_cells.y;
k_null = max(k_null, k_ext[ijk_in]);
Expand Down

0 comments on commit dc2c741

Please sign in to comment.