Skip to content

Commit 5c341c6

Browse files
committed
diffusion_thomas_algorithm.h tidy
1 parent 66e4fff commit 5c341c6

File tree

3 files changed

+40
-150
lines changed

3 files changed

+40
-150
lines changed

clang_output.txt

Lines changed: 0 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,149 +1,3 @@
1-
src/diffusion_thomas_algorithm.h: 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/tmphfdorwda.yaml src/diffusion_thomas_algorithm.h
2-
102098 warnings generated.
3-
/github/workspace/src/diffusion_thomas_algorithm.h:22:9: warning: header guard does not follow preferred style [llvm-header-guard]
4-
22 | #ifndef DIFFUSION_THOMAS_ALGORITHM_H_
5-
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6-
| GITHUB_WORKSPACE_SRC_DIFFUSION_THOMAS_ALGORITHM_H
7-
23 | #define DIFFUSION_THOMAS_ALGORITHM_H_
8-
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9-
| GITHUB_WORKSPACE_SRC_DIFFUSION_THOMAS_ALGORITHM_H
10-
/github/workspace/src/diffusion_thomas_algorithm.h:25:1: warning: #includes are not sorted properly [llvm-include-order]
11-
25 | #include <string>
12-
| ^
13-
note: this fix will not be applied because it overlaps with another fix
14-
/github/workspace/src/diffusion_thomas_algorithm.h:27:1: warning: included header biodynamo.h is not used directly [misc-include-cleaner]
15-
27 | #include "biodynamo.h"
16-
| ^~~~~~~~~~~~~~~~~~~~~~
17-
28 | #include "core/diffusion/diffusion_grid.h"
18-
/github/workspace/src/diffusion_thomas_algorithm.h:36:7: warning: constructor does not initialize these fields: resolution_, d_space_, jump_i_, jump_j_, jump_k_, constant1_, constant1a_, constant2_, constant3_, constant3a_, dirichlet_border_ [cppcoreguidelines-pro-type-member-init]
19-
36 | class DiffusionThomasAlgorithm : public DiffusionGrid {
20-
| ^
21-
/github/workspace/src/diffusion_thomas_algorithm.h:41:28: warning: no header providing "bdm::real_t" is directly included [misc-include-cleaner]
22-
29 |
23-
30 | namespace bdm {
24-
31 |
25-
32 | /// Continuum model for the 3D heat equation with exponential decay
26-
33 | ///
27-
34 | /// Implements the diffusion equation, solved implicitly: ∂t u = ∇D∇u - μu
28-
35 | /// Uses the Thomas algorithm for solving tridiagonal systems efficiently.
29-
36 | class DiffusionThomasAlgorithm : public DiffusionGrid {
30-
37 | public:
31-
38 | DiffusionThomasAlgorithm() = default;
32-
39 |
33-
40 | DiffusionThomasAlgorithm(int substance_id, std::string substance_name,
34-
41 | real_t dc, real_t mu, int resolution, real_t dt,
35-
| ^
36-
/github/workspace/src/diffusion_thomas_algorithm.h:46:34: warning: narrowing conversion from 'real_t' (aka 'double') to 'size_t' (aka 'unsigned long') [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
37-
46 | SetConcentration(GetBoxIndex(x, y, z), amount);
38-
| ^
39-
/github/workspace/src/diffusion_thomas_algorithm.h:46:37: warning: narrowing conversion from 'real_t' (aka 'double') to 'size_t' (aka 'unsigned long') [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
40-
46 | SetConcentration(GetBoxIndex(x, y, z), amount);
41-
| ^
42-
/github/workspace/src/diffusion_thomas_algorithm.h:46:40: warning: narrowing conversion from 'real_t' (aka 'double') to 'size_t' (aka 'unsigned long') [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
43-
46 | SetConcentration(GetBoxIndex(x, y, z), amount);
44-
| ^
45-
/github/workspace/src/diffusion_thomas_algorithm.h:49:25: warning: no header providing "size_t" is directly included [misc-include-cleaner]
46-
25 | void SetConcentration(size_t idx, real_t amount);
47-
| ^
48-
/github/workspace/src/diffusion_thomas_algorithm.h:115:10: warning: invalid case style for private member 'resolution_' [readability-identifier-naming]
49-
115 | size_t resolution_;
50-
| ^~~~~~~~~~~
51-
| resolution
52-
/github/workspace/src/diffusion_thomas_algorithm.h:118:10: warning: invalid case style for private member 'd_space_' [readability-identifier-naming]
53-
118 | real_t d_space_;
54-
| ^~~~~~~~
55-
| d_space
56-
/github/workspace/src/diffusion_thomas_algorithm.h:121:23: warning: invalid case style for private member 'thomas_denom_x_' [readability-identifier-naming]
57-
121 | std::vector<real_t> thomas_denom_x_;
58-
| ^~~~~~~~~~~~~~~
59-
| thomas_denom_x
60-
/github/workspace/src/diffusion_thomas_algorithm.h:124:23: warning: invalid case style for private member 'thomas_c_x_' [readability-identifier-naming]
61-
124 | std::vector<real_t> thomas_c_x_;
62-
| ^~~~~~~~~~~
63-
| thomas_c_x
64-
/github/workspace/src/diffusion_thomas_algorithm.h:127:23: warning: invalid case style for private member 'thomas_denom_y_' [readability-identifier-naming]
65-
127 | std::vector<real_t> thomas_denom_y_;
66-
| ^~~~~~~~~~~~~~~
67-
| thomas_denom_y
68-
/github/workspace/src/diffusion_thomas_algorithm.h:130:23: warning: invalid case style for private member 'thomas_c_y_' [readability-identifier-naming]
69-
130 | std::vector<real_t> thomas_c_y_;
70-
| ^~~~~~~~~~~
71-
| thomas_c_y
72-
/github/workspace/src/diffusion_thomas_algorithm.h:133:23: warning: invalid case style for private member 'thomas_denom_z_' [readability-identifier-naming]
73-
133 | std::vector<real_t> thomas_denom_z_;
74-
| ^~~~~~~~~~~~~~~
75-
| thomas_denom_z
76-
/github/workspace/src/diffusion_thomas_algorithm.h:136:23: warning: invalid case style for private member 'thomas_c_z_' [readability-identifier-naming]
77-
136 | std::vector<real_t> thomas_c_z_;
78-
| ^~~~~~~~~~~
79-
| thomas_c_z
80-
/github/workspace/src/diffusion_thomas_algorithm.h:139:7: warning: invalid case style for private member 'jump_i_' [readability-identifier-naming]
81-
139 | int jump_i_;
82-
| ^~~~~~~
83-
| jump_i
84-
/github/workspace/src/diffusion_thomas_algorithm.h:142:7: warning: invalid case style for private member 'jump_j_' [readability-identifier-naming]
85-
142 | int jump_j_;
86-
| ^~~~~~~
87-
| jump_j
88-
/github/workspace/src/diffusion_thomas_algorithm.h:145:7: warning: invalid case style for private member 'jump_k_' [readability-identifier-naming]
89-
145 | int jump_k_;
90-
| ^~~~~~~
91-
| jump_k
92-
/github/workspace/src/diffusion_thomas_algorithm.h:148:10: warning: invalid case style for private member 'constant1_' [readability-identifier-naming]
93-
148 | real_t constant1_;
94-
| ^~~~~~~~~~
95-
| constant1
96-
/github/workspace/src/diffusion_thomas_algorithm.h:151:10: warning: invalid case style for private member 'constant1a_' [readability-identifier-naming]
97-
151 | real_t constant1a_;
98-
| ^~~~~~~~~~~
99-
| constant1a
100-
/github/workspace/src/diffusion_thomas_algorithm.h:154:10: warning: invalid case style for private member 'constant2_' [readability-identifier-naming]
101-
154 | real_t constant2_;
102-
| ^~~~~~~~~~
103-
| constant2
104-
/github/workspace/src/diffusion_thomas_algorithm.h:157:10: warning: invalid case style for private member 'constant3_' [readability-identifier-naming]
105-
157 | real_t constant3_;
106-
| ^~~~~~~~~~
107-
| constant3
108-
/github/workspace/src/diffusion_thomas_algorithm.h:160:10: warning: invalid case style for private member 'constant3a_' [readability-identifier-naming]
109-
160 | real_t constant3a_;
110-
| ^~~~~~~~~~~
111-
| constant3a
112-
/github/workspace/src/diffusion_thomas_algorithm.h:163:8: warning: invalid case style for private member 'dirichlet_border_' [readability-identifier-naming]
113-
163 | bool dirichlet_border_;
114-
| ^~~~~~~~~~~~~~~~~
115-
| dirichlet_border
116-
/github/workspace/src/diffusion_thomas_algorithm.h:189:3: warning: do not use 'else' after 'return' [llvm-else-after-return,readability-else-after-return]
117-
189 | BDM_CLASS_DEF_OVERRIDE(DiffusionThomasAlgorithm, 1);
118-
| ^~~~~~~~~~~~~~~~~~~~~~
119-
/github/workspace/biodynamo/build/include/core/util/root.h:28:3: note: expanded from macro 'BDM_CLASS_DEF_OVERRIDE'
120-
28 | ClassDefOverride(class_name, class_version_id)
121-
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
122-
/github/workspace/biodynamo/build/third_party/root/include/Rtypes.h:342:4: note: expanded from macro 'ClassDefOverride'
123-
342 | _ClassDefOutline_(name,id,,override) \
124-
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125-
/github/workspace/biodynamo/build/third_party/root/include/Rtypes.h:304:4: note: expanded from macro '_ClassDefOutline_'
126-
304 | _ClassDefBase_(name,id, virtual_keyword, overrd) \
127-
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
128-
/github/workspace/biodynamo/build/third_party/root/include/Rtypes.h:280:9: note: expanded from macro '_ClassDefBase_'
129-
280 | } else if (recurseBlocker == 1) { \
130-
| ^~~~
131-
/github/workspace/src/diffusion_thomas_algorithm.h:189:3: warning: no header providing "BDM_CLASS_DEF_OVERRIDE" is directly included [misc-include-cleaner]
132-
29 | BDM_CLASS_DEF_OVERRIDE(DiffusionThomasAlgorithm, 1);
133-
| ^
134-
/github/workspace/src/diffusion_thomas_algorithm.h:189:3: warning: use c++17 style variable templates [modernize-type-traits]
135-
/github/workspace/biodynamo/build/include/core/util/root.h:28:3: note: expanded from macro 'BDM_CLASS_DEF_OVERRIDE'
136-
28 | ClassDefOverride(class_name, class_version_id)
137-
| ^
138-
/github/workspace/biodynamo/build/third_party/root/include/Rtypes.h:342:4: note: expanded from macro 'ClassDefOverride'
139-
342 | _ClassDefOutline_(name,id,,override) \
140-
| ^
141-
/github/workspace/biodynamo/build/third_party/root/include/Rtypes.h:304:4: note: expanded from macro '_ClassDefOutline_'
142-
304 | _ClassDefBase_(name,id, virtual_keyword, overrd) \
143-
| ^
144-
/github/workspace/biodynamo/build/third_party/root/include/Rtypes.h:273:18: note: expanded from macro '_ClassDefBase_'
145-
273 | static_assert(std::is_integral<decltype(id)>::value, \
146-
| ^
1471
Suppressed 102227 warnings (102065 in non-user code, 162 NOLINT).
1482
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
1493
src/hyperparams.h: 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/tmpg5dwfux3.yaml src/hyperparams.h

src/cart_cell.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#ifndef CART_CELL_H_
2323
#define CART_CELL_H_
2424

25+
#include "core/util/root.h"
2526
#include "core/agent/agent.h"
2627
#include "core/agent/cell.h"
2728
#include "core/behavior/behavior.h"

src/diffusion_thomas_algorithm.h

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424

2525
#include <string>
2626
#include <vector>
27-
#include "biodynamo.h"
27+
#include <cstddef>
28+
#include "core/real_t.h"
29+
#include "core/util/root.h"
2830
#include "core/diffusion/diffusion_grid.h"
2931

3032
namespace bdm {
@@ -35,16 +37,33 @@ namespace bdm {
3537
/// Uses the Thomas algorithm for solving tridiagonal systems efficiently.
3638
class DiffusionThomasAlgorithm : public DiffusionGrid {
3739
public:
38-
DiffusionThomasAlgorithm() = default;
40+
DiffusionThomasAlgorithm()
41+
: resolution_(0),
42+
d_space_(0.0),
43+
thomas_denom_x_(),
44+
thomas_c_x_(),
45+
thomas_denom_y_(),
46+
thomas_c_y_(),
47+
thomas_denom_z_(),
48+
thomas_c_z_(),
49+
jump_i_(0),
50+
jump_j_(0),
51+
jump_k_(0),
52+
constant1_(0.0),
53+
constant1a_(0.0),
54+
constant2_(0.0),
55+
constant3_(0.0),
56+
constant3a_(0.0),
57+
dirichlet_border_(false) {}
3958

4059
DiffusionThomasAlgorithm(int substance_id, std::string substance_name,
4160
real_t dc, real_t mu, int resolution, real_t dt,
4261
bool dirichlet_border);
4362

4463
/// Concentration setters
4564
void SetConcentration(real_t x, real_t y, real_t z, real_t amount) {
46-
SetConcentration(GetBoxIndex(x, y, z), amount);
47-
};
65+
SetConcentration(GetBoxIndex(static_cast<size_t>(x), static_cast<size_t>(y), static_cast<size_t>(z)), amount);
66+
}
4867

4968
void SetConcentration(size_t idx, real_t amount);
5069

@@ -111,28 +130,37 @@ class DiffusionThomasAlgorithm : public DiffusionGrid {
111130
void ComputeConsumptionsSecretions();
112131

113132
private:
133+
114134
/// Number of voxels in each spatial direction
135+
// NOLINTNEXTLINE(readability-identifier-naming)
115136
size_t resolution_;
116137

117138
/// Voxel side length in micrometers
139+
// NOLINTNEXTLINE(readability-identifier-naming)
118140
real_t d_space_;
119141

120142
/// Denominators for x-direction Thomas algorithm
143+
// NOLINTNEXTLINE(readability-identifier-naming)
121144
std::vector<real_t> thomas_denom_x_;
122145

123146
/// Coefficients for x-direction Thomas algorithm
147+
// NOLINTNEXTLINE(readability-identifier-naming)
124148
std::vector<real_t> thomas_c_x_;
125149

126150
/// Denominators for y-direction Thomas algorithm
151+
// NOLINTNEXTLINE(readability-identifier-naming)
127152
std::vector<real_t> thomas_denom_y_;
128153

129154
/// Coefficients for y-direction Thomas algorithm
155+
// NOLINTNEXTLINE(readability-identifier-naming)
130156
std::vector<real_t> thomas_c_y_;
131157

132158
/// Denominators for z-direction Thomas algorithm
159+
// NOLINTNEXTLINE(readability-identifier-naming)
133160
std::vector<real_t> thomas_denom_z_;
134161

135162
/// Coefficients for z-direction Thomas algorithm
163+
// NOLINTNEXTLINE(readability-identifier-naming)
136164
std::vector<real_t> thomas_c_z_;
137165

138166
/// Index jump for i-direction (x-axis)
@@ -144,22 +172,29 @@ class DiffusionThomasAlgorithm : public DiffusionGrid {
144172
/// Index jump for k-direction (z-axis)
145173
int jump_k_;
146174

175+
147176
/// First diffusion constant
177+
// NOLINTNEXTLINE(readability-identifier-naming)
148178
real_t constant1_;
149179

150180
/// Alternative first diffusion constant
181+
// NOLINTNEXTLINE(readability-identifier-naming)
151182
real_t constant1a_;
152183

153184
/// Second diffusion constant
185+
// NOLINTNEXTLINE(readability-identifier-naming)
154186
real_t constant2_;
155187

156188
/// Third diffusion constant
189+
// NOLINTNEXTLINE(readability-identifier-naming)
157190
real_t constant3_;
158191

159192
/// Alternative third diffusion constant
193+
// NOLINTNEXTLINE(readability-identifier-naming)
160194
real_t constant3a_;
161195

162196
/// Flag indicating Dirichlet boundary conditions
197+
// NOLINTNEXTLINE(readability-identifier-naming)
163198
bool dirichlet_border_;
164199

165200
/// Initialize Thomas algorithm coefficient vectors

0 commit comments

Comments
 (0)