PlaneBasedCellKiller.cpp

00001 /*
00002 
00003 Copyright (C) University of Oxford, 2005-2011
00004 
00005 University of Oxford means the Chancellor, Masters and Scholars of the
00006 University of Oxford, having an administrative office at Wellington
00007 Square, Oxford OX1 2JD, UK.
00008 
00009 This file is part of Chaste.
00010 
00011 Chaste is free software: you can redistribute it and/or modify it
00012 under the terms of the GNU Lesser General Public License as published
00013 by the Free Software Foundation, either version 2.1 of the License, or
00014 (at your option) any later version.
00015 
00016 Chaste is distributed in the hope that it will be useful, but WITHOUT
00017 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00019 License for more details. The offer of Chaste under the terms of the
00020 License is subject to the License being interpreted in accordance with
00021 English Law and subject to any action against the University of Oxford
00022 being under the jurisdiction of the English Courts.
00023 
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with Chaste. If not, see <http://www.gnu.org/licenses/>.
00026 
00027 */
00028 
00029 #include "PlaneBasedCellKiller.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++) //Note: inequality avoids testing index < 0U when DIM=1
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++) //Note: inequality avoids testing index < 0U when DIM=1
00082      {
00083          *rParamsFile << mNormalToPlane[index] << ",";
00084      }
00085      *rParamsFile << mNormalToPlane[DIM-1] << "</NormalToPlane>\n";
00086 
00087     // Call method on direct parent class
00088     AbstractCellKiller<DIM>::OutputCellKillerParameters(rParamsFile);
00089 }
00090 
00092 // Explicit instantiation
00094 
00095 template class PlaneBasedCellKiller<1>;
00096 template class PlaneBasedCellKiller<2>;
00097 template class PlaneBasedCellKiller<3>;
00098 
00099 // Serialization for Boost >= 1.36
00100 #include "SerializationExportWrapperForCpp.hpp"
00101 EXPORT_TEMPLATE_CLASS_SAME_DIMS(PlaneBasedCellKiller)
Generated on Thu Dec 22 13:00:05 2011 for Chaste by  doxygen 1.6.3