Chaste  Build::
Owen2011MigrationRule.cpp
1 /*
2 
3 Copyright (c) 2005-2016, University of Oxford.
4  All rights reserved.
5 
6  University of Oxford means the Chancellor, Masters and Scholars of the
7  University of Oxford, having an administrative office at Wellington
8  Square, Oxford OX1 2JD, UK.
9 
10  This file is part of Chaste.
11 
12  Redistribution and use in source and binary forms, with or without
13  modification, 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 
23  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34  */
35 
36 #include "RandomNumberGenerator.hpp"
37 #include "VesselSegment.hpp"
38 #include "Vessel.hpp"
39 #include "Owen2011MigrationRule.hpp"
40 #include "AbstractRegularGridDiscreteContinuumSolver.hpp"
41 #include "BaseUnits.hpp"
42 #include "Owen11Parameters.hpp"
43 
44 template<unsigned DIM>
47  mCellMotility(Owen11Parameters::mpCellMotilityEndothelial->GetValue("Owen2011MigrationRule")),
48  mCellChemotacticParameter(0.05*Owen11Parameters::mpChemotacticSensitivity->GetValue("Owen2011MigrationRule")),
49  mVegfField()
50 {
51 
52 }
53 
54 template <unsigned DIM>
55 boost::shared_ptr<Owen2011MigrationRule<DIM> > Owen2011MigrationRule<DIM>::Create()
56 {
57  MAKE_PTR(Owen2011MigrationRule<DIM>, pSelf);
58  return pSelf;
59 }
60 
61 template<unsigned DIM>
63 {
64 
65 }
66 
67 template<unsigned DIM>
68 void Owen2011MigrationRule<DIM>::SetCellChemotacticParameter(units::quantity<unit::diffusivity_per_concentration> cellChemotacticParameter)
69 {
70  mCellChemotacticParameter = cellChemotacticParameter;
71 }
72 
73 template<unsigned DIM>
74 void Owen2011MigrationRule<DIM>::SetCellMotilityParameter(units::quantity<unit::diffusivity> cellMotility)
75 {
76  mCellMotility = cellMotility;
77 }
78 
79 template<unsigned DIM>
80 std::vector<int> Owen2011MigrationRule<DIM>::GetIndices(const std::vector<boost::shared_ptr<VesselNode<DIM> > >& rNodes)
81 {
82  if(!this->mpSolver)
83  {
84  EXCEPTION("A DiscreteContinuum solver is required for this type of sprouting rule.");
85  }
86 
87  mVegfField = this->mpSolver->GetConcentrations(this->mpGrid);
88 
89  // Use the base class for the rest
91 }
92 
93 template<unsigned DIM>
95  std::vector<unsigned> neighbourIndices, unsigned gridIndex)
96 {
97  std::vector<double> probability_of_moving(neighbourIndices.size(), 0.0);
98  for(unsigned jdx=0; jdx<neighbourIndices.size(); jdx++)
99  {
100  // make sure that tip cell does not try to move into a location already occupied by the vessel that it comes from
101  // i.e. that it doesn't loop back around
102  DimensionalChastePoint<DIM> neighbour_location = this->mpGrid->GetLocationOf1dIndex(neighbourIndices[jdx]);
103 
104  bool sprout_already_attached_to_vessel_at_location = false;
105 
106  for (unsigned seg_index = 0; seg_index < pNode->GetNumberOfSegments(); seg_index++)
107  {
108  if(pNode->GetSegment(seg_index)->GetOppositeNode(pNode)->IsCoincident(neighbour_location))
109  {
110  sprout_already_attached_to_vessel_at_location = true;
111  break;
112  }
113  }
114 
115  //ensure that the new sprout would not try to cross a vessel which is oriented diagonally.
116  // todo bottleneck, dont think it is even needed for current neighbourhood
117 // bool vessel_crosses_line_segment = this->mpVesselNetwork->VesselCrossesLineSegment(neighbour_location, pNode->rGetLocation());
118  bool vessel_crosses_line_segment = false;
119 
120  if (!vessel_crosses_line_segment && !sprout_already_attached_to_vessel_at_location)
121  {
122  units::quantity<unit::concentration> VEGF_diff = mVegfField[neighbourIndices[jdx]] - mVegfField[gridIndex];
123  units::quantity<unit::time> dt = SimulationTime::Instance()->GetTimeStep() * BaseUnits::Instance()->GetReferenceTimeScale();
124  units::quantity<unit::length> dij = pNode->rGetLocation().GetDistance(neighbour_location);
125  probability_of_moving[jdx] = ((mCellMotility * dt)/(2.0*dij*dij))*(1.0 + mCellChemotacticParameter*VEGF_diff/(2.0*mCellMotility));
126  if (probability_of_moving[jdx] < 0.0)
127  {
128  probability_of_moving[jdx] = 0.0;
129  }
130  }
131  }
132  return probability_of_moving;
133 }
134 
135 // Explicit instantiation
136 template class Owen2011MigrationRule<2> ;
137 template class Owen2011MigrationRule<3> ;
static boost::shared_ptr< Owen2011MigrationRule< DIM > > Create()
virtual std::vector< int > GetIndices(const std::vector< boost::shared_ptr< VesselNode< DIM > > > &rNodes)
boost::shared_ptr< AbstractDiscreteContinuumSolver< DIM > > mpSolver
boost::shared_ptr< RegularGrid< DIM > > mpGrid
units::quantity< unit::time > GetReferenceTimeScale()
Definition: BaseUnits.cpp:72
void SetCellMotilityParameter(units::quantity< unit::diffusivity > cellMotility)
units::quantity< unit::diffusivity_per_concentration > mCellChemotacticParameter
std::vector< double > GetNeighbourMovementProbabilities(boost::shared_ptr< VesselNode< DIM > > pNode, std::vector< unsigned > neighbourIndices, unsigned gridIndex)
static BaseUnits * Instance()
Definition: BaseUnits.cpp:53
void SetCellChemotacticParameter(units::quantity< unit::diffusivity_per_concentration > cellChemotacticParameter)
std::vector< units::quantity< unit::concentration > > mVegfField
units::quantity< unit::diffusivity > mCellMotility
std::vector< int > GetIndices(const std::vector< boost::shared_ptr< VesselNode< DIM > > > &rNodes)