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>
56#include <boost/foreach.hpp>
58#include "AbstractMesh.hpp"
59#include "TetrahedralMesh.hpp"
60#include "CellPropertyRegistry.hpp"
61#include "Identifiable.hpp"
62#include "AbstractCellPopulationEventWriter.hpp"
63#include "AbstractCellPopulationCountWriter.hpp"
64#include "AbstractCellPopulationWriter.hpp"
65#include "AbstractCellWriter.hpp"
77#ifdef DOXYGEN_CHASTE_ISSUE_199
78template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
80template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM = ELEMENT_DIM>
95 template<
class Archive>
96 void serialize(Archive & archive,
const unsigned int version)
154 std::vector<boost::shared_ptr<AbstractCellWriter<ELEMENT_DIM, SPACE_DIM> > >
mCellWriters;
224 std::vector<CellPtr>& rCells,
225 const std::vector<unsigned> locationIndices=std::vector<unsigned>());
287 std::string& rVariableName,
288 bool dirichletBoundaryConditionApplies=
false,
289 double dirichletBoundaryValue=0.0)=0;
368 virtual CellPtr
AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())=0;
403 virtual void Update(
bool hasHadBirthsOrDeaths=
true)=0;
569 virtual double GetWidth(
const unsigned& rDimension)=0;
745 void KillCell(CellPtr pCell, std::string killerInfo);
798 template<
template <
unsigned,
unsigned>
class T>
801 mCellPopulationWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
809 template<
template <
unsigned,
unsigned>
class T>
812 mCellWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
820 template<
template <
unsigned,
unsigned>
class T>
831 template<
template <
unsigned,
unsigned>
class T>
894 template<
template <
unsigned,
unsigned>
class T>
900 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_pop_writer.get()))
906 BOOST_FOREACH(boost::shared_ptr<cell_writer_t> p_cell_writer,
mCellWriters)
908 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_cell_writer.get()))
916 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_count_writer.get()))
924 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_event_writer.get()))
960 std::pair<unsigned,unsigned>
CreateOrderedPair(
unsigned index1,
unsigned index2);
1054template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1061template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1068template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1074template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1081 while (!IsAtEnd() && !IsRealCell());
1086template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1089 return !( mrCellPopulation.IsCellAssociatedWithADeletedLocation(*mCellIter) || (*this)->IsDead() );
1092template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1095 return mCellIter == mrCellPopulation.rGetCells().end();
1098template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1100 : mrCellPopulation(rCellPopulation),
1118template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1121 return Iterator(*
this, this->mCells.begin());
1124template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
1127 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