From 2ab6071be39e82c3e84f1f4e4584bb7904b7237e Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Tue, 9 Aug 2016 14:52:56 +0100 Subject: [PATCH] Removed explicit references to p->rho_dh in the test27 and testPair unit tests as these might not exist in all hydro schemes. --- src/tools.c | 3 ++- tests/test27cells.c | 16 ++++++++++++---- tests/testPair.c | 20 ++++++++++++++------ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/tools.c b/src/tools.c index 1de30f17c9..b64e178490 100644 --- a/src/tools.c +++ b/src/tools.c @@ -519,7 +519,8 @@ void engine_single_density(double *dim, long long int pid, /* Dump the result. */ hydro_end_density(&p, 0); - message("part %lli (h=%e) has wcount=%e, rho=%e.", p.id, p.h, p.density.wcount, p.rho); + message("part %lli (h=%e) has wcount=%e, rho=%e.", p.id, p.h, + p.density.wcount, p.rho); fflush(stdout); } diff --git a/tests/test27cells.c b/tests/test27cells.c index 8dc8af5dad..3a93d468ef 100644 --- a/tests/test27cells.c +++ b/tests/test27cells.c @@ -147,8 +147,6 @@ void clean_up(struct cell *ci) { */ void zero_particle_fields(struct cell *c) { for (size_t pid = 0; pid < c->count; pid++) { - c->parts[pid].rho = 0.f; - c->parts[pid].rho_dh = 0.f; hydro_init_part(&c->parts[pid]); } } @@ -187,7 +185,12 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, main_cell->parts[pid].x[1], main_cell->parts[pid].x[2], main_cell->parts[pid].v[0], main_cell->parts[pid].v[1], main_cell->parts[pid].v[2], main_cell->parts[pid].rho, - main_cell->parts[pid].rho_dh, main_cell->parts[pid].density.wcount, +#if defined(GIZMO_SPH) + 0.f, +#else + main_cell->parts[pid].rho_dh, +#endif + main_cell->parts[pid].density.wcount, main_cell->parts[pid].density.wcount_dh, #if defined(GADGET2_SPH) main_cell->parts[pid].density.div_v, @@ -223,7 +226,12 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, "%13e %13e %13e\n", cj->parts[pjd].id, cj->parts[pjd].x[0], cj->parts[pjd].x[1], cj->parts[pjd].x[2], cj->parts[pjd].v[0], cj->parts[pjd].v[1], - cj->parts[pjd].v[2], cj->parts[pjd].rho, cj->parts[pjd].rho_dh, + cj->parts[pjd].v[2], cj->parts[pjd].rho, +#if defined(GIZMO_SPH) + 0.f, +#else + main_cell->parts[pjd].rho_dh, +#endif cj->parts[pjd].density.wcount, cj->parts[pjd].density.wcount_dh, #if defined(GADGET2_SPH) cj->parts[pjd].density.div_v, cj->parts[pjd].density.rot_v[0], diff --git a/tests/testPair.c b/tests/testPair.c index 385e9a9e70..8afc225043 100644 --- a/tests/testPair.c +++ b/tests/testPair.c @@ -106,8 +106,6 @@ void clean_up(struct cell *ci) { */ void zero_particle_fields(struct cell *c) { for (size_t pid = 0; pid < c->count; pid++) { - c->parts[pid].rho = 0.f; - c->parts[pid].rho_dh = 0.f; hydro_init_part(&c->parts[pid]); } } @@ -133,9 +131,14 @@ void dump_particle_fields(char *fileName, struct cell *ci, struct cell *cj) { "%13e %13e %13e\n", ci->parts[pid].id, ci->parts[pid].x[0], ci->parts[pid].x[1], ci->parts[pid].x[2], ci->parts[pid].v[0], ci->parts[pid].v[1], - ci->parts[pid].v[2], ci->parts[pid].rho, ci->parts[pid].rho_dh, + ci->parts[pid].v[2], ci->parts[pid].rho, +#if defined(GIZMO_SPH) + 0.f, +#else + cj->parts[pid].rho_dh, +#endif ci->parts[pid].density.wcount, ci->parts[pid].density.wcount_dh, -#ifdef GADGET2_SPH +#if defined(GADGET2_SPH) || defined(DEFAULT_SPH) ci->parts[pid].density.div_v, ci->parts[pid].density.rot_v[0], ci->parts[pid].density.rot_v[1], ci->parts[pid].density.rot_v[2] #else @@ -152,9 +155,14 @@ void dump_particle_fields(char *fileName, struct cell *ci, struct cell *cj) { "%13e %13e %13e\n", cj->parts[pjd].id, cj->parts[pjd].x[0], cj->parts[pjd].x[1], cj->parts[pjd].x[2], cj->parts[pjd].v[0], cj->parts[pjd].v[1], - cj->parts[pjd].v[2], cj->parts[pjd].rho, cj->parts[pjd].rho_dh, + cj->parts[pjd].v[2], cj->parts[pjd].rho, +#if defined(GIZMO_SPH) + 0.f, +#else + cj->parts[pjd].rho_dh, +#endif cj->parts[pjd].density.wcount, cj->parts[pjd].density.wcount_dh, -#ifdef GADGET2_SPH +#if defined(GADGET2_SPH) || defined(DEFAULT_SPH) cj->parts[pjd].density.div_v, cj->parts[pjd].density.rot_v[0], cj->parts[pjd].density.rot_v[1], cj->parts[pjd].density.rot_v[2] #else -- GitLab