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

Corrected a bug in test_bh.c that erased the multipole interactions when...

Corrected a bug in test_bh.c that erased the multipole interactions when running through iact_pair().
parent 983c8b8a
No related branches found
No related tags found
No related merge requests found
...@@ -400,7 +400,7 @@ static inline void make_interact_pc(struct part_local *parts, int count, ...@@ -400,7 +400,7 @@ static inline void make_interact_pc(struct part_local *parts, int count,
#ifdef SANITY_CHECKS #ifdef SANITY_CHECKS
/* Sanity checks */ /* Sanity checks */
if (leaf->count == 0) error("Empty cell!"); if (count == 0) error("Empty cell!");
/* Sanity check. */ /* Sanity check. */
if (cj->new.mass == 0.0) { if (cj->new.mass == 0.0) {
...@@ -791,7 +791,7 @@ static inline void iact_pair_direct(struct cell *ci, struct cell *cj) { ...@@ -791,7 +791,7 @@ static inline void iact_pair_direct(struct cell *ci, struct cell *cj) {
/* Copy the local particle data back. */ /* Copy the local particle data back. */
for (k = 0; k < count_j; k++) { for (k = 0; k < count_j; k++) {
for (j = 0; j < 3; j++) cj->parts[k].a[j] = parts_j[k].a[j]; for (j = 0; j < 3; j++) cj->parts[k].a[j] += parts_j[k].a[j];
} }
} }
......
...@@ -43,19 +43,19 @@ ...@@ -43,19 +43,19 @@
#define dist_min 0.5 /* Used for legacy walk only */ #define dist_min 0.5 /* Used for legacy walk only */
#define dist_cutoff_ratio 1.5 #define dist_cutoff_ratio 1.5
#define ICHECK -1 #define ICHECK -10000000
#define NO_SANITY_CHECKS #define SANITY_CHECKS
#define NO_COM_AS_TASK #define NO_COM_AS_TASK
#define NO_COUNTERS #define COUNTERS
/** Data structure for the particles. */ /** Data structure for the particles. */
struct part { struct part {
double x[3]; double x[3];
union { // union {
float a[3]; float a[3];
float a_legacy[3]; float a_legacy[3];
float a_exact[3]; float a_exact[3];
}; // };
float mass; float mass;
int id; int id;
}; // __attribute__((aligned(32))); }; // __attribute__((aligned(32)));
...@@ -400,7 +400,7 @@ static inline void make_interact_pc(struct part_local *parts, int count, ...@@ -400,7 +400,7 @@ static inline void make_interact_pc(struct part_local *parts, int count,
#ifdef SANITY_CHECKS #ifdef SANITY_CHECKS
/* Sanity checks */ /* Sanity checks */
if (leaf->count == 0) error("Empty cell!"); if (count == 0) error("Empty cell!");
/* Sanity check. */ /* Sanity check. */
if (cj->new.mass == 0.0) { if (cj->new.mass == 0.0) {
...@@ -791,7 +791,7 @@ static inline void iact_pair_direct(struct cell *ci, struct cell *cj) { ...@@ -791,7 +791,7 @@ static inline void iact_pair_direct(struct cell *ci, struct cell *cj) {
/* Copy the local particle data back. */ /* Copy the local particle data back. */
for (k = 0; k < count_j; k++) { for (k = 0; k < count_j; k++) {
for (j = 0; j < 3; j++) cj->parts[k].a[j] = parts_j[k].a[j]; for (j = 0; j < 3; j++) cj->parts[k].a[j] += parts_j[k].a[j];
} }
} }
...@@ -1472,7 +1472,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) { ...@@ -1472,7 +1472,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
} }
message("Average number of parts per leaf is %f.", ((double)N) / nr_leaves); message("Average number of parts per leaf is %f.", ((double)N) / nr_leaves);
#if ICHECK > 0 #if 1//ICHECK > 0
printf("----------------------------------------------------------\n"); printf("----------------------------------------------------------\n");
/* Do a N^2 interactions calculation */ /* Do a N^2 interactions calculation */
...@@ -1507,7 +1507,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) { ...@@ -1507,7 +1507,7 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
// FILE *fileTime = fopen(buffer, "w"); // FILE *fileTime = fopen(buffer, "w");
/* Loop over the number of runs. */ /* Loop over the number of runs. */
for (k = 0; k < 0 /* runs */; k++) { for (k = 0; k < 1 /* runs */; k++) {
countMultipoles = 0; countMultipoles = 0;
countPairs = 0; countPairs = 0;
...@@ -1528,11 +1528,11 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) { ...@@ -1528,11 +1528,11 @@ void test_bh(int N, int nr_threads, int runs, char *fileName) {
// fclose(fileTime); // fclose(fileTime);
#if ICHECK >= 0 /* #if ICHECK >= 0 */
message("[check] accel of part %i is [%.3e,%.3e,%.3e]", ICHECK, /* message("[check] accel of part %i is [%.3e,%.3e,%.3e]", ICHECK, */
root->parts[ICHECK].a_legacy[0], root->parts[ICHECK].a_legacy[1], /* root->parts[ICHECK].a_legacy[0], root->parts[ICHECK].a_legacy[1], */
root->parts[ICHECK].a_legacy[2]); /* root->parts[ICHECK].a_legacy[2]); */
#endif /* #endif */
printf("task counts: [ %8s %8s %8s %8s %8s ]\n", "self", "pair", "m-poles", printf("task counts: [ %8s %8s %8s %8s %8s ]\n", "self", "pair", "m-poles",
"direct", "CoMs"); "direct", "CoMs");
printf("task counts: [ %8i %8i %8i %8i %8i ] (legacy).\n", 0, 0, printf("task counts: [ %8i %8i %8i %8i %8i ] (legacy).\n", 0, 0,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment