diff --git a/examples/main.c b/examples/main.c index 226d8d598378b4a112e737645cf61033ad2828b1..6244a7bb615d2a29002625a4ca233aec7ab11eeb 100644 --- a/examples/main.c +++ b/examples/main.c @@ -51,22 +51,6 @@ /* Global profiler. */ struct profiler prof; -void InitVelociraptor(); -void InvokeVelociraptor(const int num_gravity_parts, struct gpart *gravity_parts); - -void init_velociraptor() { - - InitVelociraptor(); -} - -void call_velociraptor(struct engine *e) { - - struct gpart *gparts = e->s->gparts; - const int nr_gparts = e->s->nr_gparts; - - InvokeVelociraptor(nr_gparts, gparts); -} - /** * @brief Help messages for the command line parameters. */ @@ -135,8 +119,6 @@ void print_help_message() { */ int main(int argc, char *argv[]) { - init_velociraptor(); - struct clocks_time tic, toc; struct engine e; @@ -879,8 +861,6 @@ int main(int argc, char *argv[]) { /* Take a step. */ engine_step(&e); - if (e.step%250 == 0) call_velociraptor(&e); - /* Print the timers. */ if (with_verbose_timers) timers_print(e.step); diff --git a/src/engine.c b/src/engine.c index b64aeb42eb2d43dbb15f94de1e6be93026d9c6ee..9cfd6d3a84e5e29ce609976733130589a4f600d5 100644 --- a/src/engine.c +++ b/src/engine.c @@ -76,6 +76,7 @@ #include "tools.h" #include "units.h" #include "version.h" +#include "velociraptor_interface.h" /* Particle cache size. */ #define CACHE_SIZE 512 @@ -4499,6 +4500,11 @@ void engine_step(struct engine *e) { e->step_props |= engine_step_prop_statistics; } + /* Invoke VELOCIraptor every 250 timesteps. */ + if (e->step%250 == 0) { + invoke_velociraptor(e); + } + /* Now apply all the collected time step updates and particle counts. */ collectgroup1_apply(&e->collect_group1, e); @@ -5245,6 +5251,9 @@ void engine_init( e->timeBase = (e->timeEnd - e->timeBegin) / max_nr_timesteps; e->timeBase_inv = 1.0 / e->timeBase; e->ti_current = 0; + + /* Initialise VELOCIraptor. */ + init_velociraptor(e); } /**