diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 363dfe5fac67cfae3455bce30fbac24a317eae71..c9bc9811803051b274cd09cdcf6b58d1a65a0d7d 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -33,7 +33,7 @@ SPH: initial_temperature: 0 # (Optional) Initial temperature (in internal units) to set the gas particles at start-up. Value is ignored if set to 0. minimal_temperature: 0 # (Optional) Minimal temperature (in internal units) allowed for the gas particles. Value is ignored if set to 0. H_mass_fraction: 0.76 # (Optional) Hydrogen mass fraction used for initial conversion from temp to internal energy. - + # Parameters for the self-gravity scheme Gravity: eta: 0.025 # Constant dimensionless multiplier for time integration. @@ -64,7 +64,7 @@ TimeIntegration: dt_min: 1e-6 # The minimal time-step size of the simulation (in internal units). dt_max: 1e-2 # The maximal time-step size of the simulation (in internal units). max_dt_RMS_factor: 0.25 # (Optional) Dimensionless factor for the maximal displacement allowed based on the RMS velocities. - + # Parameters governing the snapshots Snapshots: basename: output # Common part of the name of output files @@ -72,6 +72,7 @@ Snapshots: time_first: 0. # (Optional) Time of the first output if non-cosmological time-integration (in internal units) delta_time: 0.01 # Time difference between consecutive outputs (in internal units) compression: 0 # (Optional) Set the level of compression of the HDF5 datasets [0-9]. 0 does no compression. + label_delta: 1 # (Optional) Set the integer increment between snapshot output labels UnitMass_in_cgs: 1 # (Optional) Unit system for the outputs (Grams) UnitLength_in_cgs: 1 # (Optional) Unit system for the outputs (Centimeters) UnitVelocity_in_cgs: 1 # (Optional) Unit system for the outputs (Centimeters per second) diff --git a/src/engine.c b/src/engine.c index 5dafce3ce1af480895eb9fa7d7a44e35bc18b547..afd514d7489716bc36a4dc9450604211f245cbf3 100644 --- a/src/engine.c +++ b/src/engine.c @@ -5422,6 +5422,8 @@ void engine_init(struct engine *e, struct space *s, parser_get_param_string(params, "Snapshots:basename", e->snapshot_base_name); e->snapshot_compression = parser_get_opt_param_int(params, "Snapshots:compression", 0); + e->snapshot_label_delta = + parser_get_opt_param_int(params, "Snapshots:label_delta", 1); e->snapshot_units = (struct unit_system *)malloc(sizeof(struct unit_system)); units_init_default(e->snapshot_units, params, "Snapshots", internal_units); e->snapshot_output_count = 0; diff --git a/src/engine.h b/src/engine.h index db3db3158748414fb9b048feabcc2695ae0873a5..4c6a8453a30d7fea8c5431d4c399138d8b7e701d 100644 --- a/src/engine.h +++ b/src/engine.h @@ -207,6 +207,7 @@ struct engine { char snapshot_base_name[PARSER_MAX_LINE_SIZE]; int snapshot_compression; + int snapshot_label_delta; struct unit_system *snapshot_units; int snapshot_output_count; diff --git a/src/serial_io.c b/src/serial_io.c index ab0853794863adf809c35c19a9f56a6a153b839c..9403caad7670b9af369f4b3598b8a05cf2d0d9e9 100644 --- a/src/serial_io.c +++ b/src/serial_io.c @@ -734,8 +734,12 @@ void write_output_serial(struct engine* e, const char* baseName, /* File name */ char fileName[FILENAME_BUFFER_SIZE]; - snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName, - e->snapshot_output_count); + if (e->snapshot_label_delta == 1) + snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName, + e->snapshot_output_count); + else + snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%06i.hdf5", baseName, + e->snapshot_output_count * e->snapshot_label_delta); /* Compute offset in the file and total number of particles */ size_t N[swift_type_count] = {Ngas, Ndm, 0, 0, Nstars, 0}; diff --git a/src/single_io.c b/src/single_io.c index f5b7d331875175d35ed048ed605c9468f68e89a2..d7afdd4a886ccde9701e7665f978e4e2ffa907aa 100644 --- a/src/single_io.c +++ b/src/single_io.c @@ -602,8 +602,12 @@ void write_output_single(struct engine* e, const char* baseName, /* File name */ char fileName[FILENAME_BUFFER_SIZE]; - snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName, - e->snapshot_output_count); + if (e->snapshot_label_delta == 1) + snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%04i.hdf5", baseName, + e->snapshot_output_count); + else + snprintf(fileName, FILENAME_BUFFER_SIZE, "%s_%06i.hdf5", baseName, + e->snapshot_output_count * e->snapshot_label_delta); /* First time, we need to create the XMF file */ if (e->snapshot_output_count == 0) xmf_create_file(baseName);