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 "AbstractCellPopulationCountWriter.hpp"
63 #include "AbstractCellPopulationWriter.hpp"
64 #include "AbstractCellWriter.hpp"
74 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM=ELEMENT_DIM>
80 friend class boost::serialization::access;
88 template<
class Archive>
89 void serialize(Archive & archive,
const unsigned int version)
147 std::vector<boost::shared_ptr<AbstractCellWriter<ELEMENT_DIM, SPACE_DIM> > >
mCellWriters;
202 std::vector<CellPtr>& rCells,
203 const std::vector<unsigned> locationIndices=std::vector<unsigned>());
265 std::string& rVariableName,
266 bool dirichletBoundaryConditionApplies=
false,
267 double dirichletBoundaryValue=0.0)=0;
346 virtual CellPtr
AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())=0;
381 virtual void Update(
bool hasHadBirthsOrDeaths=
true)=0;
547 virtual double GetWidth(
const unsigned& rDimension)=0;
695 template<
template <
unsigned,
unsigned>
class T>
698 mCellPopulationWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
707 template<
template <
unsigned,
unsigned>
class T>
710 mCellWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
719 template<
template <
unsigned,
unsigned>
class T>
772 template<
template <
unsigned,
unsigned>
class T>
778 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_pop_writer.get()))
784 BOOST_FOREACH(boost::shared_ptr<cell_writer_t> p_cell_writer,
mCellWriters)
786 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_cell_writer.get()))
794 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_count_writer.get()))
830 std::pair<unsigned,unsigned>
CreateOrderedPair(
unsigned index1,
unsigned index2);
924 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
931 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
938 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
944 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
951 while (!IsAtEnd() && !IsRealCell());
956 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
959 return !( mrCellPopulation.IsCellAssociatedWithADeletedLocation(*mCellIter) || (*this)->IsDead() );
962 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
965 return mCellIter == mrCellPopulation.rGetCells().end();
968 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
970 : mrCellPopulation(rCellPopulation),
988 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
994 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
virtual Node< SPACE_DIM > * GetNode(unsigned index)=0
bool operator!=(const typename AbstractCellPopulation< ELEMENT_DIM, SPACE_DIM >::Iterator &rOther)
virtual void AcceptPopulationWriter(boost::shared_ptr< AbstractCellPopulationWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationWriter)=0
virtual void SimulationSetupHook(AbstractCellBasedSimulation< ELEMENT_DIM, SPACE_DIM > *pSimulation)
c_vector< double, SPACE_DIM > GetCentroidOfCellPopulation()
std::vector< boost::shared_ptr< AbstractCellPopulationWriter< ELEMENT_DIM, SPACE_DIM > > > mCellPopulationWriters
virtual CellPtr GetCellUsingLocationIndex(unsigned index)
void SetDefaultCellMutationStateAndProliferativeTypeOrdering()
unsigned GetLocationIndexUsingCell(CellPtr pCell)
virtual void UpdateCellProcessLocation()
#define TEMPLATED_CLASS_IS_ABSTRACT_1_UNSIGNED(T)
std::vector< boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > > mCellWriters
void AddPopulationWriter(boost::shared_ptr< AbstractCellPopulationWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationWriter)
void SetDataOnAllCells(const std::string &rDataName, double dataValue)
boost::shared_ptr< CellPropertyRegistry > mpCellPropertyRegistry
virtual void RemoveCellUsingLocationIndex(unsigned index, CellPtr pCell)
c_vector< double, SPACE_DIM > mCentroid
virtual void OutputCellPopulationParameters(out_stream &rParamsFile)=0
std::vector< boost::shared_ptr< AbstractCellPopulationCountWriter< ELEMENT_DIM, SPACE_DIM > > > mCellPopulationCountWriters
virtual double GetWidth(const unsigned &rDimension)=0
virtual bool IsRealCell()
virtual bool IsCellAssociatedWithADeletedLocation(CellPtr pCell)=0
void SetCellAncestorsToLocationIndices()
std::set< CellPtr > GetCellsUsingLocationIndex(unsigned index)
unsigned GetNumRealCells()
virtual std::set< unsigned > GetNeighbouringLocationIndices(CellPtr pCell)=0
virtual bool IsCellAttachedToLocationIndex(unsigned index)
virtual unsigned RemoveDeadCells()=0
unsigned GetNumAllCells()
virtual void WriteResultsToFiles(const std::string &rDirectory)
void SetOutputResultsForChasteVisualizer(bool outputResultsForChasteVisualizer)
void MoveCellInLocationMap(CellPtr pCell, unsigned old_index, unsigned new_index)
bool mOutputResultsForChasteVisualizer
std::list< CellPtr > & rGetCells()
virtual void Validate()=0
std::vector< unsigned > GetCellCyclePhaseCount()
virtual void AcceptPopulationCountWriter(boost::shared_ptr< AbstractCellPopulationCountWriter< ELEMENT_DIM, SPACE_DIM > > pPopulationCountWriter)=0
c_vector< double, SPACE_DIM > GetSizeOfCellPopulation()
virtual void AcceptCellWritersAcrossPopulation()
std::pair< unsigned, unsigned > CreateOrderedPair(unsigned index1, unsigned index2)
Iterator(AbstractCellPopulation &rCellPopulation, std::list< CellPtr >::iterator cellIter)
std::map< unsigned, std::set< CellPtr > > mLocationCellMap
void SetCellUsingLocationIndex(unsigned index, CellPtr pCell)
std::list< CellPtr >::iterator mCellIter
std::map< Cell *, unsigned > mCellLocationMap
virtual CellPtr AddCell(CellPtr pNewCell, CellPtr pParentCell=CellPtr())=0
virtual double GetCellDataItemAtPdeNode(unsigned pdeNodeIndex, std::string &rVariableName, bool dirichletBoundaryConditionApplies=false, double dirichletBoundaryValue=0.0)=0
virtual std::set< unsigned > GetNeighbouringNodeIndices(unsigned index)=0
virtual void AcceptCellWriter(boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > pCellWriter, CellPtr pCell)=0
boost::shared_ptr< CellPropertyRegistry > GetCellPropertyRegistry()
void OpenRoundRobinWritersFilesForAppend(OutputFileHandler &rOutputFileHandler)
virtual void Update(bool hasHadBirthsOrDeaths=true)=0
virtual bool IsPdeNodeAssociatedWithNonApoptoticCell(unsigned pdeNodeIndex)
virtual c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)=0
virtual void OpenWritersFiles(OutputFileHandler &rOutputFileHandler)
std::list< CellPtr > mCells
void AddCellWriter(boost::shared_ptr< AbstractCellWriter< ELEMENT_DIM, SPACE_DIM > > pCellWriter)
void OutputCellPopulationInfo(out_stream &rParamsFile)
virtual bool IsRoomToDivide(CellPtr pCell)
AbstractMesh< ELEMENT_DIM, SPACE_DIM > & rGetMesh()
virtual void WriteDataToVisualizerSetupFile(out_stream &pVizSetupFile)
bool GetOutputResultsForChasteVisualizer()
virtual double GetVolumeOfCell(CellPtr pCell)=0
virtual double GetDefaultTimeStep()=0
AbstractCellPopulation & mrCellPopulation
void serialize(Archive &archive, const unsigned int version)
AbstractCellPopulation(AbstractMesh< ELEMENT_DIM, SPACE_DIM > &rMesh)
void AddCellPopulationCountWriter(boost::shared_ptr< AbstractCellPopulationCountWriter< ELEMENT_DIM, SPACE_DIM > > pCellPopulationCountWriter)
virtual void SetNode(unsigned nodeIndex, ChastePoint< SPACE_DIM > &rNewLocation)=0
virtual void AddCellUsingLocationIndex(unsigned index, CellPtr pCell)
std::vector< unsigned > GetCellProliferativeTypeCount()
AbstractMesh< ELEMENT_DIM, SPACE_DIM > & mrMesh
void AddPopulationWriter()
virtual TetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * GetTetrahedralMeshForPdeModifier()=0
virtual ~AbstractCellPopulation()
virtual void WriteVtkResultsToFile(const std::string &rDirectory)=0
void CloseRoundRobinWritersFiles()
virtual unsigned GetNumNodes()=0
std::vector< unsigned > GetCellMutationStateCount()
std::set< unsigned > GetCellAncestors()
void AddCellPopulationCountWriter()