From 3b0ed1fbd49eea869f2eccd89c3db7b5f0b8addf Mon Sep 17 00:00:00 2001 From: James Willis <james.s.willis@durham.ac.uk> Date: Thu, 5 Apr 2018 11:48:04 +0800 Subject: [PATCH] Pass output file name at initialisation of VELOCIraptor so that the simulation info can be saved correctly. --- src/velociraptor_interface.c | 5 +++-- src/velociraptor_interface.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c index 4587a46597..9837de6bcd 100644 --- a/src/velociraptor_interface.c +++ b/src/velociraptor_interface.c @@ -120,8 +120,9 @@ void velociraptor_init(struct engine *e) { sim_info.cellloc[i].loc[2] = unit_info.lengthtokpc * s->cells_top[i].loc[2]; } - char configfilename[PARSER_MAX_LINE_SIZE]; + char configfilename[PARSER_MAX_LINE_SIZE], outputFileName[FILENAME_BUFFER_SIZE]; parser_get_param_string(e->parameter_file, "StructureFinding:config_file_name", configfilename); + snprintf(outputFileName, FILENAME_BUFFER_SIZE, "%s.VELOCIraptor", e->stfBaseName); message("Config file name: %s", configfilename); message("Period: %e", sim_info.period); @@ -133,7 +134,7 @@ void velociraptor_init(struct engine *e) { //message("Local top-level cell locations range: (%e,%e,%e) -> (%e,%e,%e)", cell_loc_min[0], cell_loc_min[1], cell_loc_min[2], cell_loc_max[0], cell_loc_max[1], cell_loc_max[2]); message("Top-level cell locations range: (%e,%e,%e) -> (%e,%e,%e)", sim_info.cellloc[0].loc[0], sim_info.cellloc[0].loc[1], sim_info.cellloc[0].loc[2], sim_info.cellloc[sim_info.numcells - 1].loc[0], sim_info.cellloc[sim_info.numcells - 1].loc[1], sim_info.cellloc[sim_info.numcells - 1].loc[2]); - InitVelociraptor(configfilename, cosmo_info, unit_info, sim_info); + InitVelociraptor(configfilename, outputFileName, cosmo_info, unit_info, sim_info); /* Free cell locations after VELOCIraptor has copied them. */ //free(sim_info.cellloc); diff --git a/src/velociraptor_interface.h b/src/velociraptor_interface.h index 71366dfe5d..c14da03be0 100644 --- a/src/velociraptor_interface.h +++ b/src/velociraptor_interface.h @@ -68,7 +68,7 @@ struct siminfo { }; /* VELOCIraptor interface. */ -void InitVelociraptor(char* config_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, struct siminfo sim_info); +void InitVelociraptor(char* config_name, char* output_name, struct cosmoinfo cosmo_info, struct unitinfo unit_info, struct siminfo sim_info); void InvokeVelociraptor(const int num_gravity_parts, struct gpart *gravity_parts, const int *cell_node_ids, char* output_name); /* VELOCIraptor wrapper functions. */ -- GitLab