Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
TargetAreaLinearGrowthModifier.cpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35
36#include "TargetAreaLinearGrowthModifier.hpp"
37#include "ApoptoticCellProperty.hpp"
38#include "DifferentiatedCellProliferativeType.hpp"
39#include "AbstractPhaseBasedCellCycleModel.hpp"
40
41template<unsigned DIM>
48
49template<unsigned DIM>
53
54template<unsigned DIM>
56{
57 // Get target area A of a healthy cell in S, G2 or M phase
58 double cell_target_area = this->mReferenceTargetArea;
59
60 // The target area of an apoptotic cell decreases linearly to zero
61 if (pCell->HasCellProperty<ApoptoticCellProperty>())
62 {
64 double time_spent_apoptotic = SimulationTime::Instance()->GetTime() - pCell->GetStartOfApoptosisTime();
65 cell_target_area = cell_target_area - 0.5*cell_target_area/(pCell->GetApoptosisTime())*time_spent_apoptotic;
66
67 // Don't allow a negative target area
68 if (cell_target_area < 0)
69 {
70 cell_target_area = 0;
71 }
72 }
73 else
74 {
75 bool cell_is_differentiated = pCell->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>();
76 if (!cell_is_differentiated)
77 {
78 /*
79 * If not using a phase-based cell-cycle model, the target area of a proliferating cell increases
80 * linearly from mReferenceTargetArea as soon as the cell's age exceeds mAgeToStartGrowing, with
81 * growth rate mGrowthRate.
82 */
83 double growth_start_time = mAgeToStartGrowing;
84 double growth_rate = mGrowthRate;
85 if (growth_start_time == DOUBLE_UNSET)
86 {
87 if (dynamic_cast<AbstractPhaseBasedCellCycleModel*>(pCell->GetCellCycleModel()) == nullptr)
88 {
89 EXCEPTION("If SetAgeToStartGrowing() has not been called, a subclass of AbstractPhaseBasedCellCycleModel must be used");
90 }
91
92 /*
93 * If using a phase-based cell-cycle model, the target area of a proliferating cell increases
94 * linearly from mReferenceTargetArea to 2*mReferenceTargetArea during the cell's G2 phase.
95 */
96 AbstractPhaseBasedCellCycleModel* p_model = static_cast<AbstractPhaseBasedCellCycleModel*>(pCell->GetCellCycleModel());
97 growth_start_time = p_model->GetMDuration() + p_model->GetG1Duration() + p_model->GetSDuration();
98
99 double g2_duration = p_model->GetG2Duration();
100 growth_rate = cell_target_area/g2_duration;
101 }
102 else if (mGrowthRate == DOUBLE_UNSET)
103 {
104 EXCEPTION("If SetAgeToStartGrowing() has been called, then SetGrowthRate() must also be called");
105 }
106
107 double time_spent_growing = pCell->GetAge() - growth_start_time;
108
109 // The target area of a proliferating cell increases linearly
110 if (time_spent_growing > 0)
111 {
112 cell_target_area += time_spent_growing*growth_rate;
113 }
114
122 if (pCell->ReadyToDivide())
123 {
124 cell_target_area = this->mReferenceTargetArea;
125 }
126 }
127 }
128
129 // Set cell data
130 pCell->GetCellData()->SetItem("target area", cell_target_area);
131}
132
133template<unsigned DIM>
135{
136 return mAgeToStartGrowing;
137}
138
139template<unsigned DIM>
141{
142 assert(ageToStartGrowing >= 0.0);
143 mAgeToStartGrowing = ageToStartGrowing;
144}
145
146template<unsigned DIM>
148{
149 return mGrowthRate;
150}
151
152template<unsigned DIM>
154{
155 assert(growthRate >= 0.0);
156 mGrowthRate = growthRate;
157}
158
159template<unsigned DIM>
161{
162 *rParamsFile << "\t\t\t<AgeToStartGrowing>" << mAgeToStartGrowing << "</AgeToStartGrowing>\n";
163 *rParamsFile << "\t\t\t<GrowthRate>" << mGrowthRate << "</GrowthRate>\n";
164
165 // Next, call method on direct parent class
167}
168
169// Explicit instantiation
173
174// Serialization for Boost >= 1.36
const double DOUBLE_UNSET
Definition Exception.hpp:57
#define EXCEPTION(message)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
virtual void OutputSimulationModifierParameters(out_stream &rParamsFile)
double GetTime() const
static SimulationTime * Instance()
void OutputSimulationModifierParameters(out_stream &rParamsFile)
void SetAgeToStartGrowing(double ageToStartGrowing)