GeNN  4.9.0
GPU enhanced Neuronal Networks (GeNN)
customUpdateModels.h
Go to the documentation of this file.
1 #pragma once
2 
3 // GeNN includes
4 #include "gennExport.h"
5 #include "models.h"
6 
7 //----------------------------------------------------------------------------
8 // Macros
9 //----------------------------------------------------------------------------
10 #define DECLARE_CUSTOM_UPDATE_MODEL_EGP_REF(TYPE, NUM_PARAMS, NUM_VARS, NUM_VAR_REFS, NUM_EGP_REFS) \
11  DECLARE_SNIPPET(TYPE, NUM_PARAMS); \
12  typedef Models::VarInitContainerBase<NUM_VARS> VarValues; \
13  typedef Models::VarReferenceContainerBase<NUM_VAR_REFS> VarReferences; \
14  typedef Models::WUVarReferenceContainerBase<NUM_VAR_REFS> WUVarReferences; \
15  typedef Models::EGPReferenceContainerBase<NUM_EGP_REFS> EGPReferences
16 
17 #define DECLARE_CUSTOM_UPDATE_MODEL(TYPE, NUM_PARAMS, NUM_VARS, NUM_VAR_REFS) \
18  DECLARE_CUSTOM_UPDATE_MODEL_EGP_REF(TYPE, NUM_PARAMS, NUM_VARS, NUM_VAR_REFS, 0)
19 
20 #define SET_VAR_REFS(...) virtual VarRefVec getVarRefs() const override{ return __VA_ARGS__; }
21 #define SET_EXTRA_GLOBAL_PARAM_REFS(...) virtual EGPRefVec getExtraGlobalParamRefs() const override{ return __VA_ARGS__; }
22 #define SET_UPDATE_CODE(UPDATE_CODE) virtual std::string getUpdateCode() const override{ return UPDATE_CODE; }
23 
24 
25 //----------------------------------------------------------------------------
26 // CustomUpdateModels::Base
27 //----------------------------------------------------------------------------
29 {
32 {
33 public:
34  //----------------------------------------------------------------------------
35  // Declared virtuals
36  //----------------------------------------------------------------------------
38  virtual VarRefVec getVarRefs() const{ return {}; }
39 
41  virtual EGPRefVec getExtraGlobalParamRefs() const { return {}; }
42 
44  virtual std::string getUpdateCode() const{ return ""; }
45 
46  //----------------------------------------------------------------------------
47  // Public API
48  //----------------------------------------------------------------------------
50  boost::uuids::detail::sha1::digest_type getHashDigest() const;
51 
53  void validate() const;
54 };
55 
56 //----------------------------------------------------------------------------
57 // CustomUpdateModels::Transpose
58 //----------------------------------------------------------------------------
60 class Transpose : public Base
61 {
63 
64  SET_VAR_REFS({{"variable", "scalar", VarAccessMode::READ_WRITE}});
65 };
66 } // CustomUpdateModels
67 
std::vector< EGPRef > EGPRefVec
Definition: models.h:117
Definition: models.h:48
#define GENN_EXPORT
Definition: gennExport.h:13
Minimal custom update model for calculating tranpose.
Definition: customUpdateModels.h:60
Base class for all current source models.
Definition: customUpdateModels.h:31
virtual std::string getUpdateCode() const
Gets the code that performs the custom update.
Definition: customUpdateModels.h:44
Definition: customUpdateModels.h:28
virtual EGPRefVec getExtraGlobalParamRefs() const
Gets names and types (as strings) of model extra global parameter references.
Definition: customUpdateModels.h:41
std::vector< VarRef > VarRefVec
Definition: models.h:116
#define DECLARE_CUSTOM_UPDATE_MODEL(TYPE, NUM_PARAMS, NUM_VARS, NUM_VAR_REFS)
Definition: customUpdateModels.h:17
#define SET_VAR_REFS(...)
Definition: customUpdateModels.h:20
virtual VarRefVec getVarRefs() const
Gets names and types (as strings) of model variable references.
Definition: customUpdateModels.h:38