TysonNovakCellCycleModel.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2009
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 #include "TysonNovakCellCycleModel.hpp"
00029 
00030 
00031 #ifdef CHASTE_CVODE
00032 CvodeAdaptor TysonNovakCellCycleModel::msSolver;
00033 #else
00034 BackwardEulerIvpOdeSolver TysonNovakCellCycleModel::msSolver(6);
00035 #endif //CHASTE_CVODE
00036 
00037 
00038 TysonNovakCellCycleModel::TysonNovakCellCycleModel()
00039 {
00040     mpOdeSystem = new TysonNovak2001OdeSystem;
00041     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00042 #ifdef CHASTE_CVODE
00043     msSolver.CheckForStoppingEvents();
00044     msSolver.SetMaxSteps(10000);
00045     //msSolver.SetTolerances(1e-6, 1e-8);
00046 #endif //CHASTE_CVODE
00047 }
00048 
00049 
00050 TysonNovakCellCycleModel::TysonNovakCellCycleModel(std::vector<double> parentProteinConcentrations,
00051                                                    double divideTime)
00052  : AbstractOdeBasedCellCycleModel(divideTime)
00053 {
00054     mpOdeSystem = new TysonNovak2001OdeSystem;
00055 #ifdef CHASTE_CVODE
00056     mpOdeSystem->SetStateVariables(parentProteinConcentrations);
00057 #else
00058     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00059 #endif
00060 }
00061 
00062 
00063 void TysonNovakCellCycleModel::ResetForDivision()
00064 {
00065     AbstractOdeBasedCellCycleModel::ResetForDivision();
00066 
00067     assert(mpOdeSystem!=NULL);
00068 
00081 #ifdef CHASTE_CVODE
00082     mpOdeSystem->rGetStateVariables()[5] = mpOdeSystem->rGetStateVariables()[5]/2.0;
00083 #else
00084     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00085 #endif //CHASTE_CVODE
00086 }
00087 
00088 
00089 void TysonNovakCellCycleModel::InitialiseDaughterCell()
00090 {
00091     if (mpCell->GetCellType() == STEM)
00092     {
00093         mpCell->SetCellType(TRANSIT);
00094     }
00095 }
00096 
00097 
00098 AbstractCellCycleModel* TysonNovakCellCycleModel::CreateDaughterCellCycleModel()
00099 {
00100     return new TysonNovakCellCycleModel(mpOdeSystem->rGetStateVariables(), mBirthTime);
00101 }
00102 
00103 
00104 bool TysonNovakCellCycleModel::SolveOdeToTime(double currentTime)
00105 {
00106     double dt = 0.1/60.0;
00107 
00108     msSolver.SolveAndUpdateStateVariable(mpOdeSystem,mLastTime,currentTime,dt);
00109 
00110     return msSolver.StoppingEventOccurred();
00111 }
00112 
00113 
00114 double TysonNovakCellCycleModel::GetOdeStopTime()
00115 {
00116     assert(msSolver.StoppingEventOccurred());
00117     return msSolver.GetStoppingTime();
00118 }
00119 
00120 
00121 double TysonNovakCellCycleModel::GetSDuration()
00122 {
00128     return 0.0;
00129 }
00130 
00131 
00132 double TysonNovakCellCycleModel::GetG2Duration()
00133 {
00139     return 0.0;
00140 }
00141 
00142 
00143 double TysonNovakCellCycleModel::GetMDuration()
00144 {
00150     return 0.0;
00151 }

Generated on Wed Mar 18 12:51:50 2009 for Chaste by  doxygen 1.5.5