31 #define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS) \ 32 DECLARE_SNIPPET(TYPE, NUM_PARAMS); \ 33 typedef Models::VarInitContainerBase<NUM_VARS> VarValues; \ 34 typedef Models::VarInitContainerBase<0> PreVarValues; \ 35 typedef Models::VarInitContainerBase<0> PostVarValues 37 #define IMPLEMENT_MODEL(TYPE) IMPLEMENT_SNIPPET(TYPE) 39 #define SET_VARS(...) virtual VarVec getVars() const override{ return __VA_ARGS__; } 60 Var(
const std::string &n,
const std::string &t,
VarAccess a) : name(n), type(t), access(a)
67 bool operator == (
const Var &other)
const 69 return ((name == other.
name) && (type == other.
type) && (access == other.
access));
86 bool operator == (
const VarRef &other)
const 88 return ((name == other.
name) && (type == other.
type) && (access == other.
access));
98 EGPRef(
const std::string &n,
const std::string &t) : name(n), type(t)
103 bool operator == (
const EGPRef &other)
const 105 return ((name == other.
name) && (type == other.
type));
131 return getNamedVecIndex(varName, getVars());
138 void updateHash(boost::uuids::detail::sha1 &hash)
const;
141 void validate()
const;
168 template<
size_t NumVars>
193 GetTargetNameFn getTargetName, IsBatchedFn isBatched)
194 : m_VarIndex(varIndex), m_Var(varVec.at(varIndex)), m_GetTargetName(getTargetName), m_IsBatched(isBatched)
203 GetTargetNameFn m_GetTargetName;
204 IsBatchedFn m_IsBatched;
216 unsigned int getSize()
const {
return m_Size; }
233 typedef std::function<const NeuronGroup*(void)> GetDelayNeuronGroupFn;
238 VarReference(
unsigned int size, GetDelayNeuronGroupFn getDelayNeuronGroup,
246 GetDelayNeuronGroupFn m_GetDelayNeuronGroup;
252 template<
size_t NumVars>
262 const SynapseGroup *transposeSG =
nullptr,
const std::string &transposeVarName =
"");
281 size_t m_TransposeVarIndex;
289 template<
size_t NumVars>
317 const std::string &targetName)
318 : m_EGPIndex(egpIndex), m_EGP(egpVec.at(egpIndex)), m_TargetName(targetName)
325 std::string m_TargetName;
331 template<
size_t NumEGPs>
std::string type
Definition: models.h:73
Definition: neuronGroup.h:21
Definition: neuronGroupInternal.h:9
VarAccessMode
Supported combination of VarAccessModeAttribute.
Definition: varAccess.h:19
std::vector< EGPRef > EGPRefVec
Definition: models.h:117
std::string getTargetName() const
Definition: models.h:182
const Models::Base::Var & getTransposeVar() const
Definition: models.h:271
std::vector< Var > VarVec
Definition: models.h:115
This variable is read only.
Definition: customUpdate.h:199
VarInit(const InitVarSnippet::Base *snippet, const std::vector< double > ¶ms)
Definition: models.h:154
#define GENN_EXPORT
Definition: gennExport.h:13
std::function< bool(void)> IsBatchedFn
Definition: models.h:190
EGPRef(const std::string &n, const std::string &t)
Definition: models.h:98
Definition: snippet.h:250
unsigned int getSize() const
Definition: models.h:216
size_t getTransposeVarIndex() const
Definition: models.h:272
std::string type
Definition: models.h:109
VarRef(const std::string &n, const std::string &t, VarAccessMode a)
Definition: models.h:79
Definition: customUpdate.h:252
VarAccess
Supported combinations of VarAccessMode and VarAccessDuplication.
Definition: varAccess.h:36
Helper class for generating code - automatically inserts brackets, indents etc.
Definition: backendBase.h:30
Models::VarReference createWUPreVarRef(const SynapseGroup *sg, const std::string &varName)
Creates a reference to a weight update model presynaptic variable.
Definition: modelSpec.h:156
std::string getTransposeTargetName() const
Definition: models.h:273
std::function< std::string(void)> GetTargetNameFn
Definition: models.h:189
Definition: synapseGroupInternal.h:9
Models::EGPReference createEGPRef(const NeuronGroup *ng, const std::string &egpName)
Creates a reference to a neuron group extra global parameter.
Definition: modelSpec.h:181
VarRef(const std::string &n, const std::string &t)
Definition: models.h:81
Models::EGPReference createWUEGPRef(const SynapseGroup *sg, const std::string &egpName)
Creates a reference to a weight update model extra global parameter.
Definition: modelSpec.h:211
VarInit(double constant)
Definition: models.h:159
A variable has a name, a type and an access type.
Definition: models.h:58
Definition: synapseGroup.h:24
std::string getTargetName() const
Definition: models.h:303
Models::VarReference createVarRef(const NeuronGroup *ng, const std::string &varName)
Creates a reference to a neuron group variable.
Definition: modelSpec.h:132
Definition: initVarSnippet.h:17
virtual VarVec getVars() const
Gets names and types (as strings) of model variables.
Definition: models.h:123
size_t getVarIndex(const std::string &varName) const
Find the index of a named variable.
Definition: models.h:129
size_t getEGPIndex() const
Definition: models.h:302
VarRef()
Definition: models.h:83
Models::EGPReference createPSMEGPRef(const SynapseGroup *sg, const std::string &egpName)
Creates a reference to a postsynaptic model extra global parameter.
Definition: modelSpec.h:205
const Models::Base::Var & getVar() const
Definition: models.h:180
VarAccessMode access
Definition: models.h:93
const NeuronGroup * getDelayNeuronGroup() const
Definition: models.h:217
VarAccess access
Definition: models.h:74
Base class for all value initialisation snippets.
Definition: initVarSnippet.h:15
Models::VarReference createPSMVarRef(const SynapseGroup *sg, const std::string &varName)
Creates a reference to a postsynaptic model variable.
Definition: modelSpec.h:150
std::string name
Definition: models.h:108
Var(const std::string &n, const std::string &t)
Definition: models.h:62
EGPRef()
Definition: models.h:100
std::string type
Definition: models.h:92
An extra global parameter has a name and a type.
Definition: snippet.h:131
Base class for all code snippets.
Definition: snippet.h:120
std::vector< VarRef > VarRefVec
Definition: models.h:116
VarReferenceBase(size_t varIndex, const Models::Base::VarVec &varVec, GetTargetNameFn getTargetName, IsBatchedFn isBatched)
Definition: models.h:192
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: gennUtils.h:22
Var()
Definition: models.h:64
const Models::Base::EGP & getEGP() const
Definition: models.h:301
size_t getVarIndex() const
Definition: models.h:181
bool isBatched() const
Definition: models.h:183
std::string name
Definition: models.h:72
GENN_EXPORT void updateHash(const EGPReference &v, boost::uuids::detail::sha1 &hash)
Definition: models.cc:259
Var(const std::string &n, const std::string &t, VarAccess a)
Definition: models.h:60
Models::VarReference createWUPostVarRef(const SynapseGroup *sg, const std::string &varName)
Creates a reference to a weight update model postsynapticvariable.
Definition: modelSpec.h:162
std::string name
Definition: models.h:91
Definition: currentSourceInternal.h:9
Definition: currentSource.h:20
std::vector< EGP > EGPVec
Definition: snippet.h:179