Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Stimulus.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File Stimulus.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 // License for the specific language governing rights and limitations under
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.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <tinyxml.h>
38 
40 
41 namespace Nektar
42 {
44  {
45  typedef Loki::SingletonHolder<StimulusFactory,
46  Loki::CreateUsingNew,
47  Loki::NoDestroy > Type;
48  return Type::Instance();
49  }
50 
51  /**
52  * @class Stimulus
53  *
54  * The Stimulus class and derived classes implement a range of stimuli.
55  * The stimulus contains input stimuli that can be applied throughout the
56  * domain, on specified regions determined by the derived classes of
57  * Stimulus, at specified frequencies determined by the derived classes of
58  * Protocol.
59  *
60  */
61 
62  /**
63  * Stimulus base class constructor.
64  */
66  const MultiRegions::ExpListSharedPtr& pField,
67  const TiXmlElement* pXml)
68  {
69  m_session = pSession;
70  m_field = pField;
71  m_nq = pField->GetTotPoints();
72 
73  const TiXmlElement* vProtocol = pXml->FirstChildElement("PROTOCOL");
74  string vTypeP = vProtocol->Attribute("TYPE");
75 
77  vTypeP, pSession, vProtocol);
78 
79  }
80 
81 
82  /**
83  * Initialise the stimulus. Allocate workspace and variable storage.
84  */
86  {
87 
88 
89  }
90 
91 
92  /**
93  *
94  */
95  vector<StimulusSharedPtr> Stimulus::LoadStimuli(
97  const MultiRegions::ExpListSharedPtr& pField)
98  {
99  vector<StimulusSharedPtr> vStimList;
100 
101  TiXmlElement* vStimuli = pSession->GetElement("Nektar/Stimuli");
102  if (vStimuli)
103  {
104 
105  TiXmlElement* vStimulus = vStimuli->FirstChildElement("STIMULUS");
106  while (vStimulus)
107  {
108 
109  string vType = vStimulus->Attribute("TYPE");
110  //unsigned int vId = atoi(vStimulus->Attribute("ID"));
111 
112  vStimList.push_back(GetStimulusFactory().CreateInstance(
113  vType, pSession, pField, vStimulus));
114  vStimulus = vStimulus->NextSiblingElement("STIMULUS");
115 
116 
117 
118  }
119  }
120  return vStimList;
121  }
122 }