PetaVision  Alpha
ISTALayer.hpp
1 /*
2  * ISTALayer.hpp
3  *
4  * Created on: Jan 24, 2013
5  * Author: garkenyon
6  */
7 
8 #ifndef ISTALAYER_HPP_
9 #define ISTALAYER_HPP_
10 // TODO: Take care of code duplication between ISTALayer and HyPerLCALayer.
11 
12 #include "ANNLayer.hpp"
13 #include "probes/AdaptiveTimeScaleProbe.hpp"
14 
15 namespace PV {
16 
17 class ISTALayer : public PV::ANNLayer {
18  public:
19  ISTALayer(const char *name, HyPerCol *hc);
20  virtual ~ISTALayer();
21  virtual double getDeltaUpdateTime() override;
22  virtual int requireChannel(int channelNeeded, int *numChannelsResult) override;
23 
24  protected:
25  ISTALayer();
26  int initialize(const char *name, HyPerCol *hc);
27  virtual Response::Status allocateDataStructures() override;
28  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
29 
40  virtual void ioParam_timeConstantTau(enum ParamsIOFlag ioFlag);
45  virtual void ioParam_selfInteract(enum ParamsIOFlag ioFlag);
46 
51  virtual void ioParam_adaptiveTimeScaleProbe(enum ParamsIOFlag ioFlag);
54  virtual Response::Status updateState(double time, double dt) override;
55 
56 #ifdef PV_USE_CUDA
57  virtual Response::Status updateStateGpu(double time, double dt) override;
58 #endif
59 
60  virtual float getChannelTimeConst(enum ChannelType channel_type) override {
61  return timeConstantTau;
62  }
63 
64 #ifdef PV_USE_CUDA
65  virtual int allocateUpdateKernel() override;
66 #endif
67 
68  double *deltaTimes(); // TODO: make const-correct
69  // Better name? getDeltaTimes isn't good because it sounds like it's just the getter-method.
70 
71  private:
72  int initialize_base();
73 #ifdef PV_USE_CUDA
74  PVCuda::CudaBuffer *d_dtAdapt;
75 #endif
76 
77  // Data members
78  protected:
79  float timeConstantTau;
80  bool selfInteract;
81  char *mAdaptiveTimeScaleProbeName = nullptr;
82  AdaptiveTimeScaleProbe *mAdaptiveTimeScaleProbe = nullptr;
83  std::vector<double> mDeltaTimes;
84 }; // class ISTALayer
85 
86 } /* namespace PV */
87 #endif /* ISTALAYER_HPP_ */
virtual void ioParam_timeConstantTau(enum ParamsIOFlag ioFlag)
Definition: ISTALayer.cpp:71
virtual void ioParam_selfInteract(enum ParamsIOFlag ioFlag)
Definition: ISTALayer.cpp:76
virtual void ioParam_adaptiveTimeScaleProbe(enum ParamsIOFlag ioFlag)
adaptiveTimeScaleProbe: If using adaptive timesteps, the name of the AdaptiveTimeScaleProbe that will...
Definition: ISTALayer.cpp:83
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
Definition: ISTALayer.cpp:63
virtual double getDeltaUpdateTime() override
Definition: ISTALayer.cpp:175