Commit e13260c8 authored by Matthieu Schaller's avatar Matthieu Schaller

Also implement the changes to the cells' sort to the unit tests

parent 525dc9ee
......@@ -361,7 +361,7 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h,
// shuffle_particles(cell->hydro.parts, cell->hydro.count);
cell->hydro.sorted = 0;
for (int k = 0; k < 13; k++) cell->hydro.sort[k] = NULL;
cell->hydro.sort = NULL;
return cell;
}
......@@ -369,8 +369,7 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h,
void clean_up(struct cell *ci) {
free(ci->hydro.parts);
free(ci->hydro.xparts);
for (int k = 0; k < 13; k++)
if (ci->hydro.sort[k] != NULL) free(ci->hydro.sort[k]);
free(ci->hydro.sort);
free(ci);
}
......
......@@ -201,15 +201,14 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->hydro.parts, cell->hydro.count);
cell->hydro.sorted = 0;
for (int k = 0; k < 13; k++) cell->hydro.sort[k] = NULL;
cell->hydro.sort = NULL;
return cell;
}
void clean_up(struct cell *ci) {
free(ci->hydro.parts);
for (int k = 0; k < 13; k++)
if (ci->hydro.sort[k] != NULL) free(ci->hydro.sort[k]);
free(ci->hydro.sort);
free(ci);
}
......
......@@ -189,10 +189,10 @@ struct cell *make_cell(size_t n, size_t n_stars, double *offset, double size,
shuffle_sparticles(cell->stars.parts, cell->stars.count);
cell->hydro.sorted = 0;
for (int k = 0; k < 13; k++) cell->hydro.sort[k] = NULL;
cell->hydro.sort = NULL;
cell->stars.sorted = 0;
for (int k = 0; k < 13; k++) cell->stars.sort[k] = NULL;
cell->stars.sort = NULL;
return cell;
}
......@@ -200,8 +200,8 @@ struct cell *make_cell(size_t n, size_t n_stars, double *offset, double size,
void clean_up(struct cell *ci) {
free(ci->hydro.parts);
free(ci->stars.parts);
for (int k = 0; k < 13; k++)
if (ci->hydro.sort[k] != NULL) free(ci->hydro.sort[k]);
free(ci->hydro.sort);
free(ci->stars.sort);
free(ci);
}
......
......@@ -157,7 +157,7 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->hydro.parts, cell->hydro.count);
cell->hydro.sorted = 0;
for (int k = 0; k < 13; k++) cell->hydro.sort[k] = NULL;
cell->hydro.sort = NULL;
return cell;
}
......
......@@ -183,15 +183,14 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->hydro.parts, cell->hydro.count);
cell->hydro.sorted = 0;
for (int k = 0; k < 13; k++) cell->hydro.sort[k] = NULL;
cell->hydro.sort = NULL;
return cell;
}
void clean_up(struct cell *ci) {
free(ci->hydro.parts);
for (int k = 0; k < 13; k++)
if (ci->hydro.sort[k] != NULL) free(ci->hydro.sort[k]);
free(ci->hydro.sort);
free(ci);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment