24
24
#include " tumor_cell.h"
25
25
#include " utils_aux.h"
26
26
#include " core/agent/agent.h"
27
+ #include " core/agent/agent_pointer.h"
27
28
#include " core/agent/new_agent_event.h"
28
29
#include " core/container/math_array.h"
29
30
#include " core/diffusion/diffusion_grid.h"
@@ -143,7 +144,7 @@ void CarTCell::ChangeVolumeExponentialRelaxationEquation(
143
144
144
145
// compute Displacement
145
146
Real3 CarTCell::CalculateDisplacement (const InteractionForce* force,
146
- real_t squared_radius, real_t dt ) {
147
+ real_t squared_radius, real_t /* dt */ ) {
147
148
auto * sim = Simulation::GetActive ();
148
149
149
150
// real_t h = dt;
@@ -167,7 +168,7 @@ Real3 CarTCell::CalculateDisplacement(const InteractionForce* force,
167
168
// compute motility
168
169
if (rng->Uniform (0.0 , 1.0 ) < kMotilityProbability ) {
169
170
// random direction as unitary vector
170
- Real3 random_direction = GenerateRandomDirection ();
171
+ const Real3 random_direction = GenerateRandomDirection ();
171
172
Real3 direction_to_immunostimulatory_factor;
172
173
// returns normalized gradient towards the immunostimulatory factor source
173
174
immunostimulatory_factor_dgrid_->GetGradient (
@@ -179,8 +180,9 @@ Real3 CarTCell::CalculateDisplacement(const InteractionForce* force,
179
180
// Convert to unit direction
180
181
if (motility[0 ] * motility[0 ] + motility[1 ] * motility[1 ] +
181
182
motility[2 ] * motility[2 ] >
182
- 0 )
183
+ 0 ) {
183
184
motility.Normalize ();
185
+ }
184
186
// Scale by migration speed and add to the velocity
185
187
translation_velocity_on_point_mass += motility * kMigrationSpeedCart ;
186
188
}
@@ -189,9 +191,10 @@ Real3 CarTCell::CalculateDisplacement(const InteractionForce* force,
189
191
// --------------------------------------------
190
192
// CAR-T killing or victim cell escaping
191
193
// --------------------------------------------
192
- if (state_ == CarTCellState::kAlive ) { // If cell is not apoptotic
193
-
194
- if (attached_to_tumor_cell_) { // attached to tumor cell
194
+ // If cell is not apoptotic
195
+ if (state_ == CarTCellState::kAlive ) {
196
+ // if it is attached to tumor cell
197
+ if (attached_to_tumor_cell_) {
195
198
// try to kill the cancer cell and in case of failure see if it manages to
196
199
// scape the order needs to be this one because it should try to kill
197
200
// before seeing if it scapes
@@ -210,7 +213,7 @@ Real3 CarTCell::CalculateDisplacement(const InteractionForce* force,
210
213
// --------------------------------------------
211
214
// Compute forces between the cells and check for a new attachment
212
215
auto calculate_forces_and_elastic_displacement =
213
- L2F ([&](Agent* neighbor, real_t squared_distance) {
216
+ L2F ([&](Agent* neighbor, real_t /* squared_distance*/ ) {
214
217
// Adhesion repulsion forces between cells
215
218
// We check for every neighbor object if they touch us, i.e. push us
216
219
// away and aggregate the velocities
@@ -222,21 +225,21 @@ Real3 CarTCell::CalculateDisplacement(const InteractionForce* force,
222
225
// CAR-T adhesion to new victim cell
223
226
Real3 displac = neighbor->GetPosition () - current_position;
224
227
225
- if (TumorCell * cancer_cell = dynamic_cast <TumorCell*>(neighbor)) {
228
+ if (auto * cancer_cell = dynamic_cast <TumorCell*>(neighbor)) {
226
229
// movement towards the tumor cells
227
- real_t sq_norm_displac = displac[0 ] * displac[0 ] +
228
- displac[1 ] * displac[1 ] +
229
- displac[2 ] * displac[2 ];
230
+ const real_t sq_norm_displac = displac[0 ] * displac[0 ] +
231
+ displac[1 ] * displac[1 ] +
232
+ displac[2 ] * displac[2 ];
230
233
231
234
// The cart moves towards the tumor cell only if they are not
232
235
// touching already If they are too close the only force affecting
233
236
// is the adhesion force to avoid CAR-T non-stop pushing tumor
234
237
// cells. In case of being closer than
235
- // kMaxSquaredDistanceCartMovingTowardsTumorCell there is a
238
+ // gKMaxSquaredDistanceCartMovingTowardsTumorCell there is a
236
239
// probability kProbabilityPushing for the CAR-T to keep pushing the
237
240
// tumor cell
238
241
if (sq_norm_displac >
239
- kMaxSquaredDistanceCartMovingTowardsTumorCell ) {
242
+ gKMaxSquaredDistanceCartMovingTowardsTumorCell ) {
240
243
translation_velocity_on_point_mass[0 ] +=
241
244
displac[0 ] * kElasticConstantCart ;
242
245
translation_velocity_on_point_mass[1 ] +=
@@ -247,8 +250,9 @@ Real3 CarTCell::CalculateDisplacement(const InteractionForce* force,
247
250
248
251
// If the CAR-T has not succeeded in attaching to a tumor cell yet,
249
252
// it tries again
250
- if (!attached_to_tumor_cell_)
253
+ if (!attached_to_tumor_cell_) {
251
254
TryToGetAttachedTo (cancer_cell, sq_norm_displac, rng);
255
+ }
252
256
}
253
257
});
254
258
ctxt->ForEachNeighbor (calculate_forces_and_elastic_displacement, *this ,
@@ -281,14 +285,14 @@ void CarTCell::TryToGetAttachedTo(TumorCell* victim, real_t squared_distance,
281
285
(victim->GetOncoproteinLevel () - kOncoproteinLimit ) /
282
286
kOncoproteinDifference ;
283
287
// Clamp scale_factor to be in [0,1]
284
- if (oncoprotein_scale_factor > 1.0 )
288
+ if (oncoprotein_scale_factor > 1.0 ) {
285
289
oncoprotein_scale_factor = 1.0 ;
290
+ }
286
291
// If oncoprotein level is lower than the limit the cancer cell does not get
287
292
// detected
288
293
if (oncoprotein_scale_factor <= 0.0 ) {
289
- oncoprotein_scale_factor = 0.0 ;
290
- // the probability is going to be 0 so return the function is the most
291
- // efficient
294
+ // oncoprotein_scale_factor = 0.0; the probability is going to be 0 so
295
+ // return the function is the most efficient
292
296
return ;
293
297
}
294
298
@@ -298,8 +302,9 @@ void CarTCell::TryToGetAttachedTo(TumorCell* victim, real_t squared_distance,
298
302
kDifferenceCartAdhesionDistances ;
299
303
// Clamp scale_factor to be in [0,1]. We already checked that it is > 0
300
304
// because squared_distance < kSquaredMaxAdhesionDistanceCart
301
- if (distance_scale_factor > 1.0 )
305
+ if (distance_scale_factor > 1.0 ) {
302
306
distance_scale_factor = 1.0 ;
307
+ }
303
308
304
309
// It tries to attach the CAR-T cell to the tumor cell with probability
305
310
// kAdhesionRateCart * oncoprotein_scale_factor * distance_scale_factor *
@@ -320,41 +325,41 @@ void CarTCell::TryToGetAttachedTo(TumorCell* victim, real_t squared_distance,
320
325
}
321
326
}
322
327
}
323
-
324
- return ;
325
328
}
326
329
327
330
// Try to induce apoptosis
328
331
bool CarTCell::TryToInduceApoptosis (bdm::AgentPointer<TumorCell> attached_cell,
329
- Random* rng) {
332
+ Random* rng) const {
330
333
// If there is no attached cell (this should not happen)
331
334
332
- if (!attached_to_tumor_cell_)
335
+ if (!attached_to_tumor_cell_) {
333
336
return false ;
337
+ }
334
338
335
339
// factor of how high is the oncoprotein levelof the cancer cell
336
340
real_t scale_factor =
337
341
(attached_cell->GetOncoproteinLevel () - kOncoproteinLimit ) /
338
342
kOncoproteinDifference ;
339
343
// Clamp scale_factor to be in [0,1]
340
- if (scale_factor > 1.0 )
344
+ if (scale_factor > 1.0 ) {
341
345
scale_factor = 1.0 ;
346
+ }
342
347
// If oncoprotein level is lower than the limit the cancer cell does not
343
348
// become apoptotic
344
349
if (scale_factor < 0.0 ) {
345
- scale_factor = 0.0 ;
346
- // the probability is going to be 0 so return the function is the most
347
- // efficient
350
+ // scale_factor = 0.0; the probability is going to be 0 so return the
351
+ // function is the most efficient
348
352
return false ;
349
353
}
350
354
// CAR-T success of killing probability: aggressive cancer cells (high
351
355
// oncoprotein level) are more likely to be killed
352
- bool succeeded =
356
+ const bool succeeded =
353
357
rng->Uniform (0.0 , 1.0 ) < kKillRateCart * scale_factor * kDtMechanics ;
354
358
355
359
// The CAR-T has succeeded to induce apoptosis on the Cancer Cell
356
- if (succeeded)
360
+ if (succeeded) {
357
361
attached_cell->StartApoptosis ();
362
+ }
358
363
359
364
return succeeded;
360
365
}
0 commit comments