TysonNovakCellCycleModel.cpp

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 #include "TysonNovakCellCycleModel.hpp"
00029 
00030 #ifdef CHASTE_CVODE
00031 CvodeAdaptor TysonNovakCellCycleModel::msSolver;
00032 #else
00033 BackwardEulerIvpOdeSolver TysonNovakCellCycleModel::msSolver(6);
00034 #endif //CHASTE_CVODE
00035 
00036 TysonNovakCellCycleModel::TysonNovakCellCycleModel()
00037 {
00038     mpOdeSystem = new TysonNovak2001OdeSystem;
00039     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00040 #ifdef CHASTE_CVODE
00041     msSolver.CheckForStoppingEvents();
00042     msSolver.SetMaxSteps(10000);
00043     msSolver.SetTolerances(1e-6, 1e-8);
00044 #endif //CHASTE_CVODE
00045 }
00046 
00047 TysonNovakCellCycleModel::TysonNovakCellCycleModel(const TysonNovakCellCycleModel& rOtherModel)
00048     : AbstractOdeBasedCellCycleModelWithStoppingEvent(rOtherModel)
00049 {
00050     if (rOtherModel.mpOdeSystem != NULL)
00051     {
00052         mpOdeSystem = new TysonNovak2001OdeSystem(*static_cast<TysonNovak2001OdeSystem*>(rOtherModel.mpOdeSystem));
00053     }
00054 }
00055 
00056 void TysonNovakCellCycleModel::ResetForDivision()
00057 {
00058     AbstractOdeBasedCellCycleModelWithStoppingEvent::ResetForDivision();
00059 
00060     assert(mpOdeSystem!=NULL);
00061 
00074 #ifdef CHASTE_CVODE
00075     mpOdeSystem->rGetStateVariables()[5] = 0.5*mpOdeSystem->rGetStateVariables()[5];
00076 #else
00077     mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00078 #endif //CHASTE_CVODE
00079 }
00080 
00081 void TysonNovakCellCycleModel::InitialiseDaughterCell()
00082 {
00083     if (mpCell->GetCellProliferativeType() == STEM)
00084     {
00085         mpCell->SetCellProliferativeType(TRANSIT);
00086     }
00087 }
00088 
00089 AbstractCellCycleModel* TysonNovakCellCycleModel::CreateCellCycleModel()
00090 {
00091     return new TysonNovakCellCycleModel(*this);
00092 }
00093 
00094 bool TysonNovakCellCycleModel::SolveOdeToTime(double currentTime)
00095 {
00096     double dt = 0.1/60.0;
00097 
00098     msSolver.SolveAndUpdateStateVariable(mpOdeSystem, mLastTime, currentTime, dt);
00099 
00100     return msSolver.StoppingEventOccurred();
00101 }
00102 
00103 double TysonNovakCellCycleModel::GetOdeStopTime()
00104 {
00105     assert(msSolver.StoppingEventOccurred());
00106     return msSolver.GetStoppingTime();
00107 }
00108 
00109 double TysonNovakCellCycleModel::GetSDuration()
00110 {
00116     return 0.0;
00117 }
00118 
00119 double TysonNovakCellCycleModel::GetG2Duration()
00120 {
00126     return 0.0;
00127 }
00128 
00129 double TysonNovakCellCycleModel::GetMDuration()
00130 {
00136     return 0.0;
00137 }
00138 
00139 double TysonNovakCellCycleModel::GetAverageTransitCellCycleTime()
00140 {
00141     return 1.25;
00142 }
00143 
00144 double TysonNovakCellCycleModel::GetAverageStemCellCycleTime()
00145 {
00146     return 1.25;
00147 }
00148 
00149 
00150 bool TysonNovakCellCycleModel::CanCellTerminallyDifferentiate()
00151 {
00152     return false;
00153 }
00154 
00155 // Serialization for Boost >= 1.36
00156 #include "SerializationExportWrapperForCpp.hpp"
00157 CHASTE_CLASS_EXPORT(TysonNovakCellCycleModel)

Generated by  doxygen 1.6.2