CellMutationStatesWriter.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 "CellMutationStatesWriter.hpp"
00037 #include "AbstractCellPopulation.hpp"
00038
00039 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00040 CellMutationStatesWriter<ELEMENT_DIM, SPACE_DIM>::CellMutationStatesWriter()
00041 : AbstractCellWriter<ELEMENT_DIM, SPACE_DIM>("results.vizmutationstates")
00042 {
00043 this->mVtkCellDataName = "Mutation states";
00044 }
00045
00046 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00047 double CellMutationStatesWriter<ELEMENT_DIM, SPACE_DIM>::GetCellDataForVtkOutput(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
00048 {
00049 double mutation_state = pCell->GetMutationState()->GetColour();
00050
00051 CellPropertyCollection collection = pCell->rGetCellPropertyCollection();
00052 CellPropertyCollection label_collection = collection.GetProperties<CellLabel>();
00053
00054 if (label_collection.GetSize() == 1)
00055 {
00056 boost::shared_ptr<CellLabel> p_label = boost::static_pointer_cast<CellLabel>(label_collection.GetProperty());
00057 mutation_state = p_label->GetColour();
00058 }
00059
00060 return mutation_state;
00061 }
00062
00063 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00064 void CellMutationStatesWriter<ELEMENT_DIM, SPACE_DIM>::VisitCell(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
00065 {
00066 double mutation_state = pCell->GetMutationState()->GetColour();
00067
00069 CellPropertyCollection collection = pCell->rGetCellPropertyCollection();
00070 CellPropertyCollection label_collection = collection.GetProperties<CellLabel>();
00071
00072 if (label_collection.GetSize() == 1)
00073 {
00074 boost::shared_ptr<CellLabel> p_label = boost::static_pointer_cast<CellLabel>(label_collection.GetProperty());
00075 mutation_state = p_label->GetColour();
00076 }
00077
00078 *this->mpOutStream << mutation_state << " ";
00079 }
00080
00081
00082 template class CellMutationStatesWriter<1,1>;
00083 template class CellMutationStatesWriter<1,2>;
00084 template class CellMutationStatesWriter<2,2>;
00085 template class CellMutationStatesWriter<1,3>;
00086 template class CellMutationStatesWriter<2,3>;
00087 template class CellMutationStatesWriter<3,3>;
00088
00089 #include "SerializationExportWrapperForCpp.hpp"
00090
00091 EXPORT_TEMPLATE_CLASS_ALL_DIMS(CellMutationStatesWriter)