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