Chaste  Release::3.4
StochasticWntCellCycleModel.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 "StochasticWntCellCycleModel.hpp"
37 
38 StochasticWntCellCycleModel::StochasticWntCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
39  : WntCellCycleModel(pOdeSolver)
40 {
41  if (!pOdeSolver)
42  {
43 #ifdef CHASTE_CVODE
45  mpOdeSolver->Initialise();
46  // Chaste solvers always check for stopping events, CVODE needs to be instructed to do so
47  mpOdeSolver->CheckForStoppingEvents();
48  mpOdeSolver->SetMaxSteps(10000);
49 #else
51  mpOdeSolver->Initialise();
52 #endif //CHASTE_CVODE
53  }
54 }
55 
57 {}
58 
60 {
62 
64  double standard_deviation = 0.9;
65  mStochasticG2Duration = p_gen->NormalRandomDeviate(mean, standard_deviation);
66 
67  // Check that the normal random deviate has not returned a small or negative G2 duration
69  {
71  }
72 }
73 
75 {
78 }
79 
81 {
84 }
85 
87 {
90 }
91 
93 {
94  return mStochasticG2Duration;
95 }
96 
98 {
99  // Create a new cell-cycle model
101 
102  /*
103  * Set each member variable of the new cell-cycle model that inherits
104  * its value from the parent.
105  *
106  * Note 1: some of the new cell-cycle model's member variables (namely
107  * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mDt, mpOdeSolver)
108  * will already have been correctly initialized in its constructor.
109  *
110  * Note 2: one or more of the new cell-cycle model's member variables
111  * may be set/overwritten as soon as InitialiseDaughterCell() is called on
112  * the new cell-cycle model.
113  */
114  p_model->SetBirthTime(mBirthTime);
115  p_model->SetDimension(mDimension);
119  p_model->SetSDuration(mSDuration);
120  p_model->SetG2Duration(mG2Duration);
121  p_model->SetMDuration(mMDuration);
122  p_model->SetDivideTime(mDivideTime);
125  p_model->SetLastTime(mLastTime);
126 
127  /*
128  * Create the new cell-cycle model's ODE system and use the current values
129  * of the state variables in mpOdeSystem as an initial condition.
130  */
131  assert(mpOdeSystem);
132  double wnt_level = GetWntLevel();
133  p_model->SetOdeSystem(new WntCellCycleOdeSystem(wnt_level, mpCell->GetMutationState()));
135 
136  return p_model;
137 }
138 
140 {
141  // No new parameters to output
142 
143  // Call method on direct parent class
145 }
146 
147 // Serialization for Boost >= 1.36
150 #include "CellCycleModelOdeSolverExportWrapper.hpp"
151 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(StochasticWntCellCycleModel)
void SetStateVariables(const std::vector< double > &rStateVariables)
void SetOdeSystem(AbstractOdeSystem *pOdeSystem)
boost::shared_ptr< AbstractCellCycleModelOdeSolver > mpOdeSolver
virtual void SetStemCellG1Duration(double stemCellG1Duration)
void SetMinimumGapDuration(double minimumGapDuration)
void SetMDuration(double mDuration)
StochasticWntCellCycleModel(boost::shared_ptr< AbstractCellCycleModelOdeSolver > pOdeSolver=boost::shared_ptr< AbstractCellCycleModelOdeSolver >())
void SetG2Duration(double g2Duration)
double NormalRandomDeviate(double mean, double stdDev)
AbstractCellCycleModel * CreateCellCycleModel()
static boost::shared_ptr< CellCycleModelOdeSolver< CELL_CYCLE_MODEL, ODE_SOLVER > > Instance()
void SetDimension(unsigned dimension)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
virtual void OutputCellCycleModelParameters(out_stream &rParamsFile)
void SetFinishedRunningOdes(bool finishedRunningOdes)
static RandomNumberGenerator * Instance()
virtual void SetTransitCellG1Duration(double transitCellG1Duration)
#define CHASTE_CLASS_EXPORT(T)
void SetG2PhaseStartTime(double g2PhaseStartTime)
void SetSDuration(double sDuration)