Skip to content
Snippets Groups Projects
Commit a71b2058 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

minor fixes.

parent 4c283d4f
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
/* Some local constants. */ /* Some local constants. */
#define cell_pool_grow 1000 #define cell_pool_grow 1000
#define cell_maxparts 1 #define cell_maxparts 100
#define task_limit 1e8 #define task_limit 1e8
#define const_G 1 // 6.6738e-8 #define const_G 1 // 6.6738e-8
#define dist_min 0.5 /* Used for legacy walk only */ #define dist_min 0.5 /* Used for legacy walk only */
...@@ -386,9 +386,10 @@ void cell_split(struct cell *c, struct qsched *s) { ...@@ -386,9 +386,10 @@ void cell_split(struct cell *c, struct qsched *s) {
*/ */
static inline void make_interact_pc(struct cell *leaf, struct cell *cj) { static inline void make_interact_pc(struct cell *leaf, struct cell *cj) {
int j, k; int j, k, count = leaf->count;
double com[3] = {0.0, 0.0, 0.0}; double com[3] = {0.0, 0.0, 0.0};
float mcom, dx[3] = {0.0, 0.0, 0.0}, r2, ir, w; float mcom, dx[3] = {0.0, 0.0, 0.0}, r2, ir, w;
struct part *parts = leaf->parts;
#ifdef SANITY_CHECKS #ifdef SANITY_CHECKS
...@@ -413,18 +414,18 @@ static inline void make_interact_pc(struct cell *leaf, struct cell *cj) { ...@@ -413,18 +414,18 @@ static inline void make_interact_pc(struct cell *leaf, struct cell *cj) {
mcom = cj->new.mass; mcom = cj->new.mass;
/* Loop over every particle in leaf. */ /* Loop over every particle in leaf. */
for (j = 0; j < leaf->count; j++) { for (j = 0; j < count; j++) {
/* Compute the pairwise distance. */ /* Compute the pairwise distance. */
for (r2 = 0.0, k = 0; k < 3; k++) { for (r2 = 0.0, k = 0; k < 3; k++) {
dx[k] = com[k] - leaf->parts[j].x[k]; dx[k] = com[k] - parts[j].x[k];
r2 += dx[k] * dx[k]; r2 += dx[k] * dx[k];
} }
/* Apply the gravitational acceleration. */ /* Apply the gravitational acceleration. */
ir = 1.0f / sqrtf(r2); ir = 1.0f / sqrtf(r2);
w = mcom * const_G * ir * ir * ir; w = mcom * const_G * ir * ir * ir;
for (k = 0; k < 3; k++) leaf->parts[j].a[k] += w * dx[k]; for (k = 0; k < 3; k++) parts[j].a[k] += w * dx[k];
#if ICHECK >= 0 #if ICHECK >= 0
if (leaf->parts[j].id == ICHECK) if (leaf->parts[j].id == ICHECK)
...@@ -1211,7 +1212,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) { ...@@ -1211,7 +1212,8 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
for (k = 0; k < task_type_count; k++) task_timers[k] = 0; for (k = 0; k < task_type_count; k++) task_timers[k] = 0;
/* Initialize the scheduler. */ /* Initialize the scheduler. */
qsched_init(&s, nr_threads, qsched_flag_noreown); qsched_init(&s, nr_threads, qsched_flag_noreown |
qsched_flag_pthread);
/* Init and fill the particle array. */ /* Init and fill the particle array. */
if ((parts = (struct part *)malloc(sizeof(struct part) * N)) == NULL) if ((parts = (struct part *)malloc(sizeof(struct part) * N)) == NULL)
...@@ -1349,16 +1351,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) { ...@@ -1349,16 +1351,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
parts[i].a[1] = 0.0; parts[i].a[1] = 0.0;
parts[i].a[2] = 0.0; parts[i].a[2] = 0.0;
} }
struct cell *finger = root;
while (finger != NULL) {
finger->sorted = 0;
if (finger->split)
finger = finger->firstchild;
else
finger = finger->sibling;
}
/* Execute the tasks. */ /* Execute the tasks. */
tic = getticks(); tic = getticks();
qsched_run(&s, nr_threads, runner); qsched_run(&s, nr_threads, runner);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment