Skip to content

Commit d674533

Browse files
committed
hyperameters.h tidy
1 parent 5c341c6 commit d674533

File tree

5 files changed

+11
-63
lines changed

5 files changed

+11
-63
lines changed

clang_output.txt

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,4 @@
1-
Suppressed 102227 warnings (102065 in non-user code, 162 NOLINT).
2-
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3-
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
4-
/github/workspace/src/hyperparams.h:22:9: warning: header guard does not follow preferred style [llvm-header-guard]
5-
22 | #ifndef TUMOR_HYPERPARAMS_H_
6-
| ^~~~~~~~~~~~~~~~~~~~
7-
| GITHUB_WORKSPACE_SRC_HYPERPARAMS_H
8-
23 | #define TUMOR_HYPERPARAMS_H_
9-
| ~~~~~~~~~~~~~~~~~~~~
10-
| GITHUB_WORKSPACE_SRC_HYPERPARAMS_H
11-
/github/workspace/src/hyperparams.h:25:1: warning: #includes are not sorted properly [llvm-include-order]
12-
25 | #include <cmath>
13-
| ^
14-
note: this fix will not be applied because it overlaps with another fix
15-
/github/workspace/src/hyperparams.h:26:1: warning: included header biodynamo.h is not used directly [misc-include-cleaner]
16-
26 | #include "biodynamo.h"
17-
| ^~~~~~~~~~~~~~~~~~~~~~
18-
27 |
19-
/github/workspace/src/hyperparams.h:39:11: warning: no header providing "bdm::real_t" is directly included [misc-include-cleaner]
20-
27 |
21-
28 | namespace bdm {
22-
29 |
23-
30 | /// This file contains hyperparameters used in the simulation. Change: In a
24-
31 | /// future version it needs to be changed into a params file with no need to be
25-
32 | /// recompiled
26-
33 |
27-
34 | ///
28-
35 | /// TumorCell Hyperparameters
29-
36 | ///
30-
37 |
31-
38 | /// Rate of secretion of immunostimulatory factor of tumor cells per minute
32-
39 | constexpr real_t kRateSecretionImmunostimulatoryFactor = 10.0;
33-
| ^
34-
/github/workspace/src/hyperparams.h:128:6: warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division]
35-
128 | (kBoundedSpaceLength / kResolutionGridSubstances) *
36-
| ^
37-
/github/workspace/src/hyperparams.h:129:6: warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division]
38-
129 | (kBoundedSpaceLength / kResolutionGridSubstances) *
39-
| ^
40-
/github/workspace/src/hyperparams.h:130:6: warning: result of integer division used in a floating point context; possible loss of precision [bugprone-integer-division]
41-
130 | (kBoundedSpaceLength /
42-
| ^
43-
/github/workspace/src/hyperparams.h:189:14: warning: invalid case style for global constant 'kLengthBoxMechanics' [readability-identifier-naming]
44-
189 | const real_t kLengthBoxMechanics =
45-
| ^~~~~~~~~~~~~~~~~~~
46-
| gKLengthBoxMechanics
47-
/github/workspace/src/hyperparams.h:194:14: warning: invalid case style for global constant 'kSquaredMaxDistanceNeighborsForce' [readability-identifier-naming]
48-
194 | const real_t kSquaredMaxDistanceNeighborsForce = std::pow(
49-
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50-
| gKSquaredMaxDistanceNeighborsForce
51-
/github/workspace/src/hyperparams.h:195:54: warning: no header providing "bdm::Math" is directly included [misc-include-cleaner]
52-
27 | 0.1 + std::cbrt(kDefaultVolumeNewTumorCell * 6 / Math::kPi) *
53-
| ^
1+
^
542
102078 warnings generated.
553
Suppressed 102230 warnings (102068 in non-user code, 162 NOLINT).
564
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

src/cart_cell.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Real3 CartCell::CalculateDisplacement(const InteractionForce* force,
159159
Real3 movement_at_next_step{0, 0, 0};
160160
// this should be chaged in a future version of BioDynaMo in order to have a
161161
// cleaner code instead of hardcoding it here
162-
squared_radius = kSquaredMaxDistanceNeighborsForce;
162+
squared_radius = gKSquaredMaxDistanceNeighborsForce;
163163

164164
// the physics force to move the point mass
165165

src/cart_tumor.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ int Simulate(int argc, const char** argv) {
5656
auto* env = dynamic_cast<UniformGridEnvironment*>(
5757
Simulation::GetActive()->GetEnvironment());
5858
// Fix the box length for the uniform grid environment
59-
env->SetBoxLength(kLengthBoxMechanics);
59+
env->SetBoxLength(gKLengthBoxMechanics);
6060

6161
// Define Substances
6262
auto* rm = Simulation::GetActive()->GetResourceManager();

src/hyperparams.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
#define TUMOR_HYPERPARAMS_H_
2424

2525
#include <cmath>
26-
#include "biodynamo.h"
26+
#include "core/real_t.h"
27+
#include "core/util/math.h"
2728

2829
namespace bdm {
2930

@@ -125,10 +126,9 @@ constexpr real_t kReductionConsumptionDeadCells = 0.1;
125126
constexpr int kResolutionGridSubstances = 50; // 50 // voxels per axis
126127
/// Volume of a single voxel in μm³ (do not modify this line)
127128
constexpr real_t kVoxelVolume =
128-
(kBoundedSpaceLength / kResolutionGridSubstances) *
129-
(kBoundedSpaceLength / kResolutionGridSubstances) *
130-
(kBoundedSpaceLength /
131-
kResolutionGridSubstances); // Do not modify this line
129+
(static_cast<real_t>(kBoundedSpaceLength) / kResolutionGridSubstances) *
130+
(static_cast<real_t>(kBoundedSpaceLength) / kResolutionGridSubstances) *
131+
(static_cast<real_t>(kBoundedSpaceLength) / kResolutionGridSubstances); // Do not modify this line
132132
/// Diffusion coefficient of oxygen in μm²/min
133133
constexpr real_t kDiffusionCoefficientOxygen =
134134
100000; // 100000 micrometers^2/minute
@@ -186,12 +186,12 @@ constexpr real_t kDnew = 1.5 * kDtMechanics;
186186
constexpr real_t kDold = -0.5 * kDtMechanics;
187187

188188
/// Do not change this line
189-
const real_t kLengthBoxMechanics =
189+
const real_t gKLengthBoxMechanics =
190190
22; // Length of the box for mechanics in micrometers
191191

192192
/// Max Distance for considering two cells as neighbours for force calculations
193193
/// in μm Do not change this line
194-
const real_t kSquaredMaxDistanceNeighborsForce = std::pow(
194+
const real_t gKSquaredMaxDistanceNeighborsForce = std::pow(
195195
0.1 + std::cbrt(kDefaultVolumeNewTumorCell * 6 / Math::kPi) *
196196
kMaxRelativeAdhesionDistance,
197197
2); // (twice biggest cell radius (in case to cells tha maximum size

src/tumor_cell.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Real3 TumorCell::CalculateDisplacement(const InteractionForce* force,
277277
Real3 movement_at_next_step{0, 0, 0};
278278
// this should be chaged in a future version of BioDynaMo in order to have a
279279
// cleaner code instead of hardcoding it here
280-
squared_radius = kSquaredMaxDistanceNeighborsForce;
280+
squared_radius = gKSquaredMaxDistanceNeighborsForce;
281281

282282
Real3 translation_velocity_on_point_mass{0, 0, 0};
283283

0 commit comments

Comments
 (0)