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>
57 #include <boost/utility/enable_if.hpp>
58 #include <boost/type_traits/is_base_of.hpp>
60 #include "AbstractMesh.hpp"
61 #include "CellPropertyRegistry.hpp"
62 #include "Identifiable.hpp"
63 #include "AbstractCellPopulationCountWriter.hpp"
64 #include "AbstractCellPopulationWriter.hpp"
65 #include "AbstractCellWriter.hpp"
68 #include "WildTypeCellMutationState.hpp"
69 #include "ApcOneHitCellMutationState.hpp"
70 #include "ApcTwoHitCellMutationState.hpp"
71 #include "BetaCateninOneHitCellMutationState.hpp"
72 #include "DefaultCellProliferativeType.hpp"
73 #include "StemCellProliferativeType.hpp"
74 #include "TransitCellProliferativeType.hpp"
75 #include "DifferentiatedCellProliferativeType.hpp"
82 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM=ELEMENT_DIM>
88 friend class boost::serialization::access;
96 template<
class Archive>
97 void serialize(Archive & archive,
const unsigned int version)
155 std::vector<boost::shared_ptr<AbstractCellWriter<ELEMENT_DIM, SPACE_DIM> > >
mCellWriters;
210 std::vector<CellPtr>& rCells,
211 const std::vector<unsigned> locationIndices=std::vector<unsigned>());
308 virtual CellPtr
AddCell(CellPtr pNewCell,
309 const c_vector<double,SPACE_DIM>& rCellDivisionVector,
310 CellPtr pParentCell=CellPtr())=0;
330 virtual void Update(
bool hasHadBirthsOrDeaths=
true)=0;
496 virtual double GetWidth(
const unsigned& rDimension)=0;
622 template<
template <
unsigned,
unsigned>
class T>
625 mCellPopulationWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
634 template<
template <
unsigned,
unsigned>
class T>
637 mCellWriters.push_back(boost::shared_ptr< T<ELEMENT_DIM, SPACE_DIM> >(
new T<ELEMENT_DIM, SPACE_DIM> ));
646 template<
template <
unsigned,
unsigned>
class T>
699 template<
template <
unsigned,
unsigned>
class T>
705 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_pop_writer.get()))
711 BOOST_FOREACH(boost::shared_ptr<cell_writer_t> p_cell_writer,
mCellWriters)
713 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_cell_writer.get()))
721 if (
dynamic_cast<T<ELEMENT_DIM, SPACE_DIM>*
>(p_count_writer.get()))
757 std::pair<unsigned,unsigned>
CreateOrderedPair(
unsigned index1,
unsigned index2);
851 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
858 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
865 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
871 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
878 while (!IsAtEnd() && !IsRealCell());
883 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
886 return !( mrCellPopulation.IsCellAssociatedWithADeletedLocation(*mCellIter) || (*this)->IsDead() );
889 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
892 return mCellIter == mrCellPopulation.rGetCells().end();
895 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
897 : mrCellPopulation(rCellPopulation),
915 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
921 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
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
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 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()
virtual CellPtr AddCell(CellPtr pNewCell, const c_vector< double, SPACE_DIM > &rCellDivisionVector, CellPtr pParentCell=CellPtr())=0
void OpenRoundRobinWritersFilesForAppend(OutputFileHandler &rOutputFileHandler)
virtual void Update(bool hasHadBirthsOrDeaths=true)=0
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()
bool GetOutputResultsForChasteVisualizer()
virtual double GetVolumeOfCell(CellPtr pCell)=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 ~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()