Commit 0b000f61 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent 7fac9be5
......@@ -488,13 +488,13 @@ int main(int argc, char *argv[]) {
/* Temporary early aborts for modes not supported over MPI. */
#ifdef WITH_MPI
if(with_mpole_reconstruction && nr_nodes > 1)
error("Cannot reconstruct m-poles every step over MPI (yet).");
if (with_mpole_reconstruction && nr_nodes > 1)
error("Cannot reconstruct m-poles every step over MPI (yet).");
#endif
#if defined(WITH_MPI) && defined(HAVE_VELOCIRAPTOR)
if (with_structure_finding && nr_nodes > 1)
error("VEOCIraptor not yet enabled over MPI.");
if (with_structure_finding && nr_nodes > 1)
error("VEOCIraptor not yet enabled over MPI.");
#endif
/* Check that we can write the snapshots by testing if the output
......
......@@ -173,7 +173,7 @@ int cell_link_sparts(struct cell *c, struct spart *sparts) {
* @return The number of packed cells.
*/
int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
const int with_gravity) {
const int with_gravity) {
#ifdef WITH_MPI
......@@ -191,7 +191,7 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
pc->scount = c->scount;
/* Copy the Multipole related information */
if(with_gravity) {
if (with_gravity) {
const struct gravity_tensors *mp = c->multipole;
pc->m_pole = mp->m_pole;
......@@ -205,7 +205,6 @@ int cell_pack(struct cell *restrict c, struct pcell *restrict pc,
pc->r_max_rebuild = mp->r_max_rebuild;
}
#ifdef SWIFT_DEBUG_CHECKS
pc->cellID = c->cellID;
#endif
......@@ -297,7 +296,7 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
#endif
/* Copy the Multipole related information */
if(with_gravity) {
if (with_gravity) {
struct gravity_tensors *mp = c->multipole;
......@@ -311,7 +310,7 @@ int cell_unpack(struct pcell *restrict pc, struct cell *restrict c,
mp->r_max = pc->r_max;
mp->r_max_rebuild = pc->r_max_rebuild;
}
/* Number of new cells created. */
int count = 1;
......
......@@ -79,7 +79,7 @@ struct pcell {
/*! This cell's gravity-related tensors */
struct multipole m_pole;
/*! Centre of mass. */
double CoM[3];
......@@ -501,7 +501,8 @@ void cell_munlocktree(struct cell *c);
int cell_slocktree(struct cell *c);
void cell_sunlocktree(struct cell *c);
int cell_pack(struct cell *c, struct pcell *pc, const int with_gravity);
int cell_unpack(struct pcell *pc, struct cell *c, struct space *s, const int with_gravity);
int cell_unpack(struct pcell *pc, struct cell *c, struct space *s,
const int with_gravity);
int cell_pack_tags(const struct cell *c, int *tags);
int cell_unpack_tags(const int *tags, struct cell *c);
int cell_pack_end_step(struct cell *c, struct pcell_step *pcell);
......
......@@ -5292,7 +5292,8 @@ void engine_makeproxies(struct engine *e) {
const int cdim[3] = {s->cdim[0], s->cdim[1], s->cdim[2]};
const double dim[3] = {s->dim[0], s->dim[1], s->dim[2]};
const int periodic = s->periodic;
const double cell_width[3] = {cells[0].width[0], cells[0].width[1], cells[0].width[2]};
const double cell_width[3] = {cells[0].width[0], cells[0].width[1],
cells[0].width[2]};
/* Get some info about the physics */
const int with_hydro = (e->policy & engine_policy_hydro);
......@@ -5356,10 +5357,9 @@ void engine_makeproxies(struct engine *e) {
/* Get the cell ID. */
const int cid = cell_getid(cdim, ind[0], ind[1], ind[2]);
/* and it's location */
const double loc_i[3] = {cells[cid].loc[0],
cells[cid].loc[1],
cells[cid].loc[2]};
/* and it's location */
const double loc_i[3] = {cells[cid].loc[0], cells[cid].loc[1],
cells[cid].loc[2]};
/* Loop over all its neighbours (periodic). */
for (int i = -delta_m; i <= delta_p; i++) {
......@@ -5400,8 +5400,8 @@ void engine_makeproxies(struct engine *e) {
/* In the hydro case, only care about direct neighbours */
if (with_hydro) {
//MATTHIEU: to do: Write a better expression for the
// non-periodic case.
// MATTHIEU: to do: Write a better expression for the
// non-periodic case.
/* This is super-ugly but checks for direct neighbours */
/* with periodic BC */
......@@ -5420,39 +5420,39 @@ void engine_makeproxies(struct engine *e) {
/* In the gravity case, check distances using the MAC. */
if (with_gravity) {
/* We don't have multipoles yet (or there CoMs) so we will have to
cook up something based on cell locations only. We hence need
an upper limit on the distance that the CoMs in those cells
could have. We then can decide whether we are too close
for an M2L interaction and hence require a proxy as this pair
of cells cannot rely on just an M2L calculation. */
const double loc_j[3] = {cells[cjd].loc[0],
cells[cjd].loc[1],
cells[cjd].loc[2]};
/* Start with the distance between the cell centres. */
double dx = loc_i[0] - loc_j[0];
double dy = loc_i[1] - loc_j[1];
double dz = loc_i[2] - loc_j[2];
/* Apply BC */
if (periodic) {
dx = nearest(dx, dim[0]);
dy = nearest(dy, dim[0]);
dz = nearest(dz, dim[0]);
}
/* Add to it for the case where the future CoMs are in the corners */
dx += cell_width[0];
dy += cell_width[1];
dz += cell_width[2];
/* This is a crazy upper-bound but the best we can do */
const double r2 = dx * dx + dy * dy + dz * dz;
if (!gravity_M2L_accept(r_max, r_max, theta_crit2, r2))
proxy_type |= (int)proxy_cell_type_gravity;
/* We don't have multipoles yet (or there CoMs) so we will have
to cook up something based on cell locations only. We hence
need an upper limit on the distance that the CoMs in those
cells could have. We then can decide whether we are too close
for an M2L interaction and hence require a proxy as this pair
of cells cannot rely on just an M2L calculation. */
const double loc_j[3] = {cells[cjd].loc[0], cells[cjd].loc[1],
cells[cjd].loc[2]};
/* Start with the distance between the cell centres. */
double dx = loc_i[0] - loc_j[0];
double dy = loc_i[1] - loc_j[1];
double dz = loc_i[2] - loc_j[2];
/* Apply BC */
if (periodic) {
dx = nearest(dx, dim[0]);
dy = nearest(dy, dim[0]);
dz = nearest(dz, dim[0]);
}
/* Add to it for the case where the future CoMs are in the
* corners */
dx += cell_width[0];
dy += cell_width[1];
dz += cell_width[2];
/* This is a crazy upper-bound but the best we can do */
const double r2 = dx * dx + dy * dy + dz * dz;
if (!gravity_M2L_accept(r_max, r_max, theta_crit2, r2))
proxy_type |= (int)proxy_cell_type_gravity;
}
/* Abort if not in range at all */
......
......@@ -126,8 +126,8 @@ void proxy_tags_exchange(struct proxy *proxies, int num_proxies,
const int cid = proxies[k].cells_out[j] - s->cells_top;
cids_out[send_rid] = cid;
int err = MPI_Isend(
&tags_out[offset_out[cid]], proxies[k].cells_out[j]->pcell_size, MPI_INT,
proxies[k].nodeID, cid, MPI_COMM_WORLD, &reqs_out[send_rid]);
&tags_out[offset_out[cid]], proxies[k].cells_out[j]->pcell_size,
MPI_INT, proxies[k].nodeID, cid, MPI_COMM_WORLD, &reqs_out[send_rid]);
if (err != MPI_SUCCESS) mpi_error(err, "Failed to isend tags.");
send_rid += 1;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment