PetaVision  Alpha
TransposePatchSize.cpp
1 /*
2  * TransposePatchSize.cpp
3  *
4  * Created on: Jan 5, 2018
5  * Author: pschultz
6  */
7 
8 #include "TransposePatchSize.hpp"
9 #include "columns/HyPerCol.hpp"
10 
11 namespace PV {
12 
13 TransposePatchSize::TransposePatchSize(char const *name, HyPerCol *hc) { initialize(name, hc); }
14 
15 TransposePatchSize::TransposePatchSize() {}
16 
17 TransposePatchSize::~TransposePatchSize() {}
18 
19 int TransposePatchSize::initialize(char const *name, HyPerCol *hc) {
20  return PatchSize::initialize(name, hc);
21 }
22 
23 void TransposePatchSize::setObjectType() { mObjectType = "TransposePatchSize"; }
24 
25 void TransposePatchSize::setPatchSize(PatchSize *originalPatchSize) {
26  auto *originalConnectionData = originalPatchSize->getConnectionData();
27  pvAssert(originalConnectionData);
28  int const nxpOrig = originalPatchSize->getPatchSizeX();
29  int const nypOrig = originalPatchSize->getPatchSizeY();
30  PVLayerLoc const *originalPreLoc = originalConnectionData->getPre()->getLayerLoc();
31  PVLayerLoc const *originalPostLoc = originalConnectionData->getPost()->getLayerLoc();
32  mPatchSizeX = calcPostPatchSize(nxpOrig, originalPreLoc->nx, originalPostLoc->nx);
33  mPatchSizeY = calcPostPatchSize(nypOrig, originalPreLoc->ny, originalPostLoc->ny);
34  mPatchSizeF = -1;
35 }
36 
37 } // namespace PV
static int calcPostPatchSize(int prePatchSize, int numNeuronsPre, int numNeuronsPost)
Definition: PatchSize.cpp:101