Skip to content

Commit 126bdec

Browse files
committed
tidy and clang format on everything
1 parent 9eb4f47 commit 126bdec

13 files changed

+284
-192
lines changed

clang_output.txt

Whitespace-only changes.

src/cart_cell.cc

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,31 @@
1919
* for the compiler-research.org organization.
2020
*/
2121

22-
#include "cart_cell.h"
2322
#include <algorithm>
2423
#include <cstdint>
2524
#include <stdexcept>
2625
#include <string>
27-
#include "hyperparams.h"
28-
#include "core/util/root.h"
26+
2927
#include "core/agent/agent.h"
3028
#include "core/agent/cell.h"
31-
#include "core/resource_manager.h"
29+
#include "core/agent/new_agent_event.h"
3230
#include "core/behavior/behavior.h"
33-
#include "core/diffusion/diffusion_grid.h"
3431
#include "core/container/math_array.h"
32+
#include "core/diffusion/diffusion_grid.h"
3533
#include "core/functor.h"
36-
#include "core/agent/new_agent_event.h"
34+
#include "core/interaction_force.h"
3735
#include "core/real_t.h"
36+
#include "core/resource_manager.h"
3837
#include "core/util/log.h"
39-
#include "core/interaction_force.h"
38+
#include "core/util/root.h"
39+
40+
#include "cart_cell.h"
41+
#include "hyperparams.h"
4042
#include "tumor_cell.h"
4143
#include "utils_aux.h"
4244

4345
namespace bdm {
4446

45-
4647
CartCell::CartCell(const Real3& position)
4748
: state_(CartCellState::kAlive),
4849
timer_state_(0),
@@ -66,7 +67,8 @@ CartCell::CartCell(const Real3& position)
6667
SetVolume(kDefaultVolumeNewCartCell);
6768
const ResourceManager& rm = *Simulation::GetActive()->GetResourceManager();
6869
oxygen_dgrid_ = rm.GetDiffusionGrid("oxygen");
69-
immunostimulatory_factor_dgrid_ = rm.GetDiffusionGrid("immunostimulatory_factor");
70+
immunostimulatory_factor_dgrid_ =
71+
rm.GetDiffusionGrid("immunostimulatory_factor");
7072
ComputeConstantsConsumptionSecretion();
7173
}
7274

@@ -87,8 +89,8 @@ real_t CartCell::GetTargetTotalVolume() const {
8789
// convergence
8890
// NOLINTNEXTLINE(bugprone-easily-swappable-parameters)
8991
void CartCell::ChangeVolumeExponentialRelaxationEquation(
90-
real_t relaxation_rate_cytoplasm, real_t relaxation_rate_nucleus,
91-
real_t relaxation_rate_fluid) {
92+
real_t relaxation_rate_cytoplasm, real_t relaxation_rate_nucleus,
93+
real_t relaxation_rate_fluid) {
9294
// Exponential relaxation towards the target volume
9395
const real_t current_total_volume = GetVolume();
9496
const real_t fluid_fraction = GetFluidFraction();
@@ -110,7 +112,8 @@ void CartCell::ChangeVolumeExponentialRelaxationEquation(
110112
new_fluid = 0.0;
111113
}
112114

113-
const real_t nuclear_fluid = new_fluid * (nuclear_volume / current_total_volume);
115+
const real_t nuclear_fluid =
116+
new_fluid * (nuclear_volume / current_total_volume);
114117
// real_t cytoplasm_fluid = new_fluid - nuclear_fluid;
115118

116119
real_t nuclear_solid = current_nuclear_solid +
@@ -122,11 +125,11 @@ void CartCell::ChangeVolumeExponentialRelaxationEquation(
122125
}
123126

124127
const real_t target_cytoplasm_solid =
125-
GetTargetRelationCytoplasmNucleus() * GetTargetNucleusSolid();
128+
GetTargetRelationCytoplasmNucleus() * GetTargetNucleusSolid();
126129
real_t cytoplasm_solid =
127-
current_cytoplasm_solid +
128-
kDtCycle * relaxation_rate_cytoplasm *
129-
(target_cytoplasm_solid - current_cytoplasm_solid);
130+
current_cytoplasm_solid +
131+
kDtCycle * relaxation_rate_cytoplasm *
132+
(target_cytoplasm_solid - current_cytoplasm_solid);
130133
// Clamp to zero to prevent negative volumes
131134
if (cytoplasm_solid < 0.0) {
132135
cytoplasm_solid = 0.0;
@@ -264,9 +267,10 @@ void StateControlCart::Run(Agent* agent) {
264267

265268
if (sim->GetRandom()->Uniform(1.0) <
266269
kDtCycle /
267-
std::max(cell->GetCurrentLiveTime(),
268-
kEpsilon)) { // Probability of death= 1/CurrentLiveTime,
269-
// avoiding division by 0
270+
std::max(
271+
cell->GetCurrentLiveTime(),
272+
kEpsilon)) { // Probability of death= 1/CurrentLiveTime,
273+
// avoiding division by 0
270274
// the cell Dies
271275
cell->SetState(CartCellState::kApoptotic);
272276
cell->SetTimerState(0); // Reset timer_state, it should be 0 anyway
@@ -295,7 +299,8 @@ void StateControlCart::Run(Agent* agent) {
295299
break;
296300
}
297301
case CartCellState::kApoptotic: {
298-
cell->SetTimerState(static_cast<int>(static_cast<real_t>(cell->GetTimerState()) + kDtCycle));
302+
cell->SetTimerState(static_cast<int>(
303+
static_cast<real_t>(cell->GetTimerState()) + kDtCycle));
299304

300305
cell->ChangeVolumeExponentialRelaxationEquation(
301306
kVolumeRelaxarionRateCytoplasmApoptotic,

src/cart_cell.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@
2222
#ifndef CART_CELL_H_
2323
#define CART_CELL_H_
2424

25-
#include "core/util/root.h"
2625
#include "core/agent/agent.h"
2726
#include "core/agent/cell.h"
27+
#include "core/agent/new_agent_event.h"
2828
#include "core/behavior/behavior.h"
29-
#include "core/diffusion/diffusion_grid.h"
3029
#include "core/container/math_array.h"
31-
#include "core/agent/new_agent_event.h"
32-
#include "core/real_t.h"
30+
#include "core/diffusion/diffusion_grid.h"
3331
#include "core/interaction_force.h"
34-
#include "tumor_cell.h"
32+
#include "core/real_t.h"
33+
#include "core/util/root.h"
3534

35+
#include "tumor_cell.h"
3636

3737
namespace bdm {
3838

@@ -61,8 +61,9 @@ class CartCell : public Cell {
6161
public:
6262
CartCell() = default;
6363
explicit CartCell(const Real3& position);
64-
65-
// Copy and move constructors/destructors (assignment operators are deleted by base class)
64+
65+
// Copy and move constructors/destructors (assignment operators are deleted by
66+
// base class)
6667
CartCell(const CartCell&) = default;
6768
CartCell(CartCell&&) = default;
6869
~CartCell() override = default;
@@ -270,8 +271,9 @@ struct StateControlCart : public Behavior {
270271
BDM_BEHAVIOR_HEADER(StateControlCart, Behavior, 1);
271272

272273
StateControlCart() { AlwaysCopyToNew(); }
273-
274-
// Copy and move constructors/destructors (assignment operators handled by base class)
274+
275+
// Copy and move constructors/destructors (assignment operators handled by
276+
// base class)
275277
StateControlCart(const StateControlCart&) = default;
276278
StateControlCart(StateControlCart&&) = default;
277279
~StateControlCart() override = default;

src/cart_tumor.cc

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@
1818
* This file contains a model developed under Google Summer of Code (GSoC)
1919
* for the compiler-research.org organization.
2020
*/
21-
#include "cart_tumor.h"
21+
2222
#include <iostream>
2323
#include <memory>
2424
#include <vector>
25+
2526
#include "core/container/math_array.h"
27+
#include "core/diffusion/diffusion_grid.h"
2628
#include "core/environment/uniform_grid_environment.h"
27-
#include "core/real_t.h"
28-
#include "core/simulation.h"
2929
#include "core/model_initializer.h"
30-
#include "core/param/param.h"
31-
#include "core/operation/operation.h"
3230
#include "core/operation/mechanical_forces_op.h"
33-
#include "core/diffusion/diffusion_grid.h"
31+
#include "core/operation/operation.h"
32+
#include "core/param/param.h"
33+
#include "core/real_t.h"
34+
#include "core/simulation.h"
35+
36+
#include "cart_tumor.h"
3437
#include "diffusion_thomas_algorithm.h"
3538
#include "forces_tumor_cart.h"
3639
#include "hyperparams.h"
@@ -44,9 +47,11 @@ int Simulate(int argc, const char** argv) {
4447
auto set_param = [](Param* param) {
4548
param->random_seed = kSeed; // Set a fixed random seed for reproducibility
4649
param->bound_space = Param::BoundSpaceMode::kTorus; // Periodic boundary
47-
param->min_bound = -kBoundedSpaceLength / 2.0; // Fixed: explicit floating point division
50+
param->min_bound =
51+
-kBoundedSpaceLength / 2.0; // Fixed: explicit floating point division
4852
param->max_bound =
49-
kBoundedSpaceLength / 2.0; // Fixed: explicit floating point division - Cube of 1000x1000x1000 centered at origin
53+
kBoundedSpaceLength / 2.0; // Fixed: explicit floating point division -
54+
// Cube of 1000x1000x1000 centered at origin
5055
param->simulation_time_step = kDt;
5156
};
5257

@@ -114,10 +119,11 @@ int Simulate(int argc, const char** argv) {
114119

115120
// One spherical tumor of radius kInitialRadiusTumor in the center of the
116121
// simulation space
117-
const std::vector<Real3> positions = // Fixed: added const
122+
const std::vector<Real3> positions = // Fixed: added const
118123
CreateSphereOfTumorCells(kInitialRadiusTumor); // positions of the cells
119124
for (const auto& pos : positions) {
120-
auto* tumor_cell = new TumorCell(pos); // Fixed: use auto and gsl::owner handled by framework
125+
auto* tumor_cell = new TumorCell(
126+
pos); // Fixed: use auto and gsl::owner handled by framework
121127
tumor_cell->AddBehavior(new StateControlGrowProliferate());
122128
ctxt->AddAgent(tumor_cell);
123129
}

0 commit comments

Comments
 (0)