36 #include "AveragedSourcePde.hpp"
37 #include "ApoptoticCellProperty.hpp"
40 template<
unsigned DIM>
42 : mrCellPopulation(rCellPopulation),
43 mCoefficient(coefficient)
47 template<
unsigned DIM>
50 return mrCellPopulation;
53 template<
unsigned DIM>
59 template<
unsigned DIM>
64 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
66 mCellDensityOnCoarseElements[elem_index] = 0.0;
71 cell_iter != mrCellPopulation.End();
74 unsigned elem_index = 0;
75 const ChastePoint<DIM>& r_position_of_cell = mrCellPopulation.GetLocationOfCellCentre(*cell_iter);
77 if (pCellPdeElementMap != NULL)
79 elem_index = (*pCellPdeElementMap)[*cell_iter];
87 bool cell_is_apoptotic = cell_iter->template HasCellProperty<ApoptoticCellProperty>();
89 if (!cell_is_apoptotic)
91 mCellDensityOnCoarseElements[elem_index] += 1.0;
96 c_matrix<double, DIM, DIM> jacobian;
98 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
100 rCoarseMesh.
GetElement(elem_index)->CalculateJacobian(jacobian, det);
101 mCellDensityOnCoarseElements[elem_index] /= rCoarseMesh.
GetElement(elem_index)->GetVolume(det);
105 template<
unsigned DIM>
111 template<
unsigned DIM>
114 assert(!mCellDensityOnCoarseElements.empty());
115 return mCoefficient * mCellDensityOnCoarseElements[pElement->
GetIndex()];
118 template<
unsigned DIM>
121 return identity_matrix<double>(DIM);
124 template<
unsigned DIM>
127 return this->mCellDensityOnCoarseElements[elementIndex];
double ComputeConstantInUSourceTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement)
virtual unsigned GetNumElements() const
Element< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
const AbstractCellPopulation< DIM > & rGetCellPopulation() const
double ComputeLinearInUCoeffInSourceTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
unsigned GetContainingElementIndex(const ChastePoint< SPACE_DIM > &rTestPoint, bool strict=false, std::set< unsigned > testElements=std::set< unsigned >(), bool onlyTryWithTestElements=false)
virtual void SetupSourceTerms(TetrahedralMesh< DIM, DIM > &rCoarseMesh, std::map< CellPtr, unsigned > *pCellPdeElementMap=NULL)
unsigned GetIndex() const
double GetUptakeRateForElement(unsigned elementIndex)
double GetCoefficient() const
AveragedSourcePde(AbstractCellPopulation< DIM > &rCellPopulation, double coefficient=0.0)
c_matrix< double, DIM, DIM > ComputeDiffusionTerm(const ChastePoint< DIM > &rX)