diff --git a/.clang-format b/.clang-format index 49524f944860b51ba9aa461b3299b70a68df46ae..0ec62953436381379df734cd568d95e98627ded5 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 3db4be05be13066ab6dd7644e25d495bdf70dc21..4de91bb6bf8d19b60c097d34d2cb5812b826310c 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 4fa82c60838cf417961682318095f090f1bb709f..6ea752bdd4f55590fa36883621e6ea964b1ac761 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 52318f90e372f0ea9ba45d53dca3b1082fb86a69..587ad429ecff25cf941eef8669b163487cdd33cd 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 60d03518e3e0a82e035e0fe81abdc7ca27e13ef7..5760e42fda065e865d4247c6e5a20b177d1741ad 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 5f411833aafa603d085258f11b8bbb35ff1c6d39..cd616318d78c25cdd5e1c76ccad64ce3e3595f0f 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 f1ce38458e28f4862300fa36bfda5c4d2b372a0c..c1cf594ab31423556b415afe0078d6e6e91a2693 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 91346334c9b2eaf9fbb343aba44f8a02d866d1ef..dd154609e51b801b8bfd3a3d2f5287246779dc86 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 6bebe3aefa619052b1f7688ad627fde6812d8d81..b94ef85696244fd39b5ac7839ceef62d090cdbac 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 7c1660ec7530af7fc5440abd20c5ab627dbc9882..a161aa101b40c6035062cae75d4ae9fceabdde1f 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 07cddd89b4e39fef863dcbfd387cfda440c1ae62..3321535d87c29bd6a9024cb5dbb7db63df986872 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 e0eb8080f53f27343ff030ada6aa487e62cc9dd3..dae3fa9053dd872388821485a161399bdf30757a 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 d145934bc036357bb5d9ca9a60ec9cd4c8cb2904..9329b0d4142746ec913f85107d12a5e76925ae70 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 929a7124baa8ab05fd3452f87076d95c88c2f3b2..4f8a75b20e8e5e8ffc46beed5028cdf1d3a0bf0e 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 1b7d4ac37caf100c48b504a3836166ce33c24169..ca31a701fdf60c78b1303e5a74acc73e2fae5ec8 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 5e656d7876b168d45c4bd4bfe017d4b7f4371f4f..73cc156420699923a71bd23d1c9d239d987bfd95 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 f115d4812e5aed8426a72f6d1918b7c0ed307d32..30fd9031e159b2dab033623fc2adef34cf2d5bbf 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 09edb3b34551011bbac20ae561ab5215d8cf51d8..5db398c71e081ef34fd89240fbd66fe38266e923 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 1de3265df6298eeb955758e272c7e17afb64de00..8ec888db5deeb970adbe670d3d89be27aac45d34 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 20abd6f423c9c5aadbb30b9bb8096e860b050234..3890a91a8fc78f4088d4774469f22d8df02783b6 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 bb75335b8f72ea8dd35ebd66ea9d9340e58b1e4a..20036f4335ef25d029a60143ac7e4376e45032a9 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 5f3f3737e433df694c67eaa5adfdfd00efb23cd9..9d8980adf4af074a4639f217c144f16b71a0015f 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 5e7515b953a3c3cc6adb23e79c801724636c9b71..1235da60851ff661f53234452c5e62c5423bb52e 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 b14ecc4e738b8c3331f7ad0039e23cb2623a2d2e..9e34242565f04bca5d624219b628608fbda31e69 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 3ebf9271dcc2060de0731c00a1c362a877ee64a7..a9632c77a65b7d351fef7b0ee5e72f3f76b597d7 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 281ad02715b06dead893f7cbc679782803b383ca..7a0639dfd63cbdbd3a6f2a36002f31bbae7bc40b 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 9abd09a5f68c9762fec3b57b6d61e3cdd045d6c3..18919bbcac74a155f8226762f02f6cb11cf2504b 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 2d02b350caada74a9054ab7d698fe90c3d0b2736..181deb4d608b7d3ced6a083fcfb47f4c9dc2993e 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 065a38e1969c48682b7c4619cc317e2dd576e7e2..67c60a75e6fc460fc707a81488f70f4d80d30a02 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 eb6612fe48e8a4990404a47cd4ec6398fbf6f252..1bf4c216e5f8261b898e14f81362d2e93c58f84d 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 849903d46b2dc0d79dae3ba623c494a1ac507a49..eebad22f4449038a69c9168a0de675820615c560 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 d195c68b15278cf2758ec307541d0422606a5bd9..cf995f35f753c22bcd40c6f601d0b05cf17909cb 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 27e8e8d8a2717a818c823bfa306e184d42c4a0ca..cccc485ec319c5e592bc6895fb29f9b69e578f72 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 8142e4e5f0b109a985b330e731ea65a43a409577..721c8ebf2038c69f2539121a90e22e140f947b1a 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 a47da9e005429e180e8813db33499463cb855425..3f17e65810696bdc8a29c448046ef713f6bf47fa 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 36eb28ccf4eb804130e7930bb5a99e8826424c02..df65d8d68e70f630d913cf90aea581a5635b7780 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 e37edbe445942ae1f3de32a05c7421da460d1f3d..b0daa218c6a3aef855116879457631fb852803bb 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 9239de218e513fc2e9ae9e03d08dd421b6923d38..ba70e8253f467be474e86518ef3e6348f5aa2a21 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 7da89f0018a7bb9a1a0d0c7fc4c788416189d128..5bb9aeca2a40d0fd394c73546766bc5142ab9ef1 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 15340d302d55bbdbe37fc28d72b1e7f37b1269bf..426a1672e66e94067be153682534f03c31bfd8ee 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 bf939ffa2c0052eb728abb182e5719bb914df122..c1303795f7711c87126b4fc166caa697df15a136 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 6f68f92d1a11403e3398ba9b3ab19e87601024c4..dd33023d5415cc4270e40fa136813071c3da5549 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 f40253a08170e9af7c4b0be708c0c605ead469cf..337a259b859220ef27d22f1c6f7a44f5a98aed29 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 2be85e79b67eba1d9d6306a64f7639cae4bac291..5b28d5a50ac7e8eae45ca2b3d6661f785c819f66 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 11b4659086d3c2b0791789a411934e1ff8b22c32..d1ff15c217a76edb0f2e334298496d045e7f714a 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 6ed6dd2c36dd81a69ef1116a3f101c80b2c90f1e..bdb9eba677fdec19545cc1e35e1040d285191a1e 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 69385e5609609a6fe9451d2b3f2aa8fad1e50830..4429227798b8a9527b1e5299e57b3aa30d8eeb41 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 f0504b382e911ca85c2c6e68d54f6dfc50841a94..c98e86c93e54211b0f40f3b04c9304bdebe6e093 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 194932f65e14a649b0c64d1f72e93c540521e717..ddf5297254929f6e0f45cbc568b8d8ca5949caec 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 d3c800e03ff46920d203ef0831fa2d7a5c48b077..417698830a8ee7f822fe52ffe4d080fe81fa8b42 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 ed158d7d10fb720d8c638b1bd76c759741ce11e4..ad1248e3f031d25a8674c3660c742fc58eb22e8e 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 012f70200405b998c12944cbfdb86e27f123c7f0..f85b6ed1429b813cc42985c6ab21e703a265b3dd 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 834d3e0a899f2b8089aa0f0da5713208f5127e2a..e16d3558b117da00c60052fadd8ced87dc3a16dd 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 0fb06b5ea3633df158e4aae0446d22a12b63160f..907f16c6dc65bf2ef9efcd4ab3501cb2cdab562c 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 74cc5f1dbf3a2d72df55ce73de0321b5493193a7..6dcdc1355f02bf304e95a4c46d7e4f4c1943100c 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 947595107a4d3705c52c982da0dc8e54a5c2376e..16efe290a9c8144eb77953676c0c424288a76f63 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 353ef6f6e24356048d5f665fe1bcf81c4e6d6a50..37d7730545340a0a7afdb6fed27a351a1b654ff6 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 442945caf83a692efadf7755ebf463ebde38e0a4..9c5ab9fc619fca98dc22f15124bf4a6a63dcd539 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 18a930d8ff7f792b2f9606787a6e4c547770629a..f1b3f7448ce8f2910ed24e468c9be9c9f55bdc1a 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 6e3d964a348cf65d4ed427951f643f8c0c4ad240..fcb6e91906421a2436f645f06fb03c9116fa4a32 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 fd794abac40f102cb42439a8b57af18e446ce864..8c3bce0caffd7c64daaa8d67edd939c8ca492add 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 2b4deb407bb72c6c144a396bdf587688cbc1c5c6..cd97be44133baf105f9006e17218207a5765a445 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 330173100f41b80fcc65c9fce01838b5de8e778f..adaab7fbd295f25bdbec14b757abc68b228e2e89 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 c3eefbf045b84918ace42d917e8a9bccb3a0f02a..42f93ee023b7b620e13fca00df7893af1389db6a 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 260c18dbc7997671ee1e9d516afb8aaa0591e43c..55798c619aab5637cf445fd1dba62a272624983b 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 0688affa1b17b0298b5cfe5dafe8ce28f5e16032..84ca2a03a0100afe68ba75ac8066fc8e305ccfcf 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 cc9376aac502dfcfe032679b6e8ec6b8b50d6dfb..8de5c331ad80314571987d7e995735a75aba0162 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 ead2139571f4a037376ac703aa8997e7bfa05282..5d67e8f1d47a8f92c118993a4bd2a8d031652bd8 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 9004adb2adb54e980174608ffb30d546c69911ed..b927ec3d627af8d00af70fb705a572aafc85b71b 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 6d9eb8be408c8f331199c1573b725494b9cbc685..91441fe51bfc97a0a93ac31834a6b39b54a17e58 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 41b573eeecdfa4332d266161c5d6cecfebbdae83..1cbd4d66d5a73b3f8f6056a9064e142c2d685719 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 0325479aec0573e40c73c718b66bfb69b27a0dc5..e0e040e38eb0d7551769f87df01eb646af21ac1e 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 38bc3de8fee1d87301f1881cb506ecefbdbad86c..feb9aace24446670c42412b88582930ffe8f11b3 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 b42a931a8f812ea7fb584de6ac0fca9c2e89c50b..4fd380be04bdc23b598bcceae8223107cc9c48ec 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 85e92c199b08f21d09b2713a3d09537812c510b0..7f4ed68e8dda0ac0b555379057a97bfeda006359 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 a4a9b2ecdc79e45e108b5221e3880c78ca85e609..70f8c0a75fdf7c06dacdd4af51602b36d9ca6b48 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 6aa794207f0e23e6a26060f3ef98b7ee841d7a32..6d754a06feb4cc640d2819014dcb4b75673c8261 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 26f219befcdc696a36f2eec8d3f04f5f07c3dcfa..8506e3afd561c39eceeb2fac7fb5858dd65dbdb7 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 f4848f3ae934bf0f62d2f247294cf09128555660..3f48736dc7d4ff171458828ebfd42207ea6b865d 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 9a303b2f0d604f1b3062624674f7e38c73e65ed9..1e635284d12fc999f30faffb7f837eb90adc2d1b 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 e3a13a4d54697f32c100b1f149a768a342da37a7..6b338e93b04c739ff381e12881316c73cc86d1fc 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 b7a8c1a3532dc11e5b4a6bf1cb28f0e82b76d88c..396ce6b9dc3ef75278d42bc7919904bd1e38aa7e 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 8dbae78b78daf33c6d116195e35dec8cda061f02..77ad1e35cd76890d177abd0b9566c9c9a74a6174 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 e14eeae6a0e1b9adb6add6d8677e645613b35ddc..25b9df0679c3fab9fc0cb5bfb4dbe71f010c9df0 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 5958d97ee995efef5347214d467eac253c550bbc..a5a1be2ce21d42af6e86513fb7293a6376a351de 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 */