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

Apply standard formatting

parent 9aa51dd0
......@@ -33,8 +33,8 @@
/* Local includes. */
#include "cell.h"
#include "const.h"
#include "hydro.h"
#include "engine.h"
#include "hydro.h"
#include "inline.h"
#include "part.h"
#include "space.h"
......@@ -149,42 +149,43 @@ void printgParticle_single(struct gpart *gp) {
*/
int checkSpacehmax(struct space *s) {
/* Loop over local cells. */
float cell_h_max = 0.0f;
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells[k].nodeID == s->e->nodeID && s->cells[k].h_max > cell_h_max) {
cell_h_max = s->cells[k].h_max;
}
/* Loop over local cells. */
float cell_h_max = 0.0f;
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells[k].nodeID == s->e->nodeID && s->cells[k].h_max > cell_h_max) {
cell_h_max = s->cells[k].h_max;
}
}
/* Now all particles. */
float part_h_max = 0.0f;
for (int k = 0; k < s->nr_parts; k++) {
if (s->parts[k].h > part_h_max) {
part_h_max = s->parts[k].h;
}
/* Now all particles. */
float part_h_max = 0.0f;
for (int k = 0; k < s->nr_parts; k++) {
if (s->parts[k].h > part_h_max) {
part_h_max = s->parts[k].h;
}
}
/* If within some epsilon we are OK. */
if (abs(cell_h_max - part_h_max) <= FLT_EPSILON)
return 1;
/* If within some epsilon we are OK. */
if (abs(cell_h_max - part_h_max) <= FLT_EPSILON) return 1;
/* There is a problem. Hunt it down. */
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells[k].nodeID == s->e->nodeID) {
if (s->cells[k].h_max > part_h_max) {
message("cell %d is inconsistent (%f > %f)", k, s->cells[k].h_max, part_h_max);
}
/* There is a problem. Hunt it down. */
for (int k = 0; k < s->nr_cells; k++) {
if (s->cells[k].nodeID == s->e->nodeID) {
if (s->cells[k].h_max > part_h_max) {
message("cell %d is inconsistent (%f > %f)", k, s->cells[k].h_max,
part_h_max);
}
}
}
for (int k = 0; k < s->nr_parts; k++) {
if (s->parts[k].h > cell_h_max) {
message("part %lld is inconsistent (%f > %f)", s->parts[k].id, s->parts[k].h, cell_h_max);
}
for (int k = 0; k < s->nr_parts; k++) {
if (s->parts[k].h > cell_h_max) {
message("part %lld is inconsistent (%f > %f)", s->parts[k].id,
s->parts[k].h, cell_h_max);
}
}
return 0;
return 0;
}
#ifdef HAVE_METIS
......
......@@ -620,8 +620,8 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
/* Compute (square of) motion since last cell construction */
const float dx2 = gp->x_diff[0] * gp->x_diff[0] +
gp->x_diff[1] * gp->x_diff[1] +
gp->x_diff[2] * gp->x_diff[2];
gp->x_diff[1] * gp->x_diff[1] +
gp->x_diff[2] * gp->x_diff[2];
dx2_max = fmaxf(dx2_max, dx2);
}
......@@ -638,8 +638,8 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
/* Compute (square of) motion since last cell construction */
const float dx2 = xp->x_diff[0] * xp->x_diff[0] +
xp->x_diff[1] * xp->x_diff[1] +
xp->x_diff[2] * xp->x_diff[2];
xp->x_diff[1] * xp->x_diff[1] +
xp->x_diff[2] * xp->x_diff[2];
dx2_max = fmaxf(dx2_max, dx2);
/* Maximal smoothing length */
......@@ -648,7 +648,7 @@ static void runner_do_drift(struct cell *c, struct engine *e) {
/* Now collect quantities for statistics */
const float half_dt =
(ti_current - (p->ti_begin + p->ti_end) / 2) * timeBase;
(ti_current - (p->ti_begin + p->ti_end) / 2) * timeBase;
const double x[3] = {p->x[0], p->x[1], p->x[2]};
const float v[3] = {xp->v_full[0] + p->a_hydro[0] * half_dt,
xp->v_full[1] + p->a_hydro[1] * half_dt,
......@@ -742,8 +742,7 @@ void runner_do_drift_mapper(void *map_data, int num_elements,
struct cell *c = &cells[ind];
/* Only drift local particles. */
if (c != NULL && c->nodeID == e->nodeID)
runner_do_drift(c, e);
if (c != NULL && c->nodeID == e->nodeID) runner_do_drift(c, e);
}
}
......
......@@ -112,10 +112,10 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) {
/* Static constants. */
const static int pts[7][8] = {
{-1, 12, 10, 9, 4, 3, 1, 0}, {-1, -1, 11, 10, 5, 4, 2, 1},
{-1, -1, -1, 12, 7, 6, 4, 3}, {-1, -1, -1, -1, 8, 7, 5, 4},
{-1, -1, -1, -1, -1, 12, 10, 9}, {-1, -1, -1, -1, -1, -1, 11, 10},
{-1, -1, -1, -1, -1, -1, -1, 12}};
{-1, 12, 10, 9, 4, 3, 1, 0}, {-1, -1, 11, 10, 5, 4, 2, 1},
{-1, -1, -1, 12, 7, 6, 4, 3}, {-1, -1, -1, -1, 8, 7, 5, 4},
{-1, -1, -1, -1, -1, 12, 10, 9}, {-1, -1, -1, -1, -1, -1, 11, 10},
{-1, -1, -1, -1, -1, -1, -1, 12}};
const static float sid_scale[13] = {0.1897, 0.4025, 0.1897, 0.4025, 0.5788,
0.4025, 0.1897, 0.4025, 0.1897, 0.4025,
0.5788, 0.4025, 0.5788};
......
......@@ -47,10 +47,10 @@
/* Task type names. */
const char *taskID_names[task_type_count] = {
"none", "sort", "self", "pair", "sub_self",
"sub_pair","init", "ghost", "kick", "kick_fixdt",
"send", "recv", "grav_gather_m", "grav_fft", "grav_mm",
"grav_up", "grav_external"};
"none", "sort", "self", "pair", "sub_self",
"sub_pair", "init", "ghost", "kick", "kick_fixdt",
"send", "recv", "grav_gather_m", "grav_fft", "grav_mm",
"grav_up", "grav_external"};
const char *subtaskID_names[task_type_count] = {"none", "density", "force",
"grav", "tend"};
......
......@@ -65,7 +65,7 @@ void *threadpool_runner(void *data) {
const int num_elements = task_ind + tp->map_data_chunk > tp->map_data_size
? tp->map_data_size - task_ind
: tp->map_data_chunk;
tp->map_function(tp->map_data + tp->map_data_stride * task_ind,
tp->map_function((char *)tp->map_data + (tp->map_data_stride * task_ind),
num_elements, tp->map_extra_data);
}
}
......
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