From c123d8e576fbe7d45bcc6c805c77fb76dcde1bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-No=C3=ABl=20Grad?= Date: Thu, 2 May 2024 19:06:59 +0200 Subject: [PATCH] Apply linting and compiler diagnostics suggestions Simplify dependencies in CMake targets of the waLBerla bridge. Fix several instances of -Wunused-parameter and -Wsign-compare. Update pylint rules and address them in Python scripts. Bump version requirements in GitHub Actions. --- .github/workflows/deploy.yml | 2 +- .pylintrc | 18 +++----- maintainer/check_features.py | 2 +- samples/slice_input.py | 24 +++++------ samples/visualization_ljliquid.py | 4 +- src/core/bond_breakage/bond_breakage.hpp | 2 +- src/core/cell_system/AtomDecomposition.cpp | 4 ++ src/core/cell_system/CellStructure.cpp | 3 +- src/core/cell_system/HybridDecomposition.hpp | 1 + src/core/cell_system/RegularDecomposition.cpp | 14 +++--- src/core/cells.cpp | 2 +- src/core/constraints/ShapeBasedConstraint.cpp | 11 +++-- src/core/electrostatics/coulomb.cpp | 8 ++-- src/core/electrostatics/elc.hpp | 2 +- src/core/electrostatics/icc.cpp | 15 +++---- src/core/forces.cpp | 2 +- src/core/forces_inline.hpp | 8 ++-- src/core/ghosts.cpp | 2 +- .../immersed_boundary/ImmersedBoundaries.hpp | 8 ++-- src/core/integrate.cpp | 5 ++- src/core/lb/particle_coupling.cpp | 13 +++--- src/core/lees_edwards/LeesEdwardsBC.hpp | 8 ++-- src/core/lees_edwards/protocols.hpp | 6 +-- .../magnetostatics/dipolar_direct_sum.cpp | 9 ++-- src/core/magnetostatics/dp3m.cpp | 11 ++--- src/core/observables/EnergyObservable.hpp | 4 +- src/core/observables/PidObservable.hpp | 6 +-- src/core/observables/PressureObservable.hpp | 4 +- src/core/observables/PressureTensor.hpp | 4 +- src/core/observables/RDF.cpp | 8 ++-- src/core/observables/RDF.hpp | 8 ++-- src/core/p3m/fft.cpp | 43 ++++++++++--------- src/core/polymer.cpp | 2 +- src/core/pressure_inline.hpp | 2 +- src/core/rattle.cpp | 6 +-- src/core/system/Leaf.hpp | 1 + src/core/system/System.hpp | 2 +- .../Particle_serialization_test.cpp | 2 +- src/core/unit_tests/grid_test.cpp | 2 +- .../unit_tests/lb_particle_coupling_test.cpp | 4 +- src/core/unit_tests/link_cell_test.cpp | 14 +++--- src/core/unit_tests/random_test.hpp | 34 +++++++-------- src/core/virtual_sites/lb_tracers.cpp | 4 +- src/core/virtual_sites/lb_tracers.hpp | 2 +- src/script_interface/ObjectHandle.hpp | 4 +- .../accumulators/AccumulatorBase.hpp | 6 +-- .../accumulators/AutoUpdateAccumulators.hpp | 7 +-- .../constraints/Constraint.hpp | 5 +-- .../constraints/Constraints.hpp | 7 +-- .../constraints/ExternalField.hpp | 5 +-- .../constraints/ExternalPotential.hpp | 5 +-- .../constraints/HomogeneousMagneticField.hpp | 5 +-- .../constraints/couplings.hpp | 6 +-- src/script_interface/constraints/fields.hpp | 6 +-- .../constraints/initialize.hpp | 5 +-- src/script_interface/electrostatics/Actor.hpp | 2 - .../electrostatics/Actor_impl.hpp | 5 +++ .../electrostatics/Container.hpp | 1 + .../interactions/NonBondedInteraction.hpp | 1 + src/script_interface/magnetostatics/Actor.hpp | 1 - .../magnetostatics/Actor_impl.hpp | 4 ++ .../magnetostatics/Container.hpp | 1 + .../particle_data/ParticleHandle.hpp | 5 +-- .../particle_data/ParticleList.cpp | 5 ++- .../particle_data/ParticleList.hpp | 7 +-- .../particle_data/ParticleSlice.hpp | 5 +-- .../particle_data/Polymer.hpp | 5 +-- .../particle_data/initialize.hpp | 5 +-- src/script_interface/scafacos/scafacos.cpp | 2 +- .../tests/Accumulators_test.cpp | 2 +- .../tests/AutoParameter_test.cpp | 5 +-- .../tests/ObjectHandle_test.cpp | 18 ++++---- src/utils/include/utils/Cache.hpp | 11 +++-- src/utils/include/utils/Histogram.hpp | 2 +- .../interpolation/bspline_3d_gradient.hpp | 4 +- .../include/utils/linear_interpolation.hpp | 9 ++-- src/utils/include/utils/mpi/iall_gatherv.hpp | 7 ++- .../utils/serialization/memcpy_archive.hpp | 8 ++-- src/utils/tests/gather_buffer_test.cpp | 16 +++---- src/utils/tests/iall_gatherv_test.cpp | 5 ++- src/utils/tests/interpolation_test.cpp | 4 +- src/utils/tests/make_lin_space_test.cpp | 23 +++++----- src/utils/tests/scatter_buffer_test.cpp | 2 +- src/walberla_bridge/CMakeLists.txt | 5 +-- src/walberla_bridge/src/utils/boundary.hpp | 3 +- 85 files changed, 261 insertions(+), 309 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 06de904ae70..7ab35c52b74 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,7 +16,7 @@ jobs: - name: Install pandoc uses: r-lib/actions/setup-pandoc@v2 - name: Setup SSH agent - uses: webfactory/ssh-agent@v0.7.0 + uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.GH_PAGES_SSH_PRIVATE_KEY }} - name: Checkout diff --git a/.pylintrc b/.pylintrc index f3710fa903d..27461e3c92b 100644 --- a/.pylintrc +++ b/.pylintrc @@ -11,7 +11,7 @@ analyse-fallback-blocks=no extension-pkg-allow-list= # Files or directories to be skipped. They should be base names, not paths. -ignore=CVS build +ignore=build # Files or directories matching the regular expression patterns are skipped. # The regex matches against base names, not paths. The default value ignores @@ -25,7 +25,7 @@ ignore-patterns= # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the # number of processors available to use, and will cap the count on Windows to # avoid hangs. -jobs=2 +jobs=4 # Control the amount of potential inferred values when inferring a single # object. This can help the performance when dealing with large functions or @@ -41,7 +41,7 @@ persistent=yes # Minimum Python version to use for version dependent checks. Will default to # the version used to run pylint. -py-version=3.12 +py-version=3.10 # When enabled, pylint would attempt to guess common misconfiguration and emit # user-friendly hints instead of false-positive error messages. @@ -229,8 +229,7 @@ min-public-methods=2 [EXCEPTIONS] # Exceptions that will emit a warning when caught. -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtins.BaseException,builtins.Exception [FORMAT] @@ -254,13 +253,6 @@ max-line-length=100 # Maximum number of lines in a module. max-module-lines=1000 -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma, - dict-separator - # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no @@ -303,7 +295,7 @@ known-third-party=enchant # The type of string formatting that logging methods do. `old` means using % # formatting, `new` is for `{}` formatting. -logging-format-style=old +logging-format-style=new # Logging modules to check that the string format arguments are in logging # function parameter format. diff --git a/maintainer/check_features.py b/maintainer/check_features.py index 05a411e97ef..a102c0d1ee6 100755 --- a/maintainer/check_features.py +++ b/maintainer/check_features.py @@ -26,7 +26,7 @@ import featuredefs if len(sys.argv) != 2: - print("Usage: %s FILE" % sys.argv[0]) + print(f"Usage: {sys.argv[0]} FILE") exit(2) fdefs = featuredefs.defs(sys.argv[1]) diff --git a/samples/slice_input.py b/samples/slice_input.py index 1feb8f0fe9a..255b792e08b 100644 --- a/samples/slice_input.py +++ b/samples/slice_input.py @@ -60,30 +60,30 @@ partcls = system.part.add(id=id_list, pos=pos_list, type=type_list) p0p1 = system.part.by_ids([0, 1]) -print("TYPE\n%s" % partcls.type) +print(f"TYPE\n{partcls.type}") p0p1.type = [3, 3] -print("TYPE_NEW\n%s" % partcls.type) +print(f"TYPE_NEW\n{partcls.type}") -print("POS\n%s" % partcls.pos) +print(f"POS\n%s" % partcls.pos) system.part.by_ids(range(5)).pos = [[1, 1, 1], [2, 2, 2], [ 3, 3, 3], [4, 4, 4], [5, 5, 5]] -print("POS_NEW\n%s" % partcls.pos) +print(f"POS_NEW\n{partcls.pos}") -print("V\n%s" % partcls.v) +print(f"V\n%s" % partcls.v) p0p1.v = [[1, 2, 3], [2, 3, 4]] -print("V_NEW\n%s" % partcls.v) +print(f"V_NEW\n{partcls.v}") -print("F\n%s" % partcls.f) +print(f"F\n{partcls.f}") p0p1.f = [[3, 4, 5], [4, 5, 6]] -print("F_NEW\n%s" % partcls.f) +print(f"F_NEW\n{partcls.f}") if espressomd.has_features(["MASS"]): - print("MASS\n%s" % partcls.mass) + print(f"MASS\n{partcls.mass}") p0p1.mass = [2, 3] - print("MASS_NEW\n%s" % partcls.mass) + print(f"MASS_NEW\n{partcls.mass}") if espressomd.has_features(["ELECTROSTATICS"]): - print("Q\n%s" % partcls.q) + print(f"Q\n{partcls.q}") system.part.by_ids(range(0, n_part, 2)).q = np.ones(n_part // 2) system.part.by_ids(range(1, n_part, 2)).q = -np.ones(n_part // 2) - print("Q_NEW\n%s" % partcls.q) + print(f"Q_NEW\n{partcls.q}") diff --git a/samples/visualization_ljliquid.py b/samples/visualization_ljliquid.py index 9934ddc203c..8722ebd6ac0 100644 --- a/samples/visualization_ljliquid.py +++ b/samples/visualization_ljliquid.py @@ -93,7 +93,7 @@ f"Simulate {n_part} particles in a cubic box {box_l} at density {density}.") print("Interactions:\n") act_min_dist = system.analysis.min_dist() -print(f"Start with minimal distance {act_min_dist}") +print(f"Start with minimal distance {act_min_dist:.3f}") visualizer = espressomd.visualization.openGLLive(system) @@ -127,7 +127,7 @@ ############################################################# # Integration # ############################################################# -print("\nStart integration: run %d times %d steps" % (int_n_times, int_steps)) +print(f"\nStart integration: run {int_n_times} times {int_steps} steps") # print initial energies energies = system.analysis.energy() diff --git a/src/core/bond_breakage/bond_breakage.hpp b/src/core/bond_breakage/bond_breakage.hpp index 11d8b299e15..6725ba8103b 100644 --- a/src/core/bond_breakage/bond_breakage.hpp +++ b/src/core/bond_breakage/bond_breakage.hpp @@ -54,7 +54,7 @@ struct QueueEntry { // Serialization for synchronization across mpi ranks friend class boost::serialization::access; template - void serialize(Archive &ar, const unsigned int version) { + void serialize(Archive &ar, unsigned int const /* version */) { ar & particle_id; ar & bond_partners; ar & bond_type; diff --git a/src/core/cell_system/AtomDecomposition.cpp b/src/core/cell_system/AtomDecomposition.cpp index bd538039767..d0f7266bd2e 100644 --- a/src/core/cell_system/AtomDecomposition.cpp +++ b/src/core/cell_system/AtomDecomposition.cpp @@ -51,6 +51,7 @@ void AtomDecomposition::configure_neighbors() { local().m_neighbors = Neighbors(red_neighbors, black_neighbors); } + GhostCommunicator AtomDecomposition::prepare_comm() { /* no need for comm for only 1 node */ if (m_comm.size() == 1) { @@ -68,6 +69,7 @@ GhostCommunicator AtomDecomposition::prepare_comm() { return ghost_comm; } + void AtomDecomposition::configure_comms() { m_exchange_ghosts_comm = prepare_comm(); m_collect_ghost_force_comm = prepare_comm(); @@ -90,6 +92,7 @@ void AtomDecomposition::configure_comms() { } } } + void AtomDecomposition::mark_cells() { m_local_cells.resize(1, std::addressof(local())); m_ghost_cells.clear(); @@ -99,6 +102,7 @@ void AtomDecomposition::mark_cells() { } } } + void AtomDecomposition::resort(bool global_flag, std::vector &diff) { for (auto &p : local().particles()) { diff --git a/src/core/cell_system/CellStructure.cpp b/src/core/cell_system/CellStructure.cpp index 8913d29376a..711720552c1 100644 --- a/src/core/cell_system/CellStructure.cpp +++ b/src/core/cell_system/CellStructure.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -69,7 +70,7 @@ void CellStructure::check_particle_index() const { } /* checks: local particle id */ - int local_part_cnt = 0; + std::size_t local_part_cnt = 0u; for (int n = 0; n < get_max_local_particle_id() + 1; n++) { if (get_local_particle(n) != nullptr) { local_part_cnt++; diff --git a/src/core/cell_system/HybridDecomposition.hpp b/src/core/cell_system/HybridDecomposition.hpp index ce73c8cd7f5..adedc75f4d6 100644 --- a/src/core/cell_system/HybridDecomposition.hpp +++ b/src/core/cell_system/HybridDecomposition.hpp @@ -125,6 +125,7 @@ class HybridDecomposition : public ParticleDecomposition { Utils::Vector3d max_cutoff() const override { return m_n_square.max_cutoff(); } + Utils::Vector3d max_range() const override { return m_n_square.max_range(); } boost::optional minimum_image_distance() const override { diff --git a/src/core/cell_system/RegularDecomposition.cpp b/src/core/cell_system/RegularDecomposition.cpp index 397a45998e2..c872b118583 100644 --- a/src/core/cell_system/RegularDecomposition.cpp +++ b/src/core/cell_system/RegularDecomposition.cpp @@ -52,7 +52,7 @@ int RegularDecomposition::position_to_cell_index( Utils::Vector3d const &pos) const { Utils::Vector3i cpos; - for (unsigned int i = 0u; i < 3u; i++) { + for (auto i = 0u; i < 3u; i++) { cpos[i] = static_cast(std::floor(pos[i] * inv_cell_size[i])) + 1 - cell_offset[i]; @@ -306,7 +306,7 @@ void RegularDecomposition::create_cell_grid(double range) { auto const volume = Utils::product(local_box_l); auto const scale = std::cbrt(RegularDecomposition::max_num_cells / volume); - for (unsigned int i = 0; i < 3; i++) { + for (auto i = 0u; i < 3u; i++) { /* this is at least 1 */ cell_grid[i] = static_cast(std::ceil(local_box_l[i] * scale)); cell_range[i] = local_box_l[i] / static_cast(cell_grid[i]); @@ -336,11 +336,11 @@ void RegularDecomposition::create_cell_grid(double range) { break; /* find coordinate with the smallest cell range */ - int min_ind = 0; - double min_size = cell_range[0]; + auto min_ind = 0u; + auto min_size = cell_range[0]; - for (int i = 1; i < 3; i++) { - if (cell_grid[i] > 1 && cell_range[i] < min_size) { + for (auto i = 1u; i < 3u; ++i) { + if (cell_grid[i] > 1 and cell_range[i] < min_size) { min_ind = i; min_size = cell_range[i]; } @@ -369,7 +369,7 @@ void RegularDecomposition::create_cell_grid(double range) { /* now set all dependent variables */ int new_cells = 1; - for (unsigned int i = 0; i < 3; i++) { + for (auto i = 0u; i < 3u; i++) { ghost_cell_grid[i] = cell_grid[i] + 2; new_cells *= ghost_cell_grid[i]; cell_size[i] = m_local_box.length()[i] / static_cast(cell_grid[i]); diff --git a/src/core/cells.cpp b/src/core/cells.cpp index a0f95342f86..2197c07aa90 100644 --- a/src/core/cells.cpp +++ b/src/core/cells.cpp @@ -101,7 +101,7 @@ static void search_distance_sanity_check_max_range(System::System const &system, } static void search_distance_sanity_check_cell_structure(System::System const &system, - double const distance) { + double const) { auto const &cell_structure = *system.cell_structure; if (cell_structure.decomposition_type() == CellStructureType::HYBRID) { throw std::runtime_error("Cannot search for neighbors in the hybrid " diff --git a/src/core/constraints/ShapeBasedConstraint.cpp b/src/core/constraints/ShapeBasedConstraint.cpp index 555a22fc0dd..ad25f7b5924 100644 --- a/src/core/constraints/ShapeBasedConstraint.cpp +++ b/src/core/constraints/ShapeBasedConstraint.cpp @@ -95,7 +95,7 @@ ParticleForce ShapeBasedConstraint::force(Particle const &p, if (dist > 0) { outer_normal_vec = -dist_vec / dist; - pf = calc_central_radial_force(p, part_rep, ia_params, dist_vec, dist) + + pf = calc_central_radial_force(ia_params, dist_vec, dist) + calc_central_radial_charge_force(p, part_rep, ia_params, dist_vec, dist, get_ptr(coulomb_kernel)) + calc_non_central_force(p, part_rep, ia_params, dist_vec, dist); @@ -111,11 +111,10 @@ ParticleForce ShapeBasedConstraint::force(Particle const &p, #endif } else if (m_penetrable && (dist <= 0)) { if ((!m_only_positive) && (dist < 0)) { - pf = - calc_central_radial_force(p, part_rep, ia_params, dist_vec, -dist) + - calc_central_radial_charge_force(p, part_rep, ia_params, dist_vec, - -dist, get_ptr(coulomb_kernel)) + - calc_non_central_force(p, part_rep, ia_params, dist_vec, -dist); + pf = calc_central_radial_force(ia_params, dist_vec, -dist) + + calc_central_radial_charge_force(p, part_rep, ia_params, dist_vec, + -dist, get_ptr(coulomb_kernel)) + + calc_non_central_force(p, part_rep, ia_params, dist_vec, -dist); #ifdef DPD if (m_system.thermostat->thermo_switch & THERMO_DPD) { diff --git a/src/core/electrostatics/coulomb.cpp b/src/core/electrostatics/coulomb.cpp index 52850937530..f93e2ee587d 100644 --- a/src/core/electrostatics/coulomb.cpp +++ b/src/core/electrostatics/coulomb.cpp @@ -116,11 +116,11 @@ struct LongRangePressure { } #endif // P3M - auto operator()(std::shared_ptr const &actor) const { + auto operator()(std::shared_ptr const &) const { return Utils::Vector9d{}; } - auto operator()(std::shared_ptr const &actor) const { + auto operator()(std::shared_ptr const &) const { return Utils::Vector9d{}; } @@ -156,11 +156,11 @@ struct ShortRangeCutoff { } #endif // P3M #ifdef MMM1D_GPU - auto operator()(std::shared_ptr const &actor) const { + auto operator()(std::shared_ptr const &) const { return std::numeric_limits::infinity(); } #endif // MMM1D_GPU - auto operator()(std::shared_ptr const &actor) const { + auto operator()(std::shared_ptr const &) const { return std::numeric_limits::infinity(); } #ifdef SCAFACOS diff --git a/src/core/electrostatics/elc.hpp b/src/core/electrostatics/elc.hpp index 31914893c5a..b6e8c606114 100644 --- a/src/core/electrostatics/elc.hpp +++ b/src/core/electrostatics/elc.hpp @@ -117,7 +117,7 @@ struct elc_data { /// pairwise contributions from the lowest and top layers template - void dielectric_layers_contribution(CoulombP3M const &p3m, + void dielectric_layers_contribution(CoulombP3M const &, BoxGeometry const &box_geo, Utils::Vector3d const &pos1, Utils::Vector3d const &pos2, double q1q2, diff --git a/src/core/electrostatics/icc.cpp b/src/core/electrostatics/icc.cpp index cb99d9d2aa3..0f351e6b1ba 100644 --- a/src/core/electrostatics/icc.cpp +++ b/src/core/electrostatics/icc.cpp @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -223,13 +224,13 @@ void icc_data::sanity_checks() const { throw std::domain_error("Parameter 'first_id' must be >= 0"); if (eps_out <= 0.) throw std::domain_error("Parameter 'eps_out' must be > 0"); - if (areas.size() != n_icc) + if (areas.size() != static_cast(n_icc)) throw std::invalid_argument("Parameter 'areas' has incorrect shape"); - if (epsilons.size() != n_icc) + if (epsilons.size() != static_cast(n_icc)) throw std::invalid_argument("Parameter 'epsilons' has incorrect shape"); - if (sigmas.size() != n_icc) + if (sigmas.size() != static_cast(n_icc)) throw std::invalid_argument("Parameter 'sigmas' has incorrect shape"); - if (normals.size() != n_icc) + if (normals.size() != static_cast(n_icc)) throw std::invalid_argument("Parameter 'normals' has incorrect shape"); } @@ -245,12 +246,10 @@ void ICCStar::on_activation() const { } struct SanityChecksICC { - template - void operator()(std::shared_ptr const &actor) const {} + template void operator()(std::shared_ptr const &) const {} #ifdef P3M #ifdef CUDA - [[noreturn]] void - operator()(std::shared_ptr const &actor) const { + [[noreturn]] void operator()(std::shared_ptr const &) const { throw std::runtime_error("ICC does not work with P3MGPU"); } #endif // CUDA diff --git a/src/core/forces.cpp b/src/core/forces.cpp index 5ce4aee3683..03770168e87 100644 --- a/src/core/forces.cpp +++ b/src/core/forces.cpp @@ -216,7 +216,7 @@ void System::System::calculate_forces() { if (thermostat->lb and (propagation->used_propagations & PropagationMode::TRANS_LB_MOMENTUM_EXCHANGE)) { - lb_couple_particles(time_step); + lb_couple_particles(); } #ifdef CUDA diff --git a/src/core/forces_inline.hpp b/src/core/forces_inline.hpp index f6d643d1e71..1835522e510 100644 --- a/src/core/forces_inline.hpp +++ b/src/core/forces_inline.hpp @@ -77,14 +77,12 @@ #include #include -inline ParticleForce calc_central_radial_force(Particle const &p1, - Particle const &p2, - IA_parameters const &ia_params, +inline ParticleForce calc_central_radial_force(IA_parameters const &ia_params, Utils::Vector3d const &d, double const dist) { ParticleForce pf{}; - double force_factor = 0; + auto force_factor = 0.; /* Lennard-Jones */ #ifdef LENNARD_JONES force_factor += lj_pair_force_factor(ia_params, dist); @@ -219,7 +217,7 @@ inline void add_non_bonded_pair_force( #ifdef EXCLUSIONS if (do_nonbonded(p1, p2)) { #endif - pf += calc_central_radial_force(p1, p2, ia_params, d, dist); + pf += calc_central_radial_force(ia_params, d, dist); pf += calc_central_radial_charge_force(p1, p2, ia_params, d, dist, coulomb_kernel); pf += calc_non_central_force(p1, p2, ia_params, d, dist); diff --git a/src/core/ghosts.cpp b/src/core/ghosts.cpp index 5a815e977f8..bb213e4f035 100644 --- a/src/core/ghosts.cpp +++ b/src/core/ghosts.cpp @@ -94,7 +94,7 @@ class SerializationSizeCalculator { public: auto size() const { return m_size; } - template auto &operator<<(T &t) { + template auto &operator<<(T &) { m_size += sizeof(T); return *this; } diff --git a/src/core/immersed_boundary/ImmersedBoundaries.hpp b/src/core/immersed_boundary/ImmersedBoundaries.hpp index 2cc7d7e8fd4..bf3a2e02c2a 100644 --- a/src/core/immersed_boundary/ImmersedBoundaries.hpp +++ b/src/core/immersed_boundary/ImmersedBoundaries.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef IMMERSED_BOUNDARY_IMMERSED_BOUNDARIES_HPP -#define IMMERSED_BOUNDARY_IMMERSED_BOUNDARIES_HPP + +#pragma once #include "config/config.hpp" @@ -43,7 +43,7 @@ class ImmersedBoundaries { } double get_current_volume(int softID) const { assert(softID >= 0); - assert(softID < VolumesCurrent.size()); + assert(static_cast(softID) < VolumesCurrent.size()); return VolumesCurrent[static_cast(softID)]; } @@ -55,5 +55,3 @@ class ImmersedBoundaries { bool VolumeInitDone; bool BoundariesFound; }; - -#endif diff --git a/src/core/integrate.cpp b/src/core/integrate.cpp index 61b925b2669..dddc9da6621 100644 --- a/src/core/integrate.cpp +++ b/src/core/integrate.cpp @@ -294,7 +294,8 @@ void walberla_agrid_sanity_checks(std::string method, << "left waLBerla: [" << lattice_left << "]" << "\nMPI rank " << ::this_node << ": " << "right ESPResSo: [" << geo_right << "], " - << "right waLBerla: [" << lattice_right << "]"; + << "right waLBerla: [" << lattice_right << "]" + << "\nfor method: " << method; throw std::runtime_error( "waLBerla and ESPResSo disagree about domain decomposition."); } @@ -588,7 +589,7 @@ int System::System::integrate(int n_steps, int reuse_forces) { if (thermostat->lb and (propagation.used_propagations & PropagationMode::TRANS_LB_TRACER)) { lb_tracers_add_particle_force_to_fluid(*cell_structure, *box_geo, - *local_geo, lb, time_step); + *local_geo, lb); } #endif integrator_step_2(particles, propagation, *thermostat, time_step); diff --git a/src/core/lb/particle_coupling.cpp b/src/core/lb/particle_coupling.cpp index d1b59530a62..a864941873d 100644 --- a/src/core/lb/particle_coupling.cpp +++ b/src/core/lb/particle_coupling.cpp @@ -112,8 +112,6 @@ bool in_local_halo(LocalBox const &local_box, Utils::Vector3d const &pos, } static void positions_in_halo_impl(Utils::Vector3d const &pos_folded, - Utils::Vector3d const &fully_inside_lower, - Utils::Vector3d const &fully_inside_upper, Utils::Vector3d const &halo_lower_corner, Utils::Vector3d const &halo_upper_corner, BoxGeometry const &box_geo, @@ -161,8 +159,8 @@ std::vector positions_in_halo(Utils::Vector3d const &pos, auto const halo_lower_corner = local_box.my_left() - halo_vec; auto const halo_upper_corner = local_box.my_right() + halo_vec; std::vector res; - positions_in_halo_impl(pos_folded, fully_inside_lower, fully_inside_upper, - halo_lower_corner, halo_upper_corner, box_geo, res); + positions_in_halo_impl(pos_folded, halo_lower_corner, halo_upper_corner, + box_geo, res); return res; } @@ -204,9 +202,8 @@ void ParticleCoupling::kernel(std::vector const &particles) { positions_force_coupling.emplace_back(folded_pos); } else { auto const old_size = positions_force_coupling.size(); - positions_in_halo_impl(folded_pos, fully_inside_lower, fully_inside_upper, - halo_lower_corner, halo_upper_corner, m_box_geo, - positions_force_coupling); + positions_in_halo_impl(folded_pos, halo_lower_corner, halo_upper_corner, + m_box_geo, positions_force_coupling); auto const new_size = positions_force_coupling.size(); span_size = static_cast(new_size - old_size); } @@ -304,7 +301,7 @@ static void lb_coupling_sanity_checks(Particle const &p) { } // namespace LB -void System::System::lb_couple_particles(double time_step) { +void System::System::lb_couple_particles() { #ifdef CALIPER CALI_CXX_MARK_FUNCTION; #endif diff --git a/src/core/lees_edwards/LeesEdwardsBC.hpp b/src/core/lees_edwards/LeesEdwardsBC.hpp index 916eb31e491..1e4a935fe27 100644 --- a/src/core/lees_edwards/LeesEdwardsBC.hpp +++ b/src/core/lees_edwards/LeesEdwardsBC.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef CORE_LEES_EDWARDS_LEES_EDWARDS_BC_HPP -#define CORE_LEES_EDWARDS_LEES_EDWARDS_BC_HPP + +#pragma once #include @@ -32,7 +32,7 @@ struct LeesEdwardsBC { unsigned int shear_direction = invalid_dir; unsigned int shear_plane_normal = invalid_dir; Utils::Vector3d distance(Utils::Vector3d const &d, Utils::Vector3d const &l, - Utils::Vector3d const &hal_l, + Utils::Vector3d const &, Utils::Vector3d const &l_inv, std::bitset<3> const periodic) const { @@ -58,5 +58,3 @@ struct LeesEdwardsBC { return res; } }; - -#endif diff --git a/src/core/lees_edwards/protocols.hpp b/src/core/lees_edwards/protocols.hpp index 80cf3c42137..b583b13c5e2 100644 --- a/src/core/lees_edwards/protocols.hpp +++ b/src/core/lees_edwards/protocols.hpp @@ -30,8 +30,8 @@ namespace LeesEdwards { /** Lees-Edwards protocol for un-altered periodic boundary conditions */ struct Off { - double shear_velocity(double time) const { return 0.; } - double pos_offset(double time) const { return 0.; } + double shear_velocity(double) const { return 0.; } + double pos_offset(double) const { return 0.; } }; /** Lees-Edwards protocol for linear shearing */ @@ -41,7 +41,7 @@ struct LinearShear { LinearShear(double initial_offset, double shear_velocity, double time_0) : m_initial_pos_offset{initial_offset}, m_shear_velocity{shear_velocity}, m_time_0{time_0} {} - double shear_velocity(double time) const { return m_shear_velocity; } + double shear_velocity(double) const { return m_shear_velocity; } double pos_offset(double time) const { return m_initial_pos_offset + (time - m_time_0) * m_shear_velocity; } diff --git a/src/core/magnetostatics/dipolar_direct_sum.cpp b/src/core/magnetostatics/dipolar_direct_sum.cpp index 0eb54ff9733..4b1d5d920cb 100644 --- a/src/core/magnetostatics/dipolar_direct_sum.cpp +++ b/src/core/magnetostatics/dipolar_direct_sum.cpp @@ -220,8 +220,7 @@ T image_sum(InputIterator begin, InputIterator end, InputIterator it, } static auto gather_particle_data(BoxGeometry const &box_geo, - ParticleRange const &particles, - int n_replicas) { + ParticleRange const &particles) { auto const &comm = ::comm_cart; std::vector local_particles; std::vector local_posmom; @@ -293,7 +292,7 @@ void DipolarDirectSum::add_long_range_forces( auto const &box_geo = *get_system().box_geo; auto const &box_l = box_geo.length(); auto [local_particles, all_posmom, reqs, offset] = - gather_particle_data(box_geo, particles, n_replicas); + gather_particle_data(box_geo, particles); /* Number of image boxes considered */ auto const ncut = get_n_cut(box_geo, n_replicas); @@ -381,7 +380,7 @@ double DipolarDirectSum::long_range_energy(ParticleRange const &particles) const { auto const &box_geo = *get_system().box_geo; auto [local_particles, all_posmom, reqs, offset] = - gather_particle_data(box_geo, particles, n_replicas); + gather_particle_data(box_geo, particles); /* Number of image boxes considered */ auto const ncut = get_n_cut(box_geo, n_replicas); @@ -421,7 +420,7 @@ void DipolarDirectSum::dipole_field_at_part( auto const &box_geo = *get_system().box_geo; /* collect particle data */ auto [local_particles, all_posmom, reqs, offset] = - gather_particle_data(box_geo, particles, n_replicas); + gather_particle_data(box_geo, particles); auto const ncut = get_n_cut(box_geo, n_replicas); auto const with_replicas = (ncut.norm2() > 0); diff --git a/src/core/magnetostatics/dp3m.cpp b/src/core/magnetostatics/dp3m.cpp index 147dbf4f9a4..d47461c3f0c 100644 --- a/src/core/magnetostatics/dp3m.cpp +++ b/src/core/magnetostatics/dp3m.cpp @@ -65,6 +65,7 @@ #include #include +#include #include #include #include @@ -532,7 +533,7 @@ double DipolarP3M::calc_surface_term(bool force_flag, bool energy_flag, std::vector my(n_local_part); std::vector mz(n_local_part); - int ip = 0; + std::size_t ip = 0u; for (auto const &p : particles) { auto const dip = p.calc_dip(); mx[ip] = dip[0]; @@ -543,7 +544,7 @@ double DipolarP3M::calc_surface_term(bool force_flag, bool energy_flag, // we will need the sum of all dipolar momenta vectors auto local_dip = Utils::Vector3d{}; - for (int i = 0; i < n_local_part; i++) { + for (std::size_t i = 0u; i < n_local_part; i++) { local_dip[0] += mx[i]; local_dip[1] += my[i]; local_dip[2] += mz[i]; @@ -554,7 +555,7 @@ double DipolarP3M::calc_surface_term(bool force_flag, bool energy_flag, double energy = 0.; if (energy_flag) { double sum_e = 0.; - for (int i = 0; i < n_local_part; i++) { + for (std::size_t i = 0u; i < n_local_part; i++) { sum_e += mx[i] * box_dip[0] + my[i] * box_dip[1] + mz[i] * box_dip[2]; } energy = @@ -567,13 +568,13 @@ double DipolarP3M::calc_surface_term(bool force_flag, bool energy_flag, std::vector sumiy(n_local_part); std::vector sumiz(n_local_part); - for (int i = 0; i < n_local_part; i++) { + for (std::size_t i = 0u; i < n_local_part; i++) { sumix[i] = my[i] * box_dip[2] - mz[i] * box_dip[1]; sumiy[i] = mz[i] * box_dip[0] - mx[i] * box_dip[2]; sumiz[i] = mx[i] * box_dip[1] - my[i] * box_dip[0]; } - ip = 0; + ip = 0u; for (auto &p : particles) { auto &torque = p.torque(); torque[0] -= pref * sumix[ip]; diff --git a/src/core/observables/EnergyObservable.hpp b/src/core/observables/EnergyObservable.hpp index 44407c89b65..c073170e75a 100644 --- a/src/core/observables/EnergyObservable.hpp +++ b/src/core/observables/EnergyObservable.hpp @@ -30,9 +30,9 @@ namespace Observables { class Energy : public Observable { public: - std::vector shape() const override { return {1}; } + std::vector shape() const override { return {1u}; } std::vector - operator()(boost::mpi::communicator const &comm) const override { + operator()(boost::mpi::communicator const &) const override { return {System::get_system().calculate_energy()->accumulate(0u)}; } }; diff --git a/src/core/observables/PidObservable.hpp b/src/core/observables/PidObservable.hpp index 4e9894a61d6..07478784059 100644 --- a/src/core/observables/PidObservable.hpp +++ b/src/core/observables/PidObservable.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef OBSERVABLES_PIDOBSERVABLE_HPP -#define OBSERVABLES_PIDOBSERVABLE_HPP +#pragma once #include @@ -214,7 +213,7 @@ template class ParticleObservable : public PidObservable { std::vector evaluate(boost::mpi::communicator const &comm, ParticleReferenceRange const &local_particles, - ParticleObservables::traits const &traits) const override { + ParticleObservables::traits const &) const override { if constexpr (is_map::value) { std::vector local_traits{}; local_traits.reserve(local_particles.size()); @@ -271,4 +270,3 @@ template class ParticleObservable : public PidObservable { }; } // namespace Observables -#endif diff --git a/src/core/observables/PressureObservable.hpp b/src/core/observables/PressureObservable.hpp index 65d26d1b9ad..a0aff183665 100644 --- a/src/core/observables/PressureObservable.hpp +++ b/src/core/observables/PressureObservable.hpp @@ -30,9 +30,9 @@ namespace Observables { class Pressure : public Observable { public: - std::vector shape() const override { return {1}; } + std::vector shape() const override { return {1u}; } std::vector - operator()(boost::mpi::communicator const &comm) const override { + operator()(boost::mpi::communicator const &) const override { auto const obs = System::get_system().calculate_pressure(); return {(obs->accumulate(0., 0u) + obs->accumulate(0., 4u) + diff --git a/src/core/observables/PressureTensor.hpp b/src/core/observables/PressureTensor.hpp index d7e1f2ace5b..4c987481ce3 100644 --- a/src/core/observables/PressureTensor.hpp +++ b/src/core/observables/PressureTensor.hpp @@ -30,9 +30,9 @@ namespace Observables { class PressureTensor : public Observable { public: - std::vector shape() const override { return {3, 3}; } + std::vector shape() const override { return {3u, 3u}; } std::vector - operator()(boost::mpi::communicator const &comm) const override { + operator()(boost::mpi::communicator const &) const override { auto const obs = System::get_system().calculate_pressure(); std::vector result; diff --git a/src/core/observables/RDF.cpp b/src/core/observables/RDF.cpp index e631fefc783..809723fa3ee 100644 --- a/src/core/observables/RDF.cpp +++ b/src/core/observables/RDF.cpp @@ -27,10 +27,12 @@ #include #include +#include #include #include #include +#include #include namespace Observables { @@ -64,7 +66,7 @@ RDF::evaluate(boost::mpi::communicator const &comm, auto const &box_geo = *System::get_system().box_geo; auto const bin_width = (max_r - min_r) / static_cast(n_r_bins); auto const inv_bin_width = 1.0 / bin_width; - std::vector res(n_values(), 0.0); + std::vector res(n_r_bins, 0.0); long int cnt = 0; auto op = [this, inv_bin_width, &cnt, &res, &box_geo](auto const &pos1, auto const &pos2) { @@ -102,8 +104,8 @@ RDF::evaluate(boost::mpi::communicator const &comm, return res; // normalization auto const volume = box_geo.volume(); - for (int i = 0; i < n_r_bins; ++i) { - auto const r_in = i * bin_width + min_r; + for (std::size_t i = 0u; i < res.size(); ++i) { + auto const r_in = static_cast(i) * bin_width + min_r; auto const r_out = r_in + bin_width; auto const bin_volume = (4.0 / 3.0) * Utils::pi() * diff --git a/src/core/observables/RDF.hpp b/src/core/observables/RDF.hpp index ccebb1bd37b..d09d33bf5b8 100644 --- a/src/core/observables/RDF.hpp +++ b/src/core/observables/RDF.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef OBSERVABLES_RDF_HPP -#define OBSERVABLES_RDF_HPP +#pragma once #include "Observable.hpp" @@ -53,8 +52,8 @@ class RDF : public Observable { std::vector shape() const override { return {n_r_bins}; } - explicit RDF(std::vector ids1, std::vector ids2, int n_r_bins, - double min_r, double max_r) + RDF(std::vector ids1, std::vector ids2, int n_r_bins, double min_r, + double max_r) : m_ids1(std::move(ids1)), m_ids2(std::move(ids2)), min_r(min_r), max_r(max_r), n_r_bins(n_r_bins) { if (max_r <= min_r) @@ -72,4 +71,3 @@ class RDF : public Observable { }; } // Namespace Observables -#endif diff --git a/src/core/p3m/fft.cpp b/src/core/p3m/fft.cpp index 0c95721c528..56cbcea7872 100644 --- a/src/core/p3m/fft.cpp +++ b/src/core/p3m/fft.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -361,9 +362,9 @@ void pack_block_permute2(double const *const in, double *const out, void forw_grid_comm(fft_forw_plan plan, const double *in, double *out, fft_data_struct &fft, const boost::mpi::communicator &comm) { - for (int i = 0; i < plan.group.size(); i++) { - plan.pack_function(in, fft.send_buf.data(), &(plan.send_block[6 * i]), - &(plan.send_block[6 * i + 3]), plan.old_mesh, + for (std::size_t i = 0ul; i < plan.group.size(); i++) { + plan.pack_function(in, fft.send_buf.data(), &(plan.send_block[6ul * i]), + &(plan.send_block[6ul * i + 3ul]), plan.old_mesh, plan.element); if (plan.group[i] != comm.rank()) { @@ -374,8 +375,8 @@ void forw_grid_comm(fft_forw_plan plan, const double *in, double *out, } else { /* Self communication... */ std::swap(fft.send_buf, fft.recv_buf); } - fft_unpack_block(fft.recv_buf.data(), out, &(plan.recv_block[6 * i]), - &(plan.recv_block[6 * i + 3]), plan.new_mesh, + fft_unpack_block(fft.recv_buf.data(), out, &(plan.recv_block[6ul * i]), + &(plan.recv_block[6ul * i + 3ul]), plan.new_mesh, plan.element); } } @@ -395,9 +396,9 @@ void back_grid_comm(fft_forw_plan plan_f, fft_back_plan plan_b, replace the receive blocks by the send blocks and vice versa. Attention then also new_mesh and old_mesh are exchanged */ - for (int i = 0; i < plan_f.group.size(); i++) { - plan_b.pack_function(in, fft.send_buf.data(), &(plan_f.recv_block[6 * i]), - &(plan_f.recv_block[6 * i + 3]), plan_f.new_mesh, + for (std::size_t i = 0ul; i < plan_f.group.size(); i++) { + plan_b.pack_function(in, fft.send_buf.data(), &(plan_f.recv_block[6ul * i]), + &(plan_f.recv_block[6ul * i + 3ul]), plan_f.new_mesh, plan_f.element); if (plan_f.group[i] != comm.rank()) { /* send first, receive second */ @@ -408,8 +409,8 @@ void back_grid_comm(fft_forw_plan plan_f, fft_back_plan plan_b, } else { /* Self communication... */ std::swap(fft.send_buf, fft.recv_buf); } - fft_unpack_block(fft.recv_buf.data(), out, &(plan_f.send_block[6 * i]), - &(plan_f.send_block[6 * i + 3]), plan_f.old_mesh, + fft_unpack_block(fft.recv_buf.data(), out, &(plan_f.send_block[6ul * i]), + &(plan_f.send_block[6ul * i + 3ul]), plan_f.old_mesh, plan_f.element); } } @@ -570,16 +571,16 @@ int fft_init(Utils::Vector3i const &ca_mesh_dim, int const *ca_mesh_margin, fft.plan[i].n_ffts = fft.plan[i].new_mesh[0] * fft.plan[i].new_mesh[1]; /* === send/recv block specifications === */ - for (int j = 0; j < fft.plan[i].group.size(); j++) { + for (std::size_t j = 0ul; j < fft.plan[i].group.size(); j++) { /* send block: comm.rank() to comm-group-node i (identity: node) */ int node = fft.plan[i].group[j]; fft.plan[i].send_size[j] = calc_send_block( my_pos[i - 1], n_grid[i - 1], &(n_pos[i][3 * node]), n_grid[i], global_mesh_dim.data(), global_mesh_off.data(), - &(fft.plan[i].send_block[6 * j])); - permute_ifield(&(fft.plan[i].send_block[6 * j]), 3, + &(fft.plan[i].send_block[6ul * j])); + permute_ifield(&(fft.plan[i].send_block[6ul * j]), 3, -(fft.plan[i - 1].n_permute)); - permute_ifield(&(fft.plan[i].send_block[6 * j + 3]), 3, + permute_ifield(&(fft.plan[i].send_block[6ul * j + 3ul]), 3, -(fft.plan[i - 1].n_permute)); if (fft.plan[i].send_size[j] > fft.max_comm_size) fft.max_comm_size = fft.plan[i].send_size[j]; @@ -587,29 +588,29 @@ int fft_init(Utils::Vector3i const &ca_mesh_dim, int const *ca_mesh_margin, may have an additional margin outside the actual domain of the node */ if (i == 1) { - for (int k = 0; k < 3; k++) - fft.plan[1].send_block[6 * j + k] += ca_mesh_margin[2 * k]; + for (std::size_t k = 0ul; k < 3ul; k++) + fft.plan[1].send_block[6ul * j + k] += ca_mesh_margin[2ul * k]; } /* recv block: comm.rank() from comm-group-node i (identity: node) */ fft.plan[i].recv_size[j] = calc_send_block( my_pos[i], n_grid[i], &(n_pos[i - 1][3 * node]), n_grid[i - 1], global_mesh_dim.data(), global_mesh_off.data(), - &(fft.plan[i].recv_block[6 * j])); - permute_ifield(&(fft.plan[i].recv_block[6 * j]), 3, + &(fft.plan[i].recv_block[6ul * j])); + permute_ifield(&(fft.plan[i].recv_block[6ul * j]), 3, -(fft.plan[i].n_permute)); - permute_ifield(&(fft.plan[i].recv_block[6 * j + 3]), 3, + permute_ifield(&(fft.plan[i].recv_block[6ul * j + 3ul]), 3, -(fft.plan[i].n_permute)); if (fft.plan[i].recv_size[j] > fft.max_comm_size) fft.max_comm_size = fft.plan[i].recv_size[j]; } - for (int j = 0; j < 3; j++) + for (std::size_t j = 0ul; j < 3ul; j++) fft.plan[i].old_mesh[j] = fft.plan[i - 1].new_mesh[j]; if (i == 1) { fft.plan[i].element = 1; } else { fft.plan[i].element = 2; - for (int j = 0; j < fft.plan[i].group.size(); j++) { + for (std::size_t j = 0ul; j < fft.plan[i].group.size(); j++) { fft.plan[i].send_size[j] *= 2; fft.plan[i].recv_size[j] *= 2; } diff --git a/src/core/polymer.cpp b/src/core/polymer.cpp index ad7c67244da..5eeb9760c6e 100644 --- a/src/core/polymer.cpp +++ b/src/core/polymer.cpp @@ -193,7 +193,7 @@ draw_polymer_positions(System::System const &system, int const n_polymers, /* Try up to max_tries times to draw a valid position */ auto draw_valid_monomer_position = [&](int p, int m) -> boost::optional { - for (unsigned i = 0; i < max_tries; i++) { + for (auto i = 0; i < max_tries; i++) { auto const trial_pos = draw_monomer_position(p, m); if (is_valid_pos(trial_pos)) { return trial_pos; diff --git a/src/core/pressure_inline.hpp b/src/core/pressure_inline.hpp index 924440b3463..07b5615c324 100644 --- a/src/core/pressure_inline.hpp +++ b/src/core/pressure_inline.hpp @@ -64,7 +64,7 @@ inline void add_non_bonded_pair_virials( if (do_nonbonded(p1, p2)) #endif { - auto const force = calc_central_radial_force(p1, p2, ia_params, d, dist).f + + auto const force = calc_central_radial_force(ia_params, d, dist).f + calc_central_radial_charge_force(p1, p2, ia_params, d, dist, kernel_forces) .f + diff --git a/src/core/rattle.cpp b/src/core/rattle.cpp index 631926784b0..8a9d9808b14 100644 --- a/src/core/rattle.cpp +++ b/src/core/rattle.cpp @@ -209,10 +209,8 @@ static bool calculate_velocity_correction(RigidBond const &ia_params, * @brief Apply velocity corrections * * @param particles particle range - * @param box_geo Box geometry */ -static void apply_velocity_correction(ParticleRange const &particles, - BoxGeometry const &box_geo) { +static void apply_velocity_correction(ParticleRange const &particles) { boost::for_each(particles, [](Particle &p) { p.v() += p.rattle_params().correction; }); } @@ -237,7 +235,7 @@ void correct_velocity_shake(CellStructure &cs, BoxGeometry const &box_geo) { cs.ghosts_reduce_rattle_correction(); - apply_velocity_correction(particles, box_geo); + apply_velocity_correction(particles); cs.ghosts_update(Cells::DATA_PART_MOMENTUM); } diff --git a/src/core/system/Leaf.hpp b/src/core/system/Leaf.hpp index 25633b15bbb..e1e81797eb6 100644 --- a/src/core/system/Leaf.hpp +++ b/src/core/system/Leaf.hpp @@ -58,6 +58,7 @@ template class Leaf { assert(system); assert(not m_system.expired()); assert(system == m_system.lock()); + static_cast(system); m_system.reset(); } }; diff --git a/src/core/system/System.hpp b/src/core/system/System.hpp index a1d46118ecc..2bf9dbeb5b5 100644 --- a/src/core/system/System.hpp +++ b/src/core/system/System.hpp @@ -196,7 +196,7 @@ class System : public std::enable_shared_from_this { /** @brief Calculate initial particle forces from active thermostats. */ void thermostat_force_init(); /** @brief Calculate particle-lattice interactions. */ - void lb_couple_particles(double time_step); + void lb_couple_particles(); /** \name Hook procedures * These procedures are called if several significant changes to diff --git a/src/core/unit_tests/Particle_serialization_test.cpp b/src/core/unit_tests/Particle_serialization_test.cpp index 7a7b24f7628..d1484a24324 100644 --- a/src/core/unit_tests/Particle_serialization_test.cpp +++ b/src/core/unit_tests/Particle_serialization_test.cpp @@ -152,7 +152,7 @@ class BitwiseSerializable { class NotBitwiseSerializable { friend boost::serialization::access; - template void serialize(Archive &ar, long int) {} + template void serialize(Archive &, long int) {} }; class MixedSerializable { diff --git a/src/core/unit_tests/grid_test.cpp b/src/core/unit_tests/grid_test.cpp index 00dedcf91e2..8eb6966dc7d 100644 --- a/src/core/unit_tests/grid_test.cpp +++ b/src/core/unit_tests/grid_test.cpp @@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(lees_edwards_mi_vector) { auto const result = box.get_mi_vector(a, b); - for (int i = 0; i < 3; i++) { + for (auto i = 0u; i < 3u; i++) { auto expected = get_mi_coord(a[i], b[i], box_l[i], box.periodic(i)); if (i == le.shear_direction) { expected -= le.pos_offset = 1.; diff --git a/src/core/unit_tests/lb_particle_coupling_test.cpp b/src/core/unit_tests/lb_particle_coupling_test.cpp index acd67a9020f..204b14a0298 100644 --- a/src/core/unit_tests/lb_particle_coupling_test.cpp +++ b/src/core/unit_tests/lb_particle_coupling_test.cpp @@ -443,7 +443,7 @@ BOOST_DATA_TEST_CASE_F(CleanupActorLB, coupling_particle_lattice_ia, // check without LB coupling { system.thermostat->lb_coupling_deactivate(); - system.lb_couple_particles(params.time_step); + system.lb_couple_particles(); auto const p_opt = copy_particle_to_head_node(comm, system, pid); if (rank == 0) { auto const &p = *p_opt; @@ -464,7 +464,7 @@ BOOST_DATA_TEST_CASE_F(CleanupActorLB, coupling_particle_lattice_ia, } } // couple particle to LB - system.lb_couple_particles(params.time_step); + system.lb_couple_particles(); { auto const p_opt = copy_particle_to_head_node(comm, system, pid); if (rank == 0) { diff --git a/src/core/unit_tests/link_cell_test.cpp b/src/core/unit_tests/link_cell_test.cpp index 475580a948e..413c7a27f1a 100644 --- a/src/core/unit_tests/link_cell_test.cpp +++ b/src/core/unit_tests/link_cell_test.cpp @@ -30,9 +30,9 @@ #include BOOST_AUTO_TEST_CASE(link_cell) { - const unsigned n_cells = 10; - const auto n_part_per_cell = 10; - const auto n_part = n_cells * n_part_per_cell; + auto const n_cells = 10u; + auto const n_part_per_cell = 10u; + auto const n_part = n_cells * n_part_per_cell; std::vector cells(n_cells); @@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(link_cell) { } std::vector> lc_pairs; - lc_pairs.reserve((n_part * (n_part - 1)) / 2); + lc_pairs.reserve((n_part * (n_part - 1u)) / 2u); Algorithm::link_cell(cells.begin(), cells.end(), [&lc_pairs](Particle const &p1, Particle const &p2) { @@ -63,11 +63,11 @@ BOOST_AUTO_TEST_CASE(link_cell) { lc_pairs.emplace_back(p1.id(), p2.id()); }); - BOOST_CHECK(lc_pairs.size() == (n_part * (n_part - 1) / 2)); + BOOST_CHECK(lc_pairs.size() == (n_part * (n_part - 1u) / 2u)); auto it = lc_pairs.begin(); - for (int i = 0; i < n_part; i++) - for (int j = i + 1; j < n_part; j++) { + for (auto i = 0; i < static_cast(n_part); i++) + for (auto j = i + 1; j < static_cast(n_part); j++) { BOOST_CHECK((it->first == i) && (it->second == j)); ++it; } diff --git a/src/core/unit_tests/random_test.hpp b/src/core/unit_tests/random_test.hpp index 93912c7b926..bd03e6b7792 100644 --- a/src/core/unit_tests/random_test.hpp +++ b/src/core/unit_tests/random_test.hpp @@ -16,8 +16,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef CORE_UNIT_TESTS_RANDOM_TEST_HPP -#define CORE_UNIT_TESTS_RANDOM_TEST_HPP + +#pragma once + #include /* Helper functions to compute random numbers covariance in a single pass */ @@ -57,8 +58,8 @@ class visitor_size : public boost::static_visitor { std::size_t operator()(Vector const &v) const { return v.size(); } - std::size_t operator()(Utils::Quaternion const &q) const { return 4; } - std::size_t operator()(double v) const { return 1; } + std::size_t operator()(Utils::Quaternion const &) const { return 4u; } + std::size_t operator()(double) const { return 1u; } }; class visitor_get : public boost::static_visitor { @@ -71,7 +72,7 @@ class visitor_get : public boost::static_visitor { return q[i]; } double operator()(double v, std::size_t i) const { - assert(i == 0); + assert(i == 0u); return v; } }; @@ -110,7 +111,7 @@ noise_statistics(NoiseKernel &&noise_function, std::size_t sample_size) { std::transform(first_value.begin(), first_value.end(), dimensions.begin(), [](auto const &element) { return get_size(element); }); auto const matrix_dim = std::accumulate(dimensions.begin(), dimensions.end(), - 0, std::plus()); + std::size_t{0u}, std::plus<>()); // set up boost accumulators namespace ba = boost::accumulators; @@ -123,21 +124,21 @@ noise_statistics(NoiseKernel &&noise_function, std::size_t sample_size) { auto acc_covariance = ::square_matrix(matrix_dim); // accumulate - for (std::size_t step = 0; step < sample_size; ++step) { + for (std::size_t step = 0u; step < sample_size; ++step) { auto const noise_tuple = noise_function(); // for each vector, pool the random numbers of all columns - for (std::size_t vec1 = 0; vec1 < dimensions.size(); ++vec1) { - for (std::size_t col1 = 0; col1 < dimensions[vec1]; ++col1) { + for (std::size_t vec1 = 0u; vec1 < dimensions.size(); ++vec1) { + for (std::size_t col1 = 0u; col1 < dimensions[vec1]; ++col1) { acc_variance[vec1](::get_value(noise_tuple[vec1], col1)); } } // fill the covariance matrix (upper triangle) - std::size_t index1 = 0; - for (std::size_t vec1 = 0; vec1 < dimensions.size(); ++vec1) { - for (std::size_t col1 = 0; col1 < dimensions[vec1]; ++col1) { + std::size_t index1 = 0u; + for (std::size_t vec1 = 0u; vec1 < dimensions.size(); ++vec1) { + for (std::size_t col1 = 0u; col1 < dimensions[vec1]; ++col1) { std::size_t index2 = index1; for (std::size_t vec2 = vec1; vec2 < dimensions.size(); ++vec2) { - for (std::size_t col2 = (vec2 == vec1) ? col1 : 0; + for (std::size_t col2 = (vec2 == vec1) ? col1 : std::size_t{0u}; col2 < dimensions[vec2]; ++col2) { acc_covariance[index1][index2]( ::get_value(noise_tuple[vec1], col1), @@ -153,19 +154,19 @@ noise_statistics(NoiseKernel &&noise_function, std::size_t sample_size) { // compute statistics std::vector means(n_vectors); std::vector variances(n_vectors); - for (std::size_t i = 0; i < n_vectors; ++i) { + for (std::size_t i = 0u; i < n_vectors; ++i) { means[i] = ba::mean(acc_variance[i]); variances[i] = ba::variance(acc_variance[i]); } auto covariance = ::square_matrix(matrix_dim); - for (std::size_t i = 0; i < matrix_dim; ++i) { + for (std::size_t i = 0u; i < matrix_dim; ++i) { for (std::size_t j = i; j < matrix_dim; ++j) { covariance[i][j] = covariance[j][i] = ba::covariance(acc_covariance[i][j]); } } auto correlation = ::square_matrix(matrix_dim); - for (std::size_t i = 0; i < matrix_dim; ++i) { + for (std::size_t i = 0u; i < matrix_dim; ++i) { for (std::size_t j = i; j < matrix_dim; ++j) { correlation[i][j] = correlation[j][i] = covariance[i][j] / sqrt(covariance[i][i] * covariance[j][j]); @@ -189,4 +190,3 @@ boost::test_tools::predicate_result correlation_almost_equal( } return true; } -#endif diff --git a/src/core/virtual_sites/lb_tracers.cpp b/src/core/virtual_sites/lb_tracers.cpp index 771baa0dc88..4844472983e 100644 --- a/src/core/virtual_sites/lb_tracers.cpp +++ b/src/core/virtual_sites/lb_tracers.cpp @@ -39,7 +39,7 @@ static bool lb_sanity_checks(LB::Solver const &lb) { void lb_tracers_add_particle_force_to_fluid(CellStructure &cell_structure, BoxGeometry const &box_geo, LocalBox const &local_box, - LB::Solver &lb, double time_step) { + LB::Solver &lb) { if (lb_sanity_checks(lb)) { return; } @@ -84,7 +84,7 @@ void lb_tracers_propagate(CellStructure &cell_structure, LB::Solver const &lb, if (!LB::is_tracer(p)) continue; p.v() = lb.get_coupling_interpolated_velocity(p.pos()); - for (unsigned int i = 0u; i < 3u; i++) { + for (auto i = 0u; i < 3u; i++) { if (!p.is_fixed_along(i)) { p.pos()[i] += p.v()[i] * time_step; } diff --git a/src/core/virtual_sites/lb_tracers.hpp b/src/core/virtual_sites/lb_tracers.hpp index bbc9b4ce90d..8a1e9cd7eae 100644 --- a/src/core/virtual_sites/lb_tracers.hpp +++ b/src/core/virtual_sites/lb_tracers.hpp @@ -31,7 +31,7 @@ void lb_tracers_add_particle_force_to_fluid(CellStructure &cell_structure, BoxGeometry const &box_geo, LocalBox const &local_box, - LB::Solver &lb, double time_step); + LB::Solver &lb); void lb_tracers_propagate(CellStructure &cell_structure, LB::Solver const &lb, double time_step); diff --git a/src/script_interface/ObjectHandle.hpp b/src/script_interface/ObjectHandle.hpp index 01e44be5774..8d94631d493 100644 --- a/src/script_interface/ObjectHandle.hpp +++ b/src/script_interface/ObjectHandle.hpp @@ -119,7 +119,7 @@ class ObjectHandle { * @param name Name of the parameter * @return Value of parameter @p name */ - virtual Variant get_parameter(const std::string &name) const { return {}; } + virtual Variant get_parameter(const std::string &) const { return {}; } /** * @brief Set single parameter. @@ -169,6 +169,6 @@ class ObjectHandle { private: virtual std::string get_internal_state() const { return {}; } - virtual void set_internal_state(std::string const &state) {} + virtual void set_internal_state(std::string const &) {} }; } /* namespace ScriptInterface */ diff --git a/src/script_interface/accumulators/AccumulatorBase.hpp b/src/script_interface/accumulators/AccumulatorBase.hpp index ab6172833a4..b5e7c88cd9c 100644 --- a/src/script_interface/accumulators/AccumulatorBase.hpp +++ b/src/script_interface/accumulators/AccumulatorBase.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef SCRIPTINTERFACE_ACCUMULATORS_ACCUMULATORBASE_HPP -#define SCRIPTINTERFACE_ACCUMULATORS_ACCUMULATORBASE_HPP + +#pragma once #include "core/accumulators/AccumulatorBase.hpp" #include "script_interface/ScriptInterface.hpp" @@ -53,5 +53,3 @@ class AccumulatorBase : public AutoParameters { } // namespace Accumulators } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/accumulators/AutoUpdateAccumulators.hpp b/src/script_interface/accumulators/AutoUpdateAccumulators.hpp index a5ada2cbd98..79057a0e241 100644 --- a/src/script_interface/accumulators/AutoUpdateAccumulators.hpp +++ b/src/script_interface/accumulators/AutoUpdateAccumulators.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_ACCUMULATOR_AUTOUPDATEACCUMULATORS_HPP -#define SCRIPT_INTERFACE_ACCUMULATOR_AUTOUPDATEACCUMULATORS_HPP +#pragma once #include "AccumulatorBase.hpp" @@ -46,9 +45,7 @@ class AutoUpdateAccumulators : public ObjectList { private: // disable serialization: pickling done by the python interface std::string get_internal_state() const override { return {}; } - void set_internal_state(std::string const &state) override {} + void set_internal_state(std::string const &) override {} }; } /* namespace Accumulators */ } /* namespace ScriptInterface */ - -#endif // SCRIPT_INTERFACE_ACCUMULATOR_AUTOUPDATEACCUMULATORS_HPP diff --git a/src/script_interface/constraints/Constraint.hpp b/src/script_interface/constraints/Constraint.hpp index bcc75502d3e..2bc827bd82a 100644 --- a/src/script_interface/constraints/Constraint.hpp +++ b/src/script_interface/constraints/Constraint.hpp @@ -19,8 +19,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_CONSTRAINT_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_CONSTRAINT_HPP +#pragma once #include "core/constraints/Constraint.hpp" #include "script_interface/ScriptInterface.hpp" @@ -37,5 +36,3 @@ class Constraint : public AutoParameters { } /* namespace Constraints */ } /* namespace ScriptInterface */ - -#endif diff --git a/src/script_interface/constraints/Constraints.hpp b/src/script_interface/constraints/Constraints.hpp index a8b304c872a..9e56946b411 100644 --- a/src/script_interface/constraints/Constraints.hpp +++ b/src/script_interface/constraints/Constraints.hpp @@ -19,8 +19,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_CONSTRAINTS_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_CONSTRAINTS_HPP +#pragma once #include "Constraint.hpp" @@ -45,9 +44,7 @@ class Constraints : public ObjectList { private: // disable serialization: pickling done by the python interface std::string get_internal_state() const override { return {}; } - void set_internal_state(std::string const &state) override {} + void set_internal_state(std::string const &) override {} }; } /* namespace Constraints */ } /* namespace ScriptInterface */ - -#endif diff --git a/src/script_interface/constraints/ExternalField.hpp b/src/script_interface/constraints/ExternalField.hpp index 1e3299ee0eb..b83bd74efb5 100644 --- a/src/script_interface/constraints/ExternalField.hpp +++ b/src/script_interface/constraints/ExternalField.hpp @@ -19,8 +19,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_EXTERNAL_FIELD_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_EXTERNAL_FIELD_HPP +#pragma once #include "couplings.hpp" #include "fields.hpp" @@ -79,5 +78,3 @@ class ExternalField : public Constraint { }; } /* namespace Constraints */ } /* namespace ScriptInterface */ - -#endif diff --git a/src/script_interface/constraints/ExternalPotential.hpp b/src/script_interface/constraints/ExternalPotential.hpp index 6a9840bff8e..c7a93f96a96 100644 --- a/src/script_interface/constraints/ExternalPotential.hpp +++ b/src/script_interface/constraints/ExternalPotential.hpp @@ -19,8 +19,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_EXTERNAL_POTENTIAL_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_EXTERNAL_POTENTIAL_HPP +#pragma once #include "core/constraints/Constraint.hpp" #include "core/constraints/ExternalPotential.hpp" @@ -83,5 +82,3 @@ class ExternalPotential : public Constraint { }; } // namespace Constraints } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/constraints/HomogeneousMagneticField.hpp b/src/script_interface/constraints/HomogeneousMagneticField.hpp index d36a2dbfc92..f01aadddf1a 100644 --- a/src/script_interface/constraints/HomogeneousMagneticField.hpp +++ b/src/script_interface/constraints/HomogeneousMagneticField.hpp @@ -19,8 +19,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_HOMOGENEOUSMAGNETICFIELD_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_HOMOGENEOUSMAGNETICFIELD_HPP +#pragma once #include "core/constraints/Constraint.hpp" #include "core/constraints/HomogeneousMagneticField.hpp" @@ -65,5 +64,3 @@ class HomogeneousMagneticField : public Constraint { } /* namespace Constraints */ } /* namespace ScriptInterface */ - -#endif diff --git a/src/script_interface/constraints/couplings.hpp b/src/script_interface/constraints/couplings.hpp index 1e41d66b8d4..0e41b72925a 100644 --- a/src/script_interface/constraints/couplings.hpp +++ b/src/script_interface/constraints/couplings.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_DETAIL_COUPLINGS_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_DETAIL_COUPLINGS_HPP + +#pragma once /** * @file @@ -98,5 +98,3 @@ template <> inline Scaled make_coupling(const VariantMap ¶ms) { } // namespace detail } // namespace Constraints } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/constraints/fields.hpp b/src/script_interface/constraints/fields.hpp index 650c12ce880..428b54180b8 100644 --- a/src/script_interface/constraints/fields.hpp +++ b/src/script_interface/constraints/fields.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_DETAIL_FIELDS_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_DETAIL_FIELDS_HPP + +#pragma once #include "core/field_coupling/fields/AffineMap.hpp" #include "core/field_coupling/fields/Constant.hpp" @@ -165,5 +165,3 @@ template Field make_field(const VariantMap ¶ms) { } // namespace detail } // namespace Constraints } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/constraints/initialize.hpp b/src/script_interface/constraints/initialize.hpp index 8d48333b26b..29b4396cbcb 100644 --- a/src/script_interface/constraints/initialize.hpp +++ b/src/script_interface/constraints/initialize.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef SCRIPT_INTERFACE_CONSTRAINTS_INITIALIZE_HPP -#define SCRIPT_INTERFACE_CONSTRAINTS_INITIALIZE_HPP +#pragma once #include @@ -31,5 +30,3 @@ void initialize(Utils::Factory *om); } /* namespace Constraints */ } /* namespace ScriptInterface */ - -#endif diff --git a/src/script_interface/electrostatics/Actor.hpp b/src/script_interface/electrostatics/Actor.hpp index 7ddae421df9..1839673b300 100644 --- a/src/script_interface/electrostatics/Actor.hpp +++ b/src/script_interface/electrostatics/Actor.hpp @@ -30,9 +30,7 @@ #include "script_interface/system/Leaf.hpp" #include -#include #include -#include namespace ScriptInterface { namespace Coulomb { diff --git a/src/script_interface/electrostatics/Actor_impl.hpp b/src/script_interface/electrostatics/Actor_impl.hpp index 8204cc1e683..82b26354001 100644 --- a/src/script_interface/electrostatics/Actor_impl.hpp +++ b/src/script_interface/electrostatics/Actor_impl.hpp @@ -30,6 +30,10 @@ #include "script_interface/auto_parameters/AutoParameter.hpp" +#include +#include +#include + namespace ScriptInterface { namespace Coulomb { @@ -83,6 +87,7 @@ template Actor::Actor() { template Variant Actor::do_call_method(std::string const &name, VariantMap const ¶ms) { + assert(params.empty()); if (name == "activate") { context()->parallel_try_catch([this]() { auto &system = get_system(); diff --git a/src/script_interface/electrostatics/Container.hpp b/src/script_interface/electrostatics/Container.hpp index e89291a29c7..55234d683b3 100644 --- a/src/script_interface/electrostatics/Container.hpp +++ b/src/script_interface/electrostatics/Container.hpp @@ -59,6 +59,7 @@ class Container : public AutoParameters { } void on_bind_system(::System::System &system) override { + static_cast(system); auto const ¶ms = *m_params; for (auto const &key : get_parameter_insertion_order()) { if (params.count(key)) { diff --git a/src/script_interface/interactions/NonBondedInteraction.hpp b/src/script_interface/interactions/NonBondedInteraction.hpp index 4f8413149ee..72ccf15eb3f 100644 --- a/src/script_interface/interactions/NonBondedInteraction.hpp +++ b/src/script_interface/interactions/NonBondedInteraction.hpp @@ -878,6 +878,7 @@ class NonBondedInteractionHandle public: Variant do_call_method(std::string const &name, VariantMap const ¶ms) override { + assert(params.empty()); if (name == "get_types") { return std::vector{{m_types[0], m_types[1]}}; } diff --git a/src/script_interface/magnetostatics/Actor.hpp b/src/script_interface/magnetostatics/Actor.hpp index 0ba9a0ec974..393bd290360 100644 --- a/src/script_interface/magnetostatics/Actor.hpp +++ b/src/script_interface/magnetostatics/Actor.hpp @@ -30,7 +30,6 @@ #include "script_interface/system/Leaf.hpp" #include -#include #include namespace ScriptInterface { diff --git a/src/script_interface/magnetostatics/Actor_impl.hpp b/src/script_interface/magnetostatics/Actor_impl.hpp index 58e24e64b1d..8a8e007224c 100644 --- a/src/script_interface/magnetostatics/Actor_impl.hpp +++ b/src/script_interface/magnetostatics/Actor_impl.hpp @@ -30,12 +30,16 @@ #include "script_interface/auto_parameters/AutoParameter.hpp" +#include +#include + namespace ScriptInterface { namespace Dipoles { template Variant Actor::do_call_method(std::string const &name, VariantMap const ¶ms) { + assert(params.empty()); if (name == "activate") { context()->parallel_try_catch([this]() { auto &system = get_system(); diff --git a/src/script_interface/magnetostatics/Container.hpp b/src/script_interface/magnetostatics/Container.hpp index 52e0f56c6ff..9a8709c760b 100644 --- a/src/script_interface/magnetostatics/Container.hpp +++ b/src/script_interface/magnetostatics/Container.hpp @@ -47,6 +47,7 @@ class Container : public AutoParameters { } void on_bind_system(::System::System &system) override { + static_cast(system); auto const ¶ms = *m_params; for (auto const &key : get_parameter_insertion_order()) { if (params.count(key)) { diff --git a/src/script_interface/particle_data/ParticleHandle.hpp b/src/script_interface/particle_data/ParticleHandle.hpp index eee2c9f69ea..5c6bb460fca 100644 --- a/src/script_interface/particle_data/ParticleHandle.hpp +++ b/src/script_interface/particle_data/ParticleHandle.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_PARTICLE_HANDLE_HPP -#define ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_PARTICLE_HANDLE_HPP +#pragma once #include "script_interface/ScriptInterface.hpp" #include "script_interface/auto_parameters/AutoParameters.hpp" @@ -57,5 +56,3 @@ class ParticleHandle : public AutoParameters { } // namespace Particles } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/particle_data/ParticleList.cpp b/src/script_interface/particle_data/ParticleList.cpp index cbf82b4171e..6e1bea9338d 100644 --- a/src/script_interface/particle_data/ParticleList.cpp +++ b/src/script_interface/particle_data/ParticleList.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -174,13 +175,13 @@ static void auto_exclusions(boost::mpi::communicator const &comm, for (auto const pid1 : pids) { // loop over partners (counter-based loops due to iterator invalidation) // NOLINTNEXTLINE(modernize-loop-convert) - for (int i = 0; i < partners[pid1].size(); ++i) { + for (std::size_t i = 0u; i < partners[pid1].size(); ++i) { auto const [pid2, dist21] = partners[pid1][i]; if (dist21 > n_bonds_max) continue; // loop over all partners of the partner // NOLINTNEXTLINE(modernize-loop-convert) - for (int j = 0; j < partners[pid2].size(); ++j) { + for (std::size_t j = 0u; j < partners[pid2].size(); ++j) { auto const [pid3, dist32] = partners[pid2][j]; auto const dist31 = dist32 + dist21; if (dist31 > n_bonds_max) diff --git a/src/script_interface/particle_data/ParticleList.hpp b/src/script_interface/particle_data/ParticleList.hpp index 9506506141c..7f8cbdc6d80 100644 --- a/src/script_interface/particle_data/ParticleList.hpp +++ b/src/script_interface/particle_data/ParticleList.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_PARTICLE_LIST_HPP -#define ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_PARTICLE_LIST_HPP +#pragma once #include "script_interface/ScriptInterface.hpp" @@ -33,7 +32,7 @@ class ParticleList : public ObjectHandle { Variant do_call_method(std::string const &name, VariantMap const ¶ms) override; - void do_construct(VariantMap const ¶ms) override {} + void do_construct(VariantMap const &) override {} private: std::string get_internal_state() const override; @@ -42,5 +41,3 @@ class ParticleList : public ObjectHandle { } // namespace Particles } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/particle_data/ParticleSlice.hpp b/src/script_interface/particle_data/ParticleSlice.hpp index b6c2ae57bdb..471a6dcecac 100644 --- a/src/script_interface/particle_data/ParticleSlice.hpp +++ b/src/script_interface/particle_data/ParticleSlice.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_PARTICLE_SLICE_HPP -#define ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_PARTICLE_SLICE_HPP +#pragma once #include "ParticleHandle.hpp" @@ -53,5 +52,3 @@ class ParticleSlice : public AutoParameters { } // namespace Particles } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/particle_data/Polymer.hpp b/src/script_interface/particle_data/Polymer.hpp index 504d568ac01..48720966afe 100644 --- a/src/script_interface/particle_data/Polymer.hpp +++ b/src/script_interface/particle_data/Polymer.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_POLYMER_HPP -#define ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_POLYMER_HPP +#pragma once #include "script_interface/ScriptInterface.hpp" @@ -35,5 +34,3 @@ class Polymer : public AutoParameters { } // namespace Particles } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/particle_data/initialize.hpp b/src/script_interface/particle_data/initialize.hpp index 5b239d2068e..524b8849c51 100644 --- a/src/script_interface/particle_data/initialize.hpp +++ b/src/script_interface/particle_data/initialize.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_INITIALIZE_HPP -#define ESPRESSO_SRC_SCRIPT_INTERFACE_PARTICLE_DATA_INITIALIZE_HPP +#pragma once #include @@ -31,5 +30,3 @@ void initialize(Utils::Factory *om); } // namespace Particles } // namespace ScriptInterface - -#endif diff --git a/src/script_interface/scafacos/scafacos.cpp b/src/script_interface/scafacos/scafacos.cpp index a4249f0eb4d..bb82582a7f0 100644 --- a/src/script_interface/scafacos/scafacos.cpp +++ b/src/script_interface/scafacos/scafacos.cpp @@ -57,7 +57,7 @@ struct ConvertToStringVector } template >> - std::vector operator()(T const &value) const { + std::vector operator()(T const &) const { throw std::runtime_error("Cannot convert " + Utils::demangle()); } diff --git a/src/script_interface/tests/Accumulators_test.cpp b/src/script_interface/tests/Accumulators_test.cpp index 8cba30ee3f1..db69e5e0ce9 100644 --- a/src/script_interface/tests/Accumulators_test.cpp +++ b/src/script_interface/tests/Accumulators_test.cpp @@ -53,7 +53,7 @@ namespace Observables { class MockObservable : public Observable { public: std::vector - operator()(boost::mpi::communicator const &comm) const override { + operator()(boost::mpi::communicator const &) const override { return {1., 2., 3., 4.}; } std::vector shape() const override { return {2u, 2u}; } diff --git a/src/script_interface/tests/AutoParameter_test.cpp b/src/script_interface/tests/AutoParameter_test.cpp index e71c38d687a..ab4d720766d 100644 --- a/src/script_interface/tests/AutoParameter_test.cpp +++ b/src/script_interface/tests/AutoParameter_test.cpp @@ -44,9 +44,8 @@ BOOST_AUTO_TEST_CASE(read_only) { BOOST_CHECK(boost::get(p.get()) == i); /* Setting should throw */ - BOOST_CHECK_EXCEPTION( - p.set(2), AutoParameter::WriteError, - [](AutoParameter::WriteError const &e) { return true; }); + BOOST_CHECK_EXCEPTION(p.set(2), AutoParameter::WriteError, + [](AutoParameter::WriteError const &) { return true; }); } BOOST_AUTO_TEST_CASE(user_provided) { diff --git a/src/script_interface/tests/ObjectHandle_test.cpp b/src/script_interface/tests/ObjectHandle_test.cpp index f2927e5bfc5..32ced4486d1 100644 --- a/src/script_interface/tests/ObjectHandle_test.cpp +++ b/src/script_interface/tests/ObjectHandle_test.cpp @@ -78,13 +78,13 @@ struct LogHandle : public ObjectHandle { call_log.emplace_back(MockCall::Construct{¶ms}); } - void do_set_parameter(const std::string &name, - const Variant &value) override { + void do_set_parameter(std::string const &name, + Variant const &value) override { call_log.emplace_back(MockCall::SetParameter{&name, &value}); } - Variant do_call_method(const std::string &name, - const VariantMap ¶ms) override { + Variant do_call_method(std::string const &name, + VariantMap const ¶ms) override { call_log.emplace_back(MockCall::CallMethod{&name, ¶ms}); return none; @@ -177,19 +177,19 @@ namespace Testing { * Logging mock for Context. */ struct LogContext : public Context { - std::vector> call_log; + std::vector> call_log; - void notify_call_method(const ObjectHandle *o, std::string const &n, + void notify_call_method(ObjectHandle const *o, std::string const &n, VariantMap const &p) override { call_log.emplace_back(o, MockCall::CallMethod{&n, &p}); } - void notify_set_parameter(const ObjectHandle *o, std::string const &n, + void notify_set_parameter(ObjectHandle const *o, std::string const &n, Variant const &v) override { call_log.emplace_back(o, MockCall::SetParameter{&n, &v}); } std::shared_ptr make_shared(std::string const &, - const VariantMap &) override { + VariantMap const &) override { auto it = std::make_shared(); set_context(it.get()); @@ -200,7 +200,7 @@ struct LogContext : public Context { return make_shared(s, v); } - boost::string_ref name(const ObjectHandle *o) const override { + boost::string_ref name(ObjectHandle const *) const override { return "Dummy"; } diff --git a/src/utils/include/utils/Cache.hpp b/src/utils/include/utils/Cache.hpp index 25f84b62394..59f05377586 100644 --- a/src/utils/include/utils/Cache.hpp +++ b/src/utils/include/utils/Cache.hpp @@ -17,9 +17,9 @@ * along with this program. If not, see . */ -#ifndef CORE_UTILS_CACHE_HPP -#define CORE_UTILS_CACHE_HPP +#pragma once +#include #include #include #include @@ -149,11 +149,12 @@ template class Cache { KeyInputIterator put(KeyInputIterator kbegin, KeyInputIterator kend, ValueInputIterator vbegin) { auto const range_len = std::distance(kbegin, kend); - auto const len = (range_len > max_size()) ? max_size() : range_len; + auto const size_max = static_cast(max_size()); + auto const len = (range_len > size_max) ? size_max : range_len; kend = std::next(kbegin, len); /* Make some space. */ - while ((max_size() - size()) < len) { + while (static_cast(max_size() - size()) < len) { drop_random_element(); } @@ -180,5 +181,3 @@ template class Cache { } }; } // namespace Utils - -#endif diff --git a/src/utils/include/utils/Histogram.hpp b/src/utils/include/utils/Histogram.hpp index f16aeb015ad..cb5e79e33ee 100644 --- a/src/utils/include/utils/Histogram.hpp +++ b/src/utils/include/utils/Histogram.hpp @@ -108,7 +108,7 @@ class Histogram { for (std::size_t i = 0; i < M; ++i) { index[i] = calc_bin_index(pos[i], m_limits[i].first, m_bin_sizes[i]); } - for (array_index i = 0; i < N; ++i) { + for (array_index i = 0; i < static_cast(N); ++i) { index.back() = i; m_array(index) += value[i]; m_count(index)++; diff --git a/src/utils/include/utils/interpolation/bspline_3d_gradient.hpp b/src/utils/include/utils/interpolation/bspline_3d_gradient.hpp index fadc769401f..8de1ada168f 100644 --- a/src/utils/include/utils/interpolation/bspline_3d_gradient.hpp +++ b/src/utils/include/utils/interpolation/bspline_3d_gradient.hpp @@ -42,7 +42,7 @@ namespace Interpolation { * @param grid_spacing The distance between the grid points. * @param offset Shift of the grid relative to the origin. */ -template +template void bspline_3d_gradient(Vector3d const &pos, Kernel const &kernel, Vector3d const &grid_spacing, Vector3d const &offset) { using Utils::bspline; @@ -81,7 +81,7 @@ void bspline_3d_gradient(Vector3d const &pos, Kernel const &kernel, /** * @brief cardinal B-spline weighted sum. */ -template +template T bspline_3d_gradient_accumulate(Vector3d const &pos, Kernel const &kernel, Vector3d const &grid_spacing, Vector3d const &offset, T const &init) { diff --git a/src/utils/include/utils/linear_interpolation.hpp b/src/utils/include/utils/linear_interpolation.hpp index 63328bccdbb..87d3e6fba15 100644 --- a/src/utils/include/utils/linear_interpolation.hpp +++ b/src/utils/include/utils/linear_interpolation.hpp @@ -16,10 +16,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef UTILS_LINEAR_INTERPOLATION_HPP -#define UTILS_LINEAR_INTERPOLATION_HPP + +#pragma once #include +#include namespace Utils { /** Linear interpolation between two data points. @@ -34,7 +35,7 @@ T linear_interpolation(Container const &table, T hi, T offset, T x) { auto const dind = (x - offset) * hi; auto const ind = static_cast(dind); assert(ind <= dind); - assert((ind >= 0) and (ind < table.size())); + assert((ind >= 0) and (static_cast(ind) < table.size())); auto const dx = dind - static_cast(ind); auto const uind = static_cast(ind); @@ -42,5 +43,3 @@ T linear_interpolation(Container const &table, T hi, T offset, T x) { return table[uind] * (T{1} - dx) + table[uind + 1] * dx; } } // namespace Utils - -#endif diff --git a/src/utils/include/utils/mpi/iall_gatherv.hpp b/src/utils/include/utils/mpi/iall_gatherv.hpp index 14c5a9729fa..954839efcdf 100644 --- a/src/utils/include/utils/mpi/iall_gatherv.hpp +++ b/src/utils/include/utils/mpi/iall_gatherv.hpp @@ -17,8 +17,7 @@ * along with this program. If not, see . */ -#ifndef UTILS_MPI_ALL_GATHERV_HPP -#define UTILS_MPI_ALL_GATHERV_HPP +#pragma once #include "utils/Span.hpp" @@ -26,6 +25,7 @@ #include #include +#include #include namespace Utils { @@ -36,7 +36,7 @@ inline std::vector displacements(Span sizes) { std::vector displ(sizes.size()); int offset = 0; - for (int i = 0; i < displ.size(); i++) { + for (std::size_t i = 0u; i < displ.size(); i++) { displ[i] = offset; offset += sizes[i]; } @@ -81,4 +81,3 @@ auto iall_gatherv(boost::mpi::communicator const &comm, T const *in_values, } } // namespace Mpi } // namespace Utils -#endif diff --git a/src/utils/include/utils/serialization/memcpy_archive.hpp b/src/utils/include/utils/serialization/memcpy_archive.hpp index 2b378da34c8..1b79e306697 100644 --- a/src/utils/include/utils/serialization/memcpy_archive.hpp +++ b/src/utils/include/utils/serialization/memcpy_archive.hpp @@ -16,8 +16,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#ifndef ESPRESSO_MEMCPY_ARCHIVE_HPP -#define ESPRESSO_MEMCPY_ARCHIVE_HPP + +#pragma once #include "utils/Span.hpp" @@ -115,7 +115,7 @@ template class BasicMemcpyArchive { boost::serialization::serialize_adl(*static_cast(this), value, 4); auto const new_pos = insert; - assert((new_pos - old_pos) <= sizeof(T)); + assert(static_cast(new_pos - old_pos) <= sizeof(T)); auto const padding_size = sizeof(T) - (new_pos - old_pos); skip(padding_size); @@ -226,5 +226,3 @@ class MemcpyOArchive : public detail::BasicMemcpyArchive { } }; } // namespace Utils - -#endif // ESPRESSO_MEMCPY_ARCHIVE_HPP diff --git a/src/utils/tests/gather_buffer_test.cpp b/src/utils/tests/gather_buffer_test.cpp index 7ee296b8cd5..db4532501bd 100644 --- a/src/utils/tests/gather_buffer_test.cpp +++ b/src/utils/tests/gather_buffer_test.cpp @@ -42,9 +42,9 @@ void check_vector(const boost::mpi::communicator &comm, int root) { if (comm.rank() == root) { auto const n = comm.size(); - const int total_size = n * (n + 1) / 2; + auto const total_size = n * (n + 1) / 2; - BOOST_CHECK(buf.size() == total_size); + BOOST_CHECK_EQUAL(static_cast(buf.size()), total_size); /* Check order in result */ BOOST_CHECK(std::is_sorted(buf.begin(), buf.end())); @@ -57,9 +57,9 @@ void check_vector(const boost::mpi::communicator &comm, int root) { } } else { /* Check that buffer is unchanged */ - BOOST_CHECK(buf.size() == comm.rank() + 1); + BOOST_CHECK_EQUAL(static_cast(buf.size()), comm.rank() + 1); for (auto const &i : buf) { - BOOST_CHECK(i == comm.rank() + 1); + BOOST_CHECK_EQUAL(i, comm.rank() + 1); } } } @@ -71,14 +71,14 @@ void check_vector_out_of_bounds(const boost::mpi::communicator &comm) { if (comm.rank() == 1) { std::vector buf = {2, 2}; gather_buffer(buf, comm, root); - BOOST_CHECK(buf.size() == 3); + BOOST_CHECK(buf.size() == 3u); BOOST_CHECK(buf[0] == 1); BOOST_CHECK(buf[1] == 2); BOOST_CHECK(buf[2] == 2); } else if (comm.rank() == 0) { std::vector buf = {1}; gather_buffer(buf, comm, root); - BOOST_CHECK(buf.size() == 1); + BOOST_CHECK(buf.size() == 1u); BOOST_CHECK(buf[0] == 1); } else { std::vector buf = {}; @@ -92,7 +92,7 @@ void check_vector_empty(const boost::mpi::communicator &comm, int empty) { gather_buffer(buf, comm); if (comm.rank() == 0) { - BOOST_CHECK(buf.size() == (comm.size() - 1) * 11); + BOOST_CHECK_EQUAL(static_cast(buf.size()), (comm.size() - 1) * 11); for (int i = 0; i < comm.size(); i++) { auto const [lower, upper] = std::equal_range(buf.begin(), buf.end(), i); @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(non_trivial_type) { if (world.rank() == 0) { auto const n = world.size(); - BOOST_CHECK(buf.size() == (n * (n + 1) / 2)); + BOOST_CHECK_EQUAL(static_cast(buf.size()), (n * (n + 1) / 2)); for (auto const &e : buf) { BOOST_CHECK(e == s); diff --git a/src/utils/tests/iall_gatherv_test.cpp b/src/utils/tests/iall_gatherv_test.cpp index 708294802a2..f5e24891514 100644 --- a/src/utils/tests/iall_gatherv_test.cpp +++ b/src/utils/tests/iall_gatherv_test.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -96,7 +97,7 @@ BOOST_AUTO_TEST_CASE(multiple_elements) { auto reqs = Utils::Mpi::iall_gatherv(world, in.data(), rank + 1, out.data(), sizes.data()); boost::mpi::wait_all(reqs.begin(), reqs.end()); - for (int i = 0; i < expected_values.size(); i++) { + for (std::size_t i = 0u; i < expected_values.size(); i++) { BOOST_CHECK_EQUAL(out.at(i), expected_values.at(i)); } } @@ -112,7 +113,7 @@ BOOST_AUTO_TEST_CASE(multiple_elements) { auto reqs = Utils::Mpi::iall_gatherv(world, out.data(), rank + 1, out.data(), sizes.data()); boost::mpi::wait_all(reqs.begin(), reqs.end()); - for (int i = 0; i < expected_values.size(); i++) { + for (std::size_t i = 0u; i < expected_values.size(); i++) { BOOST_CHECK_EQUAL(out.at(i), expected_values.at(i)); } } diff --git a/src/utils/tests/interpolation_test.cpp b/src/utils/tests/interpolation_test.cpp index b452ab32e9d..931f36fa507 100644 --- a/src/utils/tests/interpolation_test.cpp +++ b/src/utils/tests/interpolation_test.cpp @@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(nearest_point) { BOOST_AUTO_TEST_CASE(interpolation_points_3) { std::vector> int_points; - auto save_ind = [&int_points](const std::array &ind, double w) { + auto save_ind = [&int_points](const std::array &ind, double) { int_points.push_back(ind); }; @@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(interpolation_points_3) { BOOST_AUTO_TEST_CASE(interpolation_points_2) { std::vector> int_points; - auto save_ind = [&int_points](const std::array &ind, double w) { + auto save_ind = [&int_points](const std::array &ind, double) { int_points.push_back(ind); }; diff --git a/src/utils/tests/make_lin_space_test.cpp b/src/utils/tests/make_lin_space_test.cpp index 3a01f0d773c..4cdb2c075f1 100644 --- a/src/utils/tests/make_lin_space_test.cpp +++ b/src/utils/tests/make_lin_space_test.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -35,7 +36,7 @@ BOOST_AUTO_TEST_CASE(make_lin_space_test) { { auto const start = 1.; auto const stop = 2.; - auto const num = 13; + auto const num = 13u; auto const lin_space = make_lin_space(start, stop, num, /* endpoint */ true); @@ -45,10 +46,11 @@ BOOST_AUTO_TEST_CASE(make_lin_space_test) { BOOST_CHECK_EQUAL(values.front(), start); BOOST_CHECK_EQUAL(values.back(), stop); - auto const dx = (stop - start) / (num - 1); - for (int i = 0; i < values.size(); i++) { - BOOST_CHECK(std::fabs(start + i * dx - values.at(i)) <= - std::numeric_limits::epsilon()); + auto const dx = (stop - start) / static_cast(num - 1u); + for (std::size_t i = 0u; i < values.size(); i++) { + BOOST_CHECK( + std::fabs(start + static_cast(i) * dx - values.at(i)) <= + std::numeric_limits::epsilon()); } } @@ -56,7 +58,7 @@ BOOST_AUTO_TEST_CASE(make_lin_space_test) { { auto const start = 1.; auto const stop = 2.; - auto const num = 13; + auto const num = 13u; auto const lin_space = make_lin_space(start, stop, num, /* endpoint */ false); @@ -66,10 +68,11 @@ BOOST_AUTO_TEST_CASE(make_lin_space_test) { BOOST_CHECK_EQUAL(values.front(), start); BOOST_CHECK_LT(values.back(), stop); - auto const dx = (stop - start) / num; - for (int i = 0; i < values.size(); i++) { - BOOST_CHECK(std::fabs(start + i * dx - values.at(i)) <= - std::numeric_limits::epsilon()); + auto const dx = (stop - start) / static_cast(num); + for (std::size_t i = 0u; i < values.size(); i++) { + BOOST_CHECK( + std::fabs(start + static_cast(i) * dx - values.at(i)) <= + std::numeric_limits::epsilon()); } } } diff --git a/src/utils/tests/scatter_buffer_test.cpp b/src/utils/tests/scatter_buffer_test.cpp index 07767635ac1..db3f6084b7b 100644 --- a/src/utils/tests/scatter_buffer_test.cpp +++ b/src/utils/tests/scatter_buffer_test.cpp @@ -43,7 +43,7 @@ void check_pointer(boost::mpi::communicator comm, int root) { } } - BOOST_CHECK(buf.size() == total_size); + BOOST_CHECK_EQUAL(static_cast(buf.size()), total_size); Utils::Mpi::scatter_buffer(buf.data(), comm.rank(), comm, root); } else { diff --git a/src/walberla_bridge/CMakeLists.txt b/src/walberla_bridge/CMakeLists.txt index 684e4c160b9..090f0c7337d 100644 --- a/src/walberla_bridge/CMakeLists.txt +++ b/src/walberla_bridge/CMakeLists.txt @@ -47,9 +47,8 @@ if(ESPRESSO_BUILD_WITH_CUDA AND WALBERLA_BUILD_WITH_CUDA) espresso_add_gpu_library(espresso_walberla_cuda SHARED) add_library(espresso::walberla_cuda ALIAS espresso_walberla_cuda) espresso_configure_walberla_target(espresso_walberla_cuda) - target_link_libraries( - espresso_walberla_cuda PUBLIC espresso::utils espresso::walberla - PRIVATE CUDA::cuda_driver CUDA::cudart) + target_link_libraries(espresso_walberla_cuda PUBLIC espresso::utils + PRIVATE CUDA::cuda_driver CUDA::cudart) endif() add_subdirectory(src) diff --git a/src/walberla_bridge/src/utils/boundary.hpp b/src/walberla_bridge/src/utils/boundary.hpp index 7d3f3cdb07f..37606b83303 100644 --- a/src/walberla_bridge/src/utils/boundary.hpp +++ b/src/walberla_bridge/src/utils/boundary.hpp @@ -87,7 +87,8 @@ void set_boundary_from_grid(BoundaryModel &boundary, auto const grid_size = lattice.get_grid_dimensions(); auto const offset = lattice.get_local_grid_range().first; auto const gl = static_cast(lattice.get_ghost_layers()); - assert(raster_flat.size() == Utils::product(grid_size)); + assert(raster_flat.size() == + static_cast(Utils::product(grid_size))); auto const n_y = grid_size[1]; auto const n_z = grid_size[2];