36 #include "AveragedSourceEllipticPde.hpp"
37 #include "ApoptoticCellProperty.hpp"
39 template<
unsigned DIM>
41 double sourceCoefficient,
42 double diffusionCoefficient)
43 : mrCellPopulation(rCellPopulation),
44 mSourceCoefficient(sourceCoefficient),
45 mDiffusionCoefficient(diffusionCoefficient)
49 template<
unsigned DIM>
52 return mrCellPopulation;
55 template<
unsigned DIM>
58 return mSourceCoefficient;
61 template<
unsigned DIM>
66 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
68 mCellDensityOnCoarseElements[elem_index] = 0.0;
73 cell_iter != mrCellPopulation.End();
76 unsigned elem_index = 0;
77 const ChastePoint<DIM>& r_position_of_cell = mrCellPopulation.GetLocationOfCellCentre(*cell_iter);
79 if (pCellPdeElementMap !=
nullptr)
81 elem_index = (*pCellPdeElementMap)[*cell_iter];
89 bool cell_is_apoptotic = cell_iter->template HasCellProperty<ApoptoticCellProperty>();
91 if (!cell_is_apoptotic)
93 mCellDensityOnCoarseElements[elem_index] += 1.0;
98 c_matrix<double, DIM, DIM> jacobian;
100 for (
unsigned elem_index=0; elem_index<mCellDensityOnCoarseElements.size(); elem_index++)
102 rCoarseMesh.
GetElement(elem_index)->CalculateJacobian(jacobian, det);
103 mCellDensityOnCoarseElements[elem_index] /= rCoarseMesh.
GetElement(elem_index)->GetVolume(det);
107 template<
unsigned DIM>
113 template<
unsigned DIM>
116 assert(!mCellDensityOnCoarseElements.empty());
117 return mSourceCoefficient * mCellDensityOnCoarseElements[pElement->
GetIndex()];
120 template<
unsigned DIM>
123 return mDiffusionCoefficient*identity_matrix<double>(DIM);
126 template<
unsigned DIM>
129 return this->mCellDensityOnCoarseElements[elementIndex];
AveragedSourceEllipticPde(AbstractCellPopulation< DIM > &rCellPopulation, double sourceCoefficient=0.0, double diffusionCoefficient=1.0)
double GetUptakeRateForElement(unsigned elementIndex)
double GetCoefficient() const
virtual unsigned GetNumElements() const
Element< ELEMENT_DIM, SPACE_DIM > * GetElement(unsigned index) const
virtual void SetupSourceTerms(TetrahedralMesh< DIM, DIM > &rCoarseMesh, std::map< CellPtr, unsigned > *pCellPdeElementMap=nullptr)
c_matrix< double, DIM, DIM > ComputeDiffusionTerm(const ChastePoint< DIM > &rX)
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
const AbstractCellPopulation< DIM > & rGetCellPopulation() const
unsigned GetContainingElementIndex(const ChastePoint< SPACE_DIM > &rTestPoint, bool strict=false, std::set< unsigned > testElements=std::set< unsigned >(), bool onlyTryWithTestElements=false)
unsigned GetIndex() const
double ComputeLinearInUCoeffInSourceTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement)
double ComputeConstantInUSourceTerm(const ChastePoint< DIM > &rX, Element< DIM, DIM > *pElement)