diff --git a/tests/test125cells.c b/tests/test125cells.c index d2bdf0d5206db7a01ac4c30e543183d1a9060609..f3d02a68b4ae1e89ebd88ddd988b9be96c8c36ac 100644 --- a/tests/test125cells.c +++ b/tests/test125cells.c @@ -197,12 +197,11 @@ void reset_particles(struct cell *c, enum velocity_field vel, set_energy_state(p, press, size, density); #if defined(GIZMO_SPH) - p->geometry.volume = p->mass / density; + p->geometry.volume = p->conserved.mass / density; p->primitives.rho = density; p->primitives.v[0] = p->v[0]; p->primitives.v[1] = p->v[1]; p->primitives.v[2] = p->v[2]; - p->conserved.mass = p->mass; p->conserved.momentum[0] = p->conserved.mass * p->v[0]; p->conserved.momentum[1] = p->conserved.mass * p->v[1]; p->conserved.momentum[2] = p->conserved.mass * p->v[2]; @@ -258,7 +257,12 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h, part->x[1] = offset[1] + size * (y + 0.5) / (float)n; part->x[2] = offset[2] + size * (z + 0.5) / (float)n; part->h = size * h / (float)n; + +#ifdef GIZMO_SPH + part->conserved.mass = density * volume / count; +#else part->mass = density * volume / count; +#endif set_velocity(part, vel, size); set_energy_state(part, press, size, density); @@ -270,12 +274,11 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h, hydro_first_init_part(part, xpart); #if defined(GIZMO_SPH) - part->geometry.volume = part->mass / density; + part->geometry.volume = part->conserved.mass / density; part->primitives.rho = density; part->primitives.v[0] = part->v[0]; part->primitives.v[1] = part->v[1]; part->primitives.v[2] = part->v[2]; - part->conserved.mass = part->mass; part->conserved.momentum[0] = part->conserved.mass * part->v[0]; part->conserved.momentum[1] = part->conserved.mass * part->v[1]; part->conserved.momentum[2] = part->conserved.mass * part->v[2]; @@ -352,7 +355,7 @@ 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].h, - main_cell->parts[pid].rho, + hydro_get_density(&main_cell->parts[pid]), #ifdef MINIMAL_SPH 0.f, #else diff --git a/tests/test27cells.c b/tests/test27cells.c index 3df058011092661502f32886632e63cf8f61c7a1..739d31623168b0933dd9aaa7d6ed44e34a9ace07 100644 --- a/tests/test27cells.c +++ b/tests/test27cells.c @@ -104,7 +104,11 @@ struct cell *make_cell(size_t n, double *offset, double size, double h, } part->h = size * h / (float)n; part->id = ++(*partId); +#ifdef GIZMO_SPH + part->conserved.mass = density * volume / count; +#else part->mass = density * volume / count; +#endif part->ti_begin = 0; part->ti_end = 1; ++part; @@ -184,7 +188,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, main_cell->parts[pid].id, main_cell->parts[pid].x[0], 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].v[2], hydro_get_density(&main_cell->parts[pid]), #if defined(GIZMO_SPH) 0.f, #else @@ -226,7 +230,7 @@ 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].v[2], hydro_get_density(&cj->parts[pjd]), #if defined(GIZMO_SPH) 0.f, #else diff --git a/tests/testPair.c b/tests/testPair.c index a1173e41f12ba4fbca0d3baaab0a49d12cbf587b..a77409eeeb763c3ca0fd002783784c4796600e6e 100644 --- a/tests/testPair.c +++ b/tests/testPair.c @@ -63,7 +63,11 @@ struct cell *make_cell(size_t n, double *offset, double size, double h, part->v[2] = random_uniform(-0.05, 0.05); part->h = size * h / (float)n; part->id = ++(*partId); +#ifdef GIZMO_SPH + part->conserved.mass = density * volume / count; +#else part->mass = density * volume / count; +#endif part->ti_begin = 0; part->ti_end = 1; ++part; @@ -131,7 +135,7 @@ 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].v[2], hydro_get_density(&ci->parts[pid]), #if defined(GIZMO_SPH) 0.f, #else @@ -155,7 +159,7 @@ 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].v[2], hydro_get_density(&cj->parts[pjd]), #if defined(GIZMO_SPH) 0.f, #else diff --git a/tests/testReading.c b/tests/testReading.c index 1824ad8992c12bd2a2e8f9b721d89b1fab708501..2ef32a5ef11c7e24a379ce5131df9cbea153fa7c 100644 --- a/tests/testReading.c +++ b/tests/testReading.c @@ -62,7 +62,7 @@ int main() { assert(index < Ngas); /* Check masses */ - float mass = parts[n].mass; + float mass = hydro_get_mass(&parts[n]); float correct_mass = boxSize * boxSize * boxSize * rho / Ngas; assert(mass == correct_mass); diff --git a/tests/testThreadpool.c b/tests/testThreadpool.c index 90ec58e10b16d816b52b785c87e6604ad11f61d8..aa65d533a29afbe4e7e8384fb887281822a31e58 100644 --- a/tests/testThreadpool.c +++ b/tests/testThreadpool.c @@ -77,4 +77,9 @@ int main(int argc, char *argv[]) { fflush(stdout); threadpool_map(&tp, map_function_first, data, N, sizeof(int), 2, NULL); } + + /* Be clean */ + threadpool_clean(&tp); + + return 0; }