PetaVision  Alpha
HyPerDeliveryFacade.hpp
1 /*
2  * HyPerDeliveryFacade.hpp
3  *
4  * Created on: Aug 24, 2017
5  * Author: Pete Schultz
6  */
7 
8 #ifndef HYPERDELIVERYFACADE_HPP_
9 #define HYPERDELIVERYFACADE_HPP_
10 
11 #include "delivery/BaseDelivery.hpp"
12 #include "delivery/HyPerDelivery.hpp"
13 
14 namespace PV {
15 
23  protected:
38  virtual void ioParam_accumulateType(enum ParamsIOFlag ioFlag);
39 
51  virtual void ioParam_updateGSynFromPostPerspective(enum ParamsIOFlag ioFlag); // End of list of HyPerDeliveryFacade parameters.
53 
54  public:
55  HyPerDeliveryFacade(char const *name, HyPerCol *hc);
56 
57  virtual ~HyPerDeliveryFacade();
58 
59  virtual void deliver() override;
60 
61  virtual void deliverUnitInput(float *recvBuffer) override;
62 
63  virtual bool isAllInputReady() override;
64 
65  HyPerDelivery::AccumulateType getAccumulateType() const { return mAccumulateType; }
66 
67  bool getUpdateGSynFromPostPerspective() const { return mUpdateGSynFromPostPerspective; }
68 
69  bool getConvertRateToSpikeCount() const { return mConvertRateToSpikeCount; }
70 
71  protected:
73 
74  int initialize(char const *name, HyPerCol *hc);
75 
76  virtual void setObjectType() override;
77 
78  virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
79 
80  void createDeliveryIntern();
81 
82  virtual Response::Status
83  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
84 
85 #ifdef PV_USE_CUDA
86  virtual Response::Status
87  setCudaDevice(std::shared_ptr<SetCudaDeviceMessage const> message) override;
88 #endif // PV_USE_CUDA
89 
90  virtual Response::Status allocateDataStructures() override;
91 
92  // Data members
93  protected:
94  HyPerDelivery::AccumulateType mAccumulateType = HyPerDelivery::CONVOLVE;
95 
96  char *mAccumulateTypeString = nullptr;
97  bool mUpdateGSynFromPostPerspective = false;
98 
99  // Whether to check if pre-layer is spiking and, if it is not,
100  // scale activity by dt to convert it to a spike count
101  bool mConvertRateToSpikeCount = false;
102 
103  HyPerDelivery *mDeliveryIntern = nullptr;
104 }; // end class HyPerDeliveryFacade
105 
106 } // end namespace PV
107 
108 #endif // HYPERDELIVERYFACADE_HPP_
virtual bool isAllInputReady() override
virtual void ioParam_updateGSynFromPostPerspective(enum ParamsIOFlag ioFlag)
updateGSynFromPostPerspective: Specifies if the connection should push from pre or pull from post...
virtual void ioParam_accumulateType(enum ParamsIOFlag ioFlag)
pvpatchAccumulateType: Specifies the method to accumulate synaptic input
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override