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

Fix crash in the unit tests related to the new way of constructing the cell...

Fix crash in the unit tests related to the new way of constructing the cell meta-data and snapshot names
parent e9a09e72
No related branches found
No related tags found
1 merge request!990Distributed snapshots
...@@ -896,6 +896,10 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3], const double dim[3], ...@@ -896,6 +896,10 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3], const double dim[3],
} }
#endif #endif
/* Abort if we don't have any cells yet (i.e. haven't constructed the space)
*/
if (nr_cells == 0) return;
double cell_width[3] = {width[0], width[1], width[2]}; double cell_width[3] = {width[0], width[1], width[2]};
/* Temporary memory for the cell-by-cell information */ /* Temporary memory for the cell-by-cell information */
......
...@@ -79,7 +79,8 @@ int main(int argc, char *argv[]) { ...@@ -79,7 +79,8 @@ int main(int argc, char *argv[]) {
&hydro_properties, &cosmo); &hydro_properties, &cosmo);
/* Init spart */ /* Init spart */
stars_first_init_spart(&sp, &stars_properties); stars_first_init_spart(&sp, &stars_properties, /*with_cosmology=*/0, cosmo.a,
cosmo.time);
/* Define an initial stellar mass. (for use when calling the feedback /* Define an initial stellar mass. (for use when calling the feedback
* functions, the results are presented per initial stellar mass, so the * functions, the results are presented per initial stellar mass, so the
......
...@@ -83,7 +83,7 @@ int main(int argc, char *argv[]) { ...@@ -83,7 +83,7 @@ int main(int argc, char *argv[]) {
unsigned long long cpufreq = 0; unsigned long long cpufreq = 0;
clocks_set_cpufreq(cpufreq); clocks_set_cpufreq(cpufreq);
const char *base_name = "testSelectOutput"; // const char *base_name = "testSelectOutput";
size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0; size_t Ngas = 0, Ngpart = 0, Ngpart_background = 0, Nspart = 0, Nbpart = 0;
int flag_entropy_ICs = -1; int flag_entropy_ICs = -1;
int periodic = 1; int periodic = 1;
...@@ -146,6 +146,8 @@ int main(int argc, char *argv[]) { ...@@ -146,6 +146,8 @@ int main(int argc, char *argv[]) {
/* pseudo initialization of the engine */ /* pseudo initialization of the engine */
message("Initialization of the engine."); message("Initialization of the engine.");
struct engine e; struct engine e;
e.physical_constants = &prog_const;
sprintf(e.snapshot_base_name, "testSelectOutput");
sprintf(e.run_name, "Select Output Test"); sprintf(e.run_name, "Select Output Test");
select_output_engine_init(&e, &s, &cosmo, &param_file, &cooling, select_output_engine_init(&e, &s, &cosmo, &param_file, &cooling,
&hydro_properties); &hydro_properties);
...@@ -158,7 +160,7 @@ int main(int argc, char *argv[]) { ...@@ -158,7 +160,7 @@ int main(int argc, char *argv[]) {
/* write output file */ /* write output file */
message("Writing output."); message("Writing output.");
write_output_single(&e, base_name, &us, &us); write_output_single(&e, &us, &us);
/* Clean-up */ /* Clean-up */
message("Cleaning memory."); message("Cleaning memory.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment