PetaVision  Alpha
HyPerLCALayer.hpp
1 /*
2  * HyPerLCALayer.hpp
3  *
4  * Created on: Jan 24, 2013
5  * Author: garkenyon
6  */
7 
8 #ifndef HYPERLCALAYER_HPP_
9 #define HYPERLCALAYER_HPP_
10 
11 #include "ANNLayer.hpp"
12 #include "probes/AdaptiveTimeScaleProbe.hpp"
13 
14 namespace PV {
15 
16 class HyPerLCALayer : public PV::ANNLayer {
17  public:
18  HyPerLCALayer(const char *name, HyPerCol *hc);
19  virtual ~HyPerLCALayer();
20  virtual double getDeltaUpdateTime() override;
21  virtual int requireChannel(int channelNeeded, int *numChannelsResult) override;
22 
23  protected:
24  HyPerLCALayer();
25  int initialize(const char *name, HyPerCol *hc);
26  virtual Response::Status
27  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
28  virtual Response::Status allocateDataStructures() override;
29  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
30 
41  virtual void ioParam_timeConstantTau(enum ParamsIOFlag ioFlag);
42 
47  virtual void ioParam_selfInteract(enum ParamsIOFlag ioFlag);
48 
53  virtual void ioParam_adaptiveTimeScaleProbe(enum ParamsIOFlag ioFlag);
56  virtual Response::Status updateState(double time, double dt) override;
57 
58 #ifdef PV_USE_CUDA
59  virtual Response::Status updateStateGpu(double time, double dt) override;
60 #endif
61 
62  virtual float getChannelTimeConst(enum ChannelType channel_type) override {
63  return timeConstantTau;
64  };
65 
66 #ifdef PV_USE_CUDA
67  virtual int allocateUpdateKernel() override;
68 #endif
69 
70  double *deltaTimes(); // TODO: make const-correct
71  // Better name? getDeltaTimes isn't good because it sounds like it's just the getter-method.
72 
73  private:
74  int initialize_base();
75 
76  // Data members
77  protected:
78  float timeConstantTau;
79  bool selfInteract;
80  char *mAdaptiveTimeScaleProbeName = nullptr;
81  AdaptiveTimeScaleProbe *mAdaptiveTimeScaleProbe = nullptr;
82  std::vector<double> mDeltaTimes;
83 
84 #ifdef PV_USE_CUDA
85  PVCuda::CudaBuffer *d_dtAdapt;
86  PVCuda::CudaBuffer *d_verticesV;
87  PVCuda::CudaBuffer *d_verticesA;
88  PVCuda::CudaBuffer *d_slopes;
89 #endif
90 }; // class HyPerLCALayer
91 
92 } /* namespace PV */
93 #endif /* HYPERLCALAYER_HPP_ */
virtual void ioParam_adaptiveTimeScaleProbe(enum ParamsIOFlag ioFlag)
adaptiveTimeScaleProbe: If using adaptive timesteps, the name of the AdaptiveTimeScaleProbe that will...
virtual double getDeltaUpdateTime() override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual void ioParam_selfInteract(enum ParamsIOFlag ioFlag)
timeConstantTau: the self-interaction coefficient s for the LCA dynamics, which models the equation d...
virtual void ioParam_timeConstantTau(enum ParamsIOFlag ioFlag)
timeConstantTau: the time constant tau for the LCA dynamics, which models the equation dV/dt = 1/tau*...