diff --git a/tests/test27cells.c b/tests/test27cells.c index 88c20294eeb571d9e74101b8594d99cfdcf1b63a..97581527e552b9b6c7a8aa55a9ac8e3317af46fb 100644 --- a/tests/test27cells.c +++ b/tests/test27cells.c @@ -225,9 +225,9 @@ void zero_particle_fields(struct cell *c) { /** * @brief Ends the loop by adding the appropriate coefficients */ -void end_calculation(struct cell *c) { +void end_calculation(struct cell *c, const struct cosmology *cosmo) { for (int pid = 0; pid < c->count; pid++) { - hydro_end_density(&c->parts[pid]); + hydro_end_density(&c->parts[pid], cosmo); /* Recover the common "Neighbour number" definition */ c->parts[pid].density.wcount *= pow_dimension(c->parts[pid].h); @@ -447,6 +447,10 @@ int main(int argc, char *argv[]) { engine.hydro_properties = &hp; engine.nodeID = NODE_ID; + struct cosmology cosmo; + cosmology_init_no_cosmo(&cosmo); + engine.cosmology = &cosmo; + struct runner runner; runner.e = &engine; @@ -536,7 +540,7 @@ int main(int argc, char *argv[]) { time += toc - tic; /* Let's get physical ! */ - end_calculation(main_cell); + end_calculation(main_cell, &cosmo); /* Dump if necessary */ if (i % 50 == 0) { @@ -584,7 +588,7 @@ int main(int argc, char *argv[]) { const ticks toc = getticks(); /* Let's get physical ! */ - end_calculation(main_cell); + end_calculation(main_cell, &cosmo); /* Dump */ sprintf(outputFileName, "brute_force_27_%s.dat", outputFileNameExtension); diff --git a/tests/testActivePair.c b/tests/testActivePair.c index 447f812df63db97d2b4320f898289bd521eaab3f..62d46c5c0a21d49bf1cb8317ad192c9eabf59c4d 100644 --- a/tests/testActivePair.c +++ b/tests/testActivePair.c @@ -179,9 +179,9 @@ void zero_particle_fields(struct cell *c) { /** * @brief Ends the loop by adding the appropriate coefficients */ -void end_calculation(struct cell *c) { +void end_calculation(struct cell *c, const struct cosmology *cosmo) { for (int pid = 0; pid < c->count; pid++) { - hydro_end_density(&c->parts[pid]); + hydro_end_density(&c->parts[pid], cosmo); /* Recover the common "Neighbour number" definition */ c->parts[pid].density.wcount *= pow_dimension(c->parts[pid].h); @@ -246,8 +246,8 @@ void test_pair_interactions(struct runner *runner, struct cell **ci, vec_interaction(runner, *ci, *cj); /* Let's get physical ! */ - end_calculation(*ci); - end_calculation(*cj); + end_calculation(*ci, runner->e->cosmology); + end_calculation(*cj, runner->e->cosmology); /* Dump if necessary */ dump_particle_fields(swiftOutputFileName, *ci, *cj); @@ -262,8 +262,8 @@ void test_pair_interactions(struct runner *runner, struct cell **ci, serial_interaction(runner, *ci, *cj); /* Let's get physical ! */ - end_calculation(*ci); - end_calculation(*cj); + end_calculation(*ci, runner->e->cosmology); + end_calculation(*cj, runner->e->cosmology); dump_particle_fields(bruteForceOutputFileName, *ci, *cj); } @@ -425,6 +425,7 @@ int main(int argc, char *argv[]) { double perturbation = 0.1, h_pert = 1.1; struct space space; struct engine engine; + struct cosmology cosmo; struct runner *runner; char c; static long long partId = 0; @@ -507,6 +508,9 @@ int main(int argc, char *argv[]) { engine.max_active_bin = num_time_bins; engine.nodeID = NODE_ID; + cosmology_init_no_cosmo(&cosmo); + engine.cosmology = &cosmo; + if (posix_memalign((void **)&runner, SWIFT_STRUCT_ALIGNMENT, sizeof(struct runner)) != 0) { error("couldn't allocate runner"); diff --git a/tests/testPeriodicBC.c b/tests/testPeriodicBC.c index 1987f24132ab5a57e688c29e95289811128b2435..0012d77ade89e3d35046f639dc669cae59c138ca 100644 --- a/tests/testPeriodicBC.c +++ b/tests/testPeriodicBC.c @@ -204,9 +204,9 @@ void zero_particle_fields(struct cell *c) { /** * @brief Ends the loop by adding the appropriate coefficients */ -void end_calculation(struct cell *c) { +void end_calculation(struct cell *c, const struct cosmology *cosmo) { for (int pid = 0; pid < c->count; pid++) { - hydro_end_density(&c->parts[pid]); + hydro_end_density(&c->parts[pid], cosmo); } } @@ -332,7 +332,7 @@ void test_boundary_conditions(struct cell **cells, struct runner runner, #endif /* Let's get physical ! */ - end_calculation(main_cell); + end_calculation(main_cell, runner.e->cosmology); /* Dump particles from the main cell. */ dump_particle_fields(swiftOutputFileName, main_cell, loc_i, loc_j, loc_k); @@ -370,7 +370,7 @@ void test_boundary_conditions(struct cell **cells, struct runner runner, #endif /* Let's get physical ! */ - end_calculation(main_cell); + end_calculation(main_cell, runner.e->cosmology); /* Dump */ dump_particle_fields(bruteForceOutputFileName, main_cell, loc_i, loc_j, @@ -493,6 +493,10 @@ int main(int argc, char *argv[]) { struct runner runner; runner.e = &engine; + struct cosmology cosmo; + cosmology_init_no_cosmo(&cosmo); + engine.cosmology = &cosmo; + /* Construct some cells */ struct cell *cells[dim * dim * dim]; static long long partId = 0; diff --git a/tests/testSymmetry.c b/tests/testSymmetry.c index 68a878b05c3fc298ef7d0b159df9997d2ef1f82d..1ba5080cc8c265f59c4ab1a599d19bb9b4803fb0 100644 --- a/tests/testSymmetry.c +++ b/tests/testSymmetry.c @@ -40,6 +40,10 @@ int main(int argc, char *argv[]) { /* voronoi_set_box(box_anchor, box_side);*/ #endif + /* Start with some values for the cosmological paramters */ + const float a = (float)random_uniform(0.8, 1.); + const float H = 0.f; + /* Create two random particles (don't do this at home !) */ struct part pi, pj; for (size_t i = 0; i < sizeof(struct part) / sizeof(float); ++i) { @@ -136,14 +140,14 @@ int main(int argc, char *argv[]) { /* --- Test the density loop --- */ /* Call the symmetric version */ - runner_iact_density(r2, dx, pi.h, pj.h, &pi, &pj); + runner_iact_density(r2, dx, pi.h, pj.h, &pi, &pj, a, H); /* Call the non-symmetric version */ - runner_iact_nonsym_density(r2, dx, pi2.h, pj2.h, &pi2, &pj2); + runner_iact_nonsym_density(r2, dx, pi2.h, pj2.h, &pi2, &pj2, a, H); dx[0] = -dx[0]; dx[1] = -dx[1]; dx[2] = -dx[2]; - runner_iact_nonsym_density(r2, dx, pj2.h, pi2.h, &pj2, &pi2); + runner_iact_nonsym_density(r2, dx, pj2.h, pi2.h, &pj2, &pi2, a, H); /* Check that the particles are the same */ i_ok = memcmp(&pi, &pi2, sizeof(struct part)); @@ -155,14 +159,14 @@ int main(int argc, char *argv[]) { /* --- Test the force loop --- */ /* Call the symmetric version */ - runner_iact_force(r2, dx, pi.h, pj.h, &pi, &pj); + runner_iact_force(r2, dx, pi.h, pj.h, &pi, &pj, a, H); /* Call the non-symmetric version */ - runner_iact_nonsym_force(r2, dx, pi2.h, pj2.h, &pi2, &pj2); + runner_iact_nonsym_force(r2, dx, pi2.h, pj2.h, &pi2, &pj2, a, H); dx[0] = -dx[0]; dx[1] = -dx[1]; dx[2] = -dx[2]; - runner_iact_nonsym_force(r2, dx, pj2.h, pi2.h, &pj2, &pi2); + runner_iact_nonsym_force(r2, dx, pj2.h, pi2.h, &pj2, &pi2, a, H); /* Check that the particles are the same */ #if defined(GIZMO_SPH)