Chaste  Release::2017.1
FixedSequenceCellCycleModel.cpp
1 /*
2 
3 Copyright (c) 2005-2017, 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 "FixedSequenceCellCycleModel.hpp"
37 #include "Exception.hpp"
38 #include "StemCellProliferativeType.hpp"
39 #include "TransitCellProliferativeType.hpp"
40 #include "DifferentiatedCellProliferativeType.hpp"
41 #include "CellCycleTimesGenerator.hpp"
42 
45 {
47 }
48 
51 {
52  /*
53  * Set each member variable of the new cell-cycle model that inherits
54  * its value from the parent.
55  *
56  * Note 1: some of the new cell-cycle model's member variables will already
57  * have been correctly initialized in its constructor or parent classes.
58  *
59  * Note 2: one or more of the new cell-cycle model's member variables
60  * may be set/overwritten as soon as InitialiseDaughterCell() is called on
61  * the new cell-cycle model.
62  *
63  * Note 3: Only set the variables defined in this class. Variables defined
64  * in parent classes will be defined there.
65  *
66  */
67 }
68 
70 {
71  return new FixedSequenceCellCycleModel(*this);
72 }
73 
75 {
76  CellCycleTimesGenerator* p_cell_cycle_times_generator = CellCycleTimesGenerator::Instance();
77 
78  if ( mpCell->GetCellProliferativeType()->IsType<StemCellProliferativeType>()
79  || mpCell->GetCellProliferativeType()->IsType<TransitCellProliferativeType>() )
80  {
81  // Generate an exponential random number with mScale
82  mG1Duration = p_cell_cycle_times_generator->GetNextCellCycleTime();
83  }
84  else if (mpCell->GetCellProliferativeType()->IsType<DifferentiatedCellProliferativeType>())
85  {
86  mG1Duration = DBL_MAX;
87  }
88  else
89  {
91  }
92 }
93 
95 {
96  CellCycleTimesGenerator* p_cell_cycle_times_generator = CellCycleTimesGenerator::Instance();
97  p_cell_cycle_times_generator->SetRate(rate);
98  mTransitCellG1Duration = 1.0/rate;
99  mStemCellG1Duration = 1.0/rate;
100 }
101 
103 {
104  CellCycleTimesGenerator* p_cell_cycle_times_generator = CellCycleTimesGenerator::Instance();
105  return p_cell_cycle_times_generator->GetRate();
106 }
107 
109 {
110  EXCEPTION("This cell cycle model does not differentiate stem cells and transit cells, please use SetRate() instead");
111 }
112 
114 {
115  EXCEPTION("This cell cycle model does not differentiate stem cells and transit cells, please use SetRate() instead");
116 }
117 
119 {
120  *rParamsFile << "\t\t\t<Rate>" << CellCycleTimesGenerator::Instance()->GetRate() << "</Rate>\n";
121 
122  // Call method on direct parent class
124 }
125 // Serialization for Boost >= 1.36
void SetStemCellG1Duration(double stemCellG1Duration)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
#define EXCEPTION(message)
Definition: Exception.hpp:143
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
static CellCycleTimesGenerator * Instance()
#define NEVER_REACHED
Definition: Exception.hpp:206
#define CHASTE_CLASS_EXPORT(T)
void SetTransitCellG1Duration(double transitCellG1Duration)
AbstractCellCycleModel * CreateCellCycleModel()