Commit 7eb507ec authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Code formatting and documentation

parent 65ceeb07
......@@ -3932,7 +3932,7 @@ void engine_rebuild(struct engine *e, int clean_smoothing_length_values) {
/* Construct the list of purely local cells */
space_list_local_cells(e->s);
/* Re-compute the mesh forces */
if ((e->policy & engine_policy_self_gravity) && e->s->periodic)
pm_mesh_compute_potential(e->mesh, e->s, &e->threadpool, e->verbose);
......@@ -4220,7 +4220,8 @@ void engine_collect_end_of_step(struct engine *e, int apply) {
/* Collect information from the local top-level cells */
threadpool_map(&e->threadpool, engine_collect_end_of_step_mapper,
s->local_cells_with_tasks_top, s->nr_local_cells_with_tasks, sizeof(int), 0, &data);
s->local_cells_with_tasks_top, s->nr_local_cells_with_tasks,
sizeof(int), 0, &data);
/* Store these in the temporary collection group. */
collectgroup1_init(&e->collect_group1, data.updates, data.g_updates,
......@@ -5094,8 +5095,10 @@ void engine_unskip(struct engine *e) {
struct cell *c = &s->cells_top[local_cells[k]];
if ((e->policy & engine_policy_hydro && cell_is_active_hydro(c, e)) ||
(e->policy & engine_policy_self_gravity && cell_is_active_gravity(c, e)) ||
(e->policy & engine_policy_external_gravity && cell_is_active_gravity(c, e))) {
(e->policy & engine_policy_self_gravity &&
cell_is_active_gravity(c, e)) ||
(e->policy & engine_policy_external_gravity &&
cell_is_active_gravity(c, e))) {
if (num_active_cells != k)
memswap(&local_cells[k], &local_cells[num_active_cells], sizeof(int));
......
......@@ -194,11 +194,12 @@ void cell_gpart_to_mesh_CIC(const struct cell* c, double* rho, int N,
}
/**
* @brief Shared information about the mesh to be used by all the threads in the pool.
* @brief Shared information about the mesh to be used by all the threads in the
* pool.
*/
struct cic_mapper_data{
const struct cell *cells;
double *rho;
struct cic_mapper_data {
const struct cell* cells;
double* rho;
int N;
double fac;
double dim[3];
......@@ -211,29 +212,29 @@ struct cic_mapper_data{
* @param num The number of cells in the chunk.
* @param extra The information about the mesh and cells.
*/
void cell_gpart_to_mesh_CIC_mapper(void *map_data, int num, void* extra) {
void cell_gpart_to_mesh_CIC_mapper(void* map_data, int num, void* extra) {
/* Unpack the shared information */
const struct cic_mapper_data *data = (struct cic_mapper_data*) extra;
const struct cell *cells = data->cells;
double *rho = data->rho;
const struct cic_mapper_data* data = (struct cic_mapper_data*)extra;
const struct cell* cells = data->cells;
double* rho = data->rho;
const int N = data->N;
const double fac = data->fac;
const double dim[3] = {data->dim[0], data->dim[1], data->dim[2]};
/* Pointer to the chunk to be processed */
int *local_cells = (int *)map_data;
int* local_cells = (int*)map_data;
//MATTHIEU: This could in principle be improved by creating a local mesh
// with just the extent required for the cell. Assignment can
// then be done without atomics. That local mesh is then added
// atomically to the global one.
// MATTHIEU: This could in principle be improved by creating a local mesh
// with just the extent required for the cell. Assignment can
// then be done without atomics. That local mesh is then added
// atomically to the global one.
/* Loop over the elements assigned to this thread */
for (int i = 0; i < num; ++i) {
/* Pointer to local cell */
const struct cell *c = &cells[local_cells[i]];
const struct cell* c = &cells[local_cells[i]];
/* Assign this cell's content to the mesh */
cell_gpart_to_mesh_CIC(c, rho, N, fac, dim);
......@@ -358,7 +359,7 @@ void mesh_to_gparts_CIC(struct gpart* gp, const double* pot, int N, double fac,
* @param verbose Are we talkative?
*/
void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct space* s,
struct threadpool *tp, int verbose) {
struct threadpool* tp, int verbose) {
#ifdef HAVE_FFTW
......@@ -409,8 +410,8 @@ void pm_mesh_compute_potential(struct pm_mesh* mesh, const struct space* s,
/* Do a parallel CIC mesh assignment of the gparts but only using
the local top-level cells */
threadpool_map(tp, cell_gpart_to_mesh_CIC_mapper, (void*) local_cells,
nr_local_cells, sizeof(int), 0, (void*) &data);
threadpool_map(tp, cell_gpart_to_mesh_CIC_mapper, (void*)local_cells,
nr_local_cells, sizeof(int), 0, (void*)&data);
if (verbose)
message("Gpart assignment took %.3f %s.",
......
......@@ -68,7 +68,7 @@ void pm_mesh_init(struct pm_mesh *mesh, const struct gravity_props *props,
double dim[3]);
void pm_mesh_init_no_mesh(struct pm_mesh *mesh, double dim[3]);
void pm_mesh_compute_potential(struct pm_mesh *mesh, const struct space *s,
struct threadpool* tp, int verbose);
struct threadpool *tp, int verbose);
void pm_mesh_interpolate_forces(const struct pm_mesh *mesh,
const struct engine *e, struct gpart *gparts,
int gcount);
......
......@@ -1718,49 +1718,39 @@ INLINE static void gravity_M2L(struct grav_tensor *l_b,
const float M_112 = m_a->M_112;
/* Compute 4th order field tensor terms (addition to rank 0) */
l_b->F_000 +=
M_004 * pot.D_004 + M_013 * pot.D_013 + M_022 * pot.D_022 +
M_031 * pot.D_031 + M_040 * pot.D_040 + M_103 * pot.D_103 +
M_112 * pot.D_112 + M_121 * pot.D_121 + M_130 * pot.D_130 +
M_202 * pot.D_202 + M_211 * pot.D_211 + M_220 * pot.D_220 +
M_301 * pot.D_301 + M_310 * pot.D_310 + M_400 * pot.D_400;
l_b->F_000 += M_004 * pot.D_004 + M_013 * pot.D_013 + M_022 * pot.D_022 +
M_031 * pot.D_031 + M_040 * pot.D_040 + M_103 * pot.D_103 +
M_112 * pot.D_112 + M_121 * pot.D_121 + M_130 * pot.D_130 +
M_202 * pot.D_202 + M_211 * pot.D_211 + M_220 * pot.D_220 +
M_301 * pot.D_301 + M_310 * pot.D_310 + M_400 * pot.D_400;
/* Compute 4th order field tensor terms (addition to rank 1) */
l_b->F_001 += M_003 * pot.D_004 + M_012 * pot.D_013 +
M_021 * pot.D_022 + M_030 * pot.D_031 +
M_102 * pot.D_103 + M_111 * pot.D_112 +
M_120 * pot.D_121 + M_201 * pot.D_202 +
M_210 * pot.D_211 + M_300 * pot.D_301;
l_b->F_010 += M_003 * pot.D_013 + M_012 * pot.D_022 +
M_021 * pot.D_031 + M_030 * pot.D_040 +
M_102 * pot.D_112 + M_111 * pot.D_121 +
M_120 * pot.D_130 + M_201 * pot.D_211 +
M_210 * pot.D_220 + M_300 * pot.D_310;
l_b->F_100 += M_003 * pot.D_103 + M_012 * pot.D_112 +
M_021 * pot.D_121 + M_030 * pot.D_130 +
M_102 * pot.D_202 + M_111 * pot.D_211 +
M_120 * pot.D_220 + M_201 * pot.D_301 +
M_210 * pot.D_310 + M_300 * pot.D_400;
l_b->F_001 += M_003 * pot.D_004 + M_012 * pot.D_013 + M_021 * pot.D_022 +
M_030 * pot.D_031 + M_102 * pot.D_103 + M_111 * pot.D_112 +
M_120 * pot.D_121 + M_201 * pot.D_202 + M_210 * pot.D_211 +
M_300 * pot.D_301;
l_b->F_010 += M_003 * pot.D_013 + M_012 * pot.D_022 + M_021 * pot.D_031 +
M_030 * pot.D_040 + M_102 * pot.D_112 + M_111 * pot.D_121 +
M_120 * pot.D_130 + M_201 * pot.D_211 + M_210 * pot.D_220 +
M_300 * pot.D_310;
l_b->F_100 += M_003 * pot.D_103 + M_012 * pot.D_112 + M_021 * pot.D_121 +
M_030 * pot.D_130 + M_102 * pot.D_202 + M_111 * pot.D_211 +
M_120 * pot.D_220 + M_201 * pot.D_301 + M_210 * pot.D_310 +
M_300 * pot.D_400;
/* Compute 4th order field tensor terms (addition to rank 2) */
l_b->F_002 += M_002 * pot.D_004 + M_011 * pot.D_013 +
M_020 * pot.D_022 + M_101 * pot.D_103 +
M_110 * pot.D_112 + M_200 * pot.D_202;
l_b->F_011 += M_002 * pot.D_013 + M_011 * pot.D_022 +
M_020 * pot.D_031 + M_101 * pot.D_112 +
M_110 * pot.D_121 + M_200 * pot.D_211;
l_b->F_020 += M_002 * pot.D_022 + M_011 * pot.D_031 +
M_020 * pot.D_040 + M_101 * pot.D_121 +
M_110 * pot.D_130 + M_200 * pot.D_220;
l_b->F_101 += M_002 * pot.D_103 + M_011 * pot.D_112 +
M_020 * pot.D_121 + M_101 * pot.D_202 +
M_110 * pot.D_211 + M_200 * pot.D_301;
l_b->F_110 += M_002 * pot.D_112 + M_011 * pot.D_121 +
M_020 * pot.D_130 + M_101 * pot.D_211 +
M_110 * pot.D_220 + M_200 * pot.D_310;
l_b->F_200 += M_002 * pot.D_202 + M_011 * pot.D_211 +
M_020 * pot.D_220 + M_101 * pot.D_301 +
M_110 * pot.D_310 + M_200 * pot.D_400;
l_b->F_002 += M_002 * pot.D_004 + M_011 * pot.D_013 + M_020 * pot.D_022 +
M_101 * pot.D_103 + M_110 * pot.D_112 + M_200 * pot.D_202;
l_b->F_011 += M_002 * pot.D_013 + M_011 * pot.D_022 + M_020 * pot.D_031 +
M_101 * pot.D_112 + M_110 * pot.D_121 + M_200 * pot.D_211;
l_b->F_020 += M_002 * pot.D_022 + M_011 * pot.D_031 + M_020 * pot.D_040 +
M_101 * pot.D_121 + M_110 * pot.D_130 + M_200 * pot.D_220;
l_b->F_101 += M_002 * pot.D_103 + M_011 * pot.D_112 + M_020 * pot.D_121 +
M_101 * pot.D_202 + M_110 * pot.D_211 + M_200 * pot.D_301;
l_b->F_110 += M_002 * pot.D_112 + M_011 * pot.D_121 + M_020 * pot.D_130 +
M_101 * pot.D_211 + M_110 * pot.D_220 + M_200 * pot.D_310;
l_b->F_200 += M_002 * pot.D_202 + M_011 * pot.D_211 + M_020 * pot.D_220 +
M_101 * pot.D_301 + M_110 * pot.D_310 + M_200 * pot.D_400;
/* Compute 4th order field tensor terms (addition to rank 3) */
l_b->F_003 += M_001 * pot.D_004 + M_010 * pot.D_013 + M_100 * pot.D_103;
......@@ -1817,98 +1807,78 @@ INLINE static void gravity_M2L(struct grav_tensor *l_b,
const float M_113 = m_a->M_113;
/* Compute 5th order field tensor terms (addition to rank 0) */
l_b->F_000 +=
M_005 * pot.D_005 + M_014 * pot.D_014 + M_023 * pot.D_023 +
M_032 * pot.D_032 + M_041 * pot.D_041 + M_050 * pot.D_050 +
M_104 * pot.D_104 + M_113 * pot.D_113 + M_122 * pot.D_122 +
M_131 * pot.D_131 + M_140 * pot.D_140 + M_203 * pot.D_203 +
M_212 * pot.D_212 + M_221 * pot.D_221 + M_230 * pot.D_230 +
M_302 * pot.D_302 + M_311 * pot.D_311 + M_320 * pot.D_320 +
M_401 * pot.D_401 + M_410 * pot.D_410 + M_500 * pot.D_500;
l_b->F_000 += M_005 * pot.D_005 + M_014 * pot.D_014 + M_023 * pot.D_023 +
M_032 * pot.D_032 + M_041 * pot.D_041 + M_050 * pot.D_050 +
M_104 * pot.D_104 + M_113 * pot.D_113 + M_122 * pot.D_122 +
M_131 * pot.D_131 + M_140 * pot.D_140 + M_203 * pot.D_203 +
M_212 * pot.D_212 + M_221 * pot.D_221 + M_230 * pot.D_230 +
M_302 * pot.D_302 + M_311 * pot.D_311 + M_320 * pot.D_320 +
M_401 * pot.D_401 + M_410 * pot.D_410 + M_500 * pot.D_500;
/* Compute 5th order field tensor terms (addition to rank 1) */
l_b->F_001 +=
M_004 * pot.D_005 + M_013 * pot.D_014 + M_022 * pot.D_023 +
M_031 * pot.D_032 + M_040 * pot.D_041 + M_103 * pot.D_104 +
M_112 * pot.D_113 + M_121 * pot.D_122 + M_130 * pot.D_131 +
M_202 * pot.D_203 + M_211 * pot.D_212 + M_220 * pot.D_221 +
M_301 * pot.D_302 + M_310 * pot.D_311 + M_400 * pot.D_401;
l_b->F_010 +=
M_004 * pot.D_014 + M_013 * pot.D_023 + M_022 * pot.D_032 +
M_031 * pot.D_041 + M_040 * pot.D_050 + M_103 * pot.D_113 +
M_112 * pot.D_122 + M_121 * pot.D_131 + M_130 * pot.D_140 +
M_202 * pot.D_212 + M_211 * pot.D_221 + M_220 * pot.D_230 +
M_301 * pot.D_311 + M_310 * pot.D_320 + M_400 * pot.D_410;
l_b->F_100 +=
M_004 * pot.D_104 + M_013 * pot.D_113 + M_022 * pot.D_122 +
M_031 * pot.D_131 + M_040 * pot.D_140 + M_103 * pot.D_203 +
M_112 * pot.D_212 + M_121 * pot.D_221 + M_130 * pot.D_230 +
M_202 * pot.D_302 + M_211 * pot.D_311 + M_220 * pot.D_320 +
M_301 * pot.D_401 + M_310 * pot.D_410 + M_400 * pot.D_500;
l_b->F_001 += M_004 * pot.D_005 + M_013 * pot.D_014 + M_022 * pot.D_023 +
M_031 * pot.D_032 + M_040 * pot.D_041 + M_103 * pot.D_104 +
M_112 * pot.D_113 + M_121 * pot.D_122 + M_130 * pot.D_131 +
M_202 * pot.D_203 + M_211 * pot.D_212 + M_220 * pot.D_221 +
M_301 * pot.D_302 + M_310 * pot.D_311 + M_400 * pot.D_401;
l_b->F_010 += M_004 * pot.D_014 + M_013 * pot.D_023 + M_022 * pot.D_032 +
M_031 * pot.D_041 + M_040 * pot.D_050 + M_103 * pot.D_113 +
M_112 * pot.D_122 + M_121 * pot.D_131 + M_130 * pot.D_140 +
M_202 * pot.D_212 + M_211 * pot.D_221 + M_220 * pot.D_230 +
M_301 * pot.D_311 + M_310 * pot.D_320 + M_400 * pot.D_410;
l_b->F_100 += M_004 * pot.D_104 + M_013 * pot.D_113 + M_022 * pot.D_122 +
M_031 * pot.D_131 + M_040 * pot.D_140 + M_103 * pot.D_203 +
M_112 * pot.D_212 + M_121 * pot.D_221 + M_130 * pot.D_230 +
M_202 * pot.D_302 + M_211 * pot.D_311 + M_220 * pot.D_320 +
M_301 * pot.D_401 + M_310 * pot.D_410 + M_400 * pot.D_500;
/* Compute 5th order field tensor terms (addition to rank 2) */
l_b->F_002 += M_003 * pot.D_005 + M_012 * pot.D_014 +
M_021 * pot.D_023 + M_030 * pot.D_032 +
M_102 * pot.D_104 + M_111 * pot.D_113 +
M_120 * pot.D_122 + M_201 * pot.D_203 +
M_210 * pot.D_212 + M_300 * pot.D_302;
l_b->F_011 += M_003 * pot.D_014 + M_012 * pot.D_023 +
M_021 * pot.D_032 + M_030 * pot.D_041 +
M_102 * pot.D_113 + M_111 * pot.D_122 +
M_120 * pot.D_131 + M_201 * pot.D_212 +
M_210 * pot.D_221 + M_300 * pot.D_311;
l_b->F_020 += M_003 * pot.D_023 + M_012 * pot.D_032 +
M_021 * pot.D_041 + M_030 * pot.D_050 +
M_102 * pot.D_122 + M_111 * pot.D_131 +
M_120 * pot.D_140 + M_201 * pot.D_221 +
M_210 * pot.D_230 + M_300 * pot.D_320;
l_b->F_101 += M_003 * pot.D_104 + M_012 * pot.D_113 +
M_021 * pot.D_122 + M_030 * pot.D_131 +
M_102 * pot.D_203 + M_111 * pot.D_212 +
M_120 * pot.D_221 + M_201 * pot.D_302 +
M_210 * pot.D_311 + M_300 * pot.D_401;
l_b->F_110 += M_003 * pot.D_113 + M_012 * pot.D_122 +
M_021 * pot.D_131 + M_030 * pot.D_140 +
M_102 * pot.D_212 + M_111 * pot.D_221 +
M_120 * pot.D_230 + M_201 * pot.D_311 +
M_210 * pot.D_320 + M_300 * pot.D_410;
l_b->F_200 += M_003 * pot.D_203 + M_012 * pot.D_212 +
M_021 * pot.D_221 + M_030 * pot.D_230 +
M_102 * pot.D_302 + M_111 * pot.D_311 +
M_120 * pot.D_320 + M_201 * pot.D_401 +
M_210 * pot.D_410 + M_300 * pot.D_500;
l_b->F_002 += M_003 * pot.D_005 + M_012 * pot.D_014 + M_021 * pot.D_023 +
M_030 * pot.D_032 + M_102 * pot.D_104 + M_111 * pot.D_113 +
M_120 * pot.D_122 + M_201 * pot.D_203 + M_210 * pot.D_212 +
M_300 * pot.D_302;
l_b->F_011 += M_003 * pot.D_014 + M_012 * pot.D_023 + M_021 * pot.D_032 +
M_030 * pot.D_041 + M_102 * pot.D_113 + M_111 * pot.D_122 +
M_120 * pot.D_131 + M_201 * pot.D_212 + M_210 * pot.D_221 +
M_300 * pot.D_311;
l_b->F_020 += M_003 * pot.D_023 + M_012 * pot.D_032 + M_021 * pot.D_041 +
M_030 * pot.D_050 + M_102 * pot.D_122 + M_111 * pot.D_131 +
M_120 * pot.D_140 + M_201 * pot.D_221 + M_210 * pot.D_230 +
M_300 * pot.D_320;
l_b->F_101 += M_003 * pot.D_104 + M_012 * pot.D_113 + M_021 * pot.D_122 +
M_030 * pot.D_131 + M_102 * pot.D_203 + M_111 * pot.D_212 +
M_120 * pot.D_221 + M_201 * pot.D_302 + M_210 * pot.D_311 +
M_300 * pot.D_401;
l_b->F_110 += M_003 * pot.D_113 + M_012 * pot.D_122 + M_021 * pot.D_131 +
M_030 * pot.D_140 + M_102 * pot.D_212 + M_111 * pot.D_221 +
M_120 * pot.D_230 + M_201 * pot.D_311 + M_210 * pot.D_320 +
M_300 * pot.D_410;
l_b->F_200 += M_003 * pot.D_203 + M_012 * pot.D_212 + M_021 * pot.D_221 +
M_030 * pot.D_230 + M_102 * pot.D_302 + M_111 * pot.D_311 +
M_120 * pot.D_320 + M_201 * pot.D_401 + M_210 * pot.D_410 +
M_300 * pot.D_500;
/* Compute 5th order field tensor terms (addition to rank 3) */
l_b->F_003 += M_002 * pot.D_005 + M_011 * pot.D_014 +
M_020 * pot.D_023 + M_101 * pot.D_104 +
M_110 * pot.D_113 + M_200 * pot.D_203;
l_b->F_012 += M_002 * pot.D_014 + M_011 * pot.D_023 +
M_020 * pot.D_032 + M_101 * pot.D_113 +
M_110 * pot.D_122 + M_200 * pot.D_212;
l_b->F_021 += M_002 * pot.D_023 + M_011 * pot.D_032 +
M_020 * pot.D_041 + M_101 * pot.D_122 +
M_110 * pot.D_131 + M_200 * pot.D_221;
l_b->F_030 += M_002 * pot.D_032 + M_011 * pot.D_041 +
M_020 * pot.D_050 + M_101 * pot.D_131 +
M_110 * pot.D_140 + M_200 * pot.D_230;
l_b->F_102 += M_002 * pot.D_104 + M_011 * pot.D_113 +
M_020 * pot.D_122 + M_101 * pot.D_203 +
M_110 * pot.D_212 + M_200 * pot.D_302;
l_b->F_111 += M_002 * pot.D_113 + M_011 * pot.D_122 +
M_020 * pot.D_131 + M_101 * pot.D_212 +
M_110 * pot.D_221 + M_200 * pot.D_311;
l_b->F_120 += M_002 * pot.D_122 + M_011 * pot.D_131 +
M_020 * pot.D_140 + M_101 * pot.D_221 +
M_110 * pot.D_230 + M_200 * pot.D_320;
l_b->F_201 += M_002 * pot.D_203 + M_011 * pot.D_212 +
M_020 * pot.D_221 + M_101 * pot.D_302 +
M_110 * pot.D_311 + M_200 * pot.D_401;
l_b->F_210 += M_002 * pot.D_212 + M_011 * pot.D_221 +
M_020 * pot.D_230 + M_101 * pot.D_311 +
M_110 * pot.D_320 + M_200 * pot.D_410;
l_b->F_300 += M_002 * pot.D_302 + M_011 * pot.D_311 +
M_020 * pot.D_320 + M_101 * pot.D_401 +
M_110 * pot.D_410 + M_200 * pot.D_500;
l_b->F_003 += M_002 * pot.D_005 + M_011 * pot.D_014 + M_020 * pot.D_023 +
M_101 * pot.D_104 + M_110 * pot.D_113 + M_200 * pot.D_203;
l_b->F_012 += M_002 * pot.D_014 + M_011 * pot.D_023 + M_020 * pot.D_032 +
M_101 * pot.D_113 + M_110 * pot.D_122 + M_200 * pot.D_212;
l_b->F_021 += M_002 * pot.D_023 + M_011 * pot.D_032 + M_020 * pot.D_041 +
M_101 * pot.D_122 + M_110 * pot.D_131 + M_200 * pot.D_221;
l_b->F_030 += M_002 * pot.D_032 + M_011 * pot.D_041 + M_020 * pot.D_050 +
M_101 * pot.D_131 + M_110 * pot.D_140 + M_200 * pot.D_230;
l_b->F_102 += M_002 * pot.D_104 + M_011 * pot.D_113 + M_020 * pot.D_122 +
M_101 * pot.D_203 + M_110 * pot.D_212 + M_200 * pot.D_302;
l_b->F_111 += M_002 * pot.D_113 + M_011 * pot.D_122 + M_020 * pot.D_131 +
M_101 * pot.D_212 + M_110 * pot.D_221 + M_200 * pot.D_311;
l_b->F_120 += M_002 * pot.D_122 + M_011 * pot.D_131 + M_020 * pot.D_140 +
M_101 * pot.D_221 + M_110 * pot.D_230 + M_200 * pot.D_320;
l_b->F_201 += M_002 * pot.D_203 + M_011 * pot.D_212 + M_020 * pot.D_221 +
M_101 * pot.D_302 + M_110 * pot.D_311 + M_200 * pot.D_401;
l_b->F_210 += M_002 * pot.D_212 + M_011 * pot.D_221 + M_020 * pot.D_230 +
M_101 * pot.D_311 + M_110 * pot.D_320 + M_200 * pot.D_410;
l_b->F_300 += M_002 * pot.D_302 + M_011 * pot.D_311 + M_020 * pot.D_320 +
M_101 * pot.D_401 + M_110 * pot.D_410 + M_200 * pot.D_500;
/* Compute 5th order field tensor terms (addition to rank 4) */
l_b->F_004 += M_001 * pot.D_005 + M_010 * pot.D_014 + M_100 * pot.D_104;
......
......@@ -400,8 +400,8 @@ void space_regrid(struct space *s, int verbose) {
bzero(s->local_cells_top, s->nr_cells * sizeof(int));
/* Allocate the indices of local cells with tasks */
if (posix_memalign((void **)&s->local_cells_with_tasks_top, SWIFT_STRUCT_ALIGNMENT,
s->nr_cells * sizeof(int)) != 0)
if (posix_memalign((void **)&s->local_cells_with_tasks_top,
SWIFT_STRUCT_ALIGNMENT, s->nr_cells * sizeof(int)) != 0)
error("Failed to allocate indices of local top-level cells.");
bzero(s->local_cells_with_tasks_top, s->nr_cells * sizeof(int));
......@@ -2360,7 +2360,8 @@ void space_list_cells_with_tasks(struct space *s) {
s->nr_local_cells_with_tasks++;
}
if (s->e->verbose)
message("Have %d local top-level cells with tasks (total=%d)", s->nr_local_cells_with_tasks, s->nr_cells);
message("Have %d local top-level cells with tasks (total=%d)",
s->nr_local_cells_with_tasks, s->nr_cells);
}
/**
......@@ -2375,13 +2376,14 @@ void space_list_local_cells(struct space *s) {
s->nr_local_cells = 0;
for (int i = 0; i < s->nr_cells; ++i)
if(s->cells_top[i].nodeID == engine_rank) {
if (s->cells_top[i].nodeID == engine_rank) {
s->local_cells_top[s->nr_local_cells] = i;
s->nr_local_cells++;
}
if (s->e->verbose)
message("Have %d local top-level cells (total=%d)", s->nr_local_cells, s->nr_cells);
message("Have %d local top-level cells (total=%d)", s->nr_local_cells,
s->nr_cells);
}
void space_synchronize_particle_positions_mapper(void *map_data, int nr_gparts,
......
......@@ -106,7 +106,7 @@ struct space {
/*! Total number of cells (top- and sub-) */
int tot_cells;
/*! Number of *local* top-level cells */
/*! Number of *local* top-level cells */
int nr_local_cells;
/*! Number of *local* top-level cells with tasks */
......
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