GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
currentSource.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard includes
4 #include <map>
5 #include <set>
6 #include <string>
7 #include <vector>
8 
9 // GeNN includes
10 #include "global.h"
11 #include "currentSourceModels.h"
12 #include "variableMode.h"
13 
14 //------------------------------------------------------------------------
15 // CurrentSource
16 //------------------------------------------------------------------------
18 {
19 public:
20  CurrentSource(const std::string &name, const CurrentSourceModels::Base *currentSourceModel,
21  const std::vector<double> &params, const std::vector<NewModels::VarInit> &varInitialisers) :
22  m_Name(name),
23  m_CurrentSourceModel(currentSourceModel), m_Params(params), m_VarInitialisers(varInitialisers),
24  m_VarMode(varInitialisers.size(), GENN_PREFERENCES::defaultVarMode)
25  {
26  }
27  CurrentSource(const CurrentSource&) = delete;
28  CurrentSource() = delete;
29 
30  //------------------------------------------------------------------------
31  // Public methods
32  //------------------------------------------------------------------------
33 
35 
36  void setVarMode(const std::string &varName, VarMode mode);
37 
38  void initDerivedParams(double dt);
39 
40  //------------------------------------------------------------------------
41  // Public const methods
42  //------------------------------------------------------------------------
43  const std::string &getName() const{ return m_Name; }
44 
46  const CurrentSourceModels::Base *getCurrentSourceModel() const{ return m_CurrentSourceModel; }
47 
48  const std::vector<double> &getParams() const{ return m_Params; }
49  const std::vector<double> &getDerivedParams() const{ return m_DerivedParams; }
50  const std::vector<NewModels::VarInit> &getVarInitialisers() const{ return m_VarInitialisers; }
51 
53  VarMode getVarMode(const std::string &varName) const;
54 
56  VarMode getVarMode(size_t index) const{ return m_VarMode[index]; }
57 
58  void addExtraGlobalParams(std::map<std::string, std::string> &kernelParameters) const;
59 
61  bool isInitCodeRequired() const;
62 
64  bool isSimRNGRequired() const;
65 
67  bool isInitRNGRequired(VarInit varInitMode) const;
68 
70  bool isDeviceVarInitRequired() const;
71 
73 
75  bool canRunOnCPU() const;
76 
77 private:
78  //------------------------------------------------------------------------
79  // Members
80  //------------------------------------------------------------------------
81  std::string m_Name;
82 
83  const CurrentSourceModels::Base *m_CurrentSourceModel;
84  std::vector<double> m_Params;
85  std::vector<double> m_DerivedParams;
86  std::vector<NewModels::VarInit> m_VarInitialisers;
87 
89  std::vector<VarMode> m_VarMode;
90 };
const std::string & getName() const
Definition: currentSource.h:43
bool isSimRNGRequired() const
Does this current source require an RNG to simulate.
Definition: currentSource.cc:67
bool canRunOnCPU() const
Can this current source run on the CPU?
Definition: currentSource.cc:99
VarMode getVarMode(size_t index) const
Get variable mode used by current source model state variable.
Definition: currentSource.h:56
Base class for all current source models.
Definition: currentSourceModels.h:28
Definition: global.h:43
bool isInitCodeRequired() const
Does this current source require any initialisation code to be run.
Definition: currentSource.cc:57
const std::vector< double > & getDerivedParams() const
Definition: currentSource.h:49
const std::vector< double > & getParams() const
Definition: currentSource.h:48
void addExtraGlobalParams(std::map< std::string, std::string > &kernelParameters) const
Definition: currentSource.cc:44
VarMode
Definition: variableMode.h:25
Global header file containing a few global variables. Part of the code generation section...
name
Definition: setup.py:112
void setVarMode(const std::string &varName, VarMode mode)
Set variable mode of neuron model state variable.
Definition: currentSource.cc:16
VarMode defaultVarMode
What is the default behaviour for model state variables? Historically, everything was allocated on bo...
Definition: global.cc:43
const CurrentSourceModels::Base * getCurrentSourceModel() const
Gets the current source model used by this group.
Definition: currentSource.h:46
bool isInitRNGRequired(VarInit varInitMode) const
Does this current source group require an RNG for it&#39;s init code.
Definition: currentSource.cc:78
CurrentSource(const std::string &name, const CurrentSourceModels::Base *currentSourceModel, const std::vector< double > &params, const std::vector< NewModels::VarInit > &varInitialisers)
Definition: currentSource.h:20
const std::vector< NewModels::VarInit > & getVarInitialisers() const
Definition: currentSource.h:50
bool isDeviceVarInitRequired() const
Is device var init code required for any variables in this current source.
Definition: currentSource.cc:88
void initDerivedParams(double dt)
Definition: currentSource.cc:26
VarMode getVarMode(const std::string &varName) const
Get variable mode used by current source model state variable.
Definition: currentSource.cc:21
CurrentSource()=delete
VarInit
Definition: variableMode.h:18
Definition: currentSource.h:17