Nektar++
Protocol.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Protocol.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
8 // Department of Aeronautics, Imperial College London (UK), and Scientific
9 // Computing and Imaging Institute, University of Utah (USA).
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining a
12 // copy of this software and associated documentation files (the "Software"),
13 // to deal in the Software without restriction, including without limitation
14 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 // and/or sell copies of the Software, and to permit persons to whom the
16 // Software is furnished to do so, subject to the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be included
19 // in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 // DEALINGS IN THE SOFTWARE.
28 //
29 // Description: Stimulus protocol base class.
30 //
31 ///////////////////////////////////////////////////////////////////////////////
32 
33 #ifndef NEKTAR_SOLVERS_CARDIACEPSOLVER_STIMULI_PROTOCOL
34 #define NEKTAR_SOLVERS_CARDIACEPSOLVER_STIMULI_PROTOCOL
35 
39 #include <SolverUtils/Core/Misc.h>
40 
41 namespace Nektar
42 {
43  // Forward declaration
44  class Protocol;
45 
46  /// A shared pointer to an EquationSystem object
47  typedef std::shared_ptr<Protocol> ProtocolSharedPtr;
48 
49  /// Datatype of the NekFactory used to instantiate classes derived from
50  /// the EquationSystem class.
51  typedef LibUtilities::NekFactory< std::string, Protocol,
53  const TiXmlElement*> ProtocolFactory;
54 
55  ProtocolFactory& GetProtocolFactory();
56 
57 
58  /// Protocol base class.
59  class Protocol
60  {
61  public:
62  virtual ~Protocol() {}
63 
64  /// Initialise the protocol storage and set initial conditions
65  void Initialise();
66 
67  /// Returns amplitude of stimulus (1 or 0) at given time
69  {
70  return v_GetAmplitude(time);
71  }
72 
73  /// Print a summary of the cell model
75  {
77  }
78 
79  protected:
80  /// Session
81  LibUtilities::SessionReaderSharedPtr m_session;
82 
83  Protocol(const LibUtilities::SessionReaderSharedPtr& pSession,
84  const TiXmlElement* pXml);
85 
86  virtual NekDouble v_GetAmplitude(const NekDouble time) = 0;
87 
88  virtual void v_GenerateSummary(SolverUtils::SummaryList& s) = 0;
89 
90  };
91 
92 }
93 
94 #endif /*PROTOCOL_H_ */
void Initialise()
Initialise the protocol storage and set initial conditions.
Definition: Protocol.cpp:68
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
virtual ~Protocol()
Definition: Protocol.h:62
ProtocolFactory & GetProtocolFactory()
Definition: Protocol.cpp:39
Protocol(const LibUtilities::SessionReaderSharedPtr &pSession, const TiXmlElement *pXml)
Definition: Protocol.cpp:58
void GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of the cell model.
Definition: Protocol.h:74
NekDouble GetAmplitude(const NekDouble time)
Returns amplitude of stimulus (1 or 0) at given time.
Definition: Protocol.h:68
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: Protocol.h:81
virtual NekDouble v_GetAmplitude(const NekDouble time)=0
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)=0
double NekDouble
Protocol base class.
Definition: Protocol.h:59
LibUtilities::NekFactory< std::string, Protocol, const LibUtilities::SessionReaderSharedPtr &, const TiXmlElement * > ProtocolFactory
Datatype of the NekFactory used to instantiate classes derived from the EquationSystem class...
Definition: Protocol.h:53
std::shared_ptr< Protocol > ProtocolSharedPtr
A shared pointer to an EquationSystem object.
Definition: Protocol.h:44
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Provides a generic Factory class.
Definition: NekFactory.hpp:103