GeNN  4.9.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 "currentSourceModels.h"
11 #include "gennExport.h"
12 #include "variableMode.h"
13 
14 // Forward declarations
16 
17 //------------------------------------------------------------------------
18 // CurrentSource
19 //------------------------------------------------------------------------
21 {
22 public:
23  CurrentSource(const CurrentSource&) = delete;
24  CurrentSource() = delete;
25 
26  //------------------------------------------------------------------------
27  // Public methods
28  //------------------------------------------------------------------------
30  void setVarLocation(const std::string &varName, VarLocation loc);
31 
33 
35  void setExtraGlobalParamLocation(const std::string &paramName, VarLocation loc);
36 
37  //------------------------------------------------------------------------
38  // Public const methods
39  //------------------------------------------------------------------------
40  const std::string &getName() const{ return m_Name; }
41 
43  const CurrentSourceModels::Base *getCurrentSourceModel() const{ return m_CurrentSourceModel; }
44 
45  const std::vector<double> &getParams() const{ return m_Params; }
46  const std::vector<Models::VarInit> &getVarInitialisers() const{ return m_VarInitialisers; }
47 
49  VarLocation getVarLocation(const std::string &varName) const;
50 
52  VarLocation getVarLocation(size_t index) const{ return m_VarLocation.at(index); }
53 
55 
56  VarLocation getExtraGlobalParamLocation(const std::string &paramName) const;
57 
59 
60  VarLocation getExtraGlobalParamLocation(size_t index) const{ return m_ExtraGlobalParamLocation.at(index); }
61 
62 protected:
63  CurrentSource(const std::string &name, const CurrentSourceModels::Base *currentSourceModel,
64  const std::vector<double> &params, const std::vector<Models::VarInit> &varInitialisers,
65  const NeuronGroupInternal *trgNeuronGroup, VarLocation defaultVarLocation,
66  VarLocation defaultExtraGlobalParamLocation);
67 
68  //------------------------------------------------------------------------
69  // Protected methods
70  //------------------------------------------------------------------------
71  void initDerivedParams(double dt);
72 
73  //------------------------------------------------------------------------
74  // Protected const methods
75  //------------------------------------------------------------------------
76  const NeuronGroupInternal *getTrgNeuronGroup() const{ return m_TrgNeuronGroup; }
77 
78  const std::vector<double> &getDerivedParams() const{ return m_DerivedParams; }
79 
81  bool isSimRNGRequired() const;
82 
84  bool isInitRNGRequired() const;
85 
86  bool isZeroCopyEnabled() const;
87 
89 
90  boost::uuids::detail::sha1::digest_type getHashDigest() const;
91 
93 
94  boost::uuids::detail::sha1::digest_type getInitHashDigest() const;
95 
96  boost::uuids::detail::sha1::digest_type getVarLocationHashDigest() const;
97 private:
98  //------------------------------------------------------------------------
99  // Members
100  //------------------------------------------------------------------------
101  std::string m_Name;
102 
103  const CurrentSourceModels::Base *m_CurrentSourceModel;
104  std::vector<double> m_Params;
105  std::vector<double> m_DerivedParams;
106  std::vector<Models::VarInit> m_VarInitialisers;
107 
108  const NeuronGroupInternal *m_TrgNeuronGroup;
109 
111  std::vector<VarLocation> m_VarLocation;
112 
114  std::vector<VarLocation> m_ExtraGlobalParamLocation;
115 };
const std::string & getName() const
Definition: currentSource.h:40
Definition: neuronGroupInternal.h:9
const NeuronGroupInternal * getTrgNeuronGroup() const
Definition: currentSource.h:76
VarLocation
< Flags defining which memory space variables should be allocated in
Definition: variableMode.h:10
Base class for all current source models.
Definition: currentSourceModels.h:26
const std::vector< Models::VarInit > & getVarInitialisers() const
Definition: currentSource.h:46
const std::vector< double > & getDerivedParams() const
Definition: currentSource.h:78
const std::vector< double > & getParams() const
Definition: currentSource.h:45
#define GENN_EXPORT
Definition: gennExport.h:13
const CurrentSourceModels::Base * getCurrentSourceModel() const
Gets the current source model used by this group.
Definition: currentSource.h:43
VarLocation getVarLocation(size_t index) const
Get variable location for current source model state variable.
Definition: currentSource.h:52
VarLocation getExtraGlobalParamLocation(size_t index) const
Get location of neuron model extra global parameter by omdex.
Definition: currentSource.h:60
Definition: currentSource.h:20