36#ifndef ABSTRACTCELLPOPULATION_HPP_
37#define ABSTRACTCELLPOPULATION_HPP_
40#include "OutputFileHandler.hpp"
45#include <boost/shared_ptr.hpp>
50#include <boost/serialization/vector.hpp>
51#include <boost/serialization/list.hpp>
52#include <boost/serialization/map.hpp>
53#include <boost/serialization/set.hpp>
54#include <boost/serialization/shared_ptr.hpp>
57#include "AbstractMesh.hpp"
58#include "TetrahedralMesh.hpp"
59#include "CellPropertyRegistry.hpp"
60#include "Identifiable.hpp"
61#include "AbstractCellPopulationEventWriter.hpp"
62#include "AbstractCellPopulationCountWriter.hpp"
63#include "AbstractCellPopulationWriter.hpp"
64#include "AbstractCellWriter.hpp"
76#ifdef DOXYGEN_CHASTE_ISSUE_199
77template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
79template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM = ELEMENT_DIM>
94 template<
class Archive>
95 void serialize(Archive & archive,
const unsigned int version)
153 std::vector<boost::shared_ptr<AbstractCellWriter<ELEMENT_DIM, SPACE_DIM> > >
mCellWriters;
223 std::vector<CellPtr>& rCells,
224 const std::vector<unsigned> locationIndices=std::vector<unsigned>());
286 std::string& rVariableName,
287 bool dirichletBoundaryConditionApplies=
false,
288 double dirichletBoundaryValue=0.0)=0;
367 virtual CellPtr
AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())=0;
402 virtual void Update(
bool hasHadBirthsOrDeaths=
true)=0;
568 virtual double GetWidth(
const unsigned& rDimension)=0;
744 void KillCell(CellPtr pCell, std::string killerInfo);
797 template<
template <
unsigned,
unsigned>
class T>
800 mCellPopulationWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
808 template<
template <
unsigned,
unsigned>
class T>
811 mCellWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
819 template<
template <
unsigned,
unsigned>
class T>
830 template<
template <
unsigned,
unsigned>
class T>
893 template<
template <
unsigned,
unsigned>
class T>
899 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_pop_writer.get()))
905 for (boost::shared_ptr<cell_writer_t> p_cell_writer :
mCellWriters)
907 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_cell_writer.get()))
915 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_count_writer.get()))
923 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_event_writer.get()))
959 std::pair<unsigned,unsigned>
CreateOrderedPair(
unsigned index1,
unsigned index2);
1053template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1060template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1067template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1073template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1080 while (!IsAtEnd() && !IsRealCell());
1085template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1088 return !( mrCellPopulation.IsCellAssociatedWithADeletedLocation(*mCellIter) || (*this)->IsDead() );
1091template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1094 return mCellIter == mrCellPopulation.rGetCells().end();
1097template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1099 : mrCellPopulation(rCellPopulation),
1117template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1120 return Iterator(*
this, this->mCells.begin());
1123template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1126 return Iterator(*
this, this->mCells.end());
#define TEMPLATED_CLASS_IS_ABSTRACT_1_UNSIGNED(T)
Iterator(AbstractCellPopulation &rCellPopulation, std::list< CellPtr >::iterator cellIter)
std::list< CellPtr >::iterator mCellIter
virtual bool IsRealCell()
AbstractCellPopulation & mrCellPopulation
bool operator!=(const typename AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::Iterator &rOther)
boost::shared_ptr< CellPropertyRegistry > mpCellPropertyRegistry
std::vector< boost::shared_ptr< AbstractCellPopulationCountWriter< ELEMENT_DIM, SPACE_DIM > > > mCellPopulationCountWriters
void ClearDivisionsInformation()
virtual double GetVolumeOfCell(CellPtr pCell)=0
std::vector< std::string > GetDivisionsInformation()
void OpenRoundRobinWritersFilesForAppend(OutputFileHandler &rOutputFileHandler)
void AddCellPopulationEventWriter(boost::shared_ptr< AbstractCellPopulationEventWriter< ELEMENT_DIM, SPACE_DIM > > pCellPopulationEventWriter)
void SetCellUsingLocationIndex(unsigned index, CellPtr pCell)
std::vector< std::string > GetRemovalsInformation()
virtual Node< SPACE_DIM > * GetNode(unsigned index)=0
void AddCellPopulationEventWriter()
virtual c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)=0
virtual void AddCellUsingLocationIndex(unsigned index, CellPtr pCell)
void AddCellWriter(boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > pCellWriter)
std::vector< unsigned > GetCellMutationStateCount()
std::list< CellPtr > & rGetCells()
void SetDataOnAllCells(const std::string &rDataName, double dataValue)
virtual void OpenWritersFiles(OutputFileHandler &rOutputFileHandler)
std::vector< boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > > mCellWriters
virtual bool IsCellAttachedToLocationIndex(unsigned index)
virtual void WriteVtkResultsToFile(const std::string &rDirectory)=0
virtual bool IsRoomToDivide(CellPtr pCell)
AbstractMesh< ELEMENT_DIM, SPACE_DIM > & mrMesh
std::list< CellPtr > mCells
virtual bool IsPdeNodeAssociatedWithNonApoptoticCell(unsigned pdeNodeIndex)
virtual double GetDefaultTimeStep()=0
std::map< unsigned, std::set< CellPtr > > mLocationCellMap
unsigned GetLocationIndexUsingCell(CellPtr pCell)
void SetOutputResultsForChasteVisualizer(bool outputResultsForChasteVisualizer)
virtual void WriteResultsToFiles(const std::string &rDirectory)
std::set< CellPtr > GetCellsUsingLocationIndex(unsigned index)
void AddCellPopulationCountWriter(boost::shared_ptr< AbstractCellPopulationCountWriter< ELEMENT_DIM, SPACE_DIM > > pCellPopulationCountWriter)
void ClearRemovalsInformation()
virtual void SetNode(unsigned nodeIndex, ChastePoint< SPACE_DIM > &rNewLocation)=0
c_vector< double, SPACE_DIM > mCentroid
virtual void AcceptPopulationCountWriter(boost::shared_ptr< AbstractCellPopulationCountWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationCountWriter)=0
void AddPopulationWriter()
virtual std::set< unsigned > GetNeighbouringLocationIndices(CellPtr pCell)=0
std::set< unsigned > GetCellAncestors()
virtual void OutputCellPopulationParameters(out_stream &rParamsFile)=0
virtual TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * GetTetrahedralMeshForPdeModifier()=0
virtual unsigned RemoveDeadCells()=0
virtual std::set< std::pair< unsigned, unsigned > > GetNeighbouringEdgeIndices(CellPtr pCell, unsigned pEdgeIndex)
virtual void SimulationSetupHook(AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM > *pSimulation)
virtual void AcceptPopulationEventWriter(boost::shared_ptr< AbstractCellPopulationEventWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationEventWriter)=0
virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex, std::string &rVariableName, bool dirichletBoundaryConditionApplies=false, double dirichletBoundaryValue=0.0)=0
virtual bool IsCellAssociatedWithADeletedLocation(CellPtr pCell)=0
void AddPopulationWriter(boost::shared_ptr< AbstractCellPopulationWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationWriter)
boost::shared_ptr< CellPropertyRegistry > GetCellPropertyRegistry()
std::vector< boost::shared_ptr< AbstractCellPopulationWriter< ELEMENT_DIM, SPACE_DIM > > > mCellPopulationWriters
virtual void WriteDataToVisualizerSetupFile(out_stream &pVizSetupFile)
virtual void CloseWritersFiles()
virtual void Validate()=0
std::vector< std::string > mDivisionsInformation
virtual void Update(bool hasHadBirthsOrDeaths=true)=0
void GenerateRemovalInformation(CellPtr pCell, std::string killerInfo)
std::vector< std::string > mRemovalsInformation
unsigned GetNumAllCells()
unsigned GetNumRealCells()
virtual double GetWidth(const unsigned &rDimension)=0
void CloseRoundRobinWritersFiles()
std::map< Cell *, unsigned > mCellLocationMap
virtual unsigned GetNumNodes()=0
void SetCellAncestorsToLocationIndices()
void AddCellPopulationCountWriter()
virtual void AcceptPopulationWriter(boost::shared_ptr< AbstractCellPopulationWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationWriter)=0
std::vector< boost::shared_ptr< AbstractCellPopulationEventWriter< ELEMENT_DIM, SPACE_DIM > > > mCellPopulationEventWriters
bool GetOutputResultsForChasteVisualizer()
void OutputCellPopulationInfo(out_stream &rParamsFile)
bool mOutputResultsForChasteVisualizer
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
std::vector< unsigned > GetCellCyclePhaseCount()
void serialize(Archive &archive, const unsigned int version)
AbstractMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh()
void StartApoptosisOnCell(CellPtr pCell, std::string killerInfo)
c_vector< double, SPACE_DIM > GetCentroidOfCellPopulation()
virtual ~AbstractCellPopulation()
void KillCell(CellPtr pCell, std::string killerInfo)
friend class boost::serialization::access
virtual void UpdateCellProcessLocation()
std::vector< unsigned > GetCellProliferativeTypeCount()
virtual std::set< unsigned > GetNeighbouringNodeIndices(unsigned index)=0
virtual CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())=0
void AddRemovalInformation(std::string removalInformation)
void SetDefaultCellMutationStateAndProliferativeTypeOrdering()
std::pair< unsigned, unsigned > CreateOrderedPair(unsigned index1, unsigned index2)
void MoveCellInLocationMap(CellPtr pCell, unsigned old_index, unsigned new_index)
c_vector< double, SPACE_DIM > GetSizeOfCellPopulation()
void AddDivisionInformation(std::string divisionInformation)
virtual void AcceptCellWritersAcrossPopulation()
virtual void RemoveCellUsingLocationIndex(unsigned index, CellPtr pCell)
virtual void AcceptCellWriter(boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > pCellWriter, CellPtr pCell)=0