00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "Alarcon2004OxygenBasedCellCycleModel.hpp"
00030
00031 #include "CellwiseData.hpp"
00032 #include "CellLabel.hpp"
00033 #include "PetscTools.hpp"
00034
00035 Alarcon2004OxygenBasedCellCycleModel::Alarcon2004OxygenBasedCellCycleModel(boost::shared_ptr<AbstractCellCycleModelOdeSolver> pOdeSolver)
00036 : AbstractOdeBasedCellCycleModel(SimulationTime::Instance()->GetTime(), pOdeSolver)
00037 {
00038 if (!mpOdeSolver)
00039 {
00040 mpOdeSolver = CellCycleModelOdeSolver<Alarcon2004OxygenBasedCellCycleModel, RungeKutta4IvpOdeSolver>::Instance();
00041 mpOdeSolver->Initialise();
00042 }
00043 }
00044
00045 void Alarcon2004OxygenBasedCellCycleModel::ResetForDivision()
00046 {
00047 AbstractOdeBasedCellCycleModel::ResetForDivision();
00048 assert(mpOdeSystem != NULL);
00049
00050
00051
00052 std::vector<double> init_conds = mpOdeSystem->GetInitialConditions();
00053 for (unsigned i=0; i<5; i++)
00054 {
00055 mpOdeSystem->rGetStateVariables()[i] = init_conds[i];
00056 }
00057 }
00058
00059 AbstractCellCycleModel* Alarcon2004OxygenBasedCellCycleModel::CreateCellCycleModel()
00060 {
00061
00062 Alarcon2004OxygenBasedCellCycleModel* p_model = new Alarcon2004OxygenBasedCellCycleModel(mpOdeSolver);
00063
00064
00065 bool is_labelled = mpCell->HasCellProperty<CellLabel>();
00066 switch (mDimension)
00067 {
00068 case 1:
00069 {
00070 const unsigned DIM = 1;
00071 p_model->SetOdeSystem(new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled));
00072 break;
00073 }
00074 case 2:
00075 {
00076 const unsigned DIM = 2;
00077 p_model->SetOdeSystem(new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled));
00078 break;
00079 }
00080 case 3:
00081 {
00082 const unsigned DIM = 3;
00083 p_model->SetOdeSystem(new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled));
00084 break;
00085 }
00086 default:
00087 NEVER_REACHED;
00088 }
00089
00090
00091 assert(mpOdeSystem);
00092 p_model->SetStateVariables(mpOdeSystem->rGetStateVariables());
00093
00094
00095 p_model->SetLastTime(mLastTime);
00096 p_model->SetDivideTime(mDivideTime);
00097 p_model->SetFinishedRunningOdes(mFinishedRunningOdes);
00098 p_model->SetG2PhaseStartTime(mG2PhaseStartTime);
00099 p_model->SetDimension(mDimension);
00100 p_model->SetCellProliferativeType(mCellProliferativeType);
00101
00102 return p_model;
00103 }
00104
00105 void Alarcon2004OxygenBasedCellCycleModel::Initialise()
00106 {
00107 assert(mpOdeSystem == NULL);
00108 assert(mpCell != NULL);
00109
00110 bool is_labelled = mpCell->HasCellProperty<CellLabel>();
00111
00112 switch (mDimension)
00113 {
00114 case 1:
00115 {
00116 const unsigned DIM = 1;
00117 mpOdeSystem = new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled);
00118 break;
00119 }
00120 case 2:
00121 {
00122 const unsigned DIM = 2;
00123 mpOdeSystem = new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled);
00124 break;
00125 }
00126 case 3:
00127 {
00128 const unsigned DIM = 3;
00129 mpOdeSystem = new Alarcon2004OxygenBasedCellCycleOdeSystem(CellwiseData<DIM>::Instance()->GetValue(mpCell,0), is_labelled);
00130 break;
00131 }
00132 default:
00133 NEVER_REACHED;
00134 }
00135
00136 mpOdeSystem->SetStateVariables(mpOdeSystem->GetInitialConditions());
00137 }
00138
00139 void Alarcon2004OxygenBasedCellCycleModel::AdjustOdeParameters(double currentTime)
00140 {
00141 SetDt(0.0001);
00142
00143
00144 switch (mDimension)
00145 {
00146 case 1:
00147 {
00148 const unsigned DIM = 1;
00149 mpOdeSystem->rGetStateVariables()[5] = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00150 break;
00151 }
00152 case 2:
00153 {
00154 const unsigned DIM = 2;
00155 mpOdeSystem->rGetStateVariables()[5] = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00156 break;
00157 }
00158 case 3:
00159 {
00160 const unsigned DIM = 3;
00161 mpOdeSystem->rGetStateVariables()[5] = CellwiseData<DIM>::Instance()->GetValue(mpCell, 0);
00162 break;
00163 }
00164 default:
00165 NEVER_REACHED;
00166 }
00167
00168
00169 bool is_labelled = mpCell->HasCellProperty<CellLabel>();
00170 static_cast<Alarcon2004OxygenBasedCellCycleOdeSystem*>(mpOdeSystem)->SetIsLabelled(is_labelled);
00171 }
00172
00173
00174 #include "SerializationExportWrapperForCpp.hpp"
00175 CHASTE_CLASS_EXPORT(Alarcon2004OxygenBasedCellCycleModel)
00176 #include "CellCycleModelOdeSolverExportWrapper.hpp"
00177 EXPORT_CELL_CYCLE_MODEL_ODE_SOLVER(Alarcon2004OxygenBasedCellCycleModel)