Chaste Commit::baa90ac2819b962188b7562f2326be23c47859a7
SloughingCellKiller.cpp
1/*
2
3Copyright (c) 2005-2024, University of Oxford.
4All rights reserved.
5
6University of Oxford means the Chancellor, Masters and Scholars of the
7University of Oxford, having an administrative office at Wellington
8Square, Oxford OX1 2JD, UK.
9
10This file is part of Chaste.
11
12Redistribution and use in source and binary forms, with or without
13modification, are permitted provided that the following conditions are met:
14 * Redistributions of source code must retain the above copyright notice,
15 this list of conditions and the following disclaimer.
16 * Redistributions in binary form must reproduce the above copyright notice,
17 this list of conditions and the following disclaimer in the documentation
18 and/or other materials provided with the distribution.
19 * Neither the name of the University of Oxford nor the names of its
20 contributors may be used to endorse or promote products derived from this
21 software without specific prior written permission.
22
23THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34*/
35#include "SloughingCellKiller.hpp"
36#include "AbstractCentreBasedCellPopulation.hpp"
37#include "Exception.hpp"
38
39template<unsigned DIM>
40SloughingCellKiller<DIM>::SloughingCellKiller(AbstractCellPopulation<DIM>* pCrypt, double sloughHeight, bool sloughSides, double sloughWidth)
41 : AbstractCellKiller<DIM>(pCrypt),
42 mSloughSides(sloughSides)
43{
44 assert(sloughHeight > 0.0);
45 mSloughHeight = sloughHeight;
46
47 assert(sloughWidth > 0.0);
48 mSloughWidth = sloughWidth;
49}
50
51template<unsigned DIM>
53{
54 return mSloughSides;
55}
56
57template<unsigned DIM>
59{
60 return mSloughHeight;
61}
62
63template<unsigned DIM>
65{
66 return mSloughWidth;
67}
68
69template<unsigned DIM>
71{
72 switch (DIM)
73 {
74 case 1:
75 {
76 for (typename AbstractCellPopulation<DIM>::Iterator cell_iter = this->mpCellPopulation->Begin();
77 cell_iter != this->mpCellPopulation->End();
78 ++cell_iter)
79 {
80 double x = this->mpCellPopulation->GetLocationOfCellCentre(*cell_iter)[0];
81
82 if (x > mSloughHeight)
83 {
84 // Mark the cell as killed and store removal information if required.
85 this->mpCellPopulation->KillCell(*cell_iter, "SloughingCellKiller");
86 }
87 }
88 break;
89 }
90 case 2:
91 {
92 for (typename AbstractCellPopulation<DIM>::Iterator cell_iter = this->mpCellPopulation->Begin();
93 cell_iter != this->mpCellPopulation->End();
94 ++cell_iter)
95 {
96 c_vector<double, 2> location;
97 location = this->mpCellPopulation->GetLocationOfCellCentre(*cell_iter);
98 double x = location[0];
99 double y = location[1];
100
101 if ((y>mSloughHeight) || (mSloughSides && ((x<0.0) || (x>mSloughWidth))))
102 {
103 // Mark the cell as killed and store removal information if required.
104 this->mpCellPopulation->KillCell(*cell_iter, "SloughingCellKiller");
105 }
106 }
107 break;
108 }
109 case 3:
110 {
111 EXCEPTION("SloughingCellKiller is not yet implemented in 3D");
112 break;
113 }
114 default:
115 // This can't happen
117 }
118}
119
120template<unsigned DIM>
122{
123 *rParamsFile << "\t\t\t<SloughLength>" << mSloughHeight << "</SloughLength>\n";
124 *rParamsFile << "\t\t\t<SloughSides>" << mSloughSides << "</SloughSides>\n";
125 *rParamsFile << "\t\t\t<SloughWidth>" << mSloughWidth << "</SloughWidth>\n";
126
127 // Call method on direct parent class
129}
130
131// Explicit instantiation
132template class SloughingCellKiller<1>;
133template class SloughingCellKiller<2>;
134template class SloughingCellKiller<3>;
135
136// Serialization for Boost >= 1.36
#define EXCEPTION(message)
#define NEVER_REACHED
#define EXPORT_TEMPLATE_CLASS_SAME_DIMS(CLASS)
virtual void OutputCellKillerParameters(out_stream &rParamsFile)=0
virtual void CheckAndLabelCellsForApoptosisOrDeath()
SloughingCellKiller(AbstractCellPopulation< DIM > *pCrypt, double sloughHeight, bool sloughSides=false, double sloughWidth=10.0)
void OutputCellKillerParameters(out_stream &rParamsFile)