From 088c695a49ec7f253a38a2e9230d50ef61107ce6 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller <schaller@strw.leidenuniv.nl> Date: Sun, 23 Aug 2020 14:32:43 +0200 Subject: [PATCH] Update the clang-formatting tool version to 10.0 --- .clang-format | 13 +++++++++ CONTRIBUTING.md | 2 +- INSTALL.swift | 2 +- README.md | 2 +- argparse/argparse.c | 4 +-- argparse/test_argparse.c | 3 +- examples/main.c | 10 +++---- format.sh | 6 ++-- logger/logger_loader_io.c | 9 +++--- logger/logger_logfile.c | 1 + logger/logger_particle.c | 1 + logger/logger_time.c | 1 + logger/logger_tools.c | 4 +-- logger/tests/testTimeArray.c | 3 +- src/black_holes/Default/black_holes_part.h | 1 - src/black_holes_struct.h | 1 - src/cell.c | 8 +++--- src/common_io.c | 4 +-- src/cooling/EAGLE/cooling_tables.c | 2 +- src/cooling/EAGLE/cooling_tables.h | 1 - src/cosmology.h | 1 - src/engine.c | 4 +-- src/feedback/EAGLE/feedback.c | 4 +-- src/gravity_derivatives.h | 4 +-- src/hashmap.c | 9 +++--- src/hydro/AnarchyPU/hydro.h | 3 +- src/hydro/AnarchyPU/hydro_iact.h | 3 +- src/hydro/AnarchyPU/hydro_io.h | 3 +- src/hydro/Default/hydro.h | 3 +- src/hydro/Default/hydro_iact.h | 3 +- src/hydro/Default/hydro_io.h | 3 +- src/hydro/Gadget2/hydro.h | 3 +- src/hydro/Gadget2/hydro_iact.h | 3 +- src/hydro/Gadget2/hydro_io.h | 3 +- src/hydro/Gizmo/hydro_slope_limiters_cell.h | 3 +- src/hydro/Minimal/hydro.h | 3 +- src/hydro/Minimal/hydro_iact.h | 3 +- src/hydro/Minimal/hydro_io.h | 3 +- src/hydro/Planetary/hydro.h | 3 +- src/hydro/Planetary/hydro_iact.h | 3 +- src/hydro/Planetary/hydro_io.h | 3 +- src/hydro/PressureEnergy/hydro.h | 3 +- src/hydro/PressureEnergy/hydro_iact.h | 3 +- src/hydro/PressureEnergy/hydro_io.h | 3 +- .../PressureEnergyMorrisMonaghanAV/hydro.h | 3 +- .../hydro_iact.h | 3 +- .../PressureEnergyMorrisMonaghanAV/hydro_io.h | 3 +- src/hydro/PressureEntropy/hydro.h | 3 +- src/hydro/PressureEntropy/hydro_iact.h | 2 +- src/hydro/PressureEntropy/hydro_io.h | 3 +- src/hydro/SPHENIX/hydro.h | 3 +- src/hydro/SPHENIX/hydro_iact.h | 3 +- src/hydro/SPHENIX/hydro_io.h | 3 +- src/hydro/Shadowswift/hydro.h | 3 +- src/hydro/Shadowswift/voronoi1d_algorithm.h | 5 ++-- src/hydro/Shadowswift/voronoi2d_algorithm.h | 7 +++-- src/hydro/Shadowswift/voronoi3d_algorithm.h | 7 +++-- src/hydro_space.c | 1 + src/kernel_hydro.c | 4 +-- src/kernel_hydro.h | 4 +-- src/line_of_sight.c | 8 +++--- src/logger_io.c | 4 +-- src/memswap.h | 3 +- src/memuse.c | 10 +++---- src/memuse_rnodes.c | 2 +- src/mpiuse.c | 8 +++--- src/multipole.h | 6 ++-- src/multipole_accept.h | 2 +- src/partition.c | 28 +++++++++---------- src/restart.c | 10 +++---- src/runner_doiact_functions_black_holes.h | 8 +++--- src/runner_doiact_grav.c | 8 +++--- src/runner_ghost.c | 8 +++--- src/runner_others.c | 2 +- src/stars/Default/stars.h | 3 +- src/stars/GEAR/stars.h | 3 +- tests/testAdiabaticIndex.c | 3 +- tests/testErfc.c | 1 - tests/testExp.c | 1 - tests/testHydroMPIrules.c | 5 ++-- tests/testKernel.c | 1 - tests/testKernelLongGrav.c | 1 - tests/testMaths.c | 1 - tests/testParser.c | 3 +- tests/testSymmetry.c | 7 ++--- 85 files changed, 171 insertions(+), 179 deletions(-) diff --git a/.clang-format b/.clang-format index 49524f9448..0ec6295343 100644 --- a/.clang-format +++ b/.clang-format @@ -3,4 +3,17 @@ Language: Cpp BasedOnStyle: Google KeepEmptyLinesAtTheStartOfBlocks: true PenaltyBreakAssignment: 2 +IncludeCategories: + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 3 + SortPriority: 3 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 4 + - Regex: '<[[:alnum:].]+>' + Priority: 5 + - Regex: '.*' + Priority: 2 + SortPriority: 0 + - Regex: config.h + Priority: 1 ... diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3db4be05be..4de91bb6bf 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-5.0 +The script 'format.sh' in the root directory applies the clang-format-10 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/INSTALL.swift b/INSTALL.swift index 4fa82c6083..6ea752bdd4 100644 --- a/INSTALL.swift +++ b/INSTALL.swift @@ -189,6 +189,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-5.0 tool with our +'format.sh' in the root directory applies the clang-format-10 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 52318f90e3..587ad429ec 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,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-5.0 +The script 'format.sh' in the root directory applies the clang-format-10 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/argparse/argparse.c b/argparse/argparse.c index 60d03518e3..5760e42fda 100644 --- a/argparse/argparse.c +++ b/argparse/argparse.c @@ -5,10 +5,10 @@ * Use of this source code is governed by a MIT-style license that can be found * in the LICENSE file. */ -#include "../config.h" - #include "argparse.h" +#include "config.h" + #include <assert.h> #include <errno.h> #include <stdio.h> diff --git a/argparse/test_argparse.c b/argparse/test_argparse.c index 5f411833aa..cd616318d7 100644 --- a/argparse/test_argparse.c +++ b/argparse/test_argparse.c @@ -1,7 +1,8 @@ +#include "argparse.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "argparse.h" static const char *const usages[] = { "test_argparse [options] [[--] args]", diff --git a/examples/main.c b/examples/main.c index f1ce38458e..c1cf594ab3 100644 --- a/examples/main.c +++ b/examples/main.c @@ -1402,7 +1402,7 @@ int main(int argc, char *argv[]) { parser_write_params_to_file(params, "unused_parameters.yml", /*used=*/0); } - /* Dump memory use report if collected for the 0 step. */ + /* Dump memory use report if collected for the 0 step. */ #ifdef SWIFT_MEMUSE_REPORTS { char dumpfile[40]; @@ -1415,7 +1415,7 @@ int main(int argc, char *argv[]) { } #endif - /* Dump MPI requests if collected. */ + /* Dump MPI requests if collected. */ #if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI) { char dumpfile[40]; @@ -1479,7 +1479,7 @@ int main(int argc, char *argv[]) { } #endif - /* Dump memory use report if collected. */ + /* Dump memory use report if collected. */ #ifdef SWIFT_MEMUSE_REPORTS { char dumpfile[40]; @@ -1493,7 +1493,7 @@ int main(int argc, char *argv[]) { } #endif - /* Dump MPI requests if collected. */ + /* Dump MPI requests if collected. */ #if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI) { char dumpfile[40]; @@ -1595,7 +1595,7 @@ int main(int argc, char *argv[]) { #endif } - /* Write final stf? */ + /* Write final stf? */ #ifdef HAVE_VELOCIRAPTOR if (with_structure_finding && e.output_list_stf) { if (e.output_list_stf->final_step_dump && !e.stf_this_timestep) diff --git a/format.sh b/format.sh index 91346334c9..dd154609e5 100755 --- a/format.sh +++ b/format.sh @@ -1,13 +1,13 @@ #!/bin/bash # Clang format command, can be overridden using CLANG_FORMAT_CMD. -# We currrently use version 5.0 so any overrides should provide that. -clang=${CLANG_FORMAT_CMD:="clang-format-5.0"} +# We currrently use version 10.0 so any overrides should provide that. +clang=${CLANG_FORMAT_CMD:="clang-format-10"} # Formatting command cmd="$clang -style=file $(git ls-files | grep '\.[ch]$')" -# Test if `clang-format-5.0` works +# Test if `clang-format-10` works command -v $clang > /dev/null if [[ $? -ne 0 ]] then diff --git a/logger/logger_loader_io.c b/logger/logger_loader_io.c index 6bebe3aefa..b94ef85696 100644 --- a/logger/logger_loader_io.c +++ b/logger/logger_loader_io.c @@ -16,15 +16,16 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************/ +#include "logger_loader_io.h" + +#include "logger_header.h" +#include "logger_tools.h" + #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> -#include "logger_header.h" -#include "logger_loader_io.h" -#include "logger_tools.h" - /** * @brief get the size of a file. * diff --git a/logger/logger_logfile.c b/logger/logger_logfile.c index 7c1660ec75..a161aa101b 100644 --- a/logger/logger_logfile.c +++ b/logger/logger_logfile.c @@ -17,6 +17,7 @@ * ******************************************************************************/ #include "logger_logfile.h" + #include "logger_loader_io.h" #include "logger_reader.h" diff --git a/logger/logger_particle.c b/logger/logger_particle.c index 07cddd89b4..3321535d87 100644 --- a/logger/logger_particle.c +++ b/logger/logger_particle.c @@ -17,6 +17,7 @@ * ******************************************************************************/ #include "logger_particle.h" + #include "logger_header.h" #include "logger_loader_io.h" #include "logger_reader.h" diff --git a/logger/logger_time.c b/logger/logger_time.c index e0eb8080f5..dae3fa9053 100644 --- a/logger/logger_time.c +++ b/logger/logger_time.c @@ -17,6 +17,7 @@ * ******************************************************************************/ #include "logger_time.h" + #include "logger_loader_io.h" #include "logger_logfile.h" #include "logger_reader.h" diff --git a/logger/logger_tools.c b/logger/logger_tools.c index d145934bc0..9329b0d414 100644 --- a/logger/logger_tools.c +++ b/logger/logger_tools.c @@ -17,11 +17,11 @@ * ******************************************************************************/ #include "logger_tools.h" + #include "logger_header.h" #include "logger_loader_io.h" -#include "logger_reader.h" - #include "logger_particle.h" +#include "logger_reader.h" #include <stdio.h> diff --git a/logger/tests/testTimeArray.c b/logger/tests/testTimeArray.c index 929a7124ba..4f8a75b20e 100644 --- a/logger/tests/testTimeArray.c +++ b/logger/tests/testTimeArray.c @@ -17,9 +17,10 @@ * ******************************************************************************/ +#include "logger_time.h" + #include <stdlib.h> #include <time.h> -#include "logger_time.h" #define NUMBER_OF_ELEMENT 10000 #define TIME_BASE 0.04 diff --git a/src/black_holes/Default/black_holes_part.h b/src/black_holes/Default/black_holes_part.h index 1b7d4ac37c..ca31a701fd 100644 --- a/src/black_holes/Default/black_holes_part.h +++ b/src/black_holes/Default/black_holes_part.h @@ -20,7 +20,6 @@ #define SWIFT_DEFAULT_BLACK_HOLE_PART_H #include "chemistry_struct.h" - #include "timeline.h" /** diff --git a/src/black_holes_struct.h b/src/black_holes_struct.h index 5e656d7876..73cc156420 100644 --- a/src/black_holes_struct.h +++ b/src/black_holes_struct.h @@ -26,7 +26,6 @@ /* Config parameters. */ #include "../config.h" - #include "inline.h" /* Import the right black holes definition */ diff --git a/src/cell.c b/src/cell.c index f115d4812e..30fd9031e1 100644 --- a/src/cell.c +++ b/src/cell.c @@ -5854,8 +5854,8 @@ struct spart *cell_add_spart(struct engine *e, struct cell *const c) { } } - /* Check that the cell was indeed drifted to this point to avoid future - * issues */ + /* Check that the cell was indeed drifted to this point to avoid future + * issues */ #ifdef SWIFT_DEBUG_CHECKS if (top->hydro.super != NULL && top->stars.count > 0 && top->stars.ti_old_part != e->ti_current) { @@ -5989,8 +5989,8 @@ struct gpart *cell_add_gpart(struct engine *e, struct cell *c) { } } - /* Check that the cell was indeed drifted to this point to avoid future - * issues */ + /* Check that the cell was indeed drifted to this point to avoid future + * issues */ #ifdef SWIFT_DEBUG_CHECKS if (top->grav.super != NULL && top->grav.count > 0 && top->grav.ti_old_part != e->ti_current) { diff --git a/src/common_io.c b/src/common_io.c index 09edb3b345..5db398c71e 100644 --- a/src/common_io.c +++ b/src/common_io.c @@ -165,7 +165,7 @@ void io_read_attribute_graceful(hid_t grp, const char* name, const htri_t h_exists = H5Aexists(grp, name); if (h_exists <= 0) { - /* Attribute either does not exist (0) or function failed (-ve) */ + /* Attribute either does not exist (0) or function failed (-ve) */ #ifdef SWIFT_DEBUG_CHECKS message("WARNING: attribute '%s' does not exist.", name); #endif @@ -176,7 +176,7 @@ void io_read_attribute_graceful(hid_t grp, const char* name, if (h_attr >= 0) { const hid_t h_err = H5Aread(h_attr, io_hdf5_type(type), data); if (h_err < 0) { - /* Explicitly do nothing unless debugging checks are activated */ + /* Explicitly do nothing unless debugging checks are activated */ #ifdef SWIFT_DEBUG_CHECKS message("WARNING: unable to read attribute '%s'", name); #endif diff --git a/src/cooling/EAGLE/cooling_tables.c b/src/cooling/EAGLE/cooling_tables.c index 1de3265df6..8ec888db5d 100644 --- a/src/cooling/EAGLE/cooling_tables.c +++ b/src/cooling/EAGLE/cooling_tables.c @@ -293,7 +293,7 @@ void read_cooling_header(const char *fname, cooling->nH[i] = log10(cooling->nH[i]); } - /* Compute inverse of solar mass fractions */ + /* Compute inverse of solar mass fractions */ #if defined(__ICC) #pragma novector #endif diff --git a/src/cooling/EAGLE/cooling_tables.h b/src/cooling/EAGLE/cooling_tables.h index 20abd6f423..3890a91a8f 100644 --- a/src/cooling/EAGLE/cooling_tables.h +++ b/src/cooling/EAGLE/cooling_tables.h @@ -26,7 +26,6 @@ /* Config parameters. */ #include "../config.h" - #include "cooling_struct.h" /*! Number of different bins along the redhsift axis of the tables */ diff --git a/src/cosmology.h b/src/cosmology.h index bb75335b8f..20036f4335 100644 --- a/src/cosmology.h +++ b/src/cosmology.h @@ -21,7 +21,6 @@ /* Config parameters. */ #include "../config.h" - #include "parser.h" #include "physical_constants.h" #include "timeline.h" diff --git a/src/engine.c b/src/engine.c index 5f3f3737e4..9d8980adf4 100644 --- a/src/engine.c +++ b/src/engine.c @@ -2665,7 +2665,7 @@ void engine_step(struct engine *e) { } #endif - /* Get current CPU times.*/ + /* Get current CPU times.*/ #ifdef WITH_MPI double start_usertime = 0.0; double start_systime = 0.0; @@ -4744,7 +4744,7 @@ void engine_config(int restart, int fof, struct engine *e, } #endif - /* Initialise the structure finder */ + /* Initialise the structure finder */ #ifdef HAVE_VELOCIRAPTOR if (e->policy & engine_policy_structure_finding) velociraptor_init(e); #endif diff --git a/src/feedback/EAGLE/feedback.c b/src/feedback/EAGLE/feedback.c index 5e7515b953..1235da6085 100644 --- a/src/feedback/EAGLE/feedback.c +++ b/src/feedback/EAGLE/feedback.c @@ -129,7 +129,7 @@ double eagle_feedback_number_of_sampled_SNII(const struct spart* sp, /* The max dying star mass is also below the SNII mass window */ else { - /* We already excluded this at the star of the function */ + /* We already excluded this at the star of the function */ #ifdef SWIFT_DEBUG_CHECKS error("Error in the logic"); #endif @@ -139,7 +139,7 @@ double eagle_feedback_number_of_sampled_SNII(const struct spart* sp, /* The min dying star mass dies above the SNII mass window */ else { - /* We already excluded this at the star of the function */ + /* We already excluded this at the star of the function */ #ifdef SWIFT_DEBUG_CHECKS error("Error in the logic"); #endif diff --git a/src/gravity_derivatives.h b/src/gravity_derivatives.h index b14ecc4e73..9e34242565 100644 --- a/src/gravity_derivatives.h +++ b/src/gravity_derivatives.h @@ -358,9 +358,9 @@ potential_derivatives_compute_M2L(const float r_x, const float r_y, #endif } -/* Alright, let's get the full terms */ + /* Alright, let's get the full terms */ - /* Compute some powers of (r_x / r), (r_y / r) and (r_z / r) */ + /* Compute some powers of (r_x / r), (r_y / r) and (r_z / r) */ #if SELF_GRAVITY_MULTIPOLE_ORDER > 0 const float rx_r = r_x * r_inv; const float ry_r = r_y * r_inv; diff --git a/src/hashmap.c b/src/hashmap.c index 3ebf9271dc..a9632c77a6 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -26,14 +26,15 @@ * Modified by Pete Warden to fix a serious performance problem, support strings * as keys and removed thread synchronization - http://petewarden.typepad.com */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include "hashmap.h" #include "error.h" -#include "hashmap.h" #include "memuse.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + #define INITIAL_NUM_CHUNKS (1) #define HASHMAP_GROWTH_FACTOR (2) #define HASHMAP_MAX_FILL_RATIO (1.0) diff --git a/src/hydro/AnarchyPU/hydro.h b/src/hydro/AnarchyPU/hydro.h index 281ad02715..7a0639dfd6 100644 --- a/src/hydro/AnarchyPU/hydro.h +++ b/src/hydro/AnarchyPU/hydro.h @@ -39,13 +39,12 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" -#include "./hydro_parameters.h" - #include <float.h> /** diff --git a/src/hydro/AnarchyPU/hydro_iact.h b/src/hydro/AnarchyPU/hydro_iact.h index 9abd09a5f6..18919bbcac 100644 --- a/src/hydro/AnarchyPU/hydro_iact.h +++ b/src/hydro/AnarchyPU/hydro_iact.h @@ -30,10 +30,9 @@ */ #include "adiabatic_index.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/AnarchyPU/hydro_io.h b/src/hydro/AnarchyPU/hydro_io.h index 2d02b350ca..181deb4d60 100644 --- a/src/hydro/AnarchyPU/hydro_io.h +++ b/src/hydro/AnarchyPU/hydro_io.h @@ -30,11 +30,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h index 065a38e196..67c60a75e6 100644 --- a/src/hydro/Default/hydro.h +++ b/src/hydro/Default/hydro.h @@ -34,13 +34,12 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" -#include "./hydro_parameters.h" - #include <float.h> /** diff --git a/src/hydro/Default/hydro_iact.h b/src/hydro/Default/hydro_iact.h index eb6612fe48..1bf4c216e5 100644 --- a/src/hydro/Default/hydro_iact.h +++ b/src/hydro/Default/hydro_iact.h @@ -28,10 +28,9 @@ */ #include "adiabatic_index.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/Default/hydro_io.h b/src/hydro/Default/hydro_io.h index 849903d46b..eebad22f44 100644 --- a/src/hydro/Default/hydro_io.h +++ b/src/hydro/Default/hydro_io.h @@ -29,11 +29,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/Gadget2/hydro.h b/src/hydro/Gadget2/hydro.h index d195c68b15..cf995f35f7 100644 --- a/src/hydro/Gadget2/hydro.h +++ b/src/hydro/Gadget2/hydro.h @@ -37,14 +37,13 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" #include "pressure_floor.h" -#include "./hydro_parameters.h" - /** * @brief Returns the comoving internal energy of a particle at the last * time the particle was kicked. diff --git a/src/hydro/Gadget2/hydro_iact.h b/src/hydro/Gadget2/hydro_iact.h index 27e8e8d8a2..cccc485ec3 100644 --- a/src/hydro/Gadget2/hydro_iact.h +++ b/src/hydro/Gadget2/hydro_iact.h @@ -33,10 +33,9 @@ */ #include "cache.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index 8142e4e5f0..721c8ebf20 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -21,11 +21,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/Gizmo/hydro_slope_limiters_cell.h b/src/hydro/Gizmo/hydro_slope_limiters_cell.h index a47da9e005..3f17e65810 100644 --- a/src/hydro/Gizmo/hydro_slope_limiters_cell.h +++ b/src/hydro/Gizmo/hydro_slope_limiters_cell.h @@ -19,10 +19,11 @@ #ifndef SWIFT_GIZMO_SLOPE_LIMITER_CELL_H #define SWIFT_GIZMO_SLOPE_LIMITER_CELL_H -#include <float.h> #include "hydro_getters.h" #include "hydro_setters.h" +#include <float.h> + /** * @brief Initialize variables for the cell wide slope limiter * diff --git a/src/hydro/Minimal/hydro.h b/src/hydro/Minimal/hydro.h index 36eb28ccf4..df65d8d68e 100644 --- a/src/hydro/Minimal/hydro.h +++ b/src/hydro/Minimal/hydro.h @@ -39,13 +39,12 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Returns the comoving internal energy of a particle at the last * time the particle was kicked. diff --git a/src/hydro/Minimal/hydro_iact.h b/src/hydro/Minimal/hydro_iact.h index e37edbe445..b0daa218c6 100644 --- a/src/hydro/Minimal/hydro_iact.h +++ b/src/hydro/Minimal/hydro_iact.h @@ -33,10 +33,9 @@ */ #include "adiabatic_index.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/Minimal/hydro_io.h b/src/hydro/Minimal/hydro_io.h index 9239de218e..ba70e8253f 100644 --- a/src/hydro/Minimal/hydro_io.h +++ b/src/hydro/Minimal/hydro_io.h @@ -35,11 +35,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/Planetary/hydro.h b/src/hydro/Planetary/hydro.h index 7da89f0018..5bb9aeca2a 100644 --- a/src/hydro/Planetary/hydro.h +++ b/src/hydro/Planetary/hydro.h @@ -41,13 +41,12 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" -#include "./hydro_parameters.h" - /* * Note: Define PLANETARY_SPH_NO_BALSARA to disable the Balsara (1995) switch * for the artificial viscosity and use the vanilla Monaghan (1992) instead. diff --git a/src/hydro/Planetary/hydro_iact.h b/src/hydro/Planetary/hydro_iact.h index 15340d302d..426a1672e6 100644 --- a/src/hydro/Planetary/hydro_iact.h +++ b/src/hydro/Planetary/hydro_iact.h @@ -35,10 +35,9 @@ #include "adiabatic_index.h" #include "const.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/Planetary/hydro_io.h b/src/hydro/Planetary/hydro_io.h index bf939ffa2c..c1303795f7 100644 --- a/src/hydro/Planetary/hydro_io.h +++ b/src/hydro/Planetary/hydro_io.h @@ -36,11 +36,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/PressureEnergy/hydro.h b/src/hydro/PressureEnergy/hydro.h index 6f68f92d1a..dd33023d54 100644 --- a/src/hydro/PressureEnergy/hydro.h +++ b/src/hydro/PressureEnergy/hydro.h @@ -42,14 +42,13 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" #include "pressure_floor.h" -#include "./hydro_parameters.h" - #include <float.h> /** diff --git a/src/hydro/PressureEnergy/hydro_iact.h b/src/hydro/PressureEnergy/hydro_iact.h index f40253a081..337a259b85 100644 --- a/src/hydro/PressureEnergy/hydro_iact.h +++ b/src/hydro/PressureEnergy/hydro_iact.h @@ -33,10 +33,9 @@ */ #include "adiabatic_index.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/PressureEnergy/hydro_io.h b/src/hydro/PressureEnergy/hydro_io.h index 2be85e79b6..5b28d5a50a 100644 --- a/src/hydro/PressureEnergy/hydro_io.h +++ b/src/hydro/PressureEnergy/hydro_io.h @@ -33,11 +33,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h index 11b4659086..d1ff15c217 100644 --- a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h +++ b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro.h @@ -43,13 +43,12 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" -#include "./hydro_parameters.h" - #include <float.h> /** diff --git a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h index 6ed6dd2c36..bdb9eba677 100644 --- a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h +++ b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_iact.h @@ -34,10 +34,9 @@ */ #include "adiabatic_index.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_io.h b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_io.h index 69385e5609..4429227798 100644 --- a/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_io.h +++ b/src/hydro/PressureEnergyMorrisMonaghanAV/hydro_io.h @@ -34,11 +34,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/PressureEntropy/hydro.h b/src/hydro/PressureEntropy/hydro.h index f0504b382e..c98e86c93e 100644 --- a/src/hydro/PressureEntropy/hydro.h +++ b/src/hydro/PressureEntropy/hydro.h @@ -37,13 +37,12 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Returns the comoving internal energy of a particle at the last * time the particle was kicked. diff --git a/src/hydro/PressureEntropy/hydro_iact.h b/src/hydro/PressureEntropy/hydro_iact.h index 194932f65e..ddf5297254 100644 --- a/src/hydro/PressureEntropy/hydro_iact.h +++ b/src/hydro/PressureEntropy/hydro_iact.h @@ -19,7 +19,7 @@ #ifndef SWIFT_PRESSURE_ENTROPY_HYDRO_IACT_H #define SWIFT_PRESSURE_ENTROPY_HYDRO_IACT_H -#include "./hydro_parameters.h" +#include "hydro_parameters.h" /** * @file PressureEntropy/hydro_iact.h diff --git a/src/hydro/PressureEntropy/hydro_io.h b/src/hydro/PressureEntropy/hydro_io.h index d3c800e03f..417698830a 100644 --- a/src/hydro/PressureEntropy/hydro_io.h +++ b/src/hydro/PressureEntropy/hydro_io.h @@ -32,11 +32,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/SPHENIX/hydro.h b/src/hydro/SPHENIX/hydro.h index ed158d7d10..ad1248e3f0 100644 --- a/src/hydro/SPHENIX/hydro.h +++ b/src/hydro/SPHENIX/hydro.h @@ -33,14 +33,13 @@ #include "dimension.h" #include "entropy_floor.h" #include "equation_of_state.h" +#include "hydro_parameters.h" #include "hydro_properties.h" #include "hydro_space.h" #include "kernel_hydro.h" #include "minmax.h" #include "pressure_floor.h" -#include "./hydro_parameters.h" - #include <float.h> /** diff --git a/src/hydro/SPHENIX/hydro_iact.h b/src/hydro/SPHENIX/hydro_iact.h index 012f702004..f85b6ed142 100644 --- a/src/hydro/SPHENIX/hydro_iact.h +++ b/src/hydro/SPHENIX/hydro_iact.h @@ -27,10 +27,9 @@ */ #include "adiabatic_index.h" +#include "hydro_parameters.h" #include "minmax.h" -#include "./hydro_parameters.h" - /** * @brief Density interaction between two particles. * diff --git a/src/hydro/SPHENIX/hydro_io.h b/src/hydro/SPHENIX/hydro_io.h index 834d3e0a89..e16d3558b1 100644 --- a/src/hydro/SPHENIX/hydro_io.h +++ b/src/hydro/SPHENIX/hydro_io.h @@ -28,11 +28,10 @@ #include "adiabatic_index.h" #include "hydro.h" +#include "hydro_parameters.h" #include "io_properties.h" #include "kernel_hydro.h" -#include "./hydro_parameters.h" - /** * @brief Specifies which particle fields to read from a dataset * diff --git a/src/hydro/Shadowswift/hydro.h b/src/hydro/Shadowswift/hydro.h index 0fb06b5ea3..907f16c6dc 100644 --- a/src/hydro/Shadowswift/hydro.h +++ b/src/hydro/Shadowswift/hydro.h @@ -19,7 +19,6 @@ #ifndef SWIFT_SHADOWSWIFT_HYDRO_H #define SWIFT_SHADOWSWIFT_HYDRO_H -#include <float.h> #include "adiabatic_index.h" #include "approx_math.h" #include "cosmology.h" @@ -30,6 +29,8 @@ #include "hydro_space.h" #include "voronoi_algorithm.h" +#include <float.h> + /** * @brief Computes the hydro time-step of a given particle * diff --git a/src/hydro/Shadowswift/voronoi1d_algorithm.h b/src/hydro/Shadowswift/voronoi1d_algorithm.h index 74cc5f1dbf..6dcdc1355f 100644 --- a/src/hydro/Shadowswift/voronoi1d_algorithm.h +++ b/src/hydro/Shadowswift/voronoi1d_algorithm.h @@ -20,12 +20,13 @@ #ifndef SWIFT_VORONOIXD_ALGORITHM_H #define SWIFT_VORONOIXD_ALGORITHM_H -#include <math.h> -#include <stdlib.h> #include "error.h" #include "inline.h" #include "voronoi1d_cell.h" +#include <math.h> +#include <stdlib.h> + /** * @brief Store the extents of the simulation box in the global variables. * diff --git a/src/hydro/Shadowswift/voronoi2d_algorithm.h b/src/hydro/Shadowswift/voronoi2d_algorithm.h index 947595107a..16efe290a9 100644 --- a/src/hydro/Shadowswift/voronoi2d_algorithm.h +++ b/src/hydro/Shadowswift/voronoi2d_algorithm.h @@ -20,14 +20,15 @@ #ifndef SWIFT_VORONOIXD_ALGORITHM_H #define SWIFT_VORONOIXD_ALGORITHM_H -#include <float.h> -#include <math.h> -#include <stdlib.h> #include "error.h" #include "inline.h" #include "minmax.h" #include "voronoi2d_cell.h" +#include <float.h> +#include <math.h> +#include <stdlib.h> + /* Check if the number of vertices exceeds the maximal allowed number */ #define VORONOI_CHECK_SIZE() \ if (nvert > VORONOI2D_MAXNUMVERT) { \ diff --git a/src/hydro/Shadowswift/voronoi3d_algorithm.h b/src/hydro/Shadowswift/voronoi3d_algorithm.h index 353ef6f6e2..37d7730545 100644 --- a/src/hydro/Shadowswift/voronoi3d_algorithm.h +++ b/src/hydro/Shadowswift/voronoi3d_algorithm.h @@ -20,14 +20,15 @@ #ifndef SWIFT_VORONOIXD_ALGORITHM_H #define SWIFT_VORONOIXD_ALGORITHM_H +#include "error.h" +#include "inline.h" +#include "voronoi3d_cell.h" + #include <float.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "error.h" -#include "inline.h" -#include "voronoi3d_cell.h" /* For debugging purposes */ //#define LOOP_CHECK 1000 diff --git a/src/hydro_space.c b/src/hydro_space.c index 442945caf8..9c5ab9fc61 100644 --- a/src/hydro_space.c +++ b/src/hydro_space.c @@ -18,6 +18,7 @@ ******************************************************************************/ #include "hydro_space.h" + #include "space.h" /** diff --git a/src/kernel_hydro.c b/src/kernel_hydro.c index 18a930d8ff..f1b3f7448c 100644 --- a/src/kernel_hydro.c +++ b/src/kernel_hydro.c @@ -18,11 +18,11 @@ * ******************************************************************************/ +#include "kernel_hydro.h" + #include <math.h> #include <stdio.h> -#include "kernel_hydro.h" - /** * @brief Test the SPH kernel function by dumping it in the interval [0,1]. * diff --git a/src/kernel_hydro.h b/src/kernel_hydro.h index 6e3d964a34..fcb6e91906 100644 --- a/src/kernel_hydro.h +++ b/src/kernel_hydro.h @@ -353,8 +353,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/line_of_sight.c b/src/line_of_sight.c index fd794abac4..8c3bce0caf 100644 --- a/src/line_of_sight.c +++ b/src/line_of_sight.c @@ -26,9 +26,6 @@ #include <mpi.h> #endif -#include <stdio.h> -#include <stdlib.h> - #include "atomic.h" #include "chemistry_io.h" #include "cooling_io.h" @@ -43,6 +40,9 @@ #include "tracers_io.h" #include "velociraptor_io.h" +#include <stdio.h> +#include <stdlib.h> + /** * @brief Will the line of sight intersect a given cell? * @@ -970,7 +970,7 @@ void do_line_of_sight(struct engine *e) { H5Gclose(h_grp); } - /* Free up some memory */ + /* Free up some memory */ #ifdef WITH_MPI free(counts); free(offsets); diff --git a/src/logger_io.c b/src/logger_io.c index 2b4deb407b..cd97be4413 100644 --- a/src/logger_io.c +++ b/src/logger_io.c @@ -24,6 +24,8 @@ #if defined(WITH_LOGGER) /* Some standard headers. */ +#include "common_io.h" + #include <hdf5.h> #include <math.h> #include <stddef.h> @@ -31,8 +33,6 @@ #include <stdlib.h> #include <string.h> -#include "common_io.h" - /* This object's header. */ #include "logger_io.h" diff --git a/src/memswap.h b/src/memswap.h index 330173100f..adaab7fbd2 100644 --- a/src/memswap.h +++ b/src/memswap.h @@ -20,9 +20,10 @@ #define SWIFT_MEMSWAP_H /* Config parameters. */ -#include <stdint.h> #include "../config.h" +#include <stdint.h> + #ifdef HAVE_IMMINTRIN_H /* Include the header file with the intrinsics for Intel architecture. */ #include <immintrin.h> diff --git a/src/memuse.c b/src/memuse.c index c3eefbf045..42f93ee023 100644 --- a/src/memuse.c +++ b/src/memuse.c @@ -232,8 +232,8 @@ void memuse_log_dump(const char *filename) { /* Found the allocation, this should be the free. */ if (memuse_log[k].allocated) { - /* Allocated twice, this is an error, but we cannot abort as that will - * attempt another memory dump, so just complain. */ + /* Allocated twice, this is an error, but we cannot abort as that will + * attempt another memory dump, so just complain. */ #if SWIFT_DEBUG_CHECKS message("Allocated the same address twice (%s: %zd)", memuse_log[k].label, memuse_log[k].size); @@ -261,7 +261,7 @@ void memuse_log_dump(const char *filename) { } else if (child == NULL && !memuse_log[k].allocated) { - /* Unmatched free, OK if NULL. */ + /* Unmatched free, OK if NULL. */ #if SWIFT_DEBUG_CHECKS if (memuse_log[k].ptr != NULL) { message("Unmatched non-NULL free: %s", memuse_log[k].label); @@ -292,8 +292,8 @@ void memuse_log_dump(const char *filename) { } #ifdef MEMUSE_RNODE_DUMP - /* Debug dump of tree. */ - // memuse_rnode_dump(0, memuse_rnode_root, 0); + /* Debug dump of tree. */ + // memuse_rnode_dump(0, memuse_rnode_root, 0); #endif /* Now we find all the still active nodes and gather their sizes against the diff --git a/src/memuse_rnodes.c b/src/memuse_rnodes.c index 260c18dbc7..55798c619a 100644 --- a/src/memuse_rnodes.c +++ b/src/memuse_rnodes.c @@ -165,7 +165,7 @@ void memuse_rnode_insert_child(struct memuse_rnode *node, uint8_t depth, /* Are we at the lowest level yet? */ depth++; if (depth == keylen) { - /* Our destination node. */ + /* Our destination node. */ #if SWIFT_DEBUG_CHECKS if (child->ptr != NULL) diff --git a/src/mpiuse.c b/src/mpiuse.c index 0688affa1b..84ca2a03a0 100644 --- a/src/mpiuse.c +++ b/src/mpiuse.c @@ -227,7 +227,7 @@ void mpiuse_log_dump(const char *filename, ticks stepticks) { /* Should be the handoff. Check that. */ if (mpiuse_log[k].activation) { - /* Used twice, this is an error, but just complain as not fatal. */ + /* Used twice, this is an error, but just complain as not fatal. */ #if SWIFT_DEBUG_CHECKS message( "Used the same MPI request address twice " @@ -264,7 +264,7 @@ void mpiuse_log_dump(const char *filename, ticks stepticks) { } else if (child == NULL && !mpiuse_log[k].activation) { - /* Unmatched handoff, not OK, but not fatal. */ + /* Unmatched handoff, not OK, but not fatal. */ #if SWIFT_DEBUG_CHECKS if (mpiuse_log[k].ptr != NULL) { message("Unmatched MPI_Test found: (%s/%s: %d->%d: %zd/%d)", @@ -312,8 +312,8 @@ void mpiuse_log_dump(const char *filename, ticks stepticks) { } #ifdef MEMUSE_RNODE_DUMP - /* Debug dump of tree. */ - // memuse_rnode_dump(0, memuse_rnode_root, 0); + /* Debug dump of tree. */ + // memuse_rnode_dump(0, memuse_rnode_root, 0); #endif /* Write our statistics. */ diff --git a/src/multipole.h b/src/multipole.h index cc9376aac5..8de5c331ad 100644 --- a/src/multipole.h +++ b/src/multipole.h @@ -526,9 +526,9 @@ __attribute__((nonnull)) INLINE static int gravity_multipole_equal( return 0; } #if SELF_GRAVITY_MULTIPOLE_ORDER > 0 - /* Manhattan Norm of 1st order terms */ - /* Nothing to do here all the 1st order terms are 0 since we expand around - * CoM */ + /* Manhattan Norm of 1st order terms */ + /* Nothing to do here all the 1st order terms are 0 since we expand around + * CoM */ #endif #if SELF_GRAVITY_MULTIPOLE_ORDER > 1 /* Manhattan Norm of 2nd order terms */ diff --git a/src/multipole_accept.h b/src/multipole_accept.h index ead2139571..5d67e8f1d4 100644 --- a/src/multipole_accept.h +++ b/src/multipole_accept.h @@ -106,7 +106,7 @@ __attribute__((nonnull, pure)) INLINE static int gravity_M2L_accept( E_BA_term /= (rho_A + rho_B); } - /* Compute r^p */ + /* Compute r^p */ #if SELF_GRAVITY_MULTIPOLE_ORDER % 2 == 1 const float r_to_p = integer_powf(sqrtf(r2), p); #else diff --git a/src/partition.c b/src/partition.c index 9004adb2ad..b927ec3d62 100644 --- a/src/partition.c +++ b/src/partition.c @@ -168,17 +168,17 @@ static void split_vector(struct space *s, int nregions, int *samplecells) { } #endif - /* METIS/ParMETIS support (optional) - * ================================= - * - * METIS/ParMETIS 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. - * - * Repartitioning is based on ParMETIS and uses weights determined from the - * estimated costs that a cells tasks will take or the relative time bins of - * the cells next updates. - */ +/* METIS/ParMETIS support (optional) + * ================================= + * + * METIS/ParMETIS 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. + * + * Repartitioning is based on ParMETIS and uses weights determined from the + * estimated costs that a cells tasks will take or the relative time bins of + * the cells next updates. + */ #if defined(WITH_MPI) && (defined(HAVE_METIS) || defined(HAVE_PARMETIS)) /** @@ -1612,7 +1612,7 @@ static void repart_edge_metis(int vweights, int eweights, int timebins, if (res != MPI_SUCCESS) mpi_error(res, "Failed to allreduce edge weights."); } - /* Allocate cell list for the partition. If not already done. */ + /* Allocate cell list for the partition. If not already done. */ #ifdef HAVE_PARMETIS int refine = 1; #endif @@ -1692,7 +1692,7 @@ static void repart_edge_metis(int vweights, int eweights, int timebins, } } - /* And repartition/ partition, using both weights or not as requested. */ + /* And repartition/ partition, using both weights or not as requested. */ #ifdef HAVE_PARMETIS if (repartition->usemetis) { pick_metis(nodeID, s, nr_nodes, weights_v, weights_e, @@ -1790,7 +1790,7 @@ static void repart_memory_metis(struct repartition *repartition, int nodeID, for (int k = 0; k < s->nr_cells; k++) weights[k] *= scale; } - /* And repartition. */ + /* And repartition. */ #ifdef HAVE_PARMETIS if (repartition->usemetis) { pick_metis(nodeID, s, nr_nodes, weights, NULL, repartition->celllist); diff --git a/src/restart.c b/src/restart.c index 6d9eb8be40..91441fe51b 100644 --- a/src/restart.c +++ b/src/restart.c @@ -26,6 +26,11 @@ #include "../config.h" /* Standard headers. */ +#include "engine.h" +#include "error.h" +#include "restart.h" +#include "version.h" + #include <errno.h> #include <glob.h> #include <stdio.h> @@ -34,11 +39,6 @@ #include <sys/stat.h> #include <unistd.h> -#include "engine.h" -#include "error.h" -#include "restart.h" -#include "version.h" - /* The signature for restart files. */ #define SWIFT_RESTART_SIGNATURE "SWIFT-restart-file" #define SWIFT_RESTART_END_SIGNATURE "SWIFT-restart-file:end" diff --git a/src/runner_doiact_functions_black_holes.h b/src/runner_doiact_functions_black_holes.h index 41b573eeec..1cbd4d66d5 100644 --- a/src/runner_doiact_functions_black_holes.h +++ b/src/runner_doiact_functions_black_holes.h @@ -109,8 +109,8 @@ void DOSELF1_BH(struct runner *r, struct cell *c, int timer) { } /* loop over the bparts in ci. */ } /* Do we have gas particles in the cell? */ - /* When doing BH swallowing, we need a quick loop also over the BH - * neighbours */ + /* When doing BH swallowing, we need a quick loop also over the BH + * neighbours */ #if (FUNCTION_TASK_LOOP == TASK_LOOP_SWALLOW) /* Loop over the bparts in ci. */ @@ -263,8 +263,8 @@ void DO_NONSYM_PAIR1_BH_NAIVE(struct runner *r, struct cell *restrict ci, } /* loop over the bparts in ci. */ } /* Do we have gas particles in the cell? */ - /* When doing BH swallowing, we need a quick loop also over the BH - * neighbours */ + /* When doing BH swallowing, we need a quick loop also over the BH + * neighbours */ #if (FUNCTION_TASK_LOOP == TASK_LOOP_SWALLOW) const int bcount_j = cj->black_holes.count; diff --git a/src/runner_doiact_grav.c b/src/runner_doiact_grav.c index 0325479aec..e0e040e38e 100644 --- a/src/runner_doiact_grav.c +++ b/src/runner_doiact_grav.c @@ -320,7 +320,7 @@ static INLINE void runner_dopair_grav_pp_full_no_cache( cache_i->pot[i] += pot; } - /* Write back to the particle data */ + /* Write back to the particle data */ #ifndef SWIFT_TASKS_WITHOUT_ATOMICS lock_lock(&ci->grav.plock); #endif @@ -519,7 +519,7 @@ static INLINE void runner_dopair_grav_pp_truncated_no_cache( cache_i->pot[i] += pot; } - /* Write back to the particle data */ + /* Write back to the particle data */ #ifndef SWIFT_TASKS_WITHOUT_ATOMICS lock_lock(&ci->grav.plock); #endif @@ -1768,7 +1768,7 @@ void runner_doself_grav_pp(struct runner *r, struct cell *c) { } } - /* Write back to the particles */ + /* Write back to the particles */ #ifndef SWIFT_TASKS_WITHOUT_ATOMICS lock_lock(&c->grav.plock); #endif @@ -2078,7 +2078,7 @@ void runner_dopair_recursive_grav_pm(struct runner *r, struct cell *ci, cj); } - /* Write back to the particles */ + /* Write back to the particles */ #ifndef SWIFT_TASKS_WITHOUT_ATOMICS lock_lock(&ci->grav.plock); #endif diff --git a/src/runner_ghost.c b/src/runner_ghost.c index 38bc3de8fe..feb9aace24 100644 --- a/src/runner_ghost.c +++ b/src/runner_ghost.c @@ -1096,10 +1096,10 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { if (((p->h >= hydro_h_max) && (f < 0.f)) || ((p->h <= hydro_h_min) && (f > 0.f))) { - /* We have a particle whose smoothing length is already set (wants - * to be larger but has already hit the maximum OR wants to be - * smaller but has already reached the minimum). So, just tidy up - * as if the smoothing length had converged correctly */ + /* We have a particle whose smoothing length is already set (wants + * to be larger but has already hit the maximum OR wants to be + * smaller but has already reached the minimum). So, just tidy up + * as if the smoothing length had converged correctly */ #ifdef EXTRA_HYDRO_LOOP diff --git a/src/runner_others.c b/src/runner_others.c index b42a931a8f..4fd380be04 100644 --- a/src/runner_others.c +++ b/src/runner_others.c @@ -130,7 +130,7 @@ void runner_do_grav_mesh(struct runner *r, struct cell *c, int timer) { if (c->progeny[k] != NULL) runner_do_grav_mesh(r, c->progeny[k], 0); } else { - /* Get the forces from the gravity mesh */ + /* Get the forces from the gravity mesh */ #ifndef SWIFT_TASKS_WITHOUT_ATOMICS lock_lock(&c->grav.plock); #endif diff --git a/src/stars/Default/stars.h b/src/stars/Default/stars.h index 85e92c199b..7f4ed68e8d 100644 --- a/src/stars/Default/stars.h +++ b/src/stars/Default/stars.h @@ -19,9 +19,10 @@ #ifndef SWIFT_DEFAULT_STARS_H #define SWIFT_DEFAULT_STARS_H -#include <float.h> #include "minmax.h" +#include <float.h> + /** * @brief Computes the gravity time-step of a given star particle. * diff --git a/src/stars/GEAR/stars.h b/src/stars/GEAR/stars.h index a4a9b2ecdc..70f8c0a75f 100644 --- a/src/stars/GEAR/stars.h +++ b/src/stars/GEAR/stars.h @@ -19,9 +19,10 @@ #ifndef SWIFT_GEAR_STARS_H #define SWIFT_GEAR_STARS_H -#include <float.h> #include "minmax.h" +#include <float.h> + /** * @brief Computes the gravity time-step of a given star particle. * diff --git a/tests/testAdiabaticIndex.c b/tests/testAdiabaticIndex.c index 6aa794207f..6d754a06fe 100644 --- a/tests/testAdiabaticIndex.c +++ b/tests/testAdiabaticIndex.c @@ -17,14 +17,13 @@ * ******************************************************************************/ #include "../config.h" +#include "swift.h" #include <fenv.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "swift.h" - /** * @brief Check that a and b are consistent (up to some relative error) * diff --git a/tests/testErfc.c b/tests/testErfc.c index 26f219befc..8506e3afd5 100644 --- a/tests/testErfc.c +++ b/tests/testErfc.c @@ -18,7 +18,6 @@ ******************************************************************************/ #include "../config.h" - #include "swift.h" /* Standard includes */ diff --git a/tests/testExp.c b/tests/testExp.c index f4848f3ae9..3f48736dc7 100644 --- a/tests/testExp.c +++ b/tests/testExp.c @@ -18,7 +18,6 @@ ******************************************************************************/ #include "../config.h" - #include "swift.h" /* Standard includes */ diff --git a/tests/testHydroMPIrules.c b/tests/testHydroMPIrules.c index 9a303b2f0d..1e635284d1 100644 --- a/tests/testHydroMPIrules.c +++ b/tests/testHydroMPIrules.c @@ -17,14 +17,13 @@ * ******************************************************************************/ #include "../config.h" +#include "swift.h" #include <fenv.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "swift.h" - void print_bytes(void *p, size_t len) { printf("("); for (size_t i = 0; i < len; ++i) { @@ -97,7 +96,7 @@ void test(void) { error("Particles 'pj' do not match after density (byte = %d)", j_not_ok); } - /* --- Test the gradient loop --- */ + /* --- Test the gradient loop --- */ #ifdef EXTRA_HYDRO_LOOP runner_iact_nonsym_gradient(r2, dx, pi.h, pj.h, &pi, &pj, a, H); diff --git a/tests/testKernel.c b/tests/testKernel.c index e3a13a4d54..6b338e93b0 100644 --- a/tests/testKernel.c +++ b/tests/testKernel.c @@ -18,7 +18,6 @@ * ******************************************************************************/ #include "../config.h" - #include "align.h" #include "kernel_hydro.h" #include "vector.h" diff --git a/tests/testKernelLongGrav.c b/tests/testKernelLongGrav.c index b7a8c1a353..396ce6b9dc 100644 --- a/tests/testKernelLongGrav.c +++ b/tests/testKernelLongGrav.c @@ -18,7 +18,6 @@ ******************************************************************************/ #include "../config.h" - #include "swift.h" /* Standard includes */ diff --git a/tests/testMaths.c b/tests/testMaths.c index 8dbae78b78..77ad1e35cd 100644 --- a/tests/testMaths.c +++ b/tests/testMaths.c @@ -18,7 +18,6 @@ ******************************************************************************/ #include "../config.h" - #include "approx_math.h" #include "vector.h" diff --git a/tests/testParser.c b/tests/testParser.c index e14eeae6a0..25b9df0679 100644 --- a/tests/testParser.c +++ b/tests/testParser.c @@ -18,11 +18,12 @@ * ******************************************************************************/ +#include "parser.h" + #include <assert.h> #include <math.h> #include <stdio.h> #include <string.h> -#include "parser.h" int main(int argc, char *argv[]) { const char *input_file = argv[1]; diff --git a/tests/testSymmetry.c b/tests/testSymmetry.c index 5958d97ee9..a5a1be2ce2 100644 --- a/tests/testSymmetry.c +++ b/tests/testSymmetry.c @@ -17,15 +17,14 @@ * ******************************************************************************/ #include "../config.h" +#include "swift.h" +#include "timestep_limiter_iact.h" #include <fenv.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "swift.h" -#include "timestep_limiter_iact.h" - void print_bytes(void *p, size_t len) { printf("("); for (size_t i = 0; i < len; ++i) { @@ -184,7 +183,7 @@ void test(void) { error("Particles 'pj' do not match after density (byte = %d)", j_not_ok); } - /* --- Test the gradient loop --- */ + /* --- Test the gradient loop --- */ #ifdef EXTRA_HYDRO_LOOP /* Call the symmetric version */ -- GitLab