00001 /* 00002 00003 Copyright (C) University of Oxford, 2005-2010 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 00029 #include "TysonNovakCellCycleModel.hpp" 00030 00031 TysonNovakCellCycleModel::TysonNovakCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver) 00032 : AbstractOdeBasedCellCycleModel(SimulationTime::Instance()->GetTime(), pOdeSolver) 00033 { 00034 if (!mpOdeSolver) 00035 { 00036 #ifdef CHASTE_CVODE 00037 mpOdeSolver = CellCycleModelOdeSolver<TysonNovakCellCycleModel, CvodeAdaptor>::Instance(); 00038 mpOdeSolver->Initialise(); 00039 // Chaste solvers always check for stopping events, CVODE needs to be instructed to do so 00040 mpOdeSolver->CheckForStoppingEvents(); 00041 mpOdeSolver->SetMaxSteps(10000); 00042 mpOdeSolver->SetTolerances(1e-6, 1e-8); 00043 #else 00044 mpOdeSolver = CellCycleModelOdeSolver<TysonNovakCellCycleModel, BackwardEulerIvpOdeSolver>::Instance(); 00045 mpOdeSolver->SetSizeOfOdeSystem(6); 00046 mpOdeSolver->Initialise(); 00047 SetDt(0.1/60.0); 00048 #endif //CHASTE_CVODE 00049 } 00050 } 00051 00052 void TysonNovakCellCycleModel::Initialise() 00053 { 00054 assert(mpOdeSystem == NULL); 00055 mpOdeSystem = new TysonNovak2001OdeSystem; 00056 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions()); 00057 00058 AbstractCellCycleModel::Initialise(); 00059 } 00060 00061 void TysonNovakCellCycleModel::ResetForDivision() 00062 { 00063 AbstractOdeBasedCellCycleModel::ResetForDivision(); 00064 00065 assert(mpOdeSystem != NULL); 00066 00079 #ifdef CHASTE_CVODE 00080 mpOdeSystem->rGetStateVariables()[5] = 0.5*mpOdeSystem->rGetStateVariables()[5]; 00081 #else 00082 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions()); 00083 #endif //CHASTE_CVODE 00084 } 00085 00086 void TysonNovakCellCycleModel::InitialiseDaughterCell() 00087 { 00088 if (mCellProliferativeType == STEM) 00089 { 00090 mCellProliferativeType = TRANSIT; 00091 } 00092 } 00093 00094 AbstractCellCycleModel* TysonNovakCellCycleModel::CreateCellCycleModel() 00095 { 00096 // Create a new cell cycle model 00097 TysonNovakCellCycleModel* p_model = new TysonNovakCellCycleModel(mpOdeSolver); 00098 00099 // Use the current values of the state variables in mpOdeSystem as an initial condition for the new cell cycle model's ODE system 00100 assert(mpOdeSystem); 00101 p_model->SetOdeSystem(new TysonNovak2001OdeSystem); 00102 p_model->SetStateVariables(mpOdeSystem->rGetStateVariables()); 00103 00104 // Set the values of the new cell cycle model's member variables 00105 p_model->SetBirthTime(mBirthTime); 00106 p_model->SetLastTime(mLastTime); 00107 p_model->SetDivideTime(mDivideTime); 00108 p_model->SetFinishedRunningOdes(mFinishedRunningOdes); 00109 p_model->SetG2PhaseStartTime(mG2PhaseStartTime); 00110 p_model->SetCellProliferativeType(mCellProliferativeType); 00111 00112 return p_model; 00113 } 00114 00115 double TysonNovakCellCycleModel::GetSDuration() 00116 { 00122 return 0.0; 00123 } 00124 00125 double TysonNovakCellCycleModel::GetG2Duration() 00126 { 00132 return 0.0; 00133 } 00134 00135 double TysonNovakCellCycleModel::GetMDuration() 00136 { 00142 return 0.0; 00143 } 00144 00145 double TysonNovakCellCycleModel::GetAverageTransitCellCycleTime() 00146 { 00147 return 1.25; 00148 } 00149 00150 double TysonNovakCellCycleModel::GetAverageStemCellCycleTime() 00151 { 00152 return 1.25; 00153 } 00154 00155 00156 bool TysonNovakCellCycleModel::CanCellTerminallyDifferentiate() 00157 { 00158 return false; 00159 } 00160 00161 // Serialization for Boost >= 1.36 00162 #include "SerializationExportWrapperForCpp.hpp" 00163 CHASTE_CLASS_EXPORT(TysonNovakCellCycleModel) 00164 #include "CellCycleModelOdeSolverExportWrapper.hpp" 00165 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(TysonNovakCellCycleModel)