Commit dc1ff243 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting and doxygen documentation

parent f595959b
...@@ -333,7 +333,7 @@ int main(int argc, char *argv[]) { ...@@ -333,7 +333,7 @@ int main(int argc, char *argv[]) {
MPI_Bcast(params, sizeof(struct swift_params), MPI_BYTE, 0, MPI_COMM_WORLD); MPI_Bcast(params, sizeof(struct swift_params), MPI_BYTE, 0, MPI_COMM_WORLD);
#endif #endif
/* Prepare the domain decomposition scheme */ /* Prepare the domain decomposition scheme */
enum repartition_type reparttype = REPART_NONE; enum repartition_type reparttype = REPART_NONE;
#ifdef WITH_MPI #ifdef WITH_MPI
struct partition initial_partition; struct partition initial_partition;
...@@ -507,8 +507,8 @@ int main(int argc, char *argv[]) { ...@@ -507,8 +507,8 @@ int main(int argc, char *argv[]) {
if (myrank == 0) clocks_gettime(&tic); if (myrank == 0) clocks_gettime(&tic);
struct engine e; struct engine e;
engine_init(&e, &s, params, nr_nodes, myrank, nr_threads, with_aff, engine_init(&e, &s, params, nr_nodes, myrank, nr_threads, with_aff,
engine_policies, talking, reparttype, &us, &prog_const, &hydro_properties, engine_policies, talking, reparttype, &us, &prog_const,
&potential, &cooling_func, &sourceterms); &hydro_properties, &potential, &cooling_func, &sourceterms);
if (myrank == 0) { if (myrank == 0) {
clocks_gettime(&toc); clocks_gettime(&toc);
message("engine_init took %.3f %s.", clocks_diff(&tic, &toc), message("engine_init took %.3f %s.", clocks_diff(&tic, &toc),
......
...@@ -936,7 +936,7 @@ void cell_clean_links(struct cell *c, void *data) { ...@@ -936,7 +936,7 @@ void cell_clean_links(struct cell *c, void *data) {
/** /**
* @brief Checks that a cell is at the current point in time * @brief Checks that a cell is at the current point in time
* *
* Calls error() if the cell is not at the current time. * Calls error() if the cell is not at the current time.
* *
* @param c Cell to act upon * @param c Cell to act upon
* @param data The current time on the integer time-line * @param data The current time on the integer time-line
...@@ -948,21 +948,26 @@ void cell_check_drift_point(struct cell *c, void *data) { ...@@ -948,21 +948,26 @@ void cell_check_drift_point(struct cell *c, void *data) {
const integertime_t ti_drift = *(integertime_t *)data; const integertime_t ti_drift = *(integertime_t *)data;
/* Only check local cells */ /* Only check local cells */
if(c->nodeID != engine_rank) return; if (c->nodeID != engine_rank) return;
if (c->ti_old != ti_drift) if (c->ti_old != ti_drift)
error("Cell in an incorrect time-zone! c->ti_old=%lld ti_drift=%lld", error("Cell in an incorrect time-zone! c->ti_old=%lld ti_drift=%lld",
c->ti_old, ti_drift); c->ti_old, ti_drift);
for(int i=0; i<c->count; ++i) for (int i = 0; i < c->count; ++i)
if(c->parts[i].ti_drift != ti_drift) if (c->parts[i].ti_drift != ti_drift)
error("part in an incorrect time-zone! p->ti_drift=%lld ti_drift=%lld", error("part in an incorrect time-zone! p->ti_drift=%lld ti_drift=%lld",
c->parts[i].ti_drift, ti_drift); c->parts[i].ti_drift, ti_drift);
for(int i=0; i<c->gcount; ++i) for (int i = 0; i < c->gcount; ++i)
if(c->gparts[i].ti_drift != ti_drift) if (c->gparts[i].ti_drift != ti_drift)
error("g-part in an incorrect time-zone! gp->ti_drift=%lld ti_drift=%lld", error("g-part in an incorrect time-zone! gp->ti_drift=%lld ti_drift=%lld",
c->gparts[i].ti_drift, ti_drift); c->gparts[i].ti_drift, ti_drift);
for (int i = 0; i < c->scount; ++i)
if (c->sparts[i].ti_drift != ti_drift)
error("s-part in an incorrect time-zone! sp->ti_drift=%lld ti_drift=%lld",
c->sparts[i].ti_drift, ti_drift);
#else #else
error("Calling debugging code without debugging flag activated."); error("Calling debugging code without debugging flag activated.");
#endif #endif
......
...@@ -2506,8 +2506,6 @@ int engine_marktasks(struct engine *e) { ...@@ -2506,8 +2506,6 @@ int engine_marktasks(struct engine *e) {
const ticks tic = getticks(); const ticks tic = getticks();
int rebuild_space = 0; int rebuild_space = 0;
message("marktasks");
/* Run through the tasks and mark as skip or not. */ /* Run through the tasks and mark as skip or not. */
size_t extra_data[3] = {(size_t)e, rebuild_space, (size_t)&e->sched}; size_t extra_data[3] = {(size_t)e, rebuild_space, (size_t)&e->sched};
threadpool_map(&e->threadpool, engine_marktasks_mapper, s->tasks, s->nr_tasks, threadpool_map(&e->threadpool, engine_marktasks_mapper, s->tasks, s->nr_tasks,
...@@ -2575,12 +2573,6 @@ void engine_rebuild(struct engine *e) { ...@@ -2575,12 +2573,6 @@ void engine_rebuild(struct engine *e) {
/* Clear the forcerebuild flag, whatever it was. */ /* Clear the forcerebuild flag, whatever it was. */
e->forcerebuild = 0; e->forcerebuild = 0;
message("rebuild"); fflush(stdout);
#ifdef WITH_MPI
MPI_Barrier(MPI_COMM_WORLD);
#endif
/* Re-build the space. */ /* Re-build the space. */
space_rebuild(e->s, e->verbose); space_rebuild(e->s, e->verbose);
...@@ -2599,8 +2591,8 @@ void engine_rebuild(struct engine *e) { ...@@ -2599,8 +2591,8 @@ void engine_rebuild(struct engine *e) {
if (engine_marktasks(e)) if (engine_marktasks(e))
error("engine_marktasks failed after space_rebuild."); error("engine_marktasks failed after space_rebuild.");
/* Print the status of the system */ /* Print the status of the system */
// if (e->verbose) engine_print_task_counts(e); // if (e->verbose) engine_print_task_counts(e);
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Check that all cells have been drifted to the current time. /* Check that all cells have been drifted to the current time.
...@@ -2624,14 +2616,14 @@ void engine_prepare(struct engine *e) { ...@@ -2624,14 +2616,14 @@ void engine_prepare(struct engine *e) {
TIMER_TIC; TIMER_TIC;
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
if(e->forcerepart || e->forcerebuild) { if (e->forcerepart || e->forcerebuild) {
/* Check that all cells have been drifted to the current time. /* Check that all cells have been drifted to the current time.
* That can include cells that have not * That can include cells that have not
* previously been active on this rank. */ * previously been active on this rank. */
space_check_drift_point(e->s, e->ti_old); space_check_drift_point(e->s, e->ti_old);
#endif #endif
} }
/* Do we need repartitioning ? */ /* Do we need repartitioning ? */
if (e->forcerepart) engine_repartition(e); if (e->forcerepart) engine_repartition(e);
...@@ -3030,9 +3022,6 @@ void engine_step(struct engine *e) { ...@@ -3030,9 +3022,6 @@ void engine_step(struct engine *e) {
e->tic_step = getticks(); e->tic_step = getticks();
message("START snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild,
e->forcerepart);
/* Move forward in time */ /* Move forward in time */
e->ti_old = e->ti_current; e->ti_old = e->ti_current;
e->ti_current = e->ti_end_min; e->ti_current = e->ti_end_min;
...@@ -3044,7 +3033,7 @@ void engine_step(struct engine *e) { ...@@ -3044,7 +3033,7 @@ void engine_step(struct engine *e) {
if (e->nodeID == 0) { if (e->nodeID == 0) {
/* Print some information to the screen */ /* Print some information to the screen */
printf(" %6d %lld %14e %14e %10zu %10zu %10zu %21.3f\n", e->step, e->ti_current, e->time, printf(" %6d %14e %14e %10zu %10zu %10zu %21.3f\n", e->step, e->time,
e->timeStep, e->updates, e->g_updates, e->s_updates, e->timeStep, e->updates, e->g_updates, e->s_updates,
e->wallclock_time); e->wallclock_time);
fflush(stdout); fflush(stdout);
...@@ -3058,7 +3047,7 @@ void engine_step(struct engine *e) { ...@@ -3058,7 +3047,7 @@ void engine_step(struct engine *e) {
/* Prepare the tasks to be launched, rebuild or repartition if needed. */ /* Prepare the tasks to be launched, rebuild or repartition if needed. */
engine_prepare(e); engine_prepare(e);
/* Repartition the space amongst the nodes? */ /* Repartition the space amongst the nodes? */
#ifdef WITH_MPI #ifdef WITH_MPI
if (e->step % 100 == 2) e->forcerepart = 1; if (e->step % 100 == 2) e->forcerepart = 1;
#endif #endif
...@@ -3086,9 +3075,6 @@ void engine_step(struct engine *e) { ...@@ -3086,9 +3075,6 @@ void engine_step(struct engine *e) {
e->forcerebuild = buff; e->forcerebuild = buff;
#endif #endif
message("MIDDLE snap=%d, rebuild=%d repart=%d ti_current=%lld", e->dump_snapshot, e->forcerebuild,
e->forcerepart, e->ti_current);
/* Do we want a snapshot? */ /* Do we want a snapshot? */
if (e->ti_end_min >= e->ti_nextSnapshot && e->ti_nextSnapshot > 0) if (e->ti_end_min >= e->ti_nextSnapshot && e->ti_nextSnapshot > 0)
e->dump_snapshot = 1; e->dump_snapshot = 1;
...@@ -3098,9 +3084,6 @@ void engine_step(struct engine *e) { ...@@ -3098,9 +3084,6 @@ void engine_step(struct engine *e) {
if (e->dump_snapshot || e->forcerebuild || e->forcerepart) if (e->dump_snapshot || e->forcerebuild || e->forcerepart)
engine_drift_all(e); engine_drift_all(e);
message("END snap=%d, rebuild=%d repart=%d", e->dump_snapshot, e->forcerebuild,
e->forcerepart);
/* Write a snapshot ? */ /* Write a snapshot ? */
if (e->dump_snapshot) { if (e->dump_snapshot) {
...@@ -3136,8 +3119,6 @@ int engine_is_done(struct engine *e) { ...@@ -3136,8 +3119,6 @@ int engine_is_done(struct engine *e) {
*/ */
void engine_unskip(struct engine *e) { void engine_unskip(struct engine *e) {
message("unskip");
const ticks tic = getticks(); const ticks tic = getticks();
threadpool_map(&e->threadpool, runner_do_unskip_mapper, e->s->cells_top, threadpool_map(&e->threadpool, runner_do_unskip_mapper, e->s->cells_top,
e->s->nr_cells, sizeof(struct cell), 1, e); e->s->nr_cells, sizeof(struct cell), 1, e);
...@@ -3154,8 +3135,6 @@ void engine_unskip(struct engine *e) { ...@@ -3154,8 +3135,6 @@ void engine_unskip(struct engine *e) {
*/ */
void engine_drift_all(struct engine *e) { void engine_drift_all(struct engine *e) {
message("drift all");
const ticks tic = getticks(); const ticks tic = getticks();
threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top, threadpool_map(&e->threadpool, runner_do_drift_mapper, e->s->cells_top,
e->s->nr_cells, sizeof(struct cell), 1, e); e->s->nr_cells, sizeof(struct cell), 1, e);
...@@ -3383,8 +3362,6 @@ void engine_dump_snapshot(struct engine *e) { ...@@ -3383,8 +3362,6 @@ void engine_dump_snapshot(struct engine *e) {
if (e->verbose) message("writing snapshot at t=%e.", e->time); if (e->verbose) message("writing snapshot at t=%e.", e->time);
message("dump");
/* Dump... */ /* Dump... */
#if defined(WITH_MPI) #if defined(WITH_MPI)
#if defined(HAVE_PARALLEL_HDF5) #if defined(HAVE_PARALLEL_HDF5)
...@@ -3477,6 +3454,7 @@ void engine_unpin() { ...@@ -3477,6 +3454,7 @@ void engine_unpin() {
* @param with_aff use processor affinity, if supported. * @param with_aff use processor affinity, if supported.
* @param policy The queuing policy to use. * @param policy The queuing policy to use.
* @param verbose Is this #engine talkative ? * @param verbose Is this #engine talkative ?
* @param reparttype What type of repartition algorithm are we using ?
* @param internal_units The system of units used internally. * @param internal_units The system of units used internally.
* @param physical_constants The #phys_const used for this run. * @param physical_constants The #phys_const used for this run.
* @param hydro The #hydro_props used for this run. * @param hydro The #hydro_props used for this run.
...@@ -3487,7 +3465,7 @@ void engine_unpin() { ...@@ -3487,7 +3465,7 @@ void engine_unpin() {
void engine_init(struct engine *e, struct space *s, void engine_init(struct engine *e, struct space *s,
const struct swift_params *params, int nr_nodes, int nodeID, const struct swift_params *params, int nr_nodes, int nodeID,
int nr_threads, int with_aff, int policy, int verbose, int nr_threads, int with_aff, int policy, int verbose,
enum repartition_type reparttype, enum repartition_type reparttype,
const struct UnitSystem *internal_units, const struct UnitSystem *internal_units,
const struct phys_const *physical_constants, const struct phys_const *physical_constants,
const struct hydro_props *hydro, const struct hydro_props *hydro,
......
...@@ -231,7 +231,7 @@ void engine_dump_snapshot(struct engine *e); ...@@ -231,7 +231,7 @@ void engine_dump_snapshot(struct engine *e);
void engine_init(struct engine *e, struct space *s, void engine_init(struct engine *e, struct space *s,
const struct swift_params *params, int nr_nodes, int nodeID, const struct swift_params *params, int nr_nodes, int nodeID,
int nr_threads, int with_aff, int policy, int verbose, int nr_threads, int with_aff, int policy, int verbose,
enum repartition_type reparttype, enum repartition_type reparttype,
const struct UnitSystem *internal_units, const struct UnitSystem *internal_units,
const struct phys_const *physical_constants, const struct phys_const *physical_constants,
const struct hydro_props *hydro, const struct hydro_props *hydro,
......
...@@ -91,8 +91,8 @@ __attribute__((always_inline)) INLINE static void gravity_kick_extra( ...@@ -91,8 +91,8 @@ __attribute__((always_inline)) INLINE static void gravity_kick_extra(
* *
* @param gp The particle. * @param gp The particle.
*/ */
__attribute__((always_inline)) INLINE static void gravity_reset_predicted_values( __attribute__((always_inline)) INLINE static void
struct gpart* gp) {} gravity_reset_predicted_values(struct gpart* gp) {}
/** /**
* @brief Initialises the g-particles for the first time * @brief Initialises the g-particles for the first time
......
...@@ -1016,9 +1016,8 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { ...@@ -1016,9 +1016,8 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
kick_part(p, xp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); kick_part(p, xp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase);
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */ /* Check that kick and the drift are synchronized */
if(p->ti_drift != p->ti_kick) if (p->ti_drift != p->ti_kick) error("Error integrating part in time.");
error("Error integrating part in time.");
#endif #endif
/* Prepare the values to be drifted */ /* Prepare the values to be drifted */
...@@ -1048,9 +1047,9 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { ...@@ -1048,9 +1047,9 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
kick_gpart(gp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); kick_gpart(gp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase);
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */ /* Check that kick and the drift are synchronized */
if(gp->ti_drift != gp->ti_kick) if (gp->ti_drift != gp->ti_kick)
error("Error integrating g-part in time."); error("Error integrating g-part in time.");
#endif #endif
/* Prepare the values to be drifted */ /* Prepare the values to be drifted */
...@@ -1080,9 +1079,9 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) { ...@@ -1080,9 +1079,9 @@ void runner_do_kick2(struct runner *r, struct cell *c, int timer) {
kick_spart(sp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase); kick_spart(sp, ti_begin + ti_step / 2, ti_begin + ti_step, timeBase);
#ifdef SWIFT_DEBUG_CHECKS #ifdef SWIFT_DEBUG_CHECKS
/* Check that kick and the drift are synchronized */ /* Check that kick and the drift are synchronized */
if(sp->ti_drift != sp->ti_kick) if (sp->ti_drift != sp->ti_kick)
error("Error integrating s-part in time."); error("Error integrating s-part in time.");
#endif #endif
/* Prepare the values to be drifted */ /* Prepare the values to be drifted */
......
...@@ -251,7 +251,6 @@ void space_regrid(struct space *s, int verbose) { ...@@ -251,7 +251,6 @@ void space_regrid(struct space *s, int verbose) {
const size_t nr_parts = s->nr_parts; const size_t nr_parts = s->nr_parts;
const ticks tic = getticks(); const ticks tic = getticks();
//const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0;
const integertime_t ti_old = (s->e != NULL) ? s->e->ti_old : 0; const integertime_t ti_old = (s->e != NULL) ? s->e->ti_old : 0;
/* Run through the cells and get the current h_max. */ /* Run through the cells and get the current h_max. */
...@@ -488,7 +487,6 @@ void space_rebuild(struct space *s, int verbose) { ...@@ -488,7 +487,6 @@ void space_rebuild(struct space *s, int verbose) {
size_t nr_gparts = s->nr_gparts; size_t nr_gparts = s->nr_gparts;
size_t nr_sparts = s->nr_sparts; size_t nr_sparts = s->nr_sparts;
struct cell *restrict cells_top = s->cells_top; struct cell *restrict cells_top = s->cells_top;
//const integertime_t ti_current = (s->e != NULL) ? s->e->ti_current : 0;
const integertime_t ti_old = (s->e != NULL) ? s->e->ti_old : 0; const integertime_t ti_old = (s->e != NULL) ? s->e->ti_old : 0;
/* Run through the particles and get their cell index. Allocates /* Run through the particles and get their cell index. Allocates
......
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