CellMutationStatesCountWriter.cpp
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 #include "CellMutationStatesCountWriter.hpp"
00037 #include "AbstractCellPopulation.hpp"
00038 #include "MeshBasedCellPopulation.hpp"
00039 #include "CaBasedCellPopulation.hpp"
00040 #include "NodeBasedCellPopulation.hpp"
00041 #include "PottsBasedCellPopulation.hpp"
00042 #include "VertexBasedCellPopulation.hpp"
00043
00044 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00045 CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::CellMutationStatesCountWriter()
00046 : AbstractCellPopulationCountWriter<ELEMENT_DIM, SPACE_DIM>("cellmutationstates.dat")
00047 {
00048 }
00049
00050 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00051 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::WriteHeader(AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
00052 {
00053 if (PetscTools::AmMaster())
00054 {
00055 pCellPopulation->SetDefaultCellMutationStateAndProliferativeTypeOrdering();
00056
00057 *this->mpOutStream << "Time\t ";
00058
00059 const std::vector<boost::shared_ptr<AbstractCellProperty> >& r_cell_properties =
00060 pCellPopulation->GetCellPropertyRegistry()->rGetAllCellProperties();
00061
00062 for (unsigned i=0; i<r_cell_properties.size(); i++)
00063 {
00064 if (r_cell_properties[i]->IsSubType<AbstractCellMutationState>())
00065 {
00066 *this->mpOutStream << r_cell_properties[i]->GetIdentifier() << "\t ";
00067 }
00068 }
00069 this->WriteNewline();
00070 }
00071 }
00072
00073 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00074 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::VisitAnyPopulation(AbstractCellPopulation<SPACE_DIM, SPACE_DIM>* pCellPopulation)
00075 {
00076 std::vector<unsigned> mutation_state_count = pCellPopulation->GetCellMutationStateCount();
00077
00078 if (PetscTools::AmMaster())
00079 {
00080 for (unsigned i=0; i<mutation_state_count.size(); i++)
00081 {
00082 *this->mpOutStream << mutation_state_count[i] << "\t";
00083 }
00084 }
00085 }
00086
00087 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00088 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::Visit(MeshBasedCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
00089 {
00090 std::vector<unsigned> mutation_state_count = pCellPopulation->GetCellMutationStateCount();
00091
00092 if (PetscTools::AmMaster())
00093 {
00094 for (unsigned i=0; i<mutation_state_count.size(); i++)
00095 {
00096 *this->mpOutStream << mutation_state_count[i] << "\t";
00097 }
00098 }
00099 }
00100
00101 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00102 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::Visit(CaBasedCellPopulation<SPACE_DIM>* pCellPopulation)
00103 {
00104 VisitAnyPopulation(pCellPopulation);
00105 }
00106
00107 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00108 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::Visit(NodeBasedCellPopulation<SPACE_DIM>* pCellPopulation)
00109 {
00110 VisitAnyPopulation(pCellPopulation);
00111 }
00112
00113 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00114 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::Visit(PottsBasedCellPopulation<SPACE_DIM>* pCellPopulation)
00115 {
00116 VisitAnyPopulation(pCellPopulation);
00117 }
00118
00119 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00120 void CellMutationStatesCountWriter<ELEMENT_DIM, SPACE_DIM>::Visit(VertexBasedCellPopulation<SPACE_DIM>* pCellPopulation)
00121 {
00122 VisitAnyPopulation(pCellPopulation);
00123 }
00124
00125
00126 template class CellMutationStatesCountWriter<1,1>;
00127 template class CellMutationStatesCountWriter<1,2>;
00128 template class CellMutationStatesCountWriter<2,2>;
00129 template class CellMutationStatesCountWriter<1,3>;
00130 template class CellMutationStatesCountWriter<2,3>;
00131 template class CellMutationStatesCountWriter<3,3>;
00132
00133 #include "SerializationExportWrapperForCpp.hpp"
00134
00135 EXPORT_TEMPLATE_CLASS_ALL_DIMS(CellMutationStatesCountWriter)