Nektar++
Stimulus.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Stimulus.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 //
10 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
11 // Department of Aeronautics, Imperial College London (UK), and Scientific
12 // Computing and Imaging Institute, University of Utah (USA).
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Stimulus base class header.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERS_CARDIACEPSOLVER_STIMULI_STIMULUS
37 #define NEKTAR_SOLVERS_CARDIACEPSOLVER_STIMULI_STIMULUS
38 
42 #include <MultiRegions/ExpList.h>
44 #include <SolverUtils/Core/Misc.h>
45 
46 namespace Nektar
47 {
48  // Forward declaration
49  class Stimulus;
50 
51  /// A shared pointer to an EquationSystem object
52  typedef std::shared_ptr<Stimulus> StimulusSharedPtr;
53 
54  /// Datatype of the NekFactory used to instantiate classes derived from
55  /// the EquationSystem class.
56  typedef LibUtilities::NekFactory< std::string, Stimulus,
59  const TiXmlElement*> StimulusFactory;
60 
62 
63 
64  /// Stimulus base class.
65  class Stimulus
66  {
67  public:
68  virtual ~Stimulus() {}
69 
70  /// Initialise the stimulus storage and set initial conditions
71  void Initialise();
72 
73  /// Updates RHS of outarray by adding a stimulus to it
75  const NekDouble time)
76  {
77  v_Update(outarray, time);
78  }
79 
80  /// Print a summary of the outarray
82  {
84  }
85 
86  static std::vector<StimulusSharedPtr> LoadStimuli(
88  const MultiRegions::ExpListSharedPtr& pField);
89 
90  protected:
91  /// Session
93  /// Transmembrane potential field from PDE system
95  /// Number of physical points.
96  int m_nq;
97  /// Stimulus protocol to apply
99 
101  const MultiRegions::ExpListSharedPtr& pField,
102  const TiXmlElement* pXml);
103 
104  virtual void v_Update(Array<OneD, Array<OneD, NekDouble> >&outarray,
105  const NekDouble time) = 0;
106 
108 
109  };
110 }
111 
112 #endif
Provides a generic Factory class.
Definition: NekFactory.hpp:105
Stimulus base class.
Definition: Stimulus.h:66
virtual void v_Update(Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)=0
Stimulus(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
Definition: Stimulus.cpp:64
void Initialise()
Initialise the stimulus storage and set initial conditions.
Definition: Stimulus.cpp:84
static std::vector< StimulusSharedPtr > LoadStimuli(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
Definition: Stimulus.cpp:92
MultiRegions::ExpListSharedPtr m_field
Transmembrane potential field from PDE system.
Definition: Stimulus.h:94
void GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of the outarray.
Definition: Stimulus.h:81
ProtocolSharedPtr m_Protocol
Stimulus protocol to apply.
Definition: Stimulus.h:98
int m_nq
Number of physical points.
Definition: Stimulus.h:96
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: Stimulus.h:92
virtual ~Stimulus()
Definition: Stimulus.h:68
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)=0
void Update(Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
Updates RHS of outarray by adding a stimulus to it.
Definition: Stimulus.h:74
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< Stimulus > StimulusSharedPtr
A shared pointer to an EquationSystem object.
Definition: Stimulus.h:49
LibUtilities::NekFactory< std::string, Stimulus, const LibUtilities::SessionReaderSharedPtr &, const MultiRegions::ExpListSharedPtr &, const TiXmlElement * > StimulusFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class.
Definition: Stimulus.h:59
StimulusFactory & GetStimulusFactory()
Definition: Stimulus.cpp:44
std::shared_ptr< Protocol > ProtocolSharedPtr
A shared pointer to an EquationSystem object.
Definition: Protocol.h:44
double NekDouble