Skip to content
Snippets Groups Projects
Commit e6835d95 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Do not verify the trigger size vs. the snapshot list any more

parent e27b2a02
Branches
Tags
2 merge requests!1715Update planetary strength after planetary plus's master rebase,!1693More threapool plotting tweaks
...@@ -690,7 +690,6 @@ void engine_allocate_foreign_particles(struct engine *e, const int fof); ...@@ -690,7 +690,6 @@ void engine_allocate_foreign_particles(struct engine *e, const int fof);
void engine_print_stats(struct engine *e); void engine_print_stats(struct engine *e);
void engine_io(struct engine *e); void engine_io(struct engine *e);
void engine_io_check_snapshot_triggers(struct engine *e); void engine_io_check_snapshot_triggers(struct engine *e);
void engine_io_verify_triggers_size(const struct engine *e);
void engine_collect_end_of_step(struct engine *e, int apply); void engine_collect_end_of_step(struct engine *e, int apply);
void engine_collect_end_of_sub_cycle(struct engine *e); void engine_collect_end_of_sub_cycle(struct engine *e);
void engine_dump_snapshot(struct engine *e); void engine_dump_snapshot(struct engine *e);
......
...@@ -613,10 +613,6 @@ void engine_config(int restart, int fof, struct engine *e, ...@@ -613,10 +613,6 @@ void engine_config(int restart, int fof, struct engine *e,
/* Read (or re-read the list of outputs */ /* Read (or re-read the list of outputs */
engine_init_output_lists(e, params, e->output_options); engine_init_output_lists(e, params, e->output_options);
/* Verify that the snapshot triggers are compatible with the
* output list */
engine_io_verify_triggers_size(e);
/* Check whether output quantities make sense */ /* Check whether output quantities make sense */
if (e->policy & engine_policy_cosmology) { if (e->policy & engine_policy_cosmology) {
......
...@@ -1449,147 +1449,3 @@ void engine_io_check_snapshot_triggers(struct engine *e) { ...@@ -1449,147 +1449,3 @@ void engine_io_check_snapshot_triggers(struct engine *e) {
} }
} }
} }
void check_triggers(const struct engine *e, const double snapshot_delta) {
return;
/* Verify the part triggers */
for (int i = 0; i < num_snapshot_triggers_part; ++i) {
if (e->snapshot_recording_triggers_part[i] > snapshot_delta) {
error(
"The recording time for the part trigger %d (dt=%e) is longer "
"than the time between snapshots (dt=%e)",
i, e->snapshot_recording_triggers_part[i], snapshot_delta);
}
}
/* Verify the spart triggers */
for (int i = 0; i < num_snapshot_triggers_spart; ++i) {
if (e->snapshot_recording_triggers_spart[i] > snapshot_delta) {
error(
"The recording time for the spart trigger %d (dt=%e) is longer "
"than the time between snapshots (dt=%e)",
i, e->snapshot_recording_triggers_spart[i], snapshot_delta);
}
}
/* Verify the bpart triggers */
for (int i = 0; i < num_snapshot_triggers_bpart; ++i) {
if (e->snapshot_recording_triggers_bpart[i] > snapshot_delta) {
error(
"The recording time for the bpart trigger %d (dt=%e) is longer "
"than the time between snapshots (dt=%e)",
i, e->snapshot_recording_triggers_bpart[i], snapshot_delta);
}
}
}
/**
* @brief Verify that the triggers provided by the user are not
* overlapping with the snapshot times.
*
* Deals witht the case of a regular snapshot pattern and output list.
*
* @param e The #engine.
*/
void engine_io_verify_triggers_size(const struct engine *e) {
/* Stop if we have nothing to do */
if (num_snapshot_triggers_part == 0 && num_snapshot_triggers_spart == 0 &&
num_snapshot_triggers_bpart == 0)
return;
if (e->output_list_snapshots) {
/* Case where an output list is used */
if (e->policy & engine_policy_cosmology) {
/* Loop over all the snapshot gaps */
for (size_t i = 0; i < e->output_list_snapshots->size - 1; ++i) {
const double a = e->output_list_snapshots->times[i];
const double a_next = e->output_list_snapshots->times[i + 1];
const double snapshot_delta =
cosmology_get_delta_time_from_scale_factors(e->cosmology, a,
a_next);
/* Do the verification */
check_triggers(e, snapshot_delta);
}
/* Also verify what happens before the first snapshot */
const double snapshot_delta_first =
cosmology_get_delta_time_from_scale_factors(
e->cosmology, e->time_begin, e->output_list_snapshots->times[0]);
/* Do the verification */
check_triggers(e, snapshot_delta_first);
} else {
/* Loop over all the snapshot gaps */
for (size_t i = 0; i < e->output_list_snapshots->size - 1; ++i) {
const double time = e->output_list_snapshots->times[i];
const double time_next = e->output_list_snapshots->times[i + 1];
const double snapshot_delta = time_next - time;
/* Do the verification */
check_triggers(e, snapshot_delta);
}
/* Also verify what happens before the first snapshot */
const double snapshot_delta_first =
e->output_list_snapshots->times[0] - e->time_begin;
/* Do the verification */
check_triggers(e, snapshot_delta_first);
}
} else {
/* Case where we have a regular pattern */
if (e->policy & engine_policy_cosmology) {
/* Loop over all the snapshot gaps */
for (double a = e->a_first_snapshot; a <= e->time_end;
a *= e->delta_time_snapshot) {
const double a_next = a * e->delta_time_snapshot;
const double snapshot_delta =
cosmology_get_delta_time_from_scale_factors(e->cosmology, a,
a_next);
/* Do the verification */
check_triggers(e, snapshot_delta);
}
/* Also verify what happens before the first snapshot */
const double snapshot_delta_first =
cosmology_get_delta_time_from_scale_factors(
e->cosmology, e->time_begin, e->a_first_snapshot);
/* Do the verification */
check_triggers(e, snapshot_delta_first);
} else {
/* Simplest case: the delta is constant */
const double snapshot_delta = e->delta_time_snapshot;
/* Do the verification */
check_triggers(e, snapshot_delta);
/* Also verify what happens before the first snapshot */
const double snapshot_delta_first =
e->time_first_snapshot - e->time_begin;
/* Do the verification */
check_triggers(e, snapshot_delta_first);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment