Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Nektar::ProtocolS1S2 Class Reference

Protocol base class. More...

#include <ProtocolS1S2.h>

Inheritance diagram for Nektar::ProtocolS1S2:
[legend]

Public Member Functions

 ~ProtocolS1S2 () override
 
void Initialise ()
 Initialise the protocol storage and set initial conditions. More...
 
- Public Member Functions inherited from Nektar::Protocol
virtual ~Protocol ()
 
void Initialise ()
 Initialise the protocol storage and set initial conditions. More...
 
NekDouble GetAmplitude (const NekDouble time)
 Returns amplitude of stimulus (1 or 0) at given time. More...
 
void GenerateSummary (SolverUtils::SummaryList &s)
 Print a summary of the cell model. More...
 

Static Public Member Functions

static ProtocolSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const TiXmlElement *pXml)
 Creates an instance of this class. More...
 

Static Public Attributes

static std::string className
 Name of class. More...
 

Protected Member Functions

NekDouble v_GetAmplitude (const NekDouble time) override
 
void v_GenerateSummary (SolverUtils::SummaryList &s) override
 
virtual void v_SetInitialConditions ()
 
- Protected Member Functions inherited from Nektar::Protocol
 Protocol (const LibUtilities::SessionReaderSharedPtr &pSession, const TiXmlElement *pXml)
 
virtual NekDouble v_GetAmplitude (const NekDouble time)=0
 
virtual void v_GenerateSummary (SolverUtils::SummaryList &s)=0
 

Protected Attributes

NekDouble m_start
 
NekDouble m_dur
 
NekDouble m_s1cyclelength
 
NekDouble m_num_s1
 
NekDouble m_s2cyclelength
 
NekDouble m_s2start
 
- Protected Attributes inherited from Nektar::Protocol
LibUtilities::SessionReaderSharedPtr m_session
 Session. More...
 

Private Member Functions

 ProtocolS1S2 (const LibUtilities::SessionReaderSharedPtr &pSession, const TiXmlElement *pXml)
 

Friends

class MemoryManager< ProtocolS1S2 >
 

Detailed Description

Protocol base class.

The Stimuli class and derived classes implement a range of stimuli. The stimulus contains input stimuli that can be applied throughout the domain, on specified regions determined by the derived classes of Stimulus, at specified frequencies determined by the derived classes of Protocol.

Definition at line 45 of file ProtocolS1S2.h.

Constructor & Destructor Documentation

◆ ~ProtocolS1S2()

Nektar::ProtocolS1S2::~ProtocolS1S2 ( )
inlineoverride

Definition at line 61 of file ProtocolS1S2.h.

62 {
63 }

◆ ProtocolS1S2()

Nektar::ProtocolS1S2::ProtocolS1S2 ( const LibUtilities::SessionReaderSharedPtr pSession,
const TiXmlElement *  pXml 
)
private

Protocol base class constructor.

Definition at line 55 of file ProtocolS1S2.cpp.

57 : Protocol(pSession, pXml)
58{
59 m_session = pSession;
60
61 if (!pXml)
62 {
63 return;
64 }
65
66 const TiXmlElement *pXmlparameter; // Declaring variable called pxml...
67 // See if we have parameters defined. They are optional so we go on if not.
68
69 // member variables m_* defined in ProtocolS1S2.h
70
71 pXmlparameter = pXml->FirstChildElement("START");
72 m_start =
73 atof(pXmlparameter->GetText()); // text value within px1, convert to a
74 // floating pt and save in m_px1
75
76 pXmlparameter = pXml->FirstChildElement("DURATION");
77 m_dur = atof(pXmlparameter->GetText());
78
79 pXmlparameter = pXml->FirstChildElement("S1CYCLELENGTH");
80 m_s1cyclelength = atof(pXmlparameter->GetText());
81
82 pXmlparameter = pXml->FirstChildElement("NUM_S1");
83 m_num_s1 = atof(pXmlparameter->GetText());
84
85 pXmlparameter = pXml->FirstChildElement("S2CYCLELENGTH");
86 m_s2cyclelength = atof(pXmlparameter->GetText());
87
89}
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: Protocol.h:85
Protocol(const LibUtilities::SessionReaderSharedPtr &pSession, const TiXmlElement *pXml)
Definition: Protocol.cpp:58
NekDouble m_s2cyclelength
Definition: ProtocolS1S2.h:73
NekDouble m_s1cyclelength
Definition: ProtocolS1S2.h:71

References m_dur, m_num_s1, m_s1cyclelength, m_s2cyclelength, m_s2start, Nektar::Protocol::m_session, and m_start.

Member Function Documentation

◆ create()

static ProtocolSharedPtr Nektar::ProtocolS1S2::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const TiXmlElement *  pXml 
)
inlinestatic

Creates an instance of this class.

Definition at line 49 of file ProtocolS1S2.h.

52 {
54 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ Initialise()

void Nektar::ProtocolS1S2::Initialise ( )

Initialise the protocol storage and set initial conditions.

Initialise the protocol. Allocate workspace and variable storage.

Definition at line 94 of file ProtocolS1S2.cpp.

95{
96}

◆ v_GenerateSummary()

void Nektar::ProtocolS1S2::v_GenerateSummary ( SolverUtils::SummaryList s)
overrideprotectedvirtual

Implements Nektar::Protocol.

Definition at line 121 of file ProtocolS1S2.cpp.

123{
124}

◆ v_GetAmplitude()

NekDouble Nektar::ProtocolS1S2::v_GetAmplitude ( const NekDouble  time)
overrideprotectedvirtual

Implements Nektar::Protocol.

Definition at line 98 of file ProtocolS1S2.cpp.

99{
100 // Number of complete S1 intervals
101 NekDouble a = floor((time - m_start) / m_s1cyclelength);
102
103 // Time since start of most recent S1 interval
104 NekDouble time1 = time - a * m_s1cyclelength - m_start;
105
106 // S1
107 if ((time1 > 0) && (a < m_num_s1) && (time1 < m_dur))
108 {
109 return 1.0;
110 }
111
112 // S2
113 if ((time > m_s2start) && (time < m_s2start + m_dur))
114 {
115 return 1.0;
116 }
117
118 return 0.0;
119}
double NekDouble

References m_dur, m_num_s1, m_s1cyclelength, m_s2start, and m_start.

◆ v_SetInitialConditions()

void Nektar::ProtocolS1S2::v_SetInitialConditions ( )
protectedvirtual

Definition at line 126 of file ProtocolS1S2.cpp.

127{
128}

Friends And Related Function Documentation

◆ MemoryManager< ProtocolS1S2 >

friend class MemoryManager< ProtocolS1S2 >
friend

Definition at line 57 of file ProtocolS1S2.h.

Member Data Documentation

◆ className

std::string Nektar::ProtocolS1S2::className
static
Initial value:
=
"ProtocolS1S2", ProtocolS1S2::create, "S1S2 stimulus protocol.")
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static ProtocolSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const TiXmlElement *pXml)
Creates an instance of this class.
Definition: ProtocolS1S2.h:49
ProtocolFactory & GetProtocolFactory()
Definition: Protocol.cpp:39

Name of class.

Definition at line 57 of file ProtocolS1S2.h.

◆ m_dur

NekDouble Nektar::ProtocolS1S2::m_dur
protected

Definition at line 70 of file ProtocolS1S2.h.

Referenced by ProtocolS1S2(), and v_GetAmplitude().

◆ m_num_s1

NekDouble Nektar::ProtocolS1S2::m_num_s1
protected

Definition at line 72 of file ProtocolS1S2.h.

Referenced by ProtocolS1S2(), and v_GetAmplitude().

◆ m_s1cyclelength

NekDouble Nektar::ProtocolS1S2::m_s1cyclelength
protected

Definition at line 71 of file ProtocolS1S2.h.

Referenced by ProtocolS1S2(), and v_GetAmplitude().

◆ m_s2cyclelength

NekDouble Nektar::ProtocolS1S2::m_s2cyclelength
protected

Definition at line 73 of file ProtocolS1S2.h.

Referenced by ProtocolS1S2().

◆ m_s2start

NekDouble Nektar::ProtocolS1S2::m_s2start
protected

Definition at line 74 of file ProtocolS1S2.h.

Referenced by ProtocolS1S2(), and v_GetAmplitude().

◆ m_start

NekDouble Nektar::ProtocolS1S2::m_start
protected

Definition at line 69 of file ProtocolS1S2.h.

Referenced by ProtocolS1S2(), and v_GetAmplitude().