Skip to content

Commit

Permalink
cleanup a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
unicoooorn committed Jan 8, 2025
1 parent 184b2d8 commit 69938ac
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
5 changes: 0 additions & 5 deletions src/cl/lbvh.cl
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ morton_t zOrder(float fx, float fy, int i){
int x = fx + 0.5;
int y = fy + 0.5;

// у нас нет эксепшенов, но можно писать коды ошибок просто в консоль, и следить чтобы вывод был пустой

if (x < 0 || x >= (1 << NBITS_PER_DIM)) {
printf("098245490432590890\n");
return 0;
Expand All @@ -142,7 +140,6 @@ morton_t zOrder(float fx, float fy, int i){

morton_t morton_code = 2 * spread_bits_x + spread_bits_y;

// augmentation
return (morton_code << 32) | i;
}

Expand Down Expand Up @@ -286,7 +283,6 @@ void initLBVHNode(__global struct Node *nodes, int i_node, __global const morton
}

int i_begin = 0, i_end = N, bit_index = NBITS - 1;
// если рассматриваем не корень, то нужно найти зону ответственности ноды и самый старший бит, с которого надо начинать поиск разреза
if (i_node) {
findRegion(&i_begin, &i_end, &bit_index, codes, N, i_node);
}
Expand Down Expand Up @@ -432,7 +428,6 @@ void calculateForce(float x0, float y0, float m0, __global const struct Node *no
continue;
}

// если запрос содержится и а левом и в правом ребенке - то они в одном пикселе
{
__global const struct Node *left = &nodes[node->child_left];
__global const struct Node *right = &nodes[node->child_right];
Expand Down
29 changes: 0 additions & 29 deletions src/cl/nbody.cl
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,11 @@ __kernel void nbody_calculate_force_global(
float y0 = pys[i];
float m0 = mxs[i];

// dvx[i] = 0;
// dvy[i] = 0;

for (int j = 0; j < N; j++) {
if (i == j) {
continue;
}

/*
M1 - cur
M2 - other
F1 = M1 * M2 / ||p1 - p2||^2
F1 = M * A = M1 * dV / dT
dV = F1 * dT / M1 = M1 * M2 * dT / (M1 * ||p1 - p2||^2)
dV = M2 * dT / ||p1 - p2||^2
f1x = (x1 - x0) / fabs(y1-y0) * f1
f1y = (y1 - y0) / fabs(x1-x0) * f1
r2 = ||p1 - p2||^2
dVy = (x1 - x0) / fabs(y1-y0) * M2 * dT / r2
dVy = (y1 - y0) / fabs(x1-x0) * M2 * dT / r2
(dx1^2 + dx2^2) / (dx1^2 + dx2^2) = 1
dx1^2 = (dx1^2 + dx2^2) - dx2^2
*/

float x1 = pxs[j];
float y1 = pys[j];
float m1 = mxs[j];
Expand Down

0 comments on commit 69938ac

Please sign in to comment.