Skip to content
Snippets Groups Projects
Commit c616a929 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Fix issues with new sort arrays in tests

parent 5c4f5858
No related branches found
No related tags found
1 merge request!380Allocate a separate sort array for each dimensions.
...@@ -340,7 +340,8 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h, ...@@ -340,7 +340,8 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h,
// shuffle_particles(cell->parts, cell->count); // shuffle_particles(cell->parts, cell->count);
cell->sorted = 0; cell->sorted = 0;
cell->sort = NULL; for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell; return cell;
} }
...@@ -348,7 +349,9 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h, ...@@ -348,7 +349,9 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h,
void clean_up(struct cell *ci) { void clean_up(struct cell *ci) {
free(ci->parts); free(ci->parts);
free(ci->xparts); free(ci->xparts);
free(ci->sort); for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci); free(ci);
} }
......
...@@ -178,14 +178,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h, ...@@ -178,14 +178,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->parts, cell->count); shuffle_particles(cell->parts, cell->count);
cell->sorted = 0; cell->sorted = 0;
cell->sort = NULL; for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell; return cell;
} }
void clean_up(struct cell *ci) { void clean_up(struct cell *ci) {
free(ci->parts); free(ci->parts);
free(ci->sort); for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci); free(ci);
} }
......
...@@ -121,14 +121,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h, ...@@ -121,14 +121,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->parts, cell->count); shuffle_particles(cell->parts, cell->count);
cell->sorted = 0; cell->sorted = 0;
cell->sort = NULL; for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell; return cell;
} }
void clean_up(struct cell *ci) { void clean_up(struct cell *ci) {
free(ci->parts); free(ci->parts);
free(ci->sort); for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci); free(ci);
} }
......
...@@ -177,14 +177,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h, ...@@ -177,14 +177,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->parts, cell->count); shuffle_particles(cell->parts, cell->count);
cell->sorted = 0; cell->sorted = 0;
cell->sort = NULL; for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell; return cell;
} }
void clean_up(struct cell *ci) { void clean_up(struct cell *ci) {
free(ci->parts); free(ci->parts);
free(ci->sort); for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci); free(ci);
} }
......
...@@ -81,7 +81,8 @@ struct cell *make_cell(size_t N, float cellSize, int offset[3], int id_offset) { ...@@ -81,7 +81,8 @@ struct cell *make_cell(size_t N, float cellSize, int offset[3], int id_offset) {
cell->ti_end_max = 1; cell->ti_end_max = 1;
cell->sorted = 0; cell->sorted = 0;
cell->sort = NULL; for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell; return cell;
} }
...@@ -211,7 +212,9 @@ int main() { ...@@ -211,7 +212,9 @@ int main() {
for (int j = 0; j < 27; ++j) { for (int j = 0; j < 27; ++j) {
free(cells[j]->parts); free(cells[j]->parts);
free(cells[j]->xparts); free(cells[j]->xparts);
free(cells[j]->sort); for (int k = 0; k < 13; k++)
if (cells[j]->sort[k] != NULL)
free(cells[j]->sort[k]);
free(cells[j]); free(cells[j]);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment