Chaste  Release::3.4
ContactInhibitionCellCycleModel.cpp
1 /*
2 
3 Copyright (c) 2005-2016, 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 
50 {
52  {
53  EXCEPTION("The member variables mQuiescentVolumeFraction and mEquilibriumVolume have not yet been set.");
54  }
55 
56  // Get cell volume
57  double cell_volume = mpCell->GetCellData()->GetItem("volume");
58 
59  // Removes the cell label
60  mpCell->RemoveCellProperty<CellLabel>();
61 
62  if (mCurrentCellCyclePhase == G_ONE_PHASE)
63  {
64  // Update G1 duration based on cell volume
65  double dt = SimulationTime::Instance()->GetTimeStep();
66  double quiescent_volume = mEquilibriumVolume * mQuiescentVolumeFraction;
67 
68  if (cell_volume < quiescent_volume)
69  {
70  // Update the duration of the current period of contact inhibition.
72  mG1Duration += dt;
73 
74  /*
75  * This method is usually called within a CellBasedSimulation, after the CellPopulation
76  * has called CellPropertyRegistry::TakeOwnership(). This means that were we to call
77  * CellPropertyRegistry::Instance() here when adding the CellLabel, we would be creating
78  * a new CellPropertyRegistry. In this case the CellLabel's cell count would be incorrect.
79  * We must therefore access the CellLabel via the cell's CellPropertyCollection.
80  */
81  boost::shared_ptr<AbstractCellProperty> p_label =
82  mpCell->rGetCellPropertyCollection().GetCellPropertyRegistry()->Get<CellLabel>();
83  mpCell->AddCellProperty(p_label);
84  }
85  else
86  {
87  // Reset the cell's quiescent duration and update the time at which the onset of quiescent occurs
90  }
91  }
92 
93  double time_since_birth = GetAge();
94  assert(time_since_birth >= 0);
95 
96  if (mpCell->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>())
97  {
98  mCurrentCellCyclePhase = G_ZERO_PHASE;
99  }
100  else if ( time_since_birth < GetMDuration() )
101  {
102  mCurrentCellCyclePhase = M_PHASE;
103  }
104  else if ( time_since_birth < GetMDuration() + mG1Duration)
105  {
106  mCurrentCellCyclePhase = G_ONE_PHASE;
107  }
108  else if ( time_since_birth < GetMDuration() + mG1Duration + GetSDuration())
109  {
110  mCurrentCellCyclePhase = S_PHASE;
111  }
112  else if ( time_since_birth < GetMDuration() + mG1Duration + GetSDuration() + GetG2Duration())
113  {
114  mCurrentCellCyclePhase = G_TWO_PHASE;
115  }
116 }
117 
119 {
120  // Create a new cell-cycle model
122 
123  /*
124  * Set each member variable of the new cell-cycle model that inherits
125  * its value from the parent.
126  *
127  * Note 1: some of the new cell-cycle model's member variables (namely
128  * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mTimeSpentInG1Phase,
129  * mCurrentHypoxicDuration, mCurrentHypoxiaOnsetTime) will already have been
130  * correctly initialized in its constructor.
131  *
132  * Note 2: one or more of the new cell-cycle model's member variables
133  * may be set/overwritten as soon as InitialiseDaughterCell() is called on
134  * the new cell-cycle model.
135  */
136  p_model->SetBirthTime(mBirthTime);
137  p_model->SetDimension(mDimension);
141  p_model->SetSDuration(mSDuration);
142  p_model->SetG2Duration(mG2Duration);
143  p_model->SetMDuration(mMDuration);
148 
149  return p_model;
150 }
151 
153 {
154  mQuiescentVolumeFraction = quiescentVolumeFraction;
155 }
156 
158 {
160 }
161 
163 {
164  mEquilibriumVolume = equilibriumVolume;
165 }
166 
168 {
169  return mEquilibriumVolume;
170 }
171 
173 {
174  mCurrentQuiescentDuration = currentQuiescentDuration;
175 }
176 
178 {
180 }
181 
183 {
184  mCurrentQuiescentOnsetTime = currentQuiescentOnsetTime;
185 }
186 
188 {
190 }
191 
193 {
194  *rParamsFile << "\t\t\t<QuiescentVolumeFraction>" << mQuiescentVolumeFraction << "</QuiescentVolumeFraction>\n";
195  *rParamsFile << "\t\t\t<EquilibriumVolume>" << mEquilibriumVolume << "</EquilibriumVolume>\n";
196 
197  // Call method on direct parent class
199 }
200 
201 // Serialization for Boost >= 1.36
virtual void SetBirthTime(double birthTime)
virtual void SetStemCellG1Duration(double stemCellG1Duration)
void SetMinimumGapDuration(double minimumGapDuration)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
void SetMDuration(double mDuration)
#define EXCEPTION(message)
Definition: Exception.hpp:143
static SimulationTime * Instance()
void SetG2Duration(double g2Duration)
double GetTimeStep() const
const double DOUBLE_UNSET
Definition: Exception.hpp:56
void SetDimension(unsigned dimension)
void SetEquilibriumVolume(double equilibriumVolume)
virtual void SetTransitCellG1Duration(double transitCellG1Duration)
double GetTime() const
#define CHASTE_CLASS_EXPORT(T)
void SetCurrentQuiescentOnsetTime(double currentQuiescentOnsetTime)
void SetQuiescentVolumeFraction(double quiescentVolumeFraction)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
void SetCurrentQuiescentDuration(double currentQuiescentDuration)
void SetSDuration(double sDuration)