Skip to content

Commit ee39008

Browse files
committed
diffusion_thomas_algorithm.cc refactorized tidy
1 parent 1010b14 commit ee39008

File tree

4 files changed

+219
-315
lines changed

4 files changed

+219
-315
lines changed

clang_output.txt

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,3 @@
1-
src/diffusion_thomas_algorithm.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/tmp5joylp3d.yaml src/diffusion_thomas_algorithm.cc
2-
102368 warnings generated.
3-
Suppressed 102373 warnings (102211 in non-user code, 162 NOLINT).
4-
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
5-
/github/workspace/src/diffusion_thomas_algorithm.cc:22:1: warning: #includes are not sorted properly [llvm-include-order]
6-
22 | #include <string>
7-
| ^ ~~~~~~~~
8-
| "cart_cell.h"
9-
23 | #include <utility>
10-
| ~~~~~~~~~
11-
| "hyperparams.h"
12-
24 | #include <vector>
13-
| ~~~~~~~~
14-
| "tumor_cell.h"
15-
25 | #include "cart_cell.h"
16-
| ~~~~~~~~~~~~~
17-
| <string>
18-
26 | #include "hyperparams.h"
19-
| ~~~~~~~~~~~~~~~
20-
| <utility>
21-
27 | #include "tumor_cell.h"
22-
| ~~~~~~~~~~~~~~
23-
| <vector>
24-
/github/workspace/src/diffusion_thomas_algorithm.cc:32:51: warning: no header providing "bdm::real_t" is directly included [misc-include-cleaner]
25-
26 | #include "hyperparams.h"
26-
27 | #include "tumor_cell.h"
27-
28 |
28-
29 | namespace bdm {
29-
30 |
30-
31 | DiffusionThomasAlgorithm::DiffusionThomasAlgorithm(
31-
32 | int substance_id, std::string substance_name, real_t dc, real_t mu,
32-
| ^
33-
/github/workspace/src/diffusion_thomas_algorithm.cc:33:5: warning: 2 adjacent parameters of 'DiffusionThomasAlgorithm' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters]
34-
33 | int resolution, real_t dt, bool dirichlet_border) // time step
35-
| ^~~~~~~~~~~~~~~~~~~~~~~~~
36-
/github/workspace/src/diffusion_thomas_algorithm.cc:33:9: note: the first parameter in the range is 'resolution'
37-
33 | int resolution, real_t dt, bool dirichlet_border) // time step
38-
| ^~~~~~~~~~
39-
/github/workspace/src/diffusion_thomas_algorithm.cc:33:28: note: the last parameter in the range is 'dt'
40-
33 | int resolution, real_t dt, bool dirichlet_border) // time step
41-
| ^~
42-
/github/workspace/src/diffusion_thomas_algorithm.cc:33:5: note:
43-
33 | int resolution, real_t dt, bool dirichlet_border) // time step
44-
| ^
45-
/github/workspace/src/diffusion_thomas_algorithm.cc:33:21: note: 'int' and 'real_t' may be implicitly converted: 'int' -> 'real_t' (as 'double'), 'real_t' (as 'double') -> 'int'
46-
33 | int resolution, real_t dt, bool dirichlet_border) // time step
47-
| ^
48-
/github/workspace/src/diffusion_thomas_algorithm.cc:34:7: warning: no header providing "bdm::DiffusionGrid" is directly included [misc-include-cleaner]
49-
26 | #include "hyperparams.h"
50-
27 | #include "tumor_cell.h"
51-
28 |
52-
29 | namespace bdm {
53-
30 |
54-
31 | DiffusionThomasAlgorithm::DiffusionThomasAlgorithm(
55-
32 | int substance_id, std::string substance_name, real_t dc, real_t mu,
56-
33 | int resolution, real_t dt, bool dirichlet_border) // time step
57-
34 | : DiffusionGrid(substance_id, std::move(substance_name), dc, mu,
58-
| ^
591
/github/workspace/src/diffusion_thomas_algorithm.cc:38:3: warning: 'resolution_' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
602
35 | resolution) {
613
| , resolution_(GetResolution())
@@ -304,60 +246,6 @@ Use -header-filter=.* to display errors from all non-system headers. Use -system
304246
/github/workspace/src/diffusion_thomas_algorithm.cc:161:39: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
305247
161 | ChangeConcentrationBy(idx, amount - GetAllConcentrations()[idx],
306248
| ^
307-
/github/workspace/src/diffusion_thomas_algorithm.cc:162:25: warning: no header providing "bdm::InteractionMode" is directly included [misc-include-cleaner]
308-
162 | InteractionMode::kAdditive, false);
309-
| ^
310-
/github/workspace/src/diffusion_thomas_algorithm.cc:189:32: warning: function 'DiffuseChemical' has cognitive complexity of 31 (threshold 25) [readability-function-cognitive-complexity]
311-
189 | void DiffusionThomasAlgorithm::DiffuseChemical(real_t dt) {
312-
| ^
313-
/github/workspace/src/diffusion_thomas_algorithm.cc:192:3: note: +1, including nesting penalty of 0, nesting level increased to 1
314-
192 | if (dirichlet_border_) {
315-
| ^
316-
/github/workspace/src/diffusion_thomas_algorithm.cc:198:3: note: +1, including nesting penalty of 0, nesting level increased to 1
317-
198 | for (unsigned int k = 0; k < resolution_; k++) {
318-
| ^
319-
/github/workspace/src/diffusion_thomas_algorithm.cc:199:5: note: +2, including nesting penalty of 1, nesting level increased to 2
320-
199 | for (unsigned int j = 0; j < resolution_; j++) {
321-
| ^
322-
/github/workspace/src/diffusion_thomas_algorithm.cc:204:7: note: +3, including nesting penalty of 2, nesting level increased to 3
323-
204 | for (unsigned int i = 1; i < resolution_; i++) {
324-
| ^
325-
/github/workspace/src/diffusion_thomas_algorithm.cc:212:7: note: +3, including nesting penalty of 2, nesting level increased to 3
326-
212 | for (int i = resolution_ - 2; i >= 0; i--) {
327-
| ^
328-
/github/workspace/src/diffusion_thomas_algorithm.cc:222:3: note: +1, including nesting penalty of 0, nesting level increased to 1
329-
222 | if (dirichlet_border_) {
330-
| ^
331-
/github/workspace/src/diffusion_thomas_algorithm.cc:228:3: note: +1, including nesting penalty of 0, nesting level increased to 1
332-
228 | for (unsigned int k = 0; k < resolution_; k++) {
333-
| ^
334-
/github/workspace/src/diffusion_thomas_algorithm.cc:229:5: note: +2, including nesting penalty of 1, nesting level increased to 2
335-
229 | for (unsigned int i = 0; i < resolution_; i++) {
336-
| ^
337-
/github/workspace/src/diffusion_thomas_algorithm.cc:234:7: note: +3, including nesting penalty of 2, nesting level increased to 3
338-
234 | for (unsigned int j = 1; j < resolution_; j++) {
339-
| ^
340-
/github/workspace/src/diffusion_thomas_algorithm.cc:242:7: note: +3, including nesting penalty of 2, nesting level increased to 3
341-
242 | for (int j = resolution_ - 2; j >= 0; j--) {
342-
| ^
343-
/github/workspace/src/diffusion_thomas_algorithm.cc:252:3: note: +1, including nesting penalty of 0, nesting level increased to 1
344-
252 | if (dirichlet_border_) {
345-
| ^
346-
/github/workspace/src/diffusion_thomas_algorithm.cc:258:3: note: +1, including nesting penalty of 0, nesting level increased to 1
347-
258 | for (unsigned int j = 0; j < resolution_; j++) {
348-
| ^
349-
/github/workspace/src/diffusion_thomas_algorithm.cc:259:5: note: +2, including nesting penalty of 1, nesting level increased to 2
350-
259 | for (unsigned int i = 0; i < resolution_; i++) {
351-
| ^
352-
/github/workspace/src/diffusion_thomas_algorithm.cc:263:7: note: +3, including nesting penalty of 2, nesting level increased to 3
353-
263 | for (unsigned int k = 1; k < resolution_; k++) {
354-
| ^
355-
/github/workspace/src/diffusion_thomas_algorithm.cc:271:7: note: +3, including nesting penalty of 2, nesting level increased to 3
356-
271 | for (int k = resolution_ - 2; k >= 0; k--) {
357-
| ^
358-
/github/workspace/src/diffusion_thomas_algorithm.cc:280:3: note: +1, including nesting penalty of 0, nesting level increased to 1
359-
280 | if (dirichlet_border_) {
360-
| ^
361249
/github/workspace/src/diffusion_thomas_algorithm.cc:189:55: warning: parameter 'dt' is unused [misc-unused-parameters]
362250
189 | void DiffusionThomasAlgorithm::DiffuseChemical(real_t dt) {
363251
| ^~
@@ -479,9 +367,6 @@ Use -header-filter=.* to display errors from all non-system headers. Use -system
479367
/github/workspace/src/diffusion_thomas_algorithm.cc:298:27: warning: lambda capture 'current_time' is not used [clang-diagnostic-unused-lambda-capture]
480368
298 | rm->ForEachAgent([this, current_time](bdm::Agent* agent) {
481369
| ~~^~~~~~~~~~~~
482-
/github/workspace/src/diffusion_thomas_algorithm.cc:298:46: warning: no header providing "bdm::Agent" is directly included [misc-include-cleaner]
483-
26 | rm->ForEachAgent([this, current_time](bdm::Agent* agent) {
484-
| ^
485370
/github/workspace/src/diffusion_thomas_algorithm.cc:302:7: warning: variable 'conc' of type 'real_t' (aka 'double') can be declared 'const' [misc-const-correctness]
486371
302 | real_t conc = this->GetValue(pos);
487372
| ^

0 commit comments

Comments
 (0)