70 #ifndef _ELECTROIONICMODEL_H_ 71 #define _ELECTROIONICMODEL_H_ 73 #include <lifev/core/array/MatrixSmall.hpp> 74 #include <lifev/core/array/VectorSmall.hpp> 75 #include <lifev/core/array/VectorEpetra.hpp> 76 #include <lifev/core/array/MatrixEpetra.hpp> 77 #include <lifev/core/array/VectorElemental.hpp> 78 #include <lifev/core/fem/FESpace.hpp> 79 #include <lifev/core/array/MapEpetra.hpp> 81 #include <lifev/core/util/Factory.hpp> 82 #include <lifev/core/util/FactorySingleton.hpp> 85 #include <lifev/electrophysiology/stimulus/ElectroStimulus.hpp> 87 #include <boost/bind.hpp> 88 #include <boost/ref.hpp> 90 #include <Teuchos_RCP.hpp> 91 #include <Teuchos_ParameterList.hpp> 92 #include "Teuchos_XMLParameterListHelpers.hpp" 96 class ElectroIonicModel
105 typedef std::shared_ptr<VectorEpetra> vectorPtr_Type;
107 typedef std::shared_ptr<VectorElemental> elvecPtr_Type;
109 typedef RegionMesh<LinearTetra> mesh_Type;
113 typedef std::shared_ptr<matrix_Type> matrixPtr_Type;
117 typedef std::shared_ptr<feSpace_Type> feSpacePtr_Type;
119 typedef std::function < Real (
const Real& t,
123 const ID& i) > function_Type;
125 typedef FactorySingleton<Factory<ElectroIonicModel, std::string> > IonicModelFactory;
141 ElectroIonicModel (
int n );
151 ElectroIonicModel (
int n,
int g );
157 ElectroIonicModel (
const ElectroIonicModel& Ionic );
160 virtual ~ElectroIonicModel() {};
171 virtual void setup( Teuchos::ParameterList& parameterList) { }
177 inline const short int Size()
const 179 return M_numberOfEquations;
186 inline const short int numberOfGatingVariables()
const 188 return M_numberOfGatingVariables;
195 inline const Real membraneCapacitance()
const 197 return M_membraneCapacitance;
204 inline const Real appliedCurrent()
const 206 return M_appliedCurrent;
213 inline vectorPtr_Type appliedCurrentPtr()
215 return M_appliedCurrentPtr;
222 inline const std::vector<Real> restingConditions()
const 224 return M_restingConditions;
231 inline const function_Type pacaingProtocol()
const 233 return M_pacingProtocol;
240 inline void setMembraneCapacitance (
const Real p )
242 M_membraneCapacitance = p;
249 inline void setAppliedCurrent (
const Real p)
251 M_appliedCurrent = p;
258 inline void setAppliedCurrentPtr (
const vectorPtr_Type p)
260 this->M_appliedCurrentPtr = p;
267 inline void setAppliedCurrent (
const vector_Type& p)
269 M_appliedCurrentPtr.reset (
new vector_Type ( p ) );
281 inline void setAppliedCurrentFromFunction (function_Type& f, feSpacePtr_Type feSpacePtr,
285 feSpacePtr -> interpolate (
286 static_cast<FESpace<RegionMesh<LinearTetra>, MapEpetra>::function_Type> (f),
287 *M_appliedCurrentPtr, time);
299 inline void setAppliedCurrentFromElectroStimulus ( ElectroStimulus& stimulus, feSpacePtr_Type feSpacePtr,
Real time = 0.0)
303 function_Type f = std::bind (&ElectroStimulus::appliedCurrent, boost::ref (stimulus), std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5 );
305 feSpacePtr -> interpolate (
306 static_cast<FESpace<RegionMesh<LinearTetra>, MapEpetra>::function_Type> (f),
307 *M_appliedCurrentPtr, time);
314 inline void setPacingProtocol ( function_Type pacingProtocol )
316 M_pacingProtocol = pacingProtocol;
324 inline void setRestingCondtions (
Real value,
int j)
326 M_restingConditions[j] = value;
333 inline void setRestingCondtions (std::vector<Real>& restingConditions)
335 M_restingConditions = restingConditions;
342 inline void addAppliedCurrent (
Real& rhs)
344 rhs += M_appliedCurrent;
351 inline void addAppliedCurrent (std::vector<Real>& rhs)
353 rhs[0] += M_appliedCurrent;
363 virtual matrix_Type getJac (
const vector_Type& v,
Real h = 1.0e-8);
370 virtual std::vector< std::vector<Real> > getJac (
const std::vector<Real>& v, Real h = 1.0e-8);
381 virtual void computeGatingRhs (
const std::vector<vectorPtr_Type>& v, std::vector<vectorPtr_Type>& rhs );
393 virtual void computeNonGatingRhs (
const std::vector<vectorPtr_Type>& v, std::vector<vectorPtr_Type>& rhs );
403 virtual void computeGatingVariablesWithRushLarsen ( std::vector<vectorPtr_Type>& v,
const Real dt );
413 virtual void computeRhs (
const std::vector<vectorPtr_Type>& v, std::vector<vectorPtr_Type>& rhs );
421 virtual void computePotentialRhsICI (
const std::vector<vectorPtr_Type>& v,
422 std::vector<vectorPtr_Type>& rhs,
423 matrix_Type& massMatrix );
432 virtual void computePotentialRhsSVI (
const std::vector<vectorPtr_Type>& v,
433 std::vector<vectorPtr_Type>& rhs,
434 FESpace<mesh_Type,
MapEpetra>& uFESpace );
443 virtual void computePotentialRhsSVI (
const std::vector<vectorPtr_Type>& v,
444 std::vector<vectorPtr_Type>& rhs,
452 virtual void initialize ( std::vector<Real>& v );
459 virtual void initialize ( std::vector<vectorPtr_Type>& v );
469 ElectroIonicModel& operator= (
const ElectroIonicModel& Ionic );
484 virtual void computeGatingRhs (
const std::vector<Real>& v, std::vector<Real>& rhs ) = 0;
490 virtual Real computeLocalPotentialRhs (
const std::vector<Real>& v ) = 0;
501 virtual void computeRhs (
const std::vector<Real>& v, std::vector<Real>& rhs) = 0;
507 virtual void showMe() = 0;
517 virtual void computeGatingVariablesWithRushLarsen ( std::vector<Real>& ,
const Real ) {}
528 virtual void computeNonGatingRhs (
const std::vector<Real>& v, std::vector<Real>& rhs )
530 if (M_numberOfGatingVariables == 0 )
532 computeGatingRhs (v, rhs);
541 short int M_numberOfEquations;
544 short int M_numberOfGatingVariables;
547 std::vector<Real> M_restingConditions;
556 vectorPtr_Type M_appliedCurrentPtr;
559 function_Type M_pacingProtocol;
VectorEpetra - The Epetra Vector format Wrapper.
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
void updateInverseJacobian(const UInt &iQuadPt)
Epetra_Import const & importer()
Getter for the Epetra_Import.
double Real
Generic real data.
QuadratureRule - The basis class for storing and accessing quadrature rules.