From 292bcc6b7157eb05a6d9e4130f0616da99bd4258 Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Fri, 2 Mar 2018 12:46:14 +0800 Subject: [PATCH] Call VELOCIraptor every 250 steps. --- examples/main.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/main.c b/examples/main.c index 9e049b0037..226d8d5983 100644 --- a/examples/main.c +++ b/examples/main.c @@ -51,12 +51,20 @@ /* Global profiler. */ struct profiler prof; -//void InvokeVelociraptor(const int nbodies, struct gpart *parts); -void InvokeVelociraptor(); +void InitVelociraptor(); +void InvokeVelociraptor(const int num_gravity_parts, struct gpart *gravity_parts); -void call_velociraptor() { +void init_velociraptor() { - InvokeVelociraptor(); + 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); } /** @@ -127,7 +135,7 @@ void print_help_message() { */ int main(int argc, char *argv[]) { - call_velociraptor(); + init_velociraptor(); struct clocks_time tic, toc; struct engine e; @@ -871,6 +879,8 @@ 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); -- GitLab