LifeV
StimulusSingleSource.cpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3  *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23  *******************************************************************************
24  */
25 //@HEADER
26 /*!
27  @file
28  @brief Class for applying cardiac stimulus represented by
29  a current at a single point with a given time and duration
30 
31  @date 02-2014
32  @author Simone Palamara <palamara.simone@gmail.com>
33 
34  @last update 02-2014
35  */
36 
37 #include <lifev/electrophysiology/stimulus/StimulusSingleSource.hpp>
38 
39 namespace LifeV
40 {
41 
42 // ===================================================
43 //! Constructors
44 // ===================================================
46  M_radius ( 0.1 ),
47  M_totalCurrent ( 0.5 ),
48  M_pacingSite_X ( 0 ),
49  M_pacingSite_Y ( 0 ),
50  M_pacingSite_Z ( 0 ),
51  M_startingTimeStimulus ( 0.0 ),
52  M_StimDuration ( 1.0 )
53 {
54 
55 }
56 
57 
58 // ===================================================
59 //! Methods
60 // ===================================================
61 Real StimulusSingleSource::appliedCurrent ( const Real& t, const Real& x, const Real& y, const Real& z, const ID& /*i*/ )
62 {
63 
64  Real current = 0.0;
65  const Real volumeOfBall = (4. / 3.) * M_PI * M_radius * M_radius * M_radius;
66  Real distance = std::sqrt ( (x - M_pacingSite_X) * (x - M_pacingSite_X) + (y - M_pacingSite_Y) * (y - M_pacingSite_Y) + (z - M_pacingSite_Z) * (z - M_pacingSite_Z) );
67  if (distance <= M_radius && t >= ( M_startingTimeStimulus ) && t <= ( M_startingTimeStimulus + M_StimDuration ) )
68  {
69  current += M_totalCurrent / volumeOfBall;
70  }
71  return current;
72 
73 }
74 
76 {
77  std::cout << "\n\n\t\t Single source activation Informations\n\n";
78 
79  std::cout << "\n\t\tList of parameters:\n\n";
80 
81  std::cout << "Radius current application: " << M_radius << std::endl;
82  std::cout << "Total current: " << M_totalCurrent << std::endl;
83  std::cout << "Pacing site: " << M_pacingSite_X << " " << M_pacingSite_Y << " " << M_pacingSite_Z << std::endl;
84  std::cout << "StimDuration: " << M_StimDuration << std::endl;
85  std::cout << "\n\t\t End of Single source activation Informations\n\n\n";
86 }
87 
88 }
Real appliedCurrent(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
Methods.
#define M_PI
Definition: winmath.h:20
void updateInverseJacobian(const UInt &iQuadPt)
uint32_type ID
IDs.
Definition: LifeV.hpp:194
double Real
Generic real data.
Definition: LifeV.hpp:175
StimulusSingleSource()
Empty Constructor.