Commit c616a929 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Fix issues with new sort arrays in tests

parent 5c4f5858
......@@ -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);
cell->sorted = 0;
cell->sort = NULL;
for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell;
}
......@@ -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) {
free(ci->parts);
free(ci->xparts);
free(ci->sort);
for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci);
}
......
......@@ -178,14 +178,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->parts, cell->count);
cell->sorted = 0;
cell->sort = NULL;
for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell;
}
void clean_up(struct cell *ci) {
free(ci->parts);
free(ci->sort);
for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci);
}
......
......@@ -121,14 +121,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->parts, cell->count);
cell->sorted = 0;
cell->sort = NULL;
for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell;
}
void clean_up(struct cell *ci) {
free(ci->parts);
free(ci->sort);
for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci);
}
......
......@@ -177,14 +177,17 @@ struct cell *make_cell(size_t n, double *offset, double size, double h,
shuffle_particles(cell->parts, cell->count);
cell->sorted = 0;
cell->sort = NULL;
for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell;
}
void clean_up(struct cell *ci) {
free(ci->parts);
free(ci->sort);
for (int k = 0; k < 13; k++)
if (ci->sort[k] != NULL)
free(ci->sort[k]);
free(ci);
}
......
......@@ -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->sorted = 0;
cell->sort = NULL;
for (int k = 0; k < 13; k++)
cell->sort[k] = NULL;
return cell;
}
......@@ -211,7 +212,9 @@ int main() {
for (int j = 0; j < 27; ++j) {
free(cells[j]->parts);
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]);
}
......
Supports Markdown
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