Commit 5c8a03e3 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

sorting indices don't actually have to be size_t, changing back to int.

parent 3e0e0c69
......@@ -154,7 +154,7 @@ void engine_redistribute(struct engine *e) {
getting the counts. The counts array is indexed as
count[from * nr_nodes + to]. */
int *counts;
size_t *dest;
int *dest;
double ih[3], dim[3];
ih[0] = s->ih[0];
ih[1] = s->ih[1];
......@@ -163,7 +163,7 @@ void engine_redistribute(struct engine *e) {
dim[1] = s->dim[1];
dim[2] = s->dim[2];
if ((counts = (int *)malloc(sizeof(int) *nr_nodes *nr_nodes)) == NULL ||
(dest = (size_t *)malloc(sizeof(size_t) * s->nr_parts)) == NULL)
(dest = (int *)malloc(sizeof(int) * s->nr_parts)) == NULL)
error("Failed to allocate count and dest buffers.");
bzero(counts, sizeof(int) * nr_nodes * nr_nodes);
struct part *parts = s->parts;
......@@ -595,7 +595,7 @@ void engine_exchange_cells(struct engine *e) {
* @return The number of arrived parts copied to parts and xparts.
*/
int engine_exchange_strays(struct engine *e, int offset, size_t *ind, size_t N) {
int engine_exchange_strays(struct engine *e, int offset, int *ind, size_t N) {
#ifdef WITH_MPI
......
......@@ -182,7 +182,7 @@ void engine_init_particles(struct engine *e);
void engine_step(struct engine *e);
void engine_maketasks(struct engine *e);
void engine_split(struct engine *e, struct partition *initial_partition);
int engine_exchange_strays(struct engine *e, int offset, size_t *ind, size_t N);
int engine_exchange_strays(struct engine *e, int offset, int *ind, size_t N);
void engine_rebuild(struct engine *e);
void engine_repartition(struct engine *e);
void engine_makeproxies(struct engine *e);
......
......@@ -311,7 +311,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
int j, k, cdim[3], nr_parts = s->nr_parts, nr_gparts = s->nr_gparts;
struct cell *restrict c, *restrict cells;
struct part *restrict p;
size_t *ind;
int *ind;
double ih[3], dim[3];
ticks tic = getticks();
......@@ -325,7 +325,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Run through the particles and get their cell index. */
// tic = getticks();
const size_t ind_size = s->size_parts;
if ((ind = (size_t *)malloc(sizeof(size_t) * ind_size)) == NULL)
if ((ind = (int *)malloc(sizeof(int) * ind_size)) == NULL)
error("Failed to allocate temporary particle indices.");
ih[0] = s->ih[0];
ih[1] = s->ih[1];
......@@ -376,8 +376,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Re-allocate the index array if needed.. */
if (s->nr_parts > ind_size) {
size_t *ind_new;
if ((ind_new = (size_t *)malloc(sizeof(size_t) * s->nr_parts)) == NULL)
int *ind_new;
if ((ind_new = (int *)malloc(sizeof(int) * s->nr_parts)) == NULL)
error("Failed to allocate temporary particle indices.");
memcpy(ind_new, ind, sizeof(size_t) * nr_parts);
free(ind);
......@@ -419,7 +419,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
/* Run through the gravity particles and get their cell index. */
// tic = getticks();
if ((ind = (size_t *)malloc(sizeof(size_t) * s->size_gparts)) == NULL)
if ((ind = (int *)malloc(sizeof(int) * s->size_gparts)) == NULL)
error("Failed to allocate temporary particle indices.");
for (k = 0; k < nr_gparts; k++) {
struct gpart *gp = &s->gparts[k];
......@@ -506,7 +506,7 @@ void space_split(struct space *s, struct cell *cells, int verbose) {
* @param verbose Are we talkative ?
*/
void space_parts_sort(struct space *s, size_t *ind, size_t N, int min, int max,
void space_parts_sort(struct space *s, int *ind, size_t N, int min, int max,
int verbose) {
ticks tic = getticks();
......@@ -554,7 +554,7 @@ void space_parts_sort(struct space *s, size_t *ind, size_t N, int min, int max,
void space_do_parts_sort() {
/* Pointers to the sorting data. */
size_t *ind = space_sort_struct.ind;
int *ind = space_sort_struct.ind;
struct part *parts = space_sort_struct.parts;
struct xpart *xparts = space_sort_struct.xparts;
......@@ -676,7 +676,7 @@ void space_do_parts_sort() {
} /* main loop. */
}
void space_gparts_sort(struct gpart *gparts, size_t *ind, size_t N, int min,
void space_gparts_sort(struct gpart *gparts, int *ind, size_t N, int min,
int max) {
struct qstack {
......
......@@ -117,7 +117,7 @@ struct qstack {
struct parallel_sort {
struct part *parts;
struct xpart *xparts;
size_t *ind;
int *ind;
struct qstack *stack;
unsigned int stack_size;
volatile unsigned int first, last, waiting;
......@@ -125,9 +125,9 @@ struct parallel_sort {
extern struct parallel_sort space_sort_struct;
/* function prototypes. */
void space_parts_sort(struct space *s, size_t *ind, size_t N, int min, int max,
void space_parts_sort(struct space *s, int *ind, size_t N, int min, int max,
int verbose);
void space_gparts_sort(struct gpart *gparts, size_t *ind, size_t N, int min, int max);
void space_gparts_sort(struct gpart *gparts, int *ind, size_t N, int min, int max);
struct cell *space_getcell(struct space *s);
int space_getsid(struct space *s, struct cell **ci, struct cell **cj,
double *shift);
......
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