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

Make the stop condition into a function for improved readability

parent 57f2c0c4
......@@ -192,7 +192,7 @@ int main(int argc, char *argv[]) {
with_outputs = 0;
break;
case 'P':
/* Partition type is one of "g", "m", "w", or "v"; "g" can be
/* Partition type is one of "g", "m", "w", or "v"; "g" can be
* followed by three numbers defining the grid. */
#ifdef WITH_MPI
switch (optarg[0]) {
......@@ -224,7 +224,7 @@ int main(int argc, char *argv[]) {
error("Error parsing number of queues.");
break;
case 'R':
/* Repartition type "n", "b", "v", "e" or "x".
/* Repartition type "n", "b", "v", "e" or "x".
* Note only none is available without METIS. */
#ifdef WITH_MPI
switch (optarg[0]) {
......@@ -468,7 +468,7 @@ int main(int argc, char *argv[]) {
"[ms]\n");
/* Let loose a runner on the space. */
for (j = 0; e.ti_current < max_nr_timesteps; j++) {
for (j = 0; !engine_is_done(&e); j++) {
/* Repartition the space amongst the nodes? */
#ifdef WITH_MPI
......
......@@ -1624,6 +1624,13 @@ void engine_step(struct engine *e) {
// printParticle(e->s->parts, e->s->xparts,515050, e->s->nr_parts);
}
/**
* @brief Returns 1 if the simulation has reached its end point, 0 otherwise
*/
int engine_is_done(struct engine *e) {
return !(e->ti_current < max_nr_timesteps);
}
/**
* @brief Create and fill the proxies.
*
......@@ -1957,7 +1964,7 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
float dt_max = timeEnd - timeBegin;
while (dt_max > e->dt_max) dt_max /= 2.f;
message("Minimal timestep size (on time-line): %e", dt_max);
message("Maximal timestep size (on time-line): %e", dt_max);
}
}
......
......@@ -63,7 +63,6 @@ extern const char *engine_policy_names[];
#define engine_maxproxies 64
#define engine_tasksreweight 10
/* The rank of the engine as a global variable (for messages). */
extern int engine_rank;
......@@ -186,5 +185,6 @@ void engine_makeproxies(struct engine *e);
void engine_redistribute(struct engine *e);
struct link *engine_addlink(struct engine *e, struct link *l, struct task *t);
void engine_print_policy(struct engine *e);
int engine_is_done(struct engine *e);
#endif /* SWIFT_ENGINE_H */
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