SingleOdeWntCellCycleModel.hpp

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 #ifndef SINGLEODEWNTCELLCYCLEMODEL_HPP_
00029 #define SINGLEODEWNTCELLCYCLEMODEL_HPP_
00030 
00031 #include "ChasteSerialization.hpp"
00032 #include <boost/serialization/base_object.hpp>
00033 #include <boost/serialization/split_member.hpp>
00034 #include <boost/serialization/shared_ptr.hpp>
00035 
00036 #include <cfloat>
00037 
00038 #include "SimpleWntCellCycleModel.hpp"
00039 #include "Mirams2010WntOdeSystem.hpp"
00040 #include "RungeKutta4IvpOdeSolver.hpp"
00041 #include "CvodeAdaptor.hpp"
00042 
00052 class SingleOdeWntCellCycleModel : public SimpleWntCellCycleModel
00053 {
00054 private:
00055     friend class boost::serialization::access;
00062     template<class Archive>
00063     void save(Archive & archive, const unsigned int version) const
00064     {
00065         assert(mpOdeSystem);
00066         archive & boost::serialization::base_object<SimpleWntCellCycleModel>(*this);
00075         boost::shared_ptr<AbstractCellMutationState> p_mutation_state = static_cast<Mirams2010WntOdeSystem*>(mpOdeSystem)->GetMutationState();
00076         archive & p_mutation_state;
00077         archive & mBetaCateninDivisionThreshold;
00078         archive & mLastTime;
00079         archive & mpOdeSystem->rGetStateVariables();
00080     }
00087     template<class Archive>
00088     void load(Archive & archive, const unsigned int version)
00089     {
00090         /*
00091          * The ODE system is set up by the archiving constructor, so we can set the mutation state
00092          * here. This is a horrible hack, but avoids having to regenerate test archives.
00093          */
00094         assert(mpOdeSystem);
00095         archive & boost::serialization::base_object<SimpleWntCellCycleModel>(*this);
00096         boost::shared_ptr<AbstractCellMutationState> p_mutation_state;
00097         archive & p_mutation_state;
00098         static_cast<Mirams2010WntOdeSystem*>(mpOdeSystem)->SetMutationState(p_mutation_state);
00099 
00100         archive & mBetaCateninDivisionThreshold;
00101         archive & mLastTime;
00102         archive & mpOdeSystem->rGetStateVariables();
00103     }
00104     BOOST_SERIALIZATION_SPLIT_MEMBER()
00105 
00106     
00109     Mirams2010WntOdeSystem* mpOdeSystem;
00110 
00118     double mBetaCateninDivisionThreshold;
00119 
00128     void ChangeCellProliferativeTypeDueToCurrentBetaCateninLevel();
00129 
00133     void UpdateBetaCateninLevel();
00134 
00135 #ifdef CHASTE_CVODE
00136 
00137     static CvodeAdaptor msSolver;
00138 #else
00139 
00140     static RungeKutta4IvpOdeSolver msSolver;
00141 #endif //CHASTE_CVODE
00142 
00144     double mLastTime;
00145 
00146 public:
00147 
00151     SingleOdeWntCellCycleModel()
00152       :   mpOdeSystem(NULL),
00153           mLastTime(DBL_MAX) // Ensure this is set properly before we try to use it.
00154     {
00155 #ifdef CHASTE_CVODE
00156         msSolver.SetMaxSteps(10000);
00157 #endif // CHASTE_CVODE
00158     };
00159 
00168     SingleOdeWntCellCycleModel(std::vector<double>& rProteinConcs,
00169                                boost::shared_ptr<AbstractCellMutationState> pMutationState,
00170                                unsigned& rDimension,
00171                                bool useTypeDependentG1 = false);
00172 
00176     ~SingleOdeWntCellCycleModel();
00177 
00186     SingleOdeWntCellCycleModel(const SingleOdeWntCellCycleModel& rOtherModel);
00187 
00195     void Initialise();
00196 
00200      void UpdateCellCyclePhase();
00201 
00206     AbstractCellCycleModel* CreateCellCycleModel();
00207 
00211     double GetBetaCateninConcentration();
00212 
00218     void SetBetaCateninDivisionThreshold(double betaCateninDivisionThreshold);
00219 
00223     double GetBetaCateninDivisionThreshold();
00224 };
00225 
00226 // Declare identifier for the serializer
00227 #include "SerializationExportWrapper.hpp"
00228 CHASTE_CLASS_EXPORT(SingleOdeWntCellCycleModel)
00229 
00230 namespace boost
00231 {
00232 namespace serialization
00233 {
00238 template<class Archive>
00239 inline void save_construct_data(
00240     Archive & ar, const SingleOdeWntCellCycleModel * t, const unsigned int file_version)
00241 {
00242 }
00243 
00248 template<class Archive>
00249 inline void load_construct_data(
00250     Archive & ar, SingleOdeWntCellCycleModel * t, const unsigned int file_version)
00251 {
00259     std::vector<double> state_vars;
00260     for (unsigned i=0; i<3; i++)
00261     {
00262         state_vars.push_back(0.0);
00263     }
00264 
00265     boost::shared_ptr<AbstractCellMutationState> p_mutation_state;
00266     unsigned dimension = 1;
00267     ::new(t)SingleOdeWntCellCycleModel(state_vars, p_mutation_state, dimension);
00268 }
00269 }
00270 } // namespace
00271 
00272 #endif /*SINGLEODEWNTCELLCYCLEMODEL_HPP_*/

Generated by  doxygen 1.6.2