OnLatticeSimulation.hpp
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 #ifndef ONLATTICESIMULATION_HPP_
00030 #define ONLATTICESIMULATION_HPP_
00031
00032 #include "ChasteSerialization.hpp"
00033 #include <boost/serialization/base_object.hpp>
00034
00035 #include "AbstractCellBasedSimulation.hpp"
00036 #include "AbstractCaUpdateRule.hpp"
00037 #include "AbstractPottsUpdateRule.hpp"
00038
00051 template<unsigned DIM>
00052 class OnLatticeSimulation : public AbstractCellBasedSimulation<DIM>
00053 {
00054 private:
00055
00057 friend class boost::serialization::access;
00064 template<class Archive>
00065 void serialize(Archive & archive, const unsigned int version)
00066 {
00067 archive & boost::serialization::base_object<AbstractCellBasedSimulation<DIM> >(*this);
00068 archive & mOutputCellVelocities;
00069 }
00070
00071 protected:
00072
00077 bool mOutputCellVelocities;
00078
00080 out_stream mpCellVelocitiesFile;
00081
00088 void UpdateCellPopulation();
00089
00095 void UpdateCellLocationsAndTopology();
00096
00106 virtual c_vector<double, DIM> CalculateCellDivisionVector(CellPtr pParentCell);
00107
00111 virtual void WriteVisualizerSetupFile();
00112
00113
00114 public:
00115
00125 OnLatticeSimulation(AbstractCellPopulation<DIM>& rCellPopulation,
00126 bool deleteCellPopulationInDestructor=false,
00127 bool initialiseCells=true);
00128
00134 void AddCaUpdateRule(boost::shared_ptr<AbstractCaUpdateRule<DIM> > pUpdateRule);
00135
00141 void AddPottsUpdateRule(boost::shared_ptr<AbstractPottsUpdateRule<DIM> > pUpdateRule);
00142
00147 bool GetOutputCellVelocities();
00148
00154 void SetOutputCellVelocities(bool outputCellVelocities);
00155
00159 virtual void SetupSolve();
00160
00164 virtual void AfterSolve();
00165
00172 void OutputAdditionalSimulationSetup(out_stream& rParamsFile);
00173
00179 void OutputSimulationParameters(out_stream& rParamsFile);
00180 };
00181
00182
00183 #include "SerializationExportWrapper.hpp"
00184 EXPORT_TEMPLATE_CLASS_SAME_DIMS(OnLatticeSimulation)
00185
00186 namespace boost
00187 {
00188 namespace serialization
00189 {
00193 template<class Archive, unsigned DIM>
00194 inline void save_construct_data(
00195 Archive & ar, const OnLatticeSimulation<DIM> * t, const BOOST_PFTO unsigned int file_version)
00196 {
00197
00198 const AbstractCellPopulation<DIM>* p_cell_population = &(t->rGetCellPopulation());
00199 ar & p_cell_population;
00200 }
00201
00205 template<class Archive, unsigned DIM>
00206 inline void load_construct_data(
00207 Archive & ar, OnLatticeSimulation<DIM> * t, const unsigned int file_version)
00208 {
00209
00210 AbstractCellPopulation<DIM>* p_cell_population;
00211 ar >> p_cell_population;
00212
00213
00214
00215 ::new(t)OnLatticeSimulation<DIM>(*p_cell_population, true, false);
00216 }
00217 }
00218 }
00219
00220 #endif