PetaVision  Alpha
PatchSize.hpp
1 /*
2  * PatchSize.hpp
3  *
4  * Created on: Jan 5, 2018
5  * Author: Pete Schultz
6  */
7 
8 #ifndef PATCHSIZE_HPP_
9 #define PATCHSIZE_HPP_
10 
11 #include "columns/BaseObject.hpp"
12 #include "components/ConnectionData.hpp"
13 
14 namespace PV {
15 
22 class PatchSize : public BaseObject {
23  protected:
35  virtual void ioParam_nxp(enum ParamsIOFlag ioFlag);
36 
42  virtual void ioParam_nyp(enum ParamsIOFlag ioFlag);
43 
48  virtual void ioParam_nfp(enum ParamsIOFlag ioFlag);
49  // end of PatchSize parameters
51 
52  public:
53  PatchSize(char const *name, HyPerCol *hc);
54 
55  virtual ~PatchSize();
56 
57  int getPatchSizeX() const { return mPatchSizeX; }
58  int getPatchSizeY() const { return mPatchSizeY; }
59  int getPatchSizeF() const { return mPatchSizeF; }
60  ConnectionData *getConnectionData() const { return mConnectionData; }
61 
75  static int calcPostPatchSize(int prePatchSize, int numNeuronsPre, int numNeuronsPost);
76 
77  protected:
78  PatchSize() {}
79 
80  int initialize(char const *name, HyPerCol *hc);
81 
82  virtual void setObjectType() override;
83 
84  int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override;
85 
93  virtual Response::Status
94  communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) override;
95 
96  protected:
97  int mPatchSizeX = 1;
98  int mPatchSizeY = 1;
99  int mPatchSizeF = -1;
100 
101  ConnectionData *mConnectionData = nullptr;
102  bool mWarnDefaultNfp = true;
103  // Whether to print a warning if the default nfp is used.
104  // Derived classes can set to false if no warning is necessary.
105 };
106 
107 } // namespace PV
108 
109 #endif // PATCHSIZE_HPP_
virtual void ioParam_nyp(enum ParamsIOFlag ioFlag)
nyp: Specifies the y patch size
Definition: PatchSize.cpp:35
virtual void ioParam_nxp(enum ParamsIOFlag ioFlag)
nxp: Specifies the x patch size
Definition: PatchSize.cpp:31
int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
Definition: PatchSize.cpp:24
virtual void ioParam_nfp(enum ParamsIOFlag ioFlag)
nfp: Specifies the post feature patch size. If negative, it can be set during the CommunicateInitInfo...
Definition: PatchSize.cpp:39
static int calcPostPatchSize(int prePatchSize, int numNeuronsPre, int numNeuronsPost)
Definition: PatchSize.cpp:101
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override
If nfp was set to a negative number in params, set it here to the postsynaptic layer&#39;s nf...
Definition: PatchSize.cpp:49