CellRadiusWriter.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 "CellRadiusWriter.hpp"
00037 #include "NodeBasedCellPopulation.hpp"
00038
00039 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00040 CellRadiusWriter<ELEMENT_DIM, SPACE_DIM>::CellRadiusWriter()
00041 : AbstractCellWriter<ELEMENT_DIM, SPACE_DIM>("cellradii.dat")
00042 {
00043 this->mVtkCellDataName = "Cell radii";
00044 }
00045
00046 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00047 double CellRadiusWriter<ELEMENT_DIM, SPACE_DIM>::GetCellDataForVtkOutput(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
00048 {
00049 double cell_radius = 0.0;
00050 if (dynamic_cast<NodeBasedCellPopulation<SPACE_DIM>*>(pCellPopulation))
00051 {
00052 unsigned node_index = pCellPopulation->GetLocationIndexUsingCell(pCell);
00053 cell_radius = pCellPopulation->GetNode(node_index)->GetRadius();
00054 }
00055 return cell_radius;
00056 }
00057
00058 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00059 void CellRadiusWriter<ELEMENT_DIM, SPACE_DIM>::VisitCell(CellPtr pCell, AbstractCellPopulation<ELEMENT_DIM, SPACE_DIM>* pCellPopulation)
00060 {
00061 unsigned location_index = pCellPopulation->GetLocationIndexUsingCell(pCell);
00062 unsigned cell_id = pCell->GetCellId();
00063 c_vector<double, SPACE_DIM> cell_location = pCellPopulation->GetLocationOfCellCentre(pCell);
00064
00065 double cell_radius = 0.0;
00066 if (dynamic_cast<NodeBasedCellPopulation<SPACE_DIM>*>(pCellPopulation))
00067 {
00068 unsigned node_index = pCellPopulation->GetLocationIndexUsingCell(pCell);
00069 cell_radius = pCellPopulation->GetNode(node_index)->GetRadius();
00070 }
00071
00072 *this->mpOutStream << location_index << " " << cell_id << " ";
00073 for (unsigned i=0; i<SPACE_DIM; i++)
00074 {
00075 *this->mpOutStream << cell_location[i] << " ";
00076 }
00077
00078 *this->mpOutStream << cell_radius << " ";
00079 }
00080
00081
00082 template class CellRadiusWriter<1,1>;
00083 template class CellRadiusWriter<1,2>;
00084 template class CellRadiusWriter<2,2>;
00085 template class CellRadiusWriter<1,3>;
00086 template class CellRadiusWriter<2,3>;
00087 template class CellRadiusWriter<3,3>;
00088
00089 #include "SerializationExportWrapperForCpp.hpp"
00090
00091 EXPORT_TEMPLATE_CLASS_ALL_DIMS(CellRadiusWriter)