Skip to content

Commit 8cff6c5

Browse files
committed
tidy forces_tumor_cart.cc
1 parent 9627cd6 commit 8cff6c5

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

clang_output.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
102215 warnings generated.
22
Suppressed 102341 warnings (102179 in non-user code, 162 NOLINT).
33
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
4-
src/cart_cell.cc: clang-tidy-18 -p=build -line-filter=[{\"name\":\"src/cart_cell.cc\",\"lines\":[[1,321]]},{\"name\":\"src/cart_cell.h\",\"lines\":[[1,250]]},{\"name\":\"src/cart_tumor.cc\",\"lines\":[[1,133]]},{\"name\":\"src/cart_tumor.h\",\"lines\":[[1,36]]},{\"name\":\"src/diffusion_thomas_algorithm.cc\",\"lines\":[[1,319]]},{\"name\":\"src/diffusion_thomas_algorithm.h\",\"lines\":[[1,194]]},{\"name\":\"src/forces_tumor_cart.cc\",\"lines\":[[1,163]]},{\"name\":\"src/forces_tumor_cart.h\",\"lines\":[[1,60]]},{\"name\":\"src/hyperparams.h\",\"lines\":[[1,216]]},{\"name\":\"src/tumor_cell.cc\",\"lines\":[[1,673]]},{\"name\":\"src/tumor_cell.h\",\"lines\":[[1,301]]},{\"name\":\"src/utils_aux.cc\",\"lines\":[[1,176]]},{\"name\":\"src/utils_aux.h\",\"lines\":[[1,96]]}] --enable-check-profile -store-check-profile=clang-tidy-review-profile --config-file=.clang-tidy --export-fixes=/tmp/tmpb2o1s_sd/tmp_yehqeyw.yaml src/cart_cell.cc
5-
/github/workspace/src/forces_tumor_cart.cc:32:3: warning: 'auto *a' can be declared as 'const auto *a' [readability-qualified-auto]
6-
32 | auto* a = dynamic_cast<const Cell*>(lhs);
7-
| ^
8-
| const
9-
/github/workspace/src/forces_tumor_cart.cc:33:3: warning: 'auto *b' can be declared as 'const auto *b' [readability-qualified-auto]
10-
33 | auto* b = dynamic_cast<const Cell*>(rhs);
11-
| ^
12-
| const
13-
/github/workspace/src/forces_tumor_cart.cc:36:34: warning: statement should be inside braces [readability-braces-around-statements]
14-
36 | if (a->GetUid() == b->GetUid())
15-
| ^
16-
| {
17-
37 | return {0.0, 0.0, 0.0, 0.0};
18-
|
19-
/github/workspace/src/forces_tumor_cart.cc:52:3: warning: variable 'dist_sq' of type 'double' can be declared 'const' [misc-const-correctness]
20-
52 | double dist_sq = displacement[0] * displacement[0] +
21-
| ^
22-
| const
234
102175 warnings generated.
245
Suppressed 102299 warnings (102137 in non-user code, 162 NOLINT).
256
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

src/forces_tumor_cart.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
namespace bdm {
3131

3232
Real4 InteractionVelocity::Calculate(const Agent* lhs, const Agent* rhs) const {
33-
auto* a = dynamic_cast<const Cell*>(lhs);
34-
auto* b = dynamic_cast<const Cell*>(rhs);
33+
const auto* a = dynamic_cast<const Cell*>(lhs);
34+
const auto* b = dynamic_cast<const Cell*>(rhs);
3535

3636
// Ignore self-interaction
37-
if (a->GetUid() == b->GetUid())
37+
if (a->GetUid() == b->GetUid()) {
3838
return {0.0, 0.0, 0.0, 0.0};
39+
}
3940

4041
Real3 displacement = a->GetPosition() - b->GetPosition();
4142

@@ -50,7 +51,7 @@ Real4 InteractionVelocity::Calculate(const Agent* lhs, const Agent* rhs) const {
5051
displacement[2] -
5152
(kBoundedSpaceLength)*round(displacement[2] / (kBoundedSpaceLength));
5253

53-
double dist_sq = displacement[0] * displacement[0] +
54+
const double dist_sq = displacement[0] * displacement[0] +
5455
displacement[1] * displacement[1] +
5556
displacement[2] * displacement[2];
5657
double distance = std::max(std::sqrt(dist_sq), 1e-5);

0 commit comments

Comments
 (0)