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 
43 #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.
57  std::string, Stimulus, const LibUtilities::SessionReaderSharedPtr &,
58  const MultiRegions::ExpListSharedPtr &, const TiXmlElement *>
60 
62 
63 /// Stimulus base class.
64 class Stimulus
65 {
66 public:
67  virtual ~Stimulus()
68  {
69  }
70 
71  /// Initialise the stimulus storage and set initial conditions
72  void Initialise();
73 
74  /// Updates RHS of outarray by adding a stimulus to it
76  const NekDouble time)
77  {
78  v_Update(outarray, time);
79  }
80 
81  /// Print a summary of the outarray
83  {
85  }
86 
87  static std::vector<StimulusSharedPtr> LoadStimuli(
89  const MultiRegions::ExpListSharedPtr &pField);
90 
91 protected:
92  /// Session
94  /// Transmembrane potential field from PDE system
96  /// Number of physical points.
97  int m_nq;
98  /// Stimulus protocol to apply
100 
102  const MultiRegions::ExpListSharedPtr &pField,
103  const TiXmlElement *pXml);
104 
105  virtual void v_Update(Array<OneD, Array<OneD, NekDouble>> &outarray,
106  const NekDouble time) = 0;
107 
109 };
110 } // namespace Nektar
111 
112 #endif
Provides a generic Factory class.
Definition: NekFactory.hpp:105
Stimulus base class.
Definition: Stimulus.h:65
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:82
static std::vector< StimulusSharedPtr > LoadStimuli(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField)
Definition: Stimulus.cpp:89
MultiRegions::ExpListSharedPtr m_field
Transmembrane potential field from PDE system.
Definition: Stimulus.h:95
void GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of the outarray.
Definition: Stimulus.h:82
ProtocolSharedPtr m_Protocol
Stimulus protocol to apply.
Definition: Stimulus.h:99
int m_nq
Number of physical points.
Definition: Stimulus.h:97
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: Stimulus.h:93
void Update(Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Updates RHS of outarray by adding a stimulus to it.
Definition: Stimulus.h:75
virtual ~Stimulus()
Definition: Stimulus.h:67
virtual void v_Update(Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)=0
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)=0
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:48
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< Stimulus > StimulusSharedPtr
A shared pointer to an EquationSystem object.
Definition: Stimulus.h:49
StimulusFactory & GetStimulusFactory()
Definition: Stimulus.cpp:44
std::shared_ptr< Protocol > ProtocolSharedPtr
A shared pointer to an EquationSystem object.
Definition: Protocol.h:46
double NekDouble
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