From 447b288a8a009e85465718771314231d34376e8c Mon Sep 17 00:00:00 2001 From: pelahi <pascaljelahi@gmail.com> Date: Tue, 15 Jan 2019 14:33:15 +0800 Subject: [PATCH] Updating interface to velociraptor --- src/engine.c | 3 +++ src/velociraptor_dummy.c | 21 +++++++++++++++++++++ src/velociraptor_interface.c | 27 +++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/engine.c b/src/engine.c index d947cc4286..de508e8b00 100644 --- a/src/engine.c +++ b/src/engine.c @@ -3195,7 +3195,10 @@ void engine_check_for_dumps(struct engine *e) { #ifdef HAVE_VELOCIRAPTOR /* Unleash the raptor! */ + ///\todo need to move velociraptor_init to initialization after reading + ///the input velociraptor_init(e, /*linked_with_snap=*/1); + velociraptor_invoke(e, /*linked_with_snap=*/1); #else error( diff --git a/src/velociraptor_dummy.c b/src/velociraptor_dummy.c index 723fa7b7b1..2b1ba26170 100644 --- a/src/velociraptor_dummy.c +++ b/src/velociraptor_dummy.c @@ -33,6 +33,7 @@ struct unitinfo {}; struct cell_loc {}; struct siminfo {}; +/* int InitVelociraptor(char *config_name, char *output_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, struct siminfo sim_info, const int numthreads) { @@ -50,5 +51,25 @@ int InvokeVelociraptor(const size_t num_gravity_parts, error("This is only a dummy. Call the real one!"); return 0; } +*/ +int InitVelociraptor(char *config_name, struct unitinfo unit_info, + struct siminfo sim_info, const int numthreads) { + + error("This is only a dummy. Call the real one!"); + return 0; +} + +int InvokeVelociraptor(const int snapnum, + char *output_name, + struct cosmoinfo cosmo_info, + struct siminfo sim_info, + const size_t num_gravity_parts, + const size_t num_hydro_parts, + struct swift_vel_part *swift_parts, + const int *cell_node_ids, + const int numthreads) { + error("This is only a dummy. Call the real one!"); + return 0; +} #endif /* HAVE_DUMMY_VELOCIRAPTOR */ diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c index 8adc6b224d..709fe3b936 100644 --- a/src/velociraptor_interface.c +++ b/src/velociraptor_interface.c @@ -107,6 +107,7 @@ struct siminfo { }; /* VELOCIraptor interface. */ +/* int InitVelociraptor(char *config_name, char *output_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, struct siminfo sim_info, const int numthreads); @@ -116,9 +117,23 @@ int InvokeVelociraptor(const size_t num_gravity_parts, struct swift_vel_part *swift_parts, const int *cell_node_ids, char *output_name, const int numthreads); +*/ +int InitVelociraptor(char *config_name, struct unitinfo unit_info, + struct siminfo sim_info, const int numthreads); + +int InvokeVelociraptor(const int snapnum, + char *output_name, + struct cosmoinfo cosmo_info, + struct siminfo sim_info, + const size_t num_gravity_parts, + const size_t num_hydro_parts, + struct swift_vel_part *swift_parts, + const int *cell_node_ids, + const int numthreads); #endif /* HAVE_VELOCIRAPTOR */ + /** * @brief Initialise VELOCIraptor with input and output file names along with * cosmological info needed to run. @@ -252,8 +267,8 @@ void velociraptor_init(struct engine *e, const int linked_with_snap) { sim_info.cell_loc[sim_info.numcells - 1].loc[2]); /* Initialise VELOCIraptor. */ - if (!InitVelociraptor(e->stf_config_file_name, outputFileName, cosmo_info, - unit_info, sim_info, e->nr_threads)) + if (InitVelociraptor(e->stf_config_file_name, outputFileName, + unit_info, sim_info, e->nr_threads) != 1) error("Exiting. VELOCIraptor initialisation failed."); if (e->verbose) @@ -275,6 +290,8 @@ void velociraptor_invoke(struct engine *e, const int linked_with_snap) { #ifdef HAVE_VELOCIRAPTOR const struct space *s = e->s; + struct cosmoinfo cosmo_info; + struct siminfo sim_info; struct gpart *gparts = s->gparts; struct part *parts = s->parts; const size_t nr_gparts = s->nr_gparts; @@ -371,8 +388,10 @@ void velociraptor_invoke(struct engine *e, const int linked_with_snap) { } /* Call VELOCIraptor. */ - if (!InvokeVelociraptor(nr_gparts, nr_hydro_parts, e->stf_output_count, - swift_parts, cell_node_ids, outputFileName, + if (!InvokeVelociraptor(e->stf_output_count, outputFileName, + cosmo_info, sim_info, + nr_gparts, nr_hydro_parts, + swift_parts, cell_node_ids, e->nr_threads)) error("Exiting. Call to VELOCIraptor failed on rank: %d.", e->nodeID); -- GitLab