Commit 2814ffdc authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting

parent 7d6ea216
......@@ -432,7 +432,8 @@ int main(int argc, char *argv[]) {
}
/* Read the parameter file */
struct swift_params *params = (struct swift_params *)malloc(sizeof(struct swift_params));
struct swift_params *params =
(struct swift_params *)malloc(sizeof(struct swift_params));
if (params == NULL) error("Error allocating memory for the parameter file.");
if (myrank == 0) {
message("Reading runtime parameters from file '%s'", paramFileName);
......
......@@ -49,11 +49,11 @@
* @param alignment The alignment in bytes of the array.
*/
#if defined(__ICC)
#define swift_align_information(type, array, alignment) \
#define swift_align_information(type, array, alignment) \
__assume_aligned(array, alignment);
#elif defined(__GNUC__)
#define swift_align_information(type, array, alignment) \
array = (type *)__builtin_assume_aligned(array, alignment);
#define swift_align_information(type, array, alignment) \
array = (type *)__builtin_assume_aligned(array, alignment);
#else
#define swift_align_information(array, alignment) ;
#endif
......
......@@ -418,7 +418,7 @@ void io_copy_mapper(void* restrict temp, int N, void* restrict extra_data) {
const size_t copySize = typeSize * props.dimension;
/* How far are we with this chunk? */
char* restrict temp_c = (char *)temp;
char* restrict temp_c = (char*)temp;
const ptrdiff_t delta = (temp_c - props.start_temp_c) / copySize;
for (int k = 0; k < N; k++) {
......@@ -440,7 +440,7 @@ void io_convert_part_f_mapper(void* restrict temp, int N,
const size_t dim = props.dimension;
/* How far are we with this chunk? */
float* restrict temp_f = (float *)temp;
float* restrict temp_f = (float*)temp;
const ptrdiff_t delta = (temp_f - props.start_temp_f) / dim;
for (int i = 0; i < N; i++)
......@@ -460,7 +460,7 @@ void io_convert_part_d_mapper(void* restrict temp, int N,
const size_t dim = props.dimension;
/* How far are we with this chunk? */
double* restrict temp_d = (double *)temp;
double* restrict temp_d = (double*)temp;
const ptrdiff_t delta = (temp_d - props.start_temp_d) / dim;
for (int i = 0; i < N; i++)
......@@ -480,7 +480,7 @@ void io_convert_gpart_f_mapper(void* restrict temp, int N,
const size_t dim = props.dimension;
/* How far are we with this chunk? */
float* restrict temp_f = (float *)temp;
float* restrict temp_f = (float*)temp;
const ptrdiff_t delta = (temp_f - props.start_temp_f) / dim;
for (int i = 0; i < N; i++)
......@@ -500,7 +500,7 @@ void io_convert_gpart_d_mapper(void* restrict temp, int N,
const size_t dim = props.dimension;
/* How far are we with this chunk? */
double* restrict temp_d = (double *)temp;
double* restrict temp_d = (double*)temp;
const ptrdiff_t delta = (temp_d - props.start_temp_d) / dim;
for (int i = 0; i < N; i++)
......@@ -531,7 +531,7 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
if (props.conversion == 0) { /* No conversion */
/* Prepare some parameters */
char* temp_c = (char *)temp;
char* temp_c = (char*)temp;
props.start_temp_c = temp_c;
/* Copy the whole thing into a buffer */
......@@ -543,8 +543,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
if (props.convert_part_f != NULL) {
/* Prepare some parameters */
float* temp_f = (float *)temp;
props.start_temp_f = (float *)temp;
float* temp_f = (float*)temp;
props.start_temp_f = (float*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
......@@ -555,8 +555,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
} else if (props.convert_part_d != NULL) {
/* Prepare some parameters */
double* temp_d = (double *)temp;
props.start_temp_d = (double *)temp;
double* temp_d = (double*)temp;
props.start_temp_d = (double*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
......@@ -567,8 +567,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
} else if (props.convert_gpart_f != NULL) {
/* Prepare some parameters */
float* temp_f = (float *)temp;
props.start_temp_f = (float *)temp;
float* temp_f = (float*)temp;
props.start_temp_f = (float*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
......@@ -579,8 +579,8 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
} else if (props.convert_gpart_d != NULL) {
/* Prepare some parameters */
double* temp_d = (double *)temp;
props.start_temp_d = (double *)temp;
double* temp_d = (double*)temp;
props.start_temp_d = (double*)temp;
props.e = e;
/* Copy the whole thing into a buffer */
......@@ -601,10 +601,12 @@ void io_copy_temp_buffer(void* temp, const struct engine* e,
/* message("Converting ! factor=%e", factor); */
if (io_is_double_precision(props.type)) {
swift_declare_aligned_ptr(double, temp_d, (double *)temp, IO_BUFFER_ALIGNMENT);
swift_declare_aligned_ptr(double, temp_d, (double*)temp,
IO_BUFFER_ALIGNMENT);
for (size_t i = 0; i < num_elements; ++i) temp_d[i] *= factor;
} else {
swift_declare_aligned_ptr(float, temp_f, (float *)temp, IO_BUFFER_ALIGNMENT);
swift_declare_aligned_ptr(float, temp_f, (float*)temp,
IO_BUFFER_ALIGNMENT);
for (size_t i = 0; i < num_elements; ++i) temp_f[i] *= factor;
}
}
......
......@@ -2070,7 +2070,8 @@ void engine_exchange_proxy_multipoles(struct engine *e) {
/* Also allocate the MPI requests */
const int count_requests = count_send_requests + count_recv_requests;
MPI_Request *requests = (MPI_Request *)malloc(sizeof(MPI_Request) * count_requests);
MPI_Request *requests =
(MPI_Request *)malloc(sizeof(MPI_Request) * count_requests);
if (requests == NULL) error("Unable to allocate memory for MPI requests");
int this_request = 0;
......@@ -2311,7 +2312,8 @@ void engine_make_self_gravity_tasks(struct engine *e) {
task_subtype_none, 0, 0, NULL, NULL);
/* Create a grid of ghosts to deal with the dependencies */
if ((ghosts = (struct task **)malloc(n_ghosts * sizeof(struct task *))) == 0)
if ((ghosts = (struct task **)malloc(n_ghosts * sizeof(struct task *))) ==
0)
error("Error allocating memory for gravity fft ghosts");
/* Make the ghosts implicit and add the dependencies */
......@@ -3022,7 +3024,8 @@ void engine_maketasks(struct engine *e) {
e->size_links += s->tot_cells * self_grav_tasks_per_cell;
/* Allocate the new list */
if ((e->links = (struct link *)malloc(sizeof(struct link) * e->size_links)) == NULL)
if ((e->links = (struct link *)malloc(sizeof(struct link) * e->size_links)) ==
NULL)
error("Failed to allocate cell-task links.");
e->nr_links = 0;
......@@ -5848,7 +5851,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e->s = s;
s->e = e;
struct unit_system *us = (struct unit_system *)malloc(sizeof(struct unit_system));
struct unit_system *us =
(struct unit_system *)malloc(sizeof(struct unit_system));
units_struct_restore(us, stream);
e->internal_units = us;
......@@ -5857,16 +5861,19 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e->snapshotUnits = us;
#ifdef WITH_MPI
struct repartition *reparttype = (struct repartition *)malloc(sizeof(struct repartition));
struct repartition *reparttype =
(struct repartition *)malloc(sizeof(struct repartition));
partition_struct_restore(reparttype, stream);
e->reparttype = reparttype;
#endif
struct phys_const *physical_constants = (struct phys_const *)malloc(sizeof(struct phys_const));
struct phys_const *physical_constants =
(struct phys_const *)malloc(sizeof(struct phys_const));
phys_const_struct_restore(physical_constants, stream);
e->physical_constants = physical_constants;
struct hydro_props *hydro_properties = (struct hydro_props *)malloc(sizeof(struct hydro_props));
struct hydro_props *hydro_properties =
(struct hydro_props *)malloc(sizeof(struct hydro_props));
hydro_props_struct_restore(hydro_properties, stream);
e->hydro_properties = hydro_properties;
......@@ -5881,15 +5888,18 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e->external_potential = external_potential;
struct cooling_function_data *cooling_func =
(struct cooling_function_data *)malloc(sizeof(struct cooling_function_data));
(struct cooling_function_data *)malloc(
sizeof(struct cooling_function_data));
cooling_struct_restore(cooling_func, stream);
e->cooling_func = cooling_func;
struct sourceterms *sourceterms = (struct sourceterms *)malloc(sizeof(struct sourceterms));
struct sourceterms *sourceterms =
(struct sourceterms *)malloc(sizeof(struct sourceterms));
sourceterms_struct_restore(sourceterms, stream);
e->sourceterms = sourceterms;
struct swift_params *parameter_file = (struct swift_params *)malloc(sizeof(struct swift_params));
struct swift_params *parameter_file =
(struct swift_params *)malloc(sizeof(struct swift_params));
parser_struct_restore(parameter_file, stream);
e->parameter_file = parameter_file;
......
......@@ -128,16 +128,16 @@ void readArray_chunk(hid_t h_data, hid_t h_plist_id,
/* message("Converting ! factor=%e", factor); */
if (io_is_double_precision(props.type)) {
double* temp_d = (double *)temp;
double* temp_d = (double*)temp;
for (size_t i = 0; i < num_elements; ++i) temp_d[i] *= factor;
} else {
float* temp_f = (float *)temp;
float* temp_f = (float*)temp;
for (size_t i = 0; i < num_elements; ++i) temp_f[i] *= factor;
}
}
/* Copy temporary buffer to particle data */
char* temp_c = (char *)temp;
char* temp_c = (char*)temp;
for (size_t i = 0; i < N; ++i)
memcpy(props.field + i * props.partSize, &temp_c[i * copySize], copySize);
......@@ -640,7 +640,8 @@ void read_ic_parallel(char* fileName, const struct unit_system* internal_units,
H5Gclose(h_grp);
/* Read the unit system used in the ICs */
struct unit_system* ic_units = (struct unit_system *)malloc(sizeof(struct unit_system));
struct unit_system* ic_units =
(struct unit_system*)malloc(sizeof(struct unit_system));
if (ic_units == NULL) error("Unable to allocate memory for IC unit system");
io_read_unit_system(h_file, ic_units, mpi_rank);
......
......@@ -442,7 +442,8 @@ static void pick_metis(struct space *s, int nregions, double *vertexw,
* of old and new ranks. Each element of the array has a cell count and
* an unique index so we can sort into decreasing counts. */
int indmax = nregions * nregions;
struct indexval *ivs = (struct indexval *)malloc(sizeof(struct indexval) * indmax);
struct indexval *ivs =
(struct indexval *)malloc(sizeof(struct indexval) * indmax);
bzero(ivs, sizeof(struct indexval) * indmax);
for (int k = 0; k < ncells; k++) {
int index = regionid[k] + nregions * s->cells_top[k].nodeID;
......
......@@ -145,7 +145,8 @@ void proxy_addcell_in(struct proxy *p, struct cell *c, int type) {
p->size_cells_in *= proxy_buffgrow;
struct cell **temp_cell;
if ((temp_cell = (struct cell **)malloc(sizeof(struct cell *) * p->size_cells_in)) == NULL)
if ((temp_cell = (struct cell **)malloc(sizeof(struct cell *) *
p->size_cells_in)) == NULL)
error("Failed to allocate incoming cell list.");
memcpy(temp_cell, p->cells_in, sizeof(struct cell *) * p->nr_cells_in);
free(p->cells_in);
......@@ -190,7 +191,8 @@ void proxy_addcell_out(struct proxy *p, struct cell *c, int type) {
p->size_cells_out *= proxy_buffgrow;
struct cell **temp_cell;
if ((temp_cell = (struct cell **)malloc(sizeof(struct cell *) * p->size_cells_out)) == NULL)
if ((temp_cell = (struct cell **)malloc(sizeof(struct cell *) *
p->size_cells_out)) == NULL)
error("Failed to allocate outgoing cell list.");
memcpy(temp_cell, p->cells_out, sizeof(struct cell *) * p->nr_cells_out);
free(p->cells_out);
......
......@@ -133,8 +133,9 @@ void restart_write(struct engine *e, const char *filename) {
error("Failed to open restart file: %s (%s)", filename, strerror(errno));
/* Dump our signature and version. */
restart_write_blocks((void *)SWIFT_RESTART_SIGNATURE, strlen(SWIFT_RESTART_SIGNATURE),
1, stream, "signature", "SWIFT signature");
restart_write_blocks((void *)SWIFT_RESTART_SIGNATURE,
strlen(SWIFT_RESTART_SIGNATURE), 1, stream, "signature",
"SWIFT signature");
restart_write_blocks((void *)package_version(), strlen(package_version()), 1,
stream, "version", "SWIFT version");
......
......@@ -194,12 +194,12 @@ void runner_do_grav_fft(struct runner* r, int timer) {
#endif
/* Allocates some memory for the density mesh */
double* restrict rho = (double *)fftw_malloc(sizeof(double) * N * N * N);
double* restrict rho = (double*)fftw_malloc(sizeof(double) * N * N * N);
if (rho == NULL) error("Error allocating memory for density mesh");
/* Allocates some memory for the mesh in Fourier space */
fftw_complex* restrict frho =
(fftw_complex *)fftw_malloc(sizeof(fftw_complex) * N * N * (N_half + 1));
(fftw_complex*)fftw_malloc(sizeof(fftw_complex) * N * N * (N_half + 1));
if (frho == NULL)
error("Error allocating memory for transform of density mesh");
......
......@@ -208,10 +208,10 @@ static INLINE void runner_dopair_grav_pp_full(const struct engine *e,
float a_x = 0.f, a_y = 0.f, a_z = 0.f;
/* Make the compiler understand we are in happy vectorization land */
swift_align_information(float,cj_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,cj_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,cj_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,cj_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_assume_size(gcount_padded_j, VEC_SIZE);
/* Loop over every particle in the other cell. */
......@@ -299,10 +299,10 @@ static INLINE void runner_dopair_grav_pp_truncated(
float a_x = 0.f, a_y = 0.f, a_z = 0.f;
/* Make the compiler understand we are in happy vectorization land */
swift_align_information(float,cj_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,cj_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,cj_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,cj_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, cj_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_assume_size(gcount_padded_j, VEC_SIZE);
/* Loop over every particle in the other cell. */
......@@ -686,10 +686,10 @@ void runner_doself_grav_pp_full(struct runner *r, struct cell *c) {
float a_x = 0.f, a_y = 0.f, a_z = 0.f;
/* Make the compiler understand we are in happy vectorization land */
swift_align_information(float,ci_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,ci_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,ci_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,ci_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_assume_size(gcount_padded, VEC_SIZE);
/* Loop over every other particle in the cell. */
......@@ -812,10 +812,10 @@ void runner_doself_grav_pp_truncated(struct runner *r, struct cell *c) {
float a_x = 0.f, a_y = 0.f, a_z = 0.f;
/* Make the compiler understand we are in happy vectorization land */
swift_align_information(float,ci_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,ci_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,ci_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float,ci_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->x, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->y, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->z, SWIFT_CACHE_ALIGNMENT);
swift_align_information(float, ci_cache->m, SWIFT_CACHE_ALIGNMENT);
swift_assume_size(gcount_padded, VEC_SIZE);
/* Loop over every other particle in the cell. */
......
......@@ -1463,7 +1463,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
case task_type_recv:
#ifdef WITH_MPI
if (t->subtype == task_subtype_tend) {
t->buff = (struct pcell_step *)malloc(sizeof(struct pcell_step) * t->ci->pcell_size);
t->buff = (struct pcell_step *)malloc(sizeof(struct pcell_step) *
t->ci->pcell_size);
err = MPI_Irecv(
t->buff, t->ci->pcell_size * sizeof(struct pcell_step), MPI_BYTE,
t->ci->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
......@@ -1482,7 +1483,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
err = MPI_Irecv(t->ci->sparts, t->ci->scount, spart_mpi_type,
t->ci->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
} else if (t->subtype == task_subtype_multipole) {
t->buff = (struct gravity_tensors *)malloc(sizeof(struct gravity_tensors) * t->ci->pcell_size);
t->buff = (struct gravity_tensors *)malloc(
sizeof(struct gravity_tensors) * t->ci->pcell_size);
err = MPI_Irecv(
t->buff, sizeof(struct gravity_tensors) * t->ci->pcell_size,
MPI_BYTE, t->ci->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
......@@ -1500,7 +1502,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
case task_type_send:
#ifdef WITH_MPI
if (t->subtype == task_subtype_tend) {
t->buff = (struct pcell_step *)malloc(sizeof(struct pcell_step) * t->ci->pcell_size);
t->buff = (struct pcell_step *)malloc(sizeof(struct pcell_step) *
t->ci->pcell_size);
cell_pack_end_step(t->ci, (struct pcell_step *)t->buff);
if ((t->ci->pcell_size * sizeof(struct pcell_step)) >
s->mpi_message_limit)
......@@ -1538,7 +1541,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
err = MPI_Issend(t->ci->sparts, t->ci->scount, spart_mpi_type,
t->cj->nodeID, t->flags, MPI_COMM_WORLD, &t->req);
} else if (t->subtype == task_subtype_multipole) {
t->buff = (struct gravity_tensors *)malloc(sizeof(struct gravity_tensors) * t->ci->pcell_size);
t->buff = (struct gravity_tensors *)malloc(
sizeof(struct gravity_tensors) * t->ci->pcell_size);
cell_pack_multipoles(t->ci, (struct gravity_tensors *)t->buff);
err = MPI_Isend(
t->buff, t->ci->pcell_size * sizeof(struct gravity_tensors),
......
......@@ -131,16 +131,16 @@ void readArray(hid_t h_grp, const struct io_props prop, size_t N,
/* message("Converting ! factor=%e", factor); */
if (io_is_double_precision(prop.type)) {
double* temp_d = (double *)temp;
double* temp_d = (double*)temp;
for (size_t i = 0; i < num_elements; ++i) temp_d[i] *= factor;
} else {
float* temp_f = (float *)temp;
float* temp_f = (float*)temp;
for (size_t i = 0; i < num_elements; ++i) temp_f[i] *= factor;
}
}
/* Copy temporary buffer to particle data */
char* temp_c = (char *)temp;
char* temp_c = (char*)temp;
for (size_t i = 0; i < N; ++i)
memcpy(prop.field + i * prop.partSize, &temp_c[i * copySize], copySize);
......@@ -387,7 +387,8 @@ void read_ic_single(char* fileName, const struct unit_system* internal_units,
H5Gclose(h_grp);
/* Read the unit system used in the ICs */
struct unit_system* ic_units = (struct unit_system *)malloc(sizeof(struct unit_system));
struct unit_system* ic_units =
(struct unit_system*)malloc(sizeof(struct unit_system));
if (ic_units == NULL) error("Unable to allocate memory for IC unit system");
io_read_unit_system(h_file, ic_units, 0);
......@@ -428,8 +429,8 @@ void read_ic_single(char* fileName, const struct unit_system* internal_units,
/* Allocate memory to store SPH particles */
if (with_hydro) {
*Ngas = N[swift_type_gas];
if (posix_memalign((void **)parts, part_align, *Ngas * sizeof(struct part)) !=
0)
if (posix_memalign((void**)parts, part_align,
*Ngas * sizeof(struct part)) != 0)
error("Error while allocating memory for SPH particles");
bzero(*parts, *Ngas * sizeof(struct part));
}
......@@ -437,7 +438,7 @@ void read_ic_single(char* fileName, const struct unit_system* internal_units,
/* Allocate memory to store star particles */
if (with_stars) {
*Nstars = N[swift_type_star];
if (posix_memalign((void **)sparts, spart_align,
if (posix_memalign((void**)sparts, spart_align,
*Nstars * sizeof(struct spart)) != 0)
error("Error while allocating memory for star particles");
bzero(*sparts, *Nstars * sizeof(struct spart));
......@@ -449,7 +450,7 @@ void read_ic_single(char* fileName, const struct unit_system* internal_units,
*Ngparts = (with_hydro ? N[swift_type_gas] : 0) +
N[swift_type_dark_matter] +
(with_stars ? N[swift_type_star] : 0);
if (posix_memalign((void **)gparts, gpart_align,
if (posix_memalign((void**)gparts, gpart_align,
*Ngparts * sizeof(struct gpart)) != 0)
error("Error while allocating memory for gravity particles");
bzero(*gparts, *Ngparts * sizeof(struct gpart));
......@@ -581,9 +582,8 @@ void write_output_single(struct engine* e, const char* baseName,
/* Number of unassociated gparts */
const size_t Ndm = Ntot > 0 ? Ntot - (Ngas + Nstars) : 0;
long long N_total[swift_type_count] = {(long long)Ngas,
(long long)Ndm, 0, 0,
(long long)Nstars, 0};
long long N_total[swift_type_count] = {
(long long)Ngas, (long long)Ndm, 0, 0, (long long)Nstars, 0};
/* File name */
char fileName[FILENAME_BUFFER_SIZE];
......@@ -767,7 +767,7 @@ void write_output_single(struct engine* e, const char* baseName,
case swift_type_dark_matter:
/* Allocate temporary array */
if (posix_memalign((void **)&dmparts, gpart_align,
if (posix_memalign((void**)&dmparts, gpart_align,
Ndm * sizeof(struct gpart)) != 0)
error("Error while allocating temporart memory for DM particles");
bzero(dmparts, Ndm * sizeof(struct gpart));
......
......@@ -1346,8 +1346,8 @@ void space_parts_sort(struct space *s, int *ind, size_t N, int min, int max,
sort_struct.xparts = s->xparts;
sort_struct.ind = ind;
sort_struct.stack_size = 2 * (max - min + 1) + 10 + s->e->nr_threads;
if ((sort_struct.stack = (struct qstack *)
malloc(sizeof(struct qstack) * sort_struct.stack_size)) == NULL)
if ((sort_struct.stack = (struct qstack *)malloc(
sizeof(struct qstack) * sort_struct.stack_size)) == NULL)
error("Failed to allocate sorting stack.");
for (unsigned int i = 0; i < sort_struct.stack_size; i++)
sort_struct.stack[i].ready = 0;
......@@ -1530,8 +1530,8 @@ void space_sparts_sort(struct space *s, int *ind, size_t N, int min, int max,
sort_struct.sparts = s->sparts;
sort_struct.ind = ind;
sort_struct.stack_size = 2 * (max - min + 1) + 10 + s->e->nr_threads;
if ((sort_struct.stack = (struct qstack *)
malloc(sizeof(struct qstack) * sort_struct.stack_size)) == NULL)
if ((sort_struct.stack = (struct qstack *)malloc(
sizeof(struct qstack) * sort_struct.stack_size)) == NULL)
error("Failed to allocate sorting stack.");
for (unsigned int i = 0; i < sort_struct.stack_size; i++)
sort_struct.stack[i].ready = 0;
......@@ -1713,8 +1713,8 @@ void space_gparts_sort(struct space *s, int *ind, size_t N, int min, int max,
sort_struct.gparts = s->gparts;
sort_struct.ind = ind;
sort_struct.stack_size = 2 * (max - min + 1) + 10 + s->e->nr_threads;
if ((sort_struct.stack = (struct qstack *)
malloc(sizeof(struct qstack) * sort_struct.stack_size)) == NULL)
if ((sort_struct.stack = (struct qstack *)malloc(
sizeof(struct qstack) * sort_struct.stack_size)) == NULL)
error("Failed to allocate sorting stack.");
for (unsigned int i = 0; i < sort_struct.stack_size; i++)
sort_struct.stack[i].ready = 0;
......
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