Chaste  Release::2018.1
ContactInhibitionCellCycleModel.cpp
1 /*
2 
3 Copyright (c) 2005-2018, University of Oxford.
4 All rights reserved.
5 
6 University of Oxford means the Chancellor, Masters and Scholars of the
7 University of Oxford, having an administrative office at Wellington
8 Square, Oxford OX1 2JD, UK.
9 
10 This file is part of Chaste.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, 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 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34 */
35 
36 #include "ContactInhibitionCellCycleModel.hpp"
37 #include "CellLabel.hpp"
38 #include "DifferentiatedCellProliferativeType.hpp"
39 
42  mQuiescentVolumeFraction(DOUBLE_UNSET),
43  mEquilibriumVolume(DOUBLE_UNSET),
44  mCurrentQuiescentOnsetTime(SimulationTime::Instance()->GetTime()),
45  mCurrentQuiescentDuration(0.0)
46 {
47 }
48 
51  mQuiescentVolumeFraction(rModel.mQuiescentVolumeFraction),
52  mEquilibriumVolume(rModel.mEquilibriumVolume),
53  mCurrentQuiescentOnsetTime(rModel.mCurrentQuiescentOnsetTime),
54  mCurrentQuiescentDuration(rModel.mCurrentQuiescentDuration)
55 {
56  /*
57  * Initialize only those member variables defined in this class.
58  *
59  * The member variables mCurrentCellCyclePhase, mG1Duration,
60  * mMinimumGapDuration, mStemCellG1Duration, mTransitCellG1Duration,
61  * mSDuration, mG2Duration and mMDuration are initialized in the
62  * AbstractPhaseBasedCellCycleModel constructor.
63  *
64  * The member variables mBirthTime, mReadyToDivide and mDimension
65  * are initialized in the AbstractCellCycleModel constructor.
66  *
67  * Note that mG1Duration is (re)set as soon as InitialiseDaughterCell()
68  * is called on the new cell-cycle model.
69  */
70 }
71 
73 {
75  {
76  EXCEPTION("The member variables mQuiescentVolumeFraction and mEquilibriumVolume have not yet been set.");
77  }
78 
79  // Get cell volume
80  double cell_volume = mpCell->GetCellData()->GetItem("volume");
81 
82  // Removes the cell label
83  mpCell->RemoveCellProperty<CellLabel>();
84 
85  if (mCurrentCellCyclePhase == G_ONE_PHASE)
86  {
87  // Update G1 duration based on cell volume
88  double dt = SimulationTime::Instance()->GetTimeStep();
89  double quiescent_volume = mEquilibriumVolume * mQuiescentVolumeFraction;
90 
91  if (cell_volume < quiescent_volume)
92  {
93  // Update the duration of the current period of contact inhibition.
95  mG1Duration += dt;
96 
97  /*
98  * This method is usually called within a CellBasedSimulation, after the CellPopulation
99  * has called CellPropertyRegistry::TakeOwnership(). This means that were we to call
100  * CellPropertyRegistry::Instance() here when adding the CellLabel, we would be creating
101  * a new CellPropertyRegistry. In this case the CellLabel's cell count would be incorrect.
102  * We must therefore access the CellLabel via the cell's CellPropertyCollection.
103  */
104  boost::shared_ptr<AbstractCellProperty> p_label =
105  mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<CellLabel>();
106  mpCell->AddCellProperty(p_label);
107  }
108  else
109  {
110  // Reset the cell's quiescent duration and update the time at which the onset of quiescent occurs
113  }
114  }
115 
116  double time_since_birth = GetAge();
117  assert(time_since_birth >= 0);
118 
119  if (mpCell->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>())
120  {
121  mCurrentCellCyclePhase = G_ZERO_PHASE;
122  }
123  else if (time_since_birth < GetMDuration())
124  {
125  mCurrentCellCyclePhase = M_PHASE;
126  }
127  else if (time_since_birth < GetMDuration() + mG1Duration)
128  {
129  mCurrentCellCyclePhase = G_ONE_PHASE;
130  }
131  else if (time_since_birth < GetMDuration() + mG1Duration + GetSDuration())
132  {
133  mCurrentCellCyclePhase = S_PHASE;
134  }
135  else if (time_since_birth < GetMDuration() + mG1Duration + GetSDuration() + GetG2Duration())
136  {
137  mCurrentCellCyclePhase = G_TWO_PHASE;
138  }
139 }
140 
142 {
143  return new ContactInhibitionCellCycleModel(*this);
144 }
145 
147 {
148  mQuiescentVolumeFraction = quiescentVolumeFraction;
149 }
150 
152 {
154 }
155 
157 {
158  mEquilibriumVolume = equilibriumVolume;
159 }
160 
162 {
163  return mEquilibriumVolume;
164 }
165 
167 {
169 }
170 
172 {
174 }
175 
177 {
178  *rParamsFile << "\t\t\t<QuiescentVolumeFraction>" << mQuiescentVolumeFraction << "</QuiescentVolumeFraction>\n";
179  *rParamsFile << "\t\t\t<EquilibriumVolume>" << mEquilibriumVolume << "</EquilibriumVolume>\n";
180 
181  // Call method on direct parent class
183 }
184 
185 // Serialization for Boost >= 1.36
#define EXCEPTION(message)
Definition: Exception.hpp:143
static SimulationTime * Instance()
double GetTimeStep() const
const double DOUBLE_UNSET
Definition: Exception.hpp:56
void SetEquilibriumVolume(double equilibriumVolume)
double GetTime() const
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
#define CHASTE_CLASS_EXPORT(T)
void SetQuiescentVolumeFraction(double quiescentVolumeFraction)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)