AbstractWntOdeBasedCellCycleModel.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 "AbstractWntOdeBasedCellCycleModel.hpp"
00029 
00030 
00031 #ifdef CHASTE_CVODE
00032 CvodeAdaptor AbstractWntOdeBasedCellCycleModel::msSolver;
00033 #else
00034 RungeKutta4IvpOdeSolver AbstractWntOdeBasedCellCycleModel::msSolver;
00035 #endif //CHASTE_CVODE
00036 
00037 
00038 AbstractWntOdeBasedCellCycleModel::AbstractWntOdeBasedCellCycleModel(unsigned dimension)
00039 {
00040     mDimension = dimension;
00041 #ifdef CHASTE_CVODE
00042     // Chaste solvers always check for stopping events, CVODE needs to be instructed to do so.
00043     msSolver.CheckForStoppingEvents();
00044     msSolver.SetMaxSteps(10000);
00045     //msSolver.SetTolerances(1e-6, 1e-8);
00046 #endif //CHASTE_CVODE
00047 }
00048 
00049 
00050 AbstractWntOdeBasedCellCycleModel::AbstractWntOdeBasedCellCycleModel(const AbstractWntOdeBasedCellCycleModel& rOtherModel)
00051     : AbstractOdeBasedCellCycleModel(rOtherModel),
00052       mDimension(rOtherModel.mDimension)
00053 {
00054 }
00055 
00056 
00057 unsigned AbstractWntOdeBasedCellCycleModel::GetDimension()
00058 {
00059     return mDimension;
00060 }
00061 
00062 
00063 double AbstractWntOdeBasedCellCycleModel::GetOdeStopTime()
00064 {
00065     assert(msSolver.StoppingEventOccurred());
00066     return msSolver.GetStoppingTime();
00067 }
00068 
00069 
00070 double AbstractWntOdeBasedCellCycleModel::GetWntLevel()
00071 {
00072     assert(mpCell != NULL);
00073     double level = 0;
00074 
00075     switch (mDimension)
00076     {
00077         case 1:
00078         {
00079             const unsigned DIM = 1;
00080             level = WntConcentration<DIM>::Instance()->GetWntLevel(mpCell);
00081             break;
00082         }
00083         case 2:
00084         {
00085             const unsigned DIM = 2;
00086             level = WntConcentration<DIM>::Instance()->GetWntLevel(mpCell);
00087             break;
00088         }
00089         case 3:
00090         {
00091             const unsigned DIM = 3;
00092             level = WntConcentration<DIM>::Instance()->GetWntLevel(mpCell);
00093             break;
00094         }
00095         default:
00096             NEVER_REACHED;
00097     }
00098     return level;
00099 }
00100 
00101 
00102 void AbstractWntOdeBasedCellCycleModel::ResetForDivision()
00103 {
00104     AbstractOdeBasedCellCycleModel::ResetForDivision();
00105 
00106     assert(mpOdeSystem!=NULL);
00107 
00108     // This model needs the protein concentrations and phase resetting to G0/G1.
00109     // Keep the Wnt pathway in the same state but reset the cell cycle part
00110     // Cell cycle is proteins 0 to 4 (first 5 ODEs)
00111     std::vector<double> init_conds = mpOdeSystem->GetInitialConditions();
00112     for (unsigned i=0; i<5; i++)
00113     {
00114        mpOdeSystem->rGetStateVariables()[i] = init_conds[i];
00115     }
00116 }
00117 
00118 
00119 void AbstractWntOdeBasedCellCycleModel::UpdateCellType()
00120 {
00121     assert(mpOdeSystem!=NULL);
00122     assert(mpCell!=NULL);
00123     if (SimulationTime::Instance()->GetTime() > mLastTime)
00124     {
00125         EXCEPTION("WntCellCycleModel::UpdateCellType() should only be called when the cell cycle model has been evaluated to the current time\n");
00126     }
00127     ChangeCellTypeDueToCurrentBetaCateninLevel();
00128 }

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