GeNN  2.2.3
GPU enhanced Neuronal Networks (GeNN)
simulation_synapse_policy_none.h
Go to the documentation of this file.
1 #pragma once
2 
3 // Standard includes
4 #include <numeric>
5 
6 //----------------------------------------------------------------------------
7 // SimulationSynapsePolicyNone
8 //----------------------------------------------------------------------------
10 {
11 public:
12  //----------------------------------------------------------------------------
13  // Public API
14  //----------------------------------------------------------------------------
15  void Init()
16  {
17  }
18 
19  template<typename UpdateFn, typename StepGeNNFn>
20  float Simulate(UpdateFn updateFn, StepGeNNFn stepGeNNFn)
21  {
22  float err = 0.0f;
23  inputpre = 0.0f;
24  for (int i = 0; i < (int)(20.0f / DT); i++)
25  {
26  // **YUCK** update global time - this shouldn't be user responsibility
27  t = i * DT;
28 
29  // for all pre-synaptic neurons
30  float x[10];
31  for (int j = 0; j < 10; j++)
32  {
33  // generate expected values
34  float newX;
35  if(updateFn(i, j, t, newX))
36  {
37  x[j]= newX;
38  }
39  else
40  {
41  x[j] = 0.0f;
42  }
43  }
44 
45  // Add error for this time step to total
46  err += std::inner_product(&x[0], &x[10],
47  &xpre[glbSpkShiftpre],
48  0.0f,
49  std::plus<float>(),
50  [](float a, float b){ return abs(a - b); });
51 
52  // Update global
53  inputpre = pow(t, 2.0);
54 
55  // Step GeNN kernel
56  stepGeNNFn();
57  }
58 
59  return err;
60  }
61 };
float Simulate(UpdateFn updateFn, StepGeNNFn stepGeNNFn)
Definition: simulation_synapse_policy_none.h:20
#define DT
This defines the global time step at which the simulation will run.
Definition: HHVclampGA_project/model/MBody1.cc:21
Definition: simulation_synapse_policy_none.h:9
void Init()
Definition: simulation_synapse_policy_none.h:15