From 567607cf78fe4f5acbf9c3de7e7b248a3469f0ff Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <matthieu.schaller@durham.ac.uk> Date: Fri, 11 Sep 2015 09:24:36 +0100 Subject: [PATCH] Apply formatting style to the new functions. Former-commit-id: ffaabe8f08b824345c5c595bb5c8241ed6f36140 --- src/debug.c | 6 +++--- src/engine.c | 18 ++++++++-------- src/space.c | 57 +++++++++++++++++++++++---------------------------- src/version.c | 26 +++++++++++------------ 4 files changed, 49 insertions(+), 58 deletions(-) diff --git a/src/debug.c b/src/debug.c index de699e54cc..d55d544345 100644 --- a/src/debug.c +++ b/src/debug.c @@ -23,10 +23,10 @@ #include "const.h" #include "part.h" - /** - * @brief Looks for the particle with the given id and prints its information to the standard output. - * + * @brief Looks for the particle with the given id and prints its information to + *the standard output. + * * @param parts The array of particles. * @param id The id too look for. * @param N The size of the array of particles. diff --git a/src/engine.c b/src/engine.c index 6509b3ece8..541bdfec5d 100644 --- a/src/engine.c +++ b/src/engine.c @@ -951,24 +951,22 @@ int engine_exchange_strays(struct engine *e, int offset, int *ind, int N) { count += p->nr_parts_in; } } - + /* Wait for all the sends to have finnished too. */ - if ( nr_out > 0 ) - if (MPI_Waitall(2 * e->nr_proxies , reqs_out , MPI_STATUSES_IGNORE) != - MPI_SUCCESS ) - error("MPI_Waitall on sends failed."); - + if (nr_out > 0) + if (MPI_Waitall(2 * e->nr_proxies, reqs_out, MPI_STATUSES_IGNORE) != + MPI_SUCCESS) + error("MPI_Waitall on sends failed."); + /* Return the number of harvested parts. */ return count; - + #else - error( "SWIFT was not compiled with MPI support." ); + error("SWIFT was not compiled with MPI support."); return 0; #endif - } - /** * @brief Fill the #space's task list. * diff --git a/src/space.c b/src/space.c index 74e65d931e..6e9f792a41 100644 --- a/src/space.c +++ b/src/space.c @@ -778,7 +778,6 @@ void space_map_clearsort(struct cell *c, void *data) { } } - /** * @brief Map a function to all particles in a cell recursively. * @@ -787,23 +786,23 @@ void space_map_clearsort(struct cell *c, void *data) { * @param data Data passed to the function fun. */ -static void rec_map_parts(struct cell * c, - void (*fun)(struct part *p, struct cell *c, void *data), - void *data) { +static void rec_map_parts(struct cell *c, + void (*fun)(struct part *p, struct cell *c, + void *data), + void *data) { int k; /* No progeny? */ if (!c->split) for (k = 0; k < c->count; k++) fun(&c->parts[k], c, data); - + /* Otherwise, recurse. */ else for (k = 0; k < 8; k++) if (c->progeny[k] != NULL) rec_map_parts(c->progeny[k], fun, data); } - /** * @brief Map a function to all particles in a space. * @@ -819,10 +818,10 @@ void space_map_parts(struct space *s, int cid = 0; /* Call the recursive function on all higher-level cells. */ - for (cid = 0; cid < s->nr_cells; cid++) rec_map_parts(&s->cells[cid], fun, data); + for (cid = 0; cid < s->nr_cells; cid++) + rec_map_parts(&s->cells[cid], fun, data); } - /** * @brief Map a function to all particles in a cell recursively. * @@ -832,22 +831,22 @@ void space_map_parts(struct space *s, * @param data Data passed to the function fun. */ -static void rec_map_cells_post(struct cell * c, int full, - void (*fun)(struct cell *c, void *data), - void *data) { +static void rec_map_cells_post(struct cell *c, int full, + void (*fun)(struct cell *c, void *data), + void *data) { int k; /* Recurse. */ if (c->split) for (k = 0; k < 8; k++) - if (c->progeny[k] != NULL) rec_map_cells_post(c->progeny[k], full, fun, data); - + if (c->progeny[k] != NULL) + rec_map_cells_post(c->progeny[k], full, fun, data); + /* No progeny? */ if (full || !c->split) fun(c, data); } - /** * @brief Map a function to all particles in a aspace. * @@ -858,45 +857,41 @@ static void rec_map_cells_post(struct cell * c, int full, */ void space_map_cells_post(struct space *s, int full, - void (*fun)(struct cell *c, void *data), - void *data) { + void (*fun)(struct cell *c, void *data), void *data) { int cid = 0; /* Call the recursive function on all higher-level cells. */ - for (cid = 0; cid < s->nr_cells; cid++) rec_map_cells_post(&s->cells[cid], full, fun, data); + for (cid = 0; cid < s->nr_cells; cid++) + rec_map_cells_post(&s->cells[cid], full, fun, data); } - - -static void rec_map_cells_pre(struct cell * c, int full, - void (*fun)(struct cell *c, void *data), - void *data) { +static void rec_map_cells_pre(struct cell *c, int full, + void (*fun)(struct cell *c, void *data), + void *data) { int k; - + /* No progeny? */ if (full || !c->split) fun(c, data); - + /* Recurse. */ if (c->split) for (k = 0; k < 8; k++) - if (c->progeny[k] != NULL) rec_map_cells_pre(c->progeny[k], full, fun, data); + if (c->progeny[k] != NULL) + rec_map_cells_pre(c->progeny[k], full, fun, data); } - - void space_map_cells_pre(struct space *s, int full, - void (*fun)(struct cell *c, void *data), - void *data) { + void (*fun)(struct cell *c, void *data), void *data) { int cid = 0; /* Call the recursive function on all higher-level cells. */ - for (cid = 0; cid < s->nr_cells; cid++) rec_map_cells_pre(&s->cells[cid], full, fun, data); + for (cid = 0; cid < s->nr_cells; cid++) + rec_map_cells_pre(&s->cells[cid], full, fun, data); } - /** * @brief Split cells that contain too many particles. * diff --git a/src/version.c b/src/version.c index a64bd6a240..e0fb7be15e 100644 --- a/src/version.c +++ b/src/version.c @@ -24,7 +24,6 @@ /* This object's header. */ #include "version.h" - /** * @brief Return the source code git revision * @@ -58,22 +57,21 @@ const char *package_description(void) { return buf; } - /** - * @brief Prints a greeting message to the standard output containing code version and revision number + * @brief Prints a greeting message to the standard output containing code + * version and revision number */ void greetings(void) { - printf( " Welcome to the cosmological code\n" ); - printf( " ______ __________________\n" ); - printf( " / ___/ | / / _/ ____/_ __/\n" ); - printf( " \\__ \\| | /| / // // /_ / / \n" ); - printf( " ___/ /| |/ |/ // // __/ / / \n" ); - printf( " /____/ |__/|__/___/_/ /_/ \n" ); - printf( " SPH With Inter-dependent Fine-grained Tasking\n\n"); - - printf( " Version : %s\n", package_version() ); - printf( " Revision: %s\n", git_revision() ); - printf( " Webpage : www.swiftsim.com\n\n" ); + printf(" Welcome to the cosmological code\n"); + printf(" ______ __________________\n"); + printf(" / ___/ | / / _/ ____/_ __/\n"); + printf(" \\__ \\| | /| / // // /_ / / \n"); + printf(" ___/ /| |/ |/ // // __/ / / \n"); + printf(" /____/ |__/|__/___/_/ /_/ \n"); + printf(" SPH With Inter-dependent Fine-grained Tasking\n\n"); + printf(" Version : %s\n", package_version()); + printf(" Revision: %s\n", git_revision()); + printf(" Webpage : www.swiftsim.com\n\n"); } -- GitLab