PetaVision  Alpha
ConstantLayer.cpp
1 /*
2  * ConstantLayer.hpp
3  *
4  * Created on: Dec 17, 2013
5  * Author: slundquist
6  */
7 
8 #include "ConstantLayer.hpp"
9 
10 namespace PV {
11 
12 ConstantLayer::ConstantLayer() { initialize_base(); }
13 
14 ConstantLayer::ConstantLayer(const char *name, HyPerCol *hc) {
15  initialize_base();
16  initialize(name, hc);
17 }
18 
19 ConstantLayer::~ConstantLayer() {}
20 
21 int ConstantLayer::initialize_base() {
22  writeStep = -1; // HyPerLayer default for writeStep is 1.0, but -1 (never write) is a better
23  // default for ConstantLayer
24  return PV_SUCCESS;
25 }
26 
27 int ConstantLayer::initialize(const char *name, HyPerCol *hc) {
28  int status = HyPerLayer::initialize(name, hc);
29  return status;
30 }
31 
32 void ConstantLayer::ioParam_triggerLayerName(enum ParamsIOFlag ioFlag) {
33  // This layer is a never a trigger layer, so set to null
34  if (ioFlag == PARAMS_IO_READ) {
35  triggerLayerName = nullptr;
36  triggerFlag = false;
37  parent->parameters()->handleUnnecessaryStringParameter(name, "triggerLayerName", nullptr);
38  }
39 }
40 
41 Response::Status
42 ConstantLayer::communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) {
43  return HyPerLayer::communicateInitInfo(message);
44 }
45 
46 // bool ConstantLayer::checkIfUpdateNeeded() {
47 bool ConstantLayer::needUpdate(double timestamp, double dt) {
48  // Only update on initialization
49  assert(timestamp >= 0.0);
50  return (timestamp == 0.0);
51 }
52 
53 } /* namespace PV */
virtual void ioParam_triggerLayerName(enum ParamsIOFlag ioFlag) override
ConstantLayer does not use triggerLayerName.
virtual bool needUpdate(double timestamp, double dt) override
int initialize(const char *name, HyPerCol *hc)
Definition: HyPerLayer.cpp:129
void handleUnnecessaryStringParameter(const char *group_name, const char *param_name)
Definition: PVParams.cpp:1704