diff --git a/src/common_io.c b/src/common_io.c index 3adda8000a9c4b074c35aa0da567b0c2093ac279..8846c8847b609cd84c5594cae38aea3edfcbf07d 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -896,6 +896,10 @@ void io_write_cell_offsets(hid_t h_grp, const int cdim[3], const double dim[3], } #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]}; /* Temporary memory for the cell-by-cell information */ diff --git a/tests/testFeedback.c b/tests/testFeedback.c index 56b4fedf7734ee25f67626bb2fd0aa7fc98571d3..1228a6fae056f41d9e4dd54a11065db336aad216 100644 --- a/tests/testFeedback.c +++ b/tests/testFeedback.c @@ -79,7 +79,8 @@ int main(int argc, char *argv[]) { &hydro_properties, &cosmo); /* 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 * functions, the results are presented per initial stellar mass, so the diff --git a/tests/testSelectOutput.c b/tests/testSelectOutput.c index 8a08bcf58f0ece5645267a28f59c103506437165..4e16df60d882f2bde04d91ace429f5526ba5d7f2 100644 --- a/tests/testSelectOutput.c +++ b/tests/testSelectOutput.c @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) { unsigned long long cpufreq = 0; 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; int flag_entropy_ICs = -1; int periodic = 1; @@ -146,6 +146,8 @@ int main(int argc, char *argv[]) { /* pseudo initialization of the engine */ message("Initialization of the engine."); struct engine e; + e.physical_constants = &prog_const; + sprintf(e.snapshot_base_name, "testSelectOutput"); sprintf(e.run_name, "Select Output Test"); select_output_engine_init(&e, &s, &cosmo, ¶m_file, &cooling, &hydro_properties); @@ -158,7 +160,7 @@ int main(int argc, char *argv[]) { /* write output file */ message("Writing output."); - write_output_single(&e, base_name, &us, &us); + write_output_single(&e, &us, &us); /* Clean-up */ message("Cleaning memory.");