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 
00032 #ifdef CHASTE_CVODE
00033 CvodeAdaptor TysonNovakCellCycleModel::msSolver;
00034 #else
00035 BackwardEulerIvpOdeSolver TysonNovakCellCycleModel::msSolver(6);
00036 #endif //CHASTE_CVODE
00037 
00038 
00039 TysonNovakCellCycleModel::TysonNovakCellCycleModel()
00040 {
00041     mpOdeSystem = new TysonNovak2001OdeSystem;
00042     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00043 #ifdef CHASTE_CVODE
00044     msSolver.CheckForStoppingEvents();
00045     msSolver.SetMaxSteps(10000);
00046     //msSolver.SetTolerances(1e-6, 1e-8);
00047 #endif //CHASTE_CVODE
00048 }
00049 
00050 TysonNovakCellCycleModel::TysonNovakCellCycleModel(const TysonNovakCellCycleModel& rOtherModel)
00051     : AbstractOdeBasedCellCycleModel(rOtherModel)
00052 {
00053     if (rOtherModel.mpOdeSystem != NULL)
00054     {
00055         mpOdeSystem = new TysonNovak2001OdeSystem(*static_cast<TysonNovak2001OdeSystem*>(rOtherModel.mpOdeSystem));
00056     }
00057 }
00058 
00059 
00060 void TysonNovakCellCycleModel::ResetForDivision()
00061 {
00062     AbstractOdeBasedCellCycleModel::ResetForDivision();
00063 
00064     assert(mpOdeSystem!=NULL);
00065 
00078 #ifdef CHASTE_CVODE
00079     mpOdeSystem->rGetStateVariables()[5] = mpOdeSystem->rGetStateVariables()[5]/2.0;
00080 #else
00081     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00082 #endif //CHASTE_CVODE
00083 }
00084 
00085 
00086 void TysonNovakCellCycleModel::InitialiseDaughterCell()
00087 {
00088     if (mpCell->GetCellType() == STEM)
00089     {
00090         mpCell->SetCellType(TRANSIT);
00091     }
00092 }
00093 
00094 AbstractCellCycleModel* TysonNovakCellCycleModel::CreateCellCycleModel()
00095 {
00096     return new TysonNovakCellCycleModel(*this);
00097 }
00098 
00099 
00100 bool TysonNovakCellCycleModel::SolveOdeToTime(double currentTime)
00101 {
00102     double dt = 0.1/60.0;
00103 
00104     msSolver.SolveAndUpdateStateVariable(mpOdeSystem,mLastTime,currentTime,dt);
00105 
00106     return msSolver.StoppingEventOccurred();
00107 }
00108 
00109 
00110 double TysonNovakCellCycleModel::GetOdeStopTime()
00111 {
00112     assert(msSolver.StoppingEventOccurred());
00113     return msSolver.GetStoppingTime();
00114 }
00115 
00116 
00117 double TysonNovakCellCycleModel::GetSDuration()
00118 {
00124     return 0.0;
00125 }
00126 
00127 
00128 double TysonNovakCellCycleModel::GetG2Duration()
00129 {
00135     return 0.0;
00136 }
00137 
00138 
00139 double TysonNovakCellCycleModel::GetMDuration()
00140 {
00146     return 0.0;
00147 }

Generated on Tue Aug 4 16:10:21 2009 for Chaste by  doxygen 1.5.5