From 9e0d044acabaff11612b0e13bb6955b4ba35caa0 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Tue, 11 Feb 2020 17:58:28 +0100 Subject: [PATCH] Applied code formatting tool --- src/debug.c | 30 ++++++++++++++++-------------- src/partition.c | 18 +++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/src/debug.c b/src/debug.c index 91f11239a1..1bfe5d2377 100644 --- a/src/debug.c +++ b/src/debug.c @@ -421,15 +421,15 @@ static void dumpCells_map(struct cell *c, void *data) { for (int k = 0; k < nr_tasks; k++) { if (tasks[k].cj == NULL) { if (tasks[k].ci != NULL) { - if (c == tasks[k].ci || c == tasks[k].ci->super ) { + if (c == tasks[k].ci || c == tasks[k].ci->super) { ntasks = ntasks + 1.0f; ticsum += (tasks[k].toc - tasks[k].tic); dsum += tasks[k].ci->depth; } } } else { - if (c == tasks[k].ci || c == tasks[k].ci->super || - c == tasks[k].cj || c == tasks[k].cj->super) { + if (c == tasks[k].ci || c == tasks[k].ci->super || c == tasks[k].cj || + c == tasks[k].cj->super) { ntasks = ntasks + 0.5f; ticsum += 0.5 * (tasks[k].toc - tasks[k].tic); if (tasks[k].ci != NULL) dsum += (tasks[k].ci->depth * 0.5); @@ -453,15 +453,16 @@ static void dumpCells_map(struct cell *c, void *data) { if (spart_is_active(&sparts[k], e)) pactcount++; } - fprintf(file, - " %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6d %6d %6d %6d %6d %6d %6d " - "%6.1f %20lld %6d %6d %6d %6d %6d %6d %6d %f %f\n", - c->loc[0], c->loc[1], c->loc[2], c->width[0], c->width[1], - c->width[2], e->step, c->hydro.count, c->grav.count, - c->stars.count, pactcount, c->depth, c->maxdepth, ntasks, c->hydro.ti_end_min, - get_time_bin(c->hydro.ti_end_min), (c->super == c), - (c->parent == NULL), cell_is_active_hydro(c, e), c->nodeID, - c->nodeID == e->nodeID, ismpiactive, ticsum, dsum); + fprintf( + file, + " %6.3f %6.3f %6.3f %6.3f %6.3f %6.3f %6d %6d %6d %6d %6d %6d %6d " + "%6.1f %20lld %6d %6d %6d %6d %6d %6d %6d %f %f\n", + c->loc[0], c->loc[1], c->loc[2], c->width[0], c->width[1], + c->width[2], e->step, c->hydro.count, c->grav.count, c->stars.count, + pactcount, c->depth, c->maxdepth, ntasks, c->hydro.ti_end_min, + get_time_bin(c->hydro.ti_end_min), (c->super == c), + (c->parent == NULL), cell_is_active_hydro(c, e), c->nodeID, + c->nodeID == e->nodeID, ismpiactive, ticsum, dsum); } } } @@ -496,8 +497,9 @@ void dumpCells(const char *prefix, int super, int active, int mpiactive, "# %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s %6s " "%20s %6s %6s %6s %6s %6s %6s %6s %6s %6s\n", "x", "y", "z", "xw", "yw", "zw", "step", "count", "gcount", "scount", - "actcount", "depth", "maxdepth", "tasks", "ti_end_min", "timebin", "issuper", - "istop", "active", "rank", "local", "mpiactive", "ticsum", "avedepth"); + "actcount", "depth", "maxdepth", "tasks", "ti_end_min", "timebin", + "issuper", "istop", "active", "rank", "local", "mpiactive", "ticsum", + "avedepth"); size_t data[6]; data[0] = (size_t)file; diff --git a/src/partition.c b/src/partition.c index b03d23c158..e18c9b680a 100644 --- a/src/partition.c +++ b/src/partition.c @@ -439,9 +439,9 @@ static void accumulate_sizes(struct space *s, int verbose, double *counts) { mapper_data.counts = gcounts; mapper_data.size = gsize; - threadpool_map(&s->e->threadpool, accumulate_sizes_mapper_gpart, - s->gparts, s->nr_gparts, sizeof(struct gpart), - space_splitsize, &mapper_data); + threadpool_map(&s->e->threadpool, accumulate_sizes_mapper_gpart, s->gparts, + s->nr_gparts, sizeof(struct gpart), space_splitsize, + &mapper_data); /* Get all the counts from all the nodes. */ if (MPI_Allreduce(MPI_IN_PLACE, gcounts, s->nr_cells, MPI_DOUBLE, MPI_SUM, @@ -464,13 +464,12 @@ static void accumulate_sizes(struct space *s, int verbose, double *counts) { /* And clip. */ int nadj = 0; - double clip = *ptrs[cut]; + double clip = *ptrs[cut]; for (int k = cut + 1; k < s->nr_cells; k++) { *ptrs[k] = clip; nadj++; } - if (verbose) - message("clipped gravity part counts of %d cells", nadj); + if (verbose) message("clipped gravity part counts of %d cells", nadj); free(ptrs); } @@ -1512,8 +1511,8 @@ static void partition_gather_weights(void *map_data, int num_elements, } else { /* Add weights from task costs to the edge. */ - atomic_add_d(&weights_e[ik], w ); - atomic_add_d(&weights_e[jk], w ); + atomic_add_d(&weights_e[ik], w); + atomic_add_d(&weights_e[jk], w); } } } @@ -1961,7 +1960,8 @@ void partition_initial_partition(struct partition *initial_partition, if ((weights_v = (double *)malloc(sizeof(double) * s->nr_cells)) == NULL) error("Failed to allocate weights_v buffer."); - if ((weights_e = (double *)malloc(sizeof(double) * s->nr_cells * 26)) == NULL) + if ((weights_e = (double *)malloc(sizeof(double) * s->nr_cells * 26)) == + NULL) error("Failed to allocate weights_e buffer."); /* Check each particle and accumulate the sizes per cell. */ -- GitLab