diff --git a/.clang-format b/.clang-format index 542c97e89adce40066f0b9a96cc8be9746640d65..49524f944860b51ba9aa461b3299b70a68df46ae 100644 --- a/.clang-format +++ b/.clang-format @@ -2,4 +2,5 @@ Language: Cpp BasedOnStyle: Google KeepEmptyLinesAtTheStartOfBlocks: true +PenaltyBreakAssignment: 2 ... diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1248883c0aea4d1ecc3cfeaa219b739ee7712de6..3db4be05be13066ab6dd7644e25d495bdf70dc21 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,5 +1,5 @@ The SWIFT source code is using a variation of the 'Google' formatting style. -The script 'format.sh' in the root directory applies the clang-format-3.8 +The script 'format.sh' in the root directory applies the clang-format-5.0 tool with our style choices to all the SWIFT C source file. Please apply the formatting script to the files before submitting a merge request. @@ -9,4 +9,4 @@ check` in the root directory. Please check that the test suite still runs with your changes applied before submitting a merge request and add relevant unit tests probing the correctness of new modules. An example of how to add a test to the suite can be found by considering the tests/testGreeting -case. \ No newline at end of file +case. diff --git a/INSTALL.swift b/INSTALL.swift index 999a8d3655fa14a8ba1dcbd430b5146cc55ba791..db6c6677b202e55e76114373f3e037cf50de10cc 100644 --- a/INSTALL.swift +++ b/INSTALL.swift @@ -182,6 +182,6 @@ before you can build it. ================== The SWIFT source code uses a variation of 'Google' style. The script -'format.sh' in the root directory applies the clang-format-3.8 tool with our +'format.sh' in the root directory applies the clang-format-5.0 tool with our style choices to all the SWIFT C source file. Please apply the formatting script to the files before submitting a merge request. diff --git a/README.md b/README.md index 8ef8a65e890507c0467a965405e488aeff8ecf36..e9ce99f10901f4a3aa5fe93d14dea4f36a54fe34 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Contribution Guidelines ----------------------- The SWIFT source code uses a variation of the 'Google' formatting style. -The script 'format.sh' in the root directory applies the clang-format-3.8 +The script 'format.sh' in the root directory applies the clang-format-5.0 tool with our style choices to all the SWIFT C source file. Please apply the formatting script to the files before submitting a pull request. diff --git a/format.sh b/format.sh index 5bf78c5bb663d5cf22178bff868912a059c5c4fe..9fea13bf363b1513f0e4356a67b2c9d1166771d1 100755 --- a/format.sh +++ b/format.sh @@ -1,3 +1,3 @@ #!/bin/bash -clang-format-3.8 -style=file -i src/*.[ch] src/*/*.[ch] src/*/*/*.[ch] examples/main.c tests/*.[ch] +clang-format-5.0 -style=file -i src/*.[ch] src/*/*.[ch] src/*/*/*.[ch] examples/main.c tests/*.[ch] diff --git a/src/approx_math.h b/src/approx_math.h index 1445a84ab09666d08987519d90aba130684e7d2c..90ea4eb997c71311e0c1ce854bbdd0a0ba7396ce 100644 --- a/src/approx_math.h +++ b/src/approx_math.h @@ -44,10 +44,9 @@ __attribute__((always_inline, const)) INLINE static float good_approx_expf( float x) { return 1.f + x * (1.f + - x * (0.5f + - x * ((1.f / 6.f) + - x * ((1.f / 24.f) + - x * ((1.f / 120.f) + (1.f / 720.f) * x))))); + x * (0.5f + x * ((1.f / 6.f) + + x * ((1.f / 24.f) + + x * ((1.f / 120.f) + (1.f / 720.f) * x))))); } /** @@ -56,11 +55,9 @@ __attribute__((always_inline, const)) INLINE static float good_approx_expf( __attribute__((always_inline, const)) INLINE static double good_approx_exp( double x) { return 1. + - x * (1. + - x * (0.5 + - x * ((1. / 6.) + - x * ((1. / 24.) + - x * ((1. / 120.) + (1. / 720.) * x))))); + x * (1. + x * (0.5 + x * ((1. / 6.) + + x * ((1. / 24.) + + x * ((1. / 120.) + (1. / 720.) * x))))); } #endif /* SWIFT_APPROX_MATH_H */ diff --git a/src/chemistry/EAGLE/chemistry_io.h b/src/chemistry/EAGLE/chemistry_io.h index a717318c1e649c3cede7ad833bce5d40dbff5d77..d78a5f19a52e92426d5eb1f8575abe2b564e32ac 100644 --- a/src/chemistry/EAGLE/chemistry_io.h +++ b/src/chemistry/EAGLE/chemistry_io.h @@ -109,8 +109,9 @@ INLINE static void chemistry_write_flavour(hid_t h_grp) { for (int elem = 0; elem < chemistry_element_count; ++elem) { char buffer[20]; sprintf(buffer, "Element %d", elem); - io_write_attribute_s(h_grp, buffer, chemistry_get_element_name( - (enum chemistry_element)elem)); + io_write_attribute_s( + h_grp, buffer, + chemistry_get_element_name((enum chemistry_element)elem)); } } #endif diff --git a/src/engine.c b/src/engine.c index 369dba72b4c9edac550a5726caba4c8311e3ccb0..b88f8a3f434cad3dc0e0bf129c1f6be49cf77bf8 100644 --- a/src/engine.c +++ b/src/engine.c @@ -4794,8 +4794,8 @@ void engine_step(struct engine *e) { /* Print the number of active tasks ? */ if (e->verbose) engine_print_task_counts(e); -/* Dump local cells and active particle counts. */ -/* dumpCells("cells", 0, 0, 0, 0, e->s, e->nodeID, e->step); */ + /* Dump local cells and active particle counts. */ + /* dumpCells("cells", 0, 0, 0, 0, e->s, e->nodeID, e->step); */ #ifdef SWIFT_DEBUG_CHECKS /* Check that we have the correct total mass in the top-level multipoles */ diff --git a/src/gravity/Default/gravity_iact.h b/src/gravity/Default/gravity_iact.h index 6fd7ae205ecb124344f0780a5e8a276445ad07b4..71e5007a49bda25a8b65d4a5d3733d0027aa2682 100644 --- a/src/gravity/Default/gravity_iact.h +++ b/src/gravity/Default/gravity_iact.h @@ -176,13 +176,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full( #if SELF_GRAVITY_MULTIPOLE_ORDER > 0 -/* 1st order contributions */ + /* 1st order contributions */ -/* 1st order contributions are all 0 since the dipole is 0 */ + /* 1st order contributions are all 0 since the dipole is 0 */ -/* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ -/* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ -/* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ + /* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ + /* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ + /* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ #endif @@ -281,13 +281,13 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated( #if SELF_GRAVITY_MULTIPOLE_ORDER > 0 -/* 1st order contributions */ + /* 1st order contributions */ -/* 1st order contributions are all 0 since the dipole is 0 */ + /* 1st order contributions are all 0 since the dipole is 0 */ -/* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ -/* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ -/* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ + /* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ + /* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ + /* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ #endif diff --git a/src/gravity/Potential/gravity_iact.h b/src/gravity/Potential/gravity_iact.h index 7d6029b96214549686e00789dcb8a3a3ad2750b4..fdc8c17da1576b85026c3e551dd70d27bc186612 100644 --- a/src/gravity/Potential/gravity_iact.h +++ b/src/gravity/Potential/gravity_iact.h @@ -180,14 +180,14 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_full( #if SELF_GRAVITY_MULTIPOLE_ORDER > 0 -/* 1st order contributions */ + /* 1st order contributions */ -/* 1st order contributions are all 0 since the dipole is 0 */ + /* 1st order contributions are all 0 since the dipole is 0 */ -/* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ -/* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ -/* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ -/* *pot = m->M_001 * d.D_001 + m->M_010 * d.D_010 + m->M_100 * d.D_100 ; */ + /* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ + /* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ + /* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ + /* *pot = m->M_001 * d.D_001 + m->M_010 * d.D_010 + m->M_100 * d.D_100 ; */ #endif @@ -292,14 +292,14 @@ __attribute__((always_inline)) INLINE static void runner_iact_grav_pm_truncated( #if SELF_GRAVITY_MULTIPOLE_ORDER > 0 -/* 1st order contributions */ + /* 1st order contributions */ -/* 1st order contributions are all 0 since the dipole is 0 */ + /* 1st order contributions are all 0 since the dipole is 0 */ -/* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ -/* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ -/* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ -/* *pot = m->M_001 * d.D_001 + m->M_010 * d.D_010 + m->M_100 * d.D_100 ; */ + /* *f_x = m->M_001 * d.D_101 + m->M_010 * d.D_110 + m->M_100 * d.D_200 ; */ + /* *f_y = m->M_001 * d.D_011 + m->M_010 * d.D_020 + m->M_100 * d.D_110 ; */ + /* *f_z = m->M_001 * d.D_002 + m->M_010 * d.D_011 + m->M_100 * d.D_101 ; */ + /* *pot = m->M_001 * d.D_001 + m->M_010 * d.D_010 + m->M_100 * d.D_100 ; */ #endif diff --git a/src/kernel_gravity.h b/src/kernel_gravity.h index 8fc278273f7f152c0e352950a0935ae2f2b0c83b..39608530f5f3f1acf2b203b79a832b50d14598d4 100644 --- a/src/kernel_gravity.h +++ b/src/kernel_gravity.h @@ -53,9 +53,10 @@ __attribute__((always_inline)) INLINE static void kernel_grav_pot_eval( if (u < 0.5f) *W = -2.8f + u * u * (5.333333333333f + u * u * (6.4f * u - 9.6f)); else - *W = -3.2f + 0.066666666667f / u + - u * u * (10.666666666667f + - u * (-16.f + u * (9.6f - 2.133333333333f * u))); + *W = + -3.2f + 0.066666666667f / u + + u * u * + (10.666666666667f + u * (-16.f + u * (9.6f - 2.133333333333f * u))); #else /* W(u) = 3u^7 - 15u^6 + 28u^5 - 21u^4 + 7u^2 - 3 */ diff --git a/src/kernel_hydro.h b/src/kernel_hydro.h index 788a9037a6ceb592f4278404ce7ea49ab9f876d1..aac06c19ce39c647ba7211f85ac0a849365d126f 100644 --- a/src/kernel_hydro.h +++ b/src/kernel_hydro.h @@ -346,7 +346,8 @@ __attribute__((always_inline)) INLINE static void kernel_eval_dWdx( *dW_dx = dw_dx * kernel_constant * kernel_gamma_inv_dim_plus_one; } -/* ------------------------------------------------------------------------- */ + /* ------------------------------------------------------------------------- + */ #ifdef WITH_OLD_VECTORIZATION /** diff --git a/src/parallel_io.c b/src/parallel_io.c index 7e892154231cb09ffca1f5f93f56240b043995ba..b82443b33ba767cfe2050cf300535db924bfb537 100644 --- a/src/parallel_io.c +++ b/src/parallel_io.c @@ -490,9 +490,10 @@ void writeArray_chunk(struct engine* e, hid_t h_data, else H5Sselect_none(h_filespace); -/* message("Writing %lld '%s', %zd elements = %zd bytes (int=%d) at offset - * %zd", N, props.name, N * props.dimension, N * props.dimension * typeSize, */ -/* (int)(N * props.dimension * typeSize), offset); */ + /* message("Writing %lld '%s', %zd elements = %zd bytes (int=%d) at offset + * %zd", N, props.name, N * props.dimension, N * props.dimension * typeSize, + */ + /* (int)(N * props.dimension * typeSize), offset); */ #ifdef IO_SPEED_MEASUREMENT MPI_Barrier(MPI_COMM_WORLD); @@ -1180,8 +1181,8 @@ void write_output_parallel(struct engine* e, const char* baseName, * broadcast from there */ MPI_Bcast(&N_total, 6, MPI_LONG_LONG_INT, mpi_size - 1, comm); -/* Now everybody konws its offset and the total number of - * particles of each type */ + /* Now everybody konws its offset and the total number of + * particles of each type */ #ifdef IO_SPEED_MEASUREMENT ticks tic = getticks(); diff --git a/src/partition.c b/src/partition.c index f7a708a152ea5b07887a2718543c274601ef4cba..98e3e7b670ddd9d849834f1e7f86fa94c2cd335f 100644 --- a/src/partition.c +++ b/src/partition.c @@ -156,17 +156,17 @@ static void split_vector(struct space *s, int nregions, int *samplecells) { } #endif -/* METIS support - * ============= - * - * METIS partitions using a multi-level k-way scheme. We support using this in - * a unweighted scheme, which works well and seems to be guaranteed, and a - * weighted by the number of particles scheme. Note METIS is optional. - * - * Repartitioning is based on METIS and uses weights determined from the times - * that cell tasks have taken. These weight the graph edges and vertices, or - * just the edges, with vertex weights from the particle counts or none. - */ + /* METIS support + * ============= + * + * METIS partitions using a multi-level k-way scheme. We support using this in + * a unweighted scheme, which works well and seems to be guaranteed, and a + * weighted by the number of particles scheme. Note METIS is optional. + * + * Repartitioning is based on METIS and uses weights determined from the times + * that cell tasks have taken. These weight the graph edges and vertices, or + * just the edges, with vertex weights from the particle counts or none. + */ #if defined(WITH_MPI) && defined(HAVE_METIS) /** @@ -926,9 +926,8 @@ void partition_initial_partition(struct partition *initial_partition, struct cell *c; /* If we've got the wrong number of nodes, fail. */ - if (nr_nodes != - initial_partition->grid[0] * initial_partition->grid[1] * - initial_partition->grid[2]) + if (nr_nodes != initial_partition->grid[0] * initial_partition->grid[1] * + initial_partition->grid[2]) error("Grid size does not match number of nodes."); /* Run through the cells and set their nodeID. */ @@ -937,9 +936,8 @@ void partition_initial_partition(struct partition *initial_partition, c = &s->cells_top[k]; for (j = 0; j < 3; j++) ind[j] = c->loc[j] / s->dim[j] * initial_partition->grid[j]; - c->nodeID = ind[0] + - initial_partition->grid[0] * - (ind[1] + initial_partition->grid[1] * ind[2]); + c->nodeID = ind[0] + initial_partition->grid[0] * + (ind[1] + initial_partition->grid[1] * ind[2]); // message("cell at [%e,%e,%e]: ind = [%i,%i,%i], nodeID = %i", c->loc[0], // c->loc[1], c->loc[2], ind[0], ind[1], ind[2], c->nodeID); } diff --git a/src/proxy.c b/src/proxy.c index ff7d12d92f1c90e1339113fcbde20847fb902283..9d170a517f6f24c907b10330c6d1e33215bcce1b 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -88,8 +88,8 @@ void proxy_cells_exch1(struct proxy *p) { p->nodeID * proxy_tag_shift + proxy_tag_count, MPI_COMM_WORLD, &p->req_cells_count_in); if (err != MPI_SUCCESS) mpi_error(err, "Failed to irecv nr of pcells."); -// message( "irecv pcells count on node %i from node %i." , p->mynodeID , -// p->nodeID ); fflush(stdout); + // message( "irecv pcells count on node %i from node %i." , p->mynodeID , + // p->nodeID ); fflush(stdout); #else error("SWIFT was not compiled with MPI support."); @@ -113,8 +113,8 @@ void proxy_cells_exch2(struct proxy *p) { MPI_COMM_WORLD, &p->req_cells_in); if (err != MPI_SUCCESS) mpi_error(err, "Failed to irecv part data."); -// message( "irecv pcells (%i) on node %i from node %i." , p->size_pcells_in , -// p->mynodeID , p->nodeID ); fflush(stdout); + // message( "irecv pcells (%i) on node %i from node %i." , p->size_pcells_in + // , p->mynodeID , p->nodeID ); fflush(stdout); #else error("SWIFT was not compiled with MPI support."); diff --git a/src/riemann/riemann_exact.h b/src/riemann/riemann_exact.h index 9a671559c12a9df6d1e11016adc619c6043c83a9..e19ead49941f9e0ca712581af1716f1bd288c0c9 100644 --- a/src/riemann/riemann_exact.h +++ b/src/riemann/riemann_exact.h @@ -388,9 +388,8 @@ __attribute__((always_inline)) INLINE static void riemann_solver_solve( pdpR = p / WR[4]; if (p > WR[4]) { /* shockwave */ - SR = vR + - aR * sqrtf(hydro_gamma_plus_one_over_two_gamma * pdpR + - hydro_gamma_minus_one_over_two_gamma); + SR = vR + aR * sqrtf(hydro_gamma_plus_one_over_two_gamma * pdpR + + hydro_gamma_minus_one_over_two_gamma); if (SR > 0.0f) { Whalf[0] = WR[0] * (pdpR + hydro_gamma_minus_one_over_gamma_plus_one) / (hydro_gamma_minus_one_over_gamma_plus_one * pdpR + 1.0f); @@ -436,9 +435,8 @@ __attribute__((always_inline)) INLINE static void riemann_solver_solve( pdpL = p / WL[4]; if (p > WL[4]) { /* shockwave */ - SL = vL - - aL * sqrtf(hydro_gamma_plus_one_over_two_gamma * pdpL + - hydro_gamma_minus_one_over_two_gamma); + SL = vL - aL * sqrtf(hydro_gamma_plus_one_over_two_gamma * pdpL + + hydro_gamma_minus_one_over_two_gamma); if (SL < 0.0f) { Whalf[0] = WL[0] * (pdpL + hydro_gamma_minus_one_over_gamma_plus_one) / (hydro_gamma_minus_one_over_gamma_plus_one * pdpL + 1.0f); diff --git a/src/riemann/riemann_hllc.h b/src/riemann/riemann_hllc.h index 68a92111d8e075faff5f93ab9c3d8a1ebc496cb0..d7e376fe667dd3cfeac58d5820053057ab928d3e 100644 --- a/src/riemann/riemann_hllc.h +++ b/src/riemann/riemann_hllc.h @@ -78,15 +78,13 @@ __attribute__((always_inline)) INLINE static void riemann_solve_for_flux( all these speeds are along the interface normal, since uL and uR are */ float qL = 1.f; if (pstar > WL[4] && WL[4] > 0.f) { - qL = sqrtf(1.f + - 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * - (pstar / WL[4] - 1.f)); + qL = sqrtf(1.f + 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * + (pstar / WL[4] - 1.f)); } float qR = 1.f; if (pstar > WR[4] && WR[4] > 0.f) { - qR = sqrtf(1.f + - 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * - (pstar / WR[4] - 1.f)); + qR = sqrtf(1.f + 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * + (pstar / WR[4] - 1.f)); } const float SL = uL - aL * qL; const float SR = uR + aR * qR; @@ -230,15 +228,13 @@ riemann_solve_for_middle_state_flux(const float *WL, const float *WR, all these speeds are along the interface normal, since uL and uR are */ float qL = 1.f; if (pstar > WL[4] && WL[4] > 0.f) { - qL = sqrtf(1.f + - 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * - (pstar / WL[4] - 1.f)); + qL = sqrtf(1.f + 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * + (pstar / WL[4] - 1.f)); } float qR = 1.f; if (pstar > WR[4] && WR[4] > 0.f) { - qR = sqrtf(1.f + - 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * - (pstar / WR[4] - 1.f)); + qR = sqrtf(1.f + 0.5f * hydro_gamma_plus_one * hydro_one_over_gamma * + (pstar / WR[4] - 1.f)); } const float SL = uL - aL * qL; const float SR = uR + aR * qR; diff --git a/src/runner.c b/src/runner.c index c444fe9e1796f8a03fc44e2be155a6dcb364e63d..43c01c716a21ed4374314283400f3b25d4ceaabb 100644 --- a/src/runner.c +++ b/src/runner.c @@ -827,7 +827,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { } } -/* We now have a particle whose smoothing length has converged */ + /* We now have a particle whose smoothing length has converged */ #ifdef EXTRA_HYDRO_LOOP diff --git a/tests/test125cells.c b/tests/test125cells.c index ddce3176d463f2ef754bf82b364858085e317e4b..70af9dfb19aeee812fdc90733a604f795b7f478f 100644 --- a/tests/test125cells.c +++ b/tests/test125cells.c @@ -238,9 +238,10 @@ void reset_particles(struct cell *c, struct hydro_space *hs, p->conserved.momentum[2] = p->conserved.mass * p->v[2]; p->conserved.energy = p->primitives.P / hydro_gamma_minus_one * volume + - 0.5f * (p->conserved.momentum[0] * p->conserved.momentum[0] + - p->conserved.momentum[1] * p->conserved.momentum[1] + - p->conserved.momentum[2] * p->conserved.momentum[2]) / + 0.5f * + (p->conserved.momentum[0] * p->conserved.momentum[0] + + p->conserved.momentum[1] * p->conserved.momentum[1] + + p->conserved.momentum[2] * p->conserved.momentum[2]) / p->conserved.mass; #endif } @@ -325,9 +326,10 @@ struct cell *make_cell(size_t n, const double offset[3], double size, double h, part->conserved.momentum[2] = part->conserved.mass * part->v[2]; part->conserved.energy = part->primitives.P / hydro_gamma_minus_one * volume + - 0.5f * (part->conserved.momentum[0] * part->conserved.momentum[0] + - part->conserved.momentum[1] * part->conserved.momentum[1] + - part->conserved.momentum[2] * part->conserved.momentum[2]) / + 0.5f * + (part->conserved.momentum[0] * part->conserved.momentum[0] + + part->conserved.momentum[1] * part->conserved.momentum[1] + + part->conserved.momentum[2] * part->conserved.momentum[2]) / part->conserved.mass; #endif @@ -429,7 +431,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, #else 0.f, 0.f, 0.f #endif - ); + ); } if (with_solution) { diff --git a/tests/test27cells.c b/tests/test27cells.c index f62c169486250ba940c22f21ba1556cca4060c1a..1ca6b2c54d901943b0cc748a2241a3a2f9ae9244 100644 --- a/tests/test27cells.c +++ b/tests/test27cells.c @@ -291,7 +291,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, #else 0., 0., 0., 0. #endif - ); + ); } /* Write all other cells */ @@ -325,7 +325,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, #else 0., 0., 0., 0. #endif - ); + ); } } } diff --git a/tests/testEOS.c b/tests/testEOS.c index 595dd0726a0a4a1606390cd38eb06c71399acb78..d090d83d77a16b2c5b4506c5f9224b3e4434d1be 100644 --- a/tests/testEOS.c +++ b/tests/testEOS.c @@ -250,8 +250,9 @@ int main(int argc, char *argv[]) { log_u += log_u_step; if (do_output == 1) - fprintf(f, "%.6e ", A1_u[i] * units_cgs_conversion_factor( - &us, UNIT_CONV_ENERGY_PER_UNIT_MASS)); + fprintf(f, "%.6e ", + A1_u[i] * units_cgs_conversion_factor( + &us, UNIT_CONV_ENERGY_PER_UNIT_MASS)); } if (do_output == 1) fprintf(f, "\n"); diff --git a/tests/testInteractions.c b/tests/testInteractions.c index b8d4073c179238370684c2b0cf15944e613ce002..0a7354f0d2a5e1853ba2c22d696dbb910de2b667 100644 --- a/tests/testInteractions.c +++ b/tests/testInteractions.c @@ -154,7 +154,7 @@ void dump_indv_particle_fields(char *fileName, struct part *p) { #else 0.f, 0.f, 0.f #endif - ); + ); fclose(file); } diff --git a/tests/testLogger.c b/tests/testLogger.c index b954b67ad6044ae5ec734706f7a1a4ff181541d8..ee933500ab585d286c9dea7370b0d208573ca7d2 100644 --- a/tests/testLogger.c +++ b/tests/testLogger.c @@ -43,9 +43,10 @@ void test_log_parts(struct dump *d) { size_t offset = d->count; /* Write the full part. */ - logger_log_part(&p, logger_mask_x | logger_mask_v | logger_mask_a | - logger_mask_u | logger_mask_h | logger_mask_rho | - logger_mask_consts, + logger_log_part(&p, + logger_mask_x | logger_mask_v | logger_mask_a | + logger_mask_u | logger_mask_h | logger_mask_rho | + logger_mask_consts, &offset, d); printf("Wrote part at offset %#016zx.\n", offset); @@ -112,8 +113,9 @@ void test_log_gparts(struct dump *d) { size_t offset = d->count; /* Write the full part. */ - logger_log_gpart(&p, logger_mask_x | logger_mask_v | logger_mask_a | - logger_mask_h | logger_mask_consts, + logger_log_gpart(&p, + logger_mask_x | logger_mask_v | logger_mask_a | + logger_mask_h | logger_mask_consts, &offset, d); printf("Wrote gpart at offset %#016zx.\n", offset); diff --git a/tests/testPeriodicBC.c b/tests/testPeriodicBC.c index ffaa3bda0ccb62cd44169e228086267d2399c31f..de30b1af9ac8595cb081eb0702e9a7e7da13a162 100644 --- a/tests/testPeriodicBC.c +++ b/tests/testPeriodicBC.c @@ -252,7 +252,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, int i, int j, #else 0., 0., 0., 0. #endif - ); + ); } fclose(file); } diff --git a/tests/testPotentialPair.c b/tests/testPotentialPair.c index fd653434268a694142ab48dba9c2a427c6fbf60c..380d1fc979f129d46b08306d759eae3ff2739195 100644 --- a/tests/testPotentialPair.c +++ b/tests/testPotentialPair.c @@ -82,8 +82,9 @@ double acceleration(double mass, double r, double H, double rlr) { if (u > 1.) acc = -mass / (r * r * r); else - acc = -mass * (21. * u * u * u * u * u - 90. * u * u * u * u + - 140. * u * u * u - 84. * u * u + 14.) / + acc = -mass * + (21. * u * u * u * u * u - 90. * u * u * u * u + 140. * u * u * u - + 84. * u * u + 14.) / (H * H * H); return r * acc * (4. * x * S_prime(2 * x) - 2. * S(2. * x) + 2.); diff --git a/tests/testPotentialSelf.c b/tests/testPotentialSelf.c index 8687e82a2a09f6388fd4154c4e122b56bf999045..6bf5dbd405830f1ba1c58d8627606a67111f5fb0 100644 --- a/tests/testPotentialSelf.c +++ b/tests/testPotentialSelf.c @@ -78,8 +78,9 @@ double acceleration(double mass, double r, double H, double rlr) { if (u > 1.) acc = -mass / (r * r * r); else - acc = -mass * (21. * u * u * u * u * u - 90. * u * u * u * u + - 140. * u * u * u - 84. * u * u + 14.) / + acc = -mass * + (21. * u * u * u * u * u - 90. * u * u * u * u + 140. * u * u * u - + 84. * u * u + 14.) / (H * H * H); return r * acc * (4. * x * S_prime(2 * x) - 2. * S(2. * x) + 2.);