Skip to content

Commit

Permalink
Merge #3202
Browse files Browse the repository at this point in the history
3202: clang-tidy: fix for empty config. r=jngrad a=KaiSzuttor

we only have a CI job with maxset and clang-tidy. This PR fixes issues found with empty config.

Co-authored-by: Kai Szuttor <[email protected]>
  • Loading branch information
bors[bot] and KaiSzuttor authored Oct 12, 2019
2 parents 128d59c + 20a9d23 commit 75d4715
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Checks: |
readability-redundant-control-flow,
readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-uniqueptr-delete-release,
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@ tutorials-samples-no-gpu:
empty:
<<: *global_job_definition
stage: build
image: gitlab.icp.uni-stuttgart.de:4567/espressomd/docker/ubuntu-python3:cuda-9.0
image: gitlab.icp.uni-stuttgart.de:4567/espressomd/docker/clang-python3:6.0
script:
- export myconfig=empty
- export myconfig=empty with_static_analysis=true
- bash maintainer/CI/build_cmake.sh
tags:
- docker
Expand Down
9 changes: 4 additions & 5 deletions src/core/constraints/ShapeBasedConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,24 @@ ParticleForce ShapeBasedConstraint::force(Particle const &p,

if (dist > 0) {
outer_normal_vec = -dist_vec / dist;
auto const dist2 = dist * dist;
force1 = calc_non_bonded_pair_force(p, part_rep, ia_params, dist_vec,
dist, &torque1, &torque2);
#ifdef DPD
if (thermo_switch & THERMO_DPD) {
force1 += dpd_pair_force(p, part_rep, ia_params, dist_vec, dist, dist2);
force1 +=
dpd_pair_force(p, part_rep, ia_params, dist_vec, dist, dist * dist);
// Additional use of DPD here requires counter increase
dpd_rng_counter_increment();
}
#endif
} else if (m_penetrable && (dist <= 0)) {
if ((!m_only_positive) && (dist < 0)) {
auto const dist2 = dist * dist;
force1 = calc_non_bonded_pair_force(p, part_rep, ia_params, dist_vec,
-dist, &torque1, &torque2);
#ifdef DPD
if (thermo_switch & THERMO_DPD) {
force1 +=
dpd_pair_force(p, part_rep, ia_params, dist_vec, dist, dist2);
force1 += dpd_pair_force(p, part_rep, ia_params, dist_vec, dist,
dist * dist);
// Additional use of DPD here requires counter increase
dpd_rng_counter_increment();
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/observables/Current.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ class Current : public PidObservable {
int n_values() const override { return 3; };
std::vector<double> evaluate(PartCfg &partCfg) const override {
std::vector<double> res(n_values());
for (int i : ids()) {
#ifdef ELECTROSTATICS
for (int i : ids()) {
double charge = partCfg[i].p.q;
res[0] += charge * partCfg[i].m.v[0];
res[1] += charge * partCfg[i].m.v[1];
res[2] += charge * partCfg[i].m.v[2];
#endif
};
#endif
return res;
};
};
Expand Down
4 changes: 2 additions & 2 deletions src/core/observables/DipoleMoment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ class DipoleMoment : public PidObservable {
int n_values() const override { return 3; };
std::vector<double> evaluate(PartCfg &partCfg) const override {
std::vector<double> res(n_values(), 0.0);
for (int i : ids()) {
#ifdef ELECTROSTATICS
for (int i : ids()) {
double charge = partCfg[i].p.q;

res[0] += charge * partCfg[i].r.p[0];
res[1] += charge * partCfg[i].r.p[1];
res[2] += charge * partCfg[i].r.p[2];
#endif // ELECTROSTATICS
}
#endif // ELECTROSTATICS
return res;
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/core/observables/MagneticDipoleMoment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ class MagneticDipoleMoment : public PidObservable {
int n_values() const override { return 3; };
std::vector<double> evaluate(PartCfg &partCfg) const override {
std::vector<double> res(n_values(), 0.0);
for (int i : ids()) {
#ifdef DIPOLES
for (int i : ids()) {
res[0] += partCfg[i].calc_dip()[0];
res[1] += partCfg[i].calc_dip()[1];
res[2] += partCfg[i].calc_dip()[2];
#endif
}
#endif
return res;
}
};
Expand Down

0 comments on commit 75d4715

Please sign in to comment.