diff --git a/src/common_io.h b/src/common_io.h index 4a9779974c75ad7b1d60d38cdb7c2f5292429ea8..fc391b4726224022a6943c3a5cfc337ede22e4de 100644 --- a/src/common_io.h +++ b/src/common_io.h @@ -30,8 +30,6 @@ #define PARTICLE_GROUP_BUFFER_SIZE 50 #define FILENAME_BUFFER_SIZE 150 #define IO_BUFFER_ALIGNMENT 1024 -#define IO_STF_OUTPUT_FREQ_FORMAT_STEPS 0 -#define IO_STF_OUTPUT_FREQ_FORMAT_TIME 1 /* Avoid cyclic inclusion problems */ struct part; @@ -58,6 +56,15 @@ enum IO_DATA_TYPE { CHAR }; +/** + * @brief The different formats for when to run structure finding. + * + */ +enum IO_STF_OUTPUT_FORMAT { + STEPS = 0, + TIME +}; + #if defined(HAVE_HDF5) hid_t io_hdf5_type(enum IO_DATA_TYPE type); diff --git a/src/engine.c b/src/engine.c index bb576bbd5ccefe929d62d49210a954c63abf7071..cffe1d9ce97aea9c269509f9d4667bc45d415495 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4616,9 +4616,9 @@ void engine_step(struct engine *e) { /* Do we want to perform structure finding? */ if ((e->policy & engine_policy_structure_finding)) { - if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_STEPS && e->step%(int)e->deltaTimeSTF == 0) + if(e->stf_output_freq_format == STEPS && e->step%(int)e->deltaTimeSTF == 0) e->run_stf = 1; - else if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_TIME && e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0) + else if(e->stf_output_freq_format == TIME && e->ti_end_min >= e->ti_nextSTF && e->ti_nextSTF > 0) e->run_stf = 1; } @@ -4653,7 +4653,7 @@ void engine_step(struct engine *e) { //velociraptor_invoke(e); /* ... and find the next output time */ - if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_TIME) engine_compute_next_stf_time(e); + if(e->stf_output_freq_format == TIME) engine_compute_next_stf_time(e); e->run_stf = 0; } @@ -5562,10 +5562,10 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, e->a_first_stf = parser_get_opt_param_double(params, "StructureFinding:a_time_first", 0.1); //velociraptor_init(e); e->stf_output_freq_format = parser_get_param_int(params, "StructureFinding:output_time_format"); - if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_STEPS) { + if(e->stf_output_freq_format == STEPS) { e->deltaTimeSTF = (double)parser_get_param_int(params, "StructureFinding:delta_time"); } - else if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_TIME) { + else if(e->stf_output_freq_format == TIME) { e->deltaTimeSTF = parser_get_param_double(params, "StructureFinding:delta_time"); } else error("Invalid flag (%d) set for output time format of structure finding.", e->stf_output_freq_format); @@ -5896,7 +5896,7 @@ void engine_config(int restart, struct engine *e, struct swift_params *params, if (e->policy & engine_policy_structure_finding) { /* Find the time of the first stf output */ - if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_TIME) { + if(e->stf_output_freq_format == TIME) { engine_compute_next_stf_time(e); message("Next STF step will be: %lld", e->ti_nextSTF); } diff --git a/src/velociraptor_interface.c b/src/velociraptor_interface.c index 8efe043f95ef3553cd3afa5dac9a3baab4121e28..ef72b8adb9f95d96973dec3cbd71a4ae2627bb94 100644 --- a/src/velociraptor_interface.c +++ b/src/velociraptor_interface.c @@ -178,11 +178,11 @@ void velociraptor_invoke(struct engine *e) { /* Append base name with either the step number or time depending on what format is specified in the parameter file. */ char outputFileName[PARSER_MAX_LINE_SIZE + 128]; - if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_STEPS) { + if(e->stf_output_freq_format == STEPS) { snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s_%04i.VELOCIraptor", e->stfBaseName, e->step); } - else if(e->stf_output_freq_format == IO_STF_OUTPUT_FREQ_FORMAT_TIME) { + else if(e->stf_output_freq_format == TIME) { snprintf(outputFileName, PARSER_MAX_LINE_SIZE + 128, "%s_%04e.VELOCIraptor", e->stfBaseName, e->time); }