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 #include "PlaneBasedCellKiller.hpp"
00029 #include "PetscTools.hpp"
00030
00031 template <unsigned DIM>
00032 PlaneBasedCellKiller<DIM>::PlaneBasedCellKiller(AbstractCellPopulation<DIM>* pCellPopulation,
00033 c_vector<double, DIM> point,
00034 c_vector<double, DIM> normal)
00035 : AbstractCellKiller<DIM>(pCellPopulation),
00036 mPointOnPlane(point)
00037 {
00038 assert(norm_2(normal) > 0.0);
00039 mNormalToPlane = normal/norm_2(normal);
00040 }
00041
00042 template <unsigned DIM>
00043 const c_vector<double, DIM>& PlaneBasedCellKiller<DIM>::rGetPointOnPlane() const
00044 {
00045 return mPointOnPlane;
00046 }
00047
00048 template <unsigned DIM>
00049 const c_vector<double, DIM>& PlaneBasedCellKiller<DIM>::rGetNormalToPlane() const
00050 {
00051 return mNormalToPlane;
00052 }
00053
00054 template <unsigned DIM>
00055 void PlaneBasedCellKiller<DIM>::TestAndLabelCellsForApoptosisOrDeath()
00056 {
00057 for (typename AbstractCellPopulation<DIM>::Iterator cell_iter = this->mpCellPopulation->Begin();
00058 cell_iter != this->mpCellPopulation->End();
00059 ++cell_iter)
00060 {
00061 c_vector<double, DIM> cell_location = this->mpCellPopulation->GetLocationOfCellCentre(*cell_iter);
00062
00063 if (inner_prod(cell_location - mPointOnPlane, mNormalToPlane) > 0.0)
00064 {
00065 cell_iter->Kill();
00066 }
00067 }
00068 }
00069
00070 template<unsigned DIM>
00071 void PlaneBasedCellKiller<DIM>::OutputCellKillerParameters(out_stream& rParamsFile)
00072 {
00073 *rParamsFile << "\t\t\t<PointOnPlane>";
00074 for (unsigned index=0; index != DIM-1U; index++)
00075 {
00076 *rParamsFile << mPointOnPlane[index] << ",";
00077 }
00078 *rParamsFile << mPointOnPlane[DIM-1] << "</PointOnPlane> \n";
00079
00080 *rParamsFile << "\t\t\t<NormalToPlane>";
00081 for (unsigned index=0; index != DIM-1U; index++)
00082 {
00083 *rParamsFile << mNormalToPlane[index] << ",";
00084 }
00085 *rParamsFile << mNormalToPlane[DIM-1] << "</NormalToPlane> \n";
00086
00087
00088 AbstractCellKiller<DIM>::OutputCellKillerParameters(rParamsFile);
00089 }
00090
00092
00094
00095 template class PlaneBasedCellKiller<1>;
00096 template class PlaneBasedCellKiller<2>;
00097 template class PlaneBasedCellKiller<3>;
00098
00099
00100 #include "SerializationExportWrapperForCpp.hpp"
00101 EXPORT_TEMPLATE_CLASS_SAME_DIMS(PlaneBasedCellKiller)