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