GeNN  3.3.0
GPU enhanced Neuronal Networks (GeNN)
newPostsynapticModels.h
Go to the documentation of this file.
1 #pragma once
2 
3 // GeNN includes
4 #include "newModels.h"
5 #include "postSynapseModels.h"
6 
7 //----------------------------------------------------------------------------
8 // Macros
9 //----------------------------------------------------------------------------
10 #define SET_DECAY_CODE(DECAY_CODE) virtual std::string getDecayCode() const override{ return DECAY_CODE; }
11 #define SET_CURRENT_CONVERTER_CODE(CURRENT_CONVERTER_CODE) virtual std::string getApplyInputCode() const override{ return "$(Isyn) += " CURRENT_CONVERTER_CODE ";"; }
12 #define SET_APPLY_INPUT_CODE(APPLY_INPUT_CODE) virtual std::string getApplyInputCode() const override{ return APPLY_INPUT_CODE; }
13 #define SET_SUPPORT_CODE(SUPPORT_CODE) virtual std::string getSupportCode() const override{ return SUPPORT_CODE; }
14 
15 //----------------------------------------------------------------------------
16 // PostsynapticModels::Base
17 //----------------------------------------------------------------------------
19 {
21 class Base : public NewModels::Base
22 {
23 public:
24  //----------------------------------------------------------------------------
25  // Declared virtuals
26  //----------------------------------------------------------------------------
27  virtual std::string getDecayCode() const{ return ""; }
28  virtual std::string getApplyInputCode() const{ return ""; }
29  virtual std::string getSupportCode() const{ return ""; }
30 
34 };
35 
36 //----------------------------------------------------------------------------
37 // PostsynapticModels::LegacyWrapper
38 //----------------------------------------------------------------------------
39 class LegacyWrapper : public NewModels::LegacyWrapper<Base, postSynModel, postSynModels>
40 {
41 public:
42  LegacyWrapper(unsigned int legacyTypeIndex) : NewModels::LegacyWrapper<Base, postSynModel, postSynModels>(legacyTypeIndex)
43  {
44  }
45 
46  //----------------------------------------------------------------------------
47  // Base virtuals
48  //----------------------------------------------------------------------------
49  virtual std::string getDecayCode() const;
50  virtual std::string getApplyInputCode() const;
51  virtual std::string getSupportCode() const;
52 };
53 
54 //----------------------------------------------------------------------------
55 // PostsynapticModels::ExpConductance
56 //----------------------------------------------------------------------------
58 
63 class ExpCond : public Base
64 {
65 public:
67 
68  SET_DECAY_CODE("$(inSyn)*=$(expDecay);");
69 
70  SET_CURRENT_CONVERTER_CODE("$(inSyn) * ($(E) - $(V))");
71 
72  SET_PARAM_NAMES({"tau", "E"});
73 
74  SET_DERIVED_PARAMS({{"expDecay", [](const vector<double> &pars, double dt){ return std::exp(-dt / pars[0]); }}});
75 };
76 
77 //----------------------------------------------------------------------------
78 // PostsynapticModels::DeltaCurr
79 //----------------------------------------------------------------------------
81 
82 class DeltaCurr : public Base
83 {
84 public:
86 
87  SET_CURRENT_CONVERTER_CODE("$(inSyn); $(inSyn) = 0");
88 };
89 }
Definition: newPostsynapticModels.h:39
Definition: newPostsynapticModels.h:18
Class to hold the information that defines a post-synaptic model (a model of how synapses affect post...
Definition: postSynapseModels.h:17
#define SET_DECAY_CODE(DECAY_CODE)
Definition: newPostsynapticModels.h:10
LegacyWrapper(unsigned int legacyTypeIndex)
Definition: newPostsynapticModels.h:42
Wrapper around old-style models stored in global arrays and referenced by index.
Definition: newModels.h:170
virtual NewModels::Base::StringPairVec getExtraGlobalParams() const
Definition: newPostsynapticModels.h:33
Base class for all postsynaptic models.
Definition: newPostsynapticModels.h:21
Simple delta current synapse.
Definition: newPostsynapticModels.h:82
Base class for all models - in addition to the parameters snippets have, models can have state variab...
Definition: newModels.h:132
#define SET_DERIVED_PARAMS(...)
Definition: snippet.h:29
#define DECLARE_MODEL(TYPE, NUM_PARAMS, NUM_VARS)
Definition: newModels.h:18
Exponential decay with synaptic input treated as a conductance value.
Definition: newPostsynapticModels.h:63
vector< postSynModel > postSynModels
Global C++ vector containing all post-synaptic update model descriptions.
Definition: postSynapseModels.cc:28
#define SET_PARAM_NAMES(...)
Definition: snippet.h:28
#define SET_CURRENT_CONVERTER_CODE(CURRENT_CONVERTER_CODE)
Definition: newPostsynapticModels.h:11
virtual std::string getDecayCode() const
Definition: newPostsynapticModels.h:27
virtual std::string getSupportCode() const
Definition: newPostsynapticModels.h:29
virtual std::string getApplyInputCode() const
Definition: newPostsynapticModels.h:28
std::vector< std::pair< std::string, std::string > > StringPairVec
Definition: snippet.h:117
Definition: codeGenUtils.h:24