36 #include "RadialCellDataDistributionWriter.hpp"
37 #include "MeshBasedCellPopulation.hpp"
38 #include "CaBasedCellPopulation.hpp"
39 #include "NodeBasedCellPopulation.hpp"
40 #include "PottsBasedCellPopulation.hpp"
41 #include "VertexBasedCellPopulation.hpp"
43 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
51 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
58 std::map<double, CellPtr> radius_cell_map;
59 double max_distance_from_centre = 0.0;
61 cell_iter != pCellPopulation->
End();
65 radius_cell_map[distance] = *cell_iter;
67 if (distance > max_distance_from_centre)
69 max_distance_from_centre = distance;
74 std::vector<double> radius_intervals;
75 for (
unsigned i=0; i<mNumRadialBins; i++)
77 double upper_radius = max_distance_from_centre*((
double) i+1)/((
double) mNumRadialBins);
78 radius_intervals.push_back(upper_radius);
82 double lower_radius = 0.0;
83 for (
unsigned i=0; i<mNumRadialBins; i++)
86 double average_solution = 0.0;
88 for (std::map<double, CellPtr>::iterator iter = radius_cell_map.begin(); iter != radius_cell_map.end(); ++iter)
90 if (iter->first > lower_radius && iter->first <= radius_intervals[i])
92 average_solution += (iter->second)->GetCellData()->GetItem(mVariableName);
98 average_solution /= (
double) counter;
102 *this->mpOutStream << radius_intervals[i] <<
" " << average_solution <<
" ";
103 lower_radius = radius_intervals[i];
107 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
114 std::map<double, CellPtr> radius_cell_map;
115 double max_distance_from_centre = 0.0;
117 cell_iter != pCellPopulation->
End();
121 radius_cell_map[distance] = *cell_iter;
123 if (distance > max_distance_from_centre)
125 max_distance_from_centre = distance;
130 std::vector<double> radius_intervals;
131 for (
unsigned i=0; i<mNumRadialBins; i++)
133 double upper_radius = max_distance_from_centre*((
double) i+1)/((
double) mNumRadialBins);
134 radius_intervals.push_back(upper_radius);
138 double lower_radius = 0.0;
139 for (
unsigned i=0; i<mNumRadialBins; i++)
141 unsigned counter = 0;
142 double average_solution = 0.0;
144 for (std::map<double, CellPtr>::iterator iter = radius_cell_map.begin(); iter != radius_cell_map.end(); ++iter)
146 if (iter->first > lower_radius && iter->first <= radius_intervals[i])
148 average_solution += (iter->second)->GetCellData()->GetItem(mVariableName);
154 average_solution /= (
double) counter;
158 *this->mpOutStream << radius_intervals[i] <<
" " << average_solution <<
" ";
159 lower_radius = radius_intervals[i];
163 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
166 VisitAnyPopulation(pCellPopulation);
169 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
172 VisitAnyPopulation(pCellPopulation);
175 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
178 VisitAnyPopulation(pCellPopulation);
181 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
184 VisitAnyPopulation(pCellPopulation);
187 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
190 mVariableName = variableName;
193 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
196 return mVariableName;
199 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
202 mNumRadialBins = numRadialBins;
205 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM>
208 return mNumRadialBins;
c_vector< double, SPACE_DIM > GetCentroidOfCellPopulation()
RadialCellDataDistributionWriter()
std::string GetVariableName() const
void VisitAnyPopulation(AbstractCellPopulation< SPACE_DIM, SPACE_DIM > *pCellPopulation)
void SetVariableName(std::string variableName)
unsigned GetNumRadialBins() const
const unsigned UNSIGNED_UNSET
#define EXPORT_TEMPLATE_CLASS_ALL_DIMS(CLASS)
virtual c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)=0
void SetNumRadialBins(unsigned numRadialBins)
c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)
virtual void Visit(MeshBasedCellPopulation< ELEMENT_DIM, SPACE_DIM > *pCellPopulation)