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
00030
00031
00032
00033
00034
00035
00036 #ifndef ONLATTICESIMULATION_HPP_
00037 #define ONLATTICESIMULATION_HPP_
00038
00039 #include "ChasteSerialization.hpp"
00040 #include <boost/serialization/base_object.hpp>
00041
00042 #include "AbstractCellBasedSimulation.hpp"
00043 #include "AbstractPottsUpdateRule.hpp"
00044 #include "AbstractCaUpdateRule.hpp"
00045
00058 template<unsigned DIM>
00059 class OnLatticeSimulation : public AbstractCellBasedSimulation<DIM>
00060 {
00061 private:
00062
00064 friend class boost::serialization::access;
00071 template<class Archive>
00072 void serialize(Archive & archive, const unsigned int version)
00073 {
00074 archive & boost::serialization::base_object<AbstractCellBasedSimulation<DIM> >(*this);
00075 }
00076
00077 protected:
00078
00085 void UpdateCellPopulation();
00086
00092 void UpdateCellLocationsAndTopology();
00093
00103 virtual c_vector<double, DIM> CalculateCellDivisionVector(CellPtr pParentCell);
00104
00108 virtual void WriteVisualizerSetupFile();
00109
00110
00111 public:
00112
00122 OnLatticeSimulation(AbstractCellPopulation<DIM>& rCellPopulation,
00123 bool deleteCellPopulationInDestructor=false,
00124 bool initialiseCells=true);
00125
00131 void AddCaUpdateRule(boost::shared_ptr<AbstractCaUpdateRule<DIM> > pUpdateRule);
00132
00136 void RemoveAllCaUpdateRules();
00137
00143 void AddPottsUpdateRule(boost::shared_ptr<AbstractPottsUpdateRule<DIM> > pUpdateRule);
00144
00148 void RemoveAllPottsUpdateRules();
00149
00156 void OutputAdditionalSimulationSetup(out_stream& rParamsFile);
00157
00163 void OutputSimulationParameters(out_stream& rParamsFile);
00164 };
00165
00166
00167 #include "SerializationExportWrapper.hpp"
00168 EXPORT_TEMPLATE_CLASS_SAME_DIMS(OnLatticeSimulation)
00169
00170 namespace boost
00171 {
00172 namespace serialization
00173 {
00177 template<class Archive, unsigned DIM>
00178 inline void save_construct_data(
00179 Archive & ar, const OnLatticeSimulation<DIM> * t, const BOOST_PFTO unsigned int file_version)
00180 {
00181
00182 const AbstractCellPopulation<DIM>* p_cell_population = &(t->rGetCellPopulation());
00183 ar & p_cell_population;
00184 }
00185
00189 template<class Archive, unsigned DIM>
00190 inline void load_construct_data(
00191 Archive & ar, OnLatticeSimulation<DIM> * t, const unsigned int file_version)
00192 {
00193
00194 AbstractCellPopulation<DIM>* p_cell_population;
00195 ar >> p_cell_population;
00196
00197
00198
00199 ::new(t)OnLatticeSimulation<DIM>(*p_cell_population, true, false);
00200 }
00201 }
00202 }
00203
00204 #endif