41 double constantSourceCoefficient,
42 double linearSourceCoefficient,
43 double diffusionCoefficient,
44 bool scaleByCellVolume)
45 : mrCellPopulation(rCellPopulation),
46 mConstantSourceCoefficient(constantSourceCoefficient),
47 mLinearSourceCoefficient(linearSourceCoefficient),
48 mDiffusionCoefficient(diffusionCoefficient),
49 mScaleByCellVolume(scaleByCellVolume)
88 for (
double & mCellDensityOnCoarseElement : mCellDensityOnCoarseElements)
90 mCellDensityOnCoarseElement = 0.0;
95 cell_iter != mrCellPopulation.End();
98 unsigned elem_index = 0;
99 const ChastePoint<DIM>& r_position_of_cell = mrCellPopulation.GetLocationOfCellCentre(*cell_iter);
101 if (pCellPdeElementMap !=
nullptr)
103 elem_index = (*pCellPdeElementMap)[*cell_iter];
111 bool cell_is_apoptotic = cell_iter->template HasCellProperty<ApoptoticCellProperty>();
113 if (!cell_is_apoptotic)
115 double cell_weight = 1.0;
117 if (mScaleByCellVolume)
120 cell_weight = mrCellPopulation.GetVolumeOfCell(*cell_iter);
122 if (cell_weight <1e-6)
124 EXCEPTION(
"The volume of one of the cells is " << cell_weight <<
125 " and you are scaling by cell volume. Either turn scaling off or use"
126 " a cell model with non zero areas (i.e. a Bounded Voronoi Tesselation model).");
130 mCellDensityOnCoarseElements[elem_index] += cell_weight;
135 c_matrix<double, DIM, DIM> jacobian;
137 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
139 rCoarseMesh.
GetElement(elem_index)->CalculateJacobian(jacobian, det);
140 mCellDensityOnCoarseElements[elem_index] /= rCoarseMesh.
GetElement(elem_index)->GetVolume(det);