Nektar++
StimulusPoint.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StimulusPoint.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Rectangular stimulus class
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 #include <iostream>
35 #include <tinyxml.h>
37 
39 
40 namespace Nektar
41 {
42  std::string StimulusPoint::className
44  "StimulusPoint",
46  "Point stimulus.");
47 
48  /**
49  * @class StimulusPoint
50  *
51  * The Stimulus class and derived classes implement a range of stimuli.
52  * The stimulus contains input stimuli that can be applied throughout the
53  * domain, on specified regions determined by the derived classes of
54  * Stimulus, at specified frequencies determined by the derived classes of
55  * Protocol.
56  */
57 
58  /**
59  * Stimulus base class constructor.
60  */
63  const MultiRegions::ExpListSharedPtr& pField,
64  const TiXmlElement* pXml)
65  : Stimulus(pSession, pField, pXml)
66  {
67  m_session = pSession;
68  m_field = pField;
69  m_nq = pField->GetTotPoints();
70 
71  if (!pXml)
72  {
73  return;
74  }
75 
76  const TiXmlElement *pXmlparameter;
77 
78  pXmlparameter = pXml->FirstChildElement("p_strength");
79  m_strength = atof(pXmlparameter->GetText());
80  }
81 
82 
83  /**
84  * Initialise the stimulus. Allocate workspace and variable storage.
85  */
87  {
88  }
89 
90 
91  /**
92  *
93  */
95  Array<OneD, Array<OneD, NekDouble> >&outarray,
96  const NekDouble time)
97  {
98  // Get the protocol amplitude
99  NekDouble v_amp = m_Protocol->GetAmplitude(time) * m_strength;
100 
101  outarray[0][0] += v_amp;
102  }
103 
104 
105  /**
106  *
107  */
109  {
110  }
111 }
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
void Initialise()
Initialise the stimulus storage and set initial conditions.
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
ProtocolSharedPtr m_Protocol
Stimulus protocol to apply.
Definition: Stimulus.h:98
static StimulusSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
Creates an instance of this class.
Definition: StimulusPoint.h:53
LibUtilities::SessionReaderSharedPtr m_session
Session.
Definition: Stimulus.h:92
int m_nq
Number of physical points.
Definition: Stimulus.h:96
static std::string className
Name of class.
Definition: StimulusPoint.h:63
Stimulus base class.
Definition: Stimulus.h:65
double NekDouble
MultiRegions::ExpListSharedPtr m_field
Transmembrane potential field from PDE system.
Definition: Stimulus.h:94
StimulusFactory & GetStimulusFactory()
Definition: Stimulus.cpp:44
StimulusPoint(const LibUtilities::SessionReaderSharedPtr &pSession, const MultiRegions::ExpListSharedPtr &pField, const TiXmlElement *pXml)
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:199
virtual void v_Update(Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
std::shared_ptr< SessionReader > SessionReaderSharedPtr