Chaste  Release::3.4
LuoRudySpiralWaveCellFactory.hpp
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 #ifndef LUORUDYSPIRALWAVECELLFACTORY_HPP_
37 #define LUORUDYSPIRALWAVECELLFACTORY_HPP_
38 
39 #include "LuoRudy1991BackwardEuler.hpp"
40 #include "AbstractCardiacCellFactory.hpp"
41 #include "MultiStimulus.hpp"
42 #include "SimpleStimulus.hpp"
43 
50 {
51 private:
53  boost::shared_ptr<SimpleStimulus> mpS1Stimulus;
55  boost::shared_ptr<SimpleStimulus> mpS2Stimulus;
57  boost::shared_ptr<MultiStimulus> mpBothStimulus;
59  double mXExtent;
61  double mYExtent;
62 public:
69  LuoRudySpiralWaveCellFactory(double xExtent, double yExtent)
71  mpS1Stimulus(new SimpleStimulus(-50000.0, 2, 0)),
72  mpS2Stimulus(new SimpleStimulus(-70000.0, 2, 45)),
74  mXExtent(xExtent),
75  mYExtent(yExtent)
76  {
77  mpBothStimulus->AddStimulus(mpS1Stimulus);
78  mpBothStimulus->AddStimulus(mpS2Stimulus);
79  }
80 
91  {
92  double x = pNode->rGetLocation()[0];
93  double y = pNode->rGetLocation()[1];
94 
95  double x_threshold_for_S1 = 0.1 + 1e-6;
96  double x_threshold_for_S2 = mXExtent*0.6;
97  double y_threshold_for_S2 = mYExtent*0.5;
98 
99  AbstractCardiacCell* p_cell;
100  if ( x < x_threshold_for_S1 )
101  {
102  if (y<y_threshold_for_S2)
103  {
104  p_cell = new CellLuoRudy1991FromCellMLBackwardEuler(mpSolver, mpBothStimulus);
105  }
106  else
107  {
108  p_cell = new CellLuoRudy1991FromCellMLBackwardEuler(mpSolver, mpS1Stimulus);
109  }
110  }
111  else if ( (x < x_threshold_for_S2) && (y < y_threshold_for_S2) )
112  {
113  p_cell = new CellLuoRudy1991FromCellMLBackwardEuler(mpSolver, mpS2Stimulus);
114  }
115  else
116  {
117  p_cell = new CellLuoRudy1991FromCellMLBackwardEuler(mpSolver, this->mpZeroStimulus);
118  }
119 
120  // Alter parameters to match those used in
121  // Qu et al. Origins of Spiral Wave Meander and Breakup... Annals of Biomedical Eng. 28:755-771 (2000).
122  p_cell->SetParameter("membrane_L_type_calcium_current_conductance",0); // slow inward current in original model.
123 
124  unsigned node_index = pNode->GetIndex();
125  if (node_index==0)
126  {
127 // std::cout << "[K_o] = " << p_cell->GetAnyVariable("extracellular_potassium_concentration") << "mM \n";
128 // std::cout << "[K_i] = " << p_cell->GetAnyVariable("cytosolic_potassium_concentration") << "mM \n";
129 // std::cout << "[Na_o] = " << p_cell->GetAnyVariable("extracellular_sodium_concentration") << "mM \n";
130 // std::cout << "[Na_i] = " << p_cell->GetAnyVariable("cytosolic_sodium_concentration") << "mM \n";
131  std::cout << "G_si = " << p_cell->GetAnyVariable("membrane_L_type_calcium_current_conductance") << "\n";
132 // std::cout << "G_Na = " << p_cell->GetAnyVariable("membrane_fast_sodium_current_conductance") << "mM \n";
133 // std::cout << "G_K = " << p_cell->GetAnyVariable("membrane_rapid_delayed_rectifier_potassium_current_conductance") << "mM \n";
134 // std::cout << "G_K1 = " << p_cell->GetAnyVariable("membrane_inward_rectifier_potassium_current_conductance") << "mM \n";
135  }
136  return p_cell;
137  }
138 };
139 
140 #endif // LUORUDYSPIRALWAVECELLFACTORY_HPP_
Definition: Node.hpp:58
boost::shared_ptr< ZeroStimulus > mpZeroStimulus
boost::shared_ptr< AbstractIvpOdeSolver > mpSolver
AbstractCardiacCell * CreateCardiacCellForTissueNode(Node< 2 > *pNode)
double GetAnyVariable(const std::string &rName, double time=0.0)
boost::shared_ptr< MultiStimulus > mpBothStimulus
void SetParameter(const std::string &rParameterName, double value)
const c_vector< double, SPACE_DIM > & rGetLocation() const
Definition: Node.cpp:140
unsigned GetIndex() const
Definition: Node.cpp:159
boost::shared_ptr< SimpleStimulus > mpS2Stimulus
LuoRudySpiralWaveCellFactory(double xExtent, double yExtent)
boost::shared_ptr< SimpleStimulus > mpS1Stimulus