diff --git a/src/cell.c b/src/cell.c index f1f29027cd09cec08bfc52d286cbcfd320d96dc6..85f8531c261ed8878bff4e32ba2419616b754372 100644 --- a/src/cell.c +++ b/src/cell.c @@ -1453,7 +1453,7 @@ void cell_activate_drift_gpart(struct cell *c, struct scheduler *s) { if (parent->drift_gpart == NULL) error("Trying to activate un-existing parent->drift_gpart"); #endif - scheduler_activate(s, parent->drift_gpart); + scheduler_activate(s, parent->drift_gpart); break; } } @@ -2706,8 +2706,7 @@ void cell_drift_all_multipoles(struct cell *c, const struct engine *e) { dt_drift = (ti_current - ti_old_multipole) * e->time_base; /* Drift the multipole */ - if (ti_current > ti_old_multipole) - gravity_drift(c->multipole, dt_drift); + if (ti_current > ti_old_multipole) gravity_drift(c->multipole, dt_drift); /* Are we not in a leaf ? */ if (c->split) { @@ -2748,8 +2747,7 @@ void cell_drift_multipole(struct cell *c, const struct engine *e) { else dt_drift = (ti_current - ti_old_multipole) * e->time_base; - if (ti_current > ti_old_multipole) - gravity_drift(c->multipole, dt_drift); + if (ti_current > ti_old_multipole) gravity_drift(c->multipole, dt_drift); /* Update the time of the last drift */ c->ti_old_multipole = ti_current; diff --git a/src/engine.c b/src/engine.c index 5f010b5b406dbbc26040fb420b264c70b2083a9b..01739a5a74ad9df0459c363f53cd3e261e5e802a 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2378,8 +2378,8 @@ void engine_make_self_gravity_tasks_mapper(void *map_data, int num_elements, int delta_p = delta; /* Special case where every cell is in range of every other one */ - if(delta >= cdim[0] / 2) { - if(cdim[0] % 2 == 0) { + if (delta >= cdim[0] / 2) { + if (cdim[0] % 2 == 0) { delta_m = cdim[0] / 2; delta_p = cdim[0] / 2 - 1; } else { @@ -6029,7 +6029,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, if (!(e->policy & engine_policy_cosmology)) if (e->dt_max > (e->time_end - e->time_begin) && e->nodeID == 0) error("Maximal time-step size larger than the simulation run time t=%e", - e->time_end - e->time_begin); + e->time_end - e->time_begin); /* Deal with outputs */ if (e->policy & engine_policy_cosmology) { @@ -6082,7 +6082,8 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, /* Reduce the total mass */ #ifdef WITH_MPI - MPI_Allreduce(MPI_IN_PLACE, &e->total_mass, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); + MPI_Allreduce(MPI_IN_PLACE, &e->total_mass, 1, MPI_DOUBLE, MPI_SUM, + MPI_COMM_WORLD); #endif /* Find the time of the first snapshot output */ diff --git a/src/gravity/Potential/gravity.h b/src/gravity/Potential/gravity.h index 494b80f76fc8c21ded2aa3fc0e5229f207174bc7..3a6c0fba18856b57911d49bcee6915f5003e2e68 100644 --- a/src/gravity/Potential/gravity.h +++ b/src/gravity/Potential/gravity.h @@ -169,8 +169,7 @@ __attribute__((always_inline)) INLINE static void gravity_end_force( const int periodic) { /* Apply the periodic correction to the peculiar potential */ - if(periodic) - gp->potential += potential_normalisation; + if (periodic) gp->potential += potential_normalisation; /* Let's get physical... */ gp->a_grav[0] *= const_G; diff --git a/src/gravity/Potential/gravity_debug.h b/src/gravity/Potential/gravity_debug.h index d0a6c6ec30a1d0f2c329fa194f10db34aed74f1d..621f3ccb9c4621f44f902c37a2e03bd7575defe7 100644 --- a/src/gravity/Potential/gravity_debug.h +++ b/src/gravity/Potential/gravity_debug.h @@ -23,9 +23,11 @@ __attribute__((always_inline)) INLINE static void gravity_debug_particle( const struct gpart* p) { printf( "mass=%.3e time_bin=%d\n" - "x=[%.5e,%.5e,%.5e], v_full=[%.5e,%.5e,%.5e], a=[%.5e,%.5e,%.5e] pot=%.5e\n", + "x=[%.5e,%.5e,%.5e], v_full=[%.5e,%.5e,%.5e], a=[%.5e,%.5e,%.5e] " + "pot=%.5e\n", p->mass, p->time_bin, p->x[0], p->x[1], p->x[2], p->v_full[0], - p->v_full[1], p->v_full[2], p->a_grav[0], p->a_grav[1], p->a_grav[2], p->potential); + p->v_full[1], p->v_full[2], p->a_grav[0], p->a_grav[1], p->a_grav[2], + p->potential); #ifdef SWIFT_DEBUG_CHECKS printf("num_interacted=%lld ti_drift=%lld ti_kick=%lld\n", p->num_interacted, p->ti_drift, p->ti_kick); diff --git a/src/gravity_iact.h b/src/gravity_iact.h index 2bd2272128ad430a65ab723847481f5684a30a71..2aaf7219d0851058cba92d4686ed989572dbcaa4 100644 --- a/src/gravity_iact.h +++ b/src/gravity_iact.h @@ -36,5 +36,4 @@ #error "Invalid choice of gravity variant" #endif - #endif diff --git a/src/mesh_gravity.c b/src/mesh_gravity.c index 84a694a915e2f75e531a4a466b96b4dacaf1eca4..2359b8a9cdf785bce719a1d0379d177d00328b9e 100644 --- a/src/mesh_gravity.c +++ b/src/mesh_gravity.c @@ -282,7 +282,7 @@ void mesh_to_gparts_CIC(struct gpart* gp, const double* pot, int N, double fac, * @param verbose Are we talkative? */ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct space* s, - int verbose) { + int verbose) { #ifdef HAVE_FFTW @@ -323,9 +323,9 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct space* s, for (size_t i = 0; i < s->nr_gparts; ++i) gpart_to_mesh_CIC(&s->gparts[i], rho, N, cell_fac, dim); - if(verbose) - message("gpart assignment took %.3f %s.", clocks_from_ticks(getticks() - tic), - clocks_getunit()); + if (verbose) + message("gpart assignment took %.3f %s.", + clocks_from_ticks(getticks() - tic), clocks_getunit()); /* message("\n\n\n DENSITY"); */ /* print_array(rho, N); */ @@ -407,9 +407,9 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct space* s, /* Let's store it in the structure */ mesh->potential = rho; - if(verbose) - message("Fourier-space PM took %.3f %s.", clocks_from_ticks(getticks() - tic2), - clocks_getunit()); + if (verbose) + message("Fourier-space PM took %.3f %s.", + clocks_from_ticks(getticks() - tic2), clocks_getunit()); /* message("\n\n\n POTENTIAL"); */ /* print_array(potential, N); */ diff --git a/src/mesh_gravity.h b/src/mesh_gravity.h index 86707a4b94fbc7040e1ff7379620aa71a4f40fc4..c512a53ca349816caf4c666c6f504dd4b717bcb7 100644 --- a/src/mesh_gravity.h +++ b/src/mesh_gravity.h @@ -67,7 +67,7 @@ void pm_mesh_init(struct pm_mesh *mesh, const struct gravity_props *props, double dim[3]); void pm_mesh_init_no_mesh(struct pm_mesh *mesh, double dim[3]); void pm_mesh_compute_potential(struct pm_mesh *mesh, const struct space *s, - int verbose); + int verbose); void pm_mesh_interpolate_forces(const struct pm_mesh *mesh, const struct engine *e, struct gpart *gparts, int gcount); diff --git a/src/multipole.h b/src/multipole.h index 080cf669a11b9959ee83a392e024f7f88bfeba3d..e0e6da32a2950d7fce164b2abc422302b7c7de5e 100644 --- a/src/multipole.h +++ b/src/multipole.h @@ -240,30 +240,31 @@ INLINE static void gravity_drift(struct gravity_tensors *m, double dt) { m->CoM[2] += dz; #ifdef SWIFT_DEBUG_CHECKS - if(m->m_pole.vel[0] > m->m_pole.max_delta_vel[0]) + if (m->m_pole.vel[0] > m->m_pole.max_delta_vel[0]) error("Invalid maximal velocity"); - if(m->m_pole.vel[0] < m->m_pole.min_delta_vel[0]) + if (m->m_pole.vel[0] < m->m_pole.min_delta_vel[0]) error("Invalid minimal velocity"); - if(m->m_pole.vel[1] > m->m_pole.max_delta_vel[1]) + if (m->m_pole.vel[1] > m->m_pole.max_delta_vel[1]) error("Invalid maximal velocity"); - if(m->m_pole.vel[1] < m->m_pole.min_delta_vel[1]) + if (m->m_pole.vel[1] < m->m_pole.min_delta_vel[1]) error("Invalid minimal velocity"); - if(m->m_pole.vel[2] > m->m_pole.max_delta_vel[2]) + if (m->m_pole.vel[2] > m->m_pole.max_delta_vel[2]) error("Invalid maximal velocity"); - if(m->m_pole.vel[2] < m->m_pole.min_delta_vel[2]) + if (m->m_pole.vel[2] < m->m_pole.min_delta_vel[2]) error("Invalid minimal velocity"); #endif /* Maximal distance covered by any particle */ float dv[3]; dv[0] = max(m->m_pole.max_delta_vel[0] - m->m_pole.vel[0], - m->m_pole.vel[0] - m->m_pole.min_delta_vel[0]); + m->m_pole.vel[0] - m->m_pole.min_delta_vel[0]); dv[1] = max(m->m_pole.max_delta_vel[1] - m->m_pole.vel[1], - m->m_pole.vel[1] - m->m_pole.min_delta_vel[1]); + m->m_pole.vel[1] - m->m_pole.min_delta_vel[1]); dv[2] = max(m->m_pole.max_delta_vel[2] - m->m_pole.vel[2], - m->m_pole.vel[2] - m->m_pole.min_delta_vel[2]); + m->m_pole.vel[2] - m->m_pole.min_delta_vel[2]); - const float max_delta_vel = sqrt(dv[0] * dv[0] + dv[1] * dv[1] + dv[2] * dv[2]); + const float max_delta_vel = + sqrt(dv[0] * dv[0] + dv[1] * dv[1] + dv[2] * dv[2]); const float x_diff = max_delta_vel * dt; /* Conservative change in maximal radius containing all gpart */ diff --git a/src/runner.c b/src/runner.c index d4dea7a61b63a0b95ad1fe3c96526066a8f9d773..c444fe9e1796f8a03fc44e2be155a6dcb364e63d 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1666,7 +1666,8 @@ void runner_do_end_force(struct runner *r, struct cell *c, int timer) { const float G_newton = e->physical_constants->const_newton_G; const double r_s = e->mesh->r_s; const double volume = s->dim[0] * s->dim[1] * s->dim[2]; - const float potential_normalisation = 4. * M_PI * e->total_mass * r_s * r_s / volume; + const float potential_normalisation = + 4. * M_PI * e->total_mass * r_s * r_s / volume; TIMER_TIC; diff --git a/src/runner_doiact_grav.h b/src/runner_doiact_grav.h index 654640ef8b99e51f206af9f50ed9aa89cd1e0bd2..b1a1e58d282ea291367a35e3cfcb3ddc8c5521d4 100644 --- a/src/runner_doiact_grav.h +++ b/src/runner_doiact_grav.h @@ -24,8 +24,8 @@ #include "active.h" #include "cell.h" #include "gravity.h" -#include "gravity_iact.h" #include "gravity_cache.h" +#include "gravity_iact.h" #include "inline.h" #include "part.h" #include "space_getsid.h" diff --git a/src/space.c b/src/space.c index fa4dbba7082d3a3be603522a44b7fcc22523cd0e..f2a6dd1f526e04d25623f641d8f02cd017e482f4 100644 --- a/src/space.c +++ b/src/space.c @@ -1903,17 +1903,17 @@ void space_split_recursive(struct space *s, struct cell *c, CoM[1] += m->CoM[1] * m->m_pole.M_000; CoM[2] += m->CoM[2] * m->m_pole.M_000; - vel[0] += m->m_pole.vel[0] * m->m_pole.M_000; - vel[1] += m->m_pole.vel[1] * m->m_pole.M_000; - vel[2] += m->m_pole.vel[2] * m->m_pole.M_000; + vel[0] += m->m_pole.vel[0] * m->m_pole.M_000; + vel[1] += m->m_pole.vel[1] * m->m_pole.M_000; + vel[2] += m->m_pole.vel[2] * m->m_pole.M_000; - max_delta_vel[0] = max(m->m_pole.max_delta_vel[0], max_delta_vel[0]); - max_delta_vel[1] = max(m->m_pole.max_delta_vel[1], max_delta_vel[1]); - max_delta_vel[2] = max(m->m_pole.max_delta_vel[2], max_delta_vel[2]); + max_delta_vel[0] = max(m->m_pole.max_delta_vel[0], max_delta_vel[0]); + max_delta_vel[1] = max(m->m_pole.max_delta_vel[1], max_delta_vel[1]); + max_delta_vel[2] = max(m->m_pole.max_delta_vel[2], max_delta_vel[2]); - min_delta_vel[0] = min(m->m_pole.min_delta_vel[0], min_delta_vel[0]); - min_delta_vel[1] = min(m->m_pole.min_delta_vel[1], min_delta_vel[1]); - min_delta_vel[2] = min(m->m_pole.min_delta_vel[2], min_delta_vel[2]); + min_delta_vel[0] = min(m->m_pole.min_delta_vel[0], min_delta_vel[0]); + min_delta_vel[1] = min(m->m_pole.min_delta_vel[1], min_delta_vel[1]); + min_delta_vel[2] = min(m->m_pole.min_delta_vel[2], min_delta_vel[2]); } }