VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
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 "VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo.hpp"
00030 
00031 VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo::VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
00032     : AbstractVanLeeuwen2009WntSwatCellCycleModel(pOdeSolver)
00033 {
00034     if (mpOdeSolver == boost::shared_ptr<AbstractCellCycleModelOdeSolver>())
00035     {
00036 #ifdef CHASTE_CVODE
00037         mpOdeSolver = CellCycleModelOdeSolver<VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo, 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 #else
00043         mpOdeSolver = CellCycleModelOdeSolver<VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo, RungeKutta4IvpOdeSolver>::Instance();
00044         mpOdeSolver->Initialise();
00045         SetDt(0.00005);
00046 #endif //CHASTE_CVODE
00047     }
00048 }
00049 
00050 void VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo::InitialiseOdeSystem(double wntConcentration, boost::shared_ptr<AbstractCellMutationState> pMutationState)
00051 {
00052     mpOdeSystem = new VanLeeuwen2009WntSwatCellCycleOdeSystem(2, wntConcentration,  pMutationState);
00053 }
00054 
00055 AbstractCellCycleModel* VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo::CreateCellCycleModel()
00056 {
00057     // Create a new cell-cycle model
00058     VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo* p_model = new VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo(mpOdeSolver);
00059 
00060     /*
00061      * Set each member variable of the new cell-cycle model that inherits
00062      * its value from the parent.
00063      * 
00064      * Note 1: some of the new cell-cycle model's member variables (namely
00065      * mBirthTime, mCurrentCellCyclePhase, mReadyToDivide, mDt, mpOdeSolver)
00066      * will already have been correctly initialized in its constructor.
00067      * 
00068      * Note 2: one or more of the new cell-cycle model's member variables
00069      * may be set/overwritten as soon as InitialiseDaughterCell() is called on
00070      * the new cell-cycle model.
00071      */
00072     p_model->SetBirthTime(mBirthTime);
00073     p_model->SetDimension(mDimension);
00074     p_model->SetCellProliferativeType(mCellProliferativeType);
00075     p_model->SetMinimumGapDuration(mMinimumGapDuration);
00076     p_model->SetStemCellG1Duration(mStemCellG1Duration);
00077     p_model->SetTransitCellG1Duration(mTransitCellG1Duration);
00078     p_model->SetSDuration(mSDuration);
00079     p_model->SetG2Duration(mG2Duration);
00080     p_model->SetMDuration(mMDuration);
00081     p_model->SetDivideTime(mDivideTime);
00082     p_model->SetFinishedRunningOdes(mFinishedRunningOdes);
00083     p_model->SetG2PhaseStartTime(mG2PhaseStartTime);
00084     p_model->SetLastTime(mLastTime);
00085 
00086     /*
00087      * Create the new cell-cycle model's ODE system and use the current values
00088      * of the state variables in mpOdeSystem as an initial condition.
00089      */
00090     assert(mpOdeSystem);
00091     double wnt_level = GetWntLevel();
00092     p_model->InitialiseOdeSystem(wnt_level, mpCell->GetMutationState());
00093     p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00094 
00095     return p_model;
00096 }
00097 
00098 void VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo::OutputCellCycleModelParameters(out_stream& rParamsFile)
00099 {
00100     // No new parameters to output
00101 
00102     // Call method on direct parent class
00103     AbstractVanLeeuwen2009WntSwatCellCycleModel::OutputCellCycleModelParameters(rParamsFile);
00104 }
00105 
00106 // Declare identifier for the serializer
00107 #include "SerializationExportWrapperForCpp.hpp"
00108 CHASTE_CLASS_EXPORT(VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo)
00109 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00110 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(VanLeeuwen2009WntSwatCellCycleModelHypothesisTwo)

Generated on Tue May 31 14:31:41 2011 for Chaste by  doxygen 1.5.5