PetaVision  Alpha
L1NormLCAProbe.cpp
1 /*
2  * L1NormLCAProbe.cpp
3  *
4  * Created on: Oct 9, 2015
5  * Author: pschultz
6  */
7 
8 #include "L1NormLCAProbe.hpp"
9 #include "../layers/HyPerLCALayer.hpp"
10 
11 namespace PV {
12 
13 L1NormLCAProbe::L1NormLCAProbe(const char *name, HyPerCol *hc) {
14  initialize_base();
15  initialize(name, hc);
16 }
17 
18 L1NormLCAProbe::L1NormLCAProbe() { initialize_base(); }
19 
20 Response::Status
21 L1NormLCAProbe::communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) {
22  auto status = L1NormProbe::communicateInitInfo(message);
23  if (!Response::completed(status)) {
24  return status;
25  }
26  assert(targetLayer);
27  HyPerLCALayer *targetLCALayer = dynamic_cast<HyPerLCALayer *>(targetLayer);
28  if (targetLCALayer == NULL) {
29  if (parent->columnId() == 0) {
30  ErrorLog().printf(
31  "%s: targetLayer \"%s\" is not an LCA layer.\n",
32  getDescription_c(),
33  getTargetName());
34  }
35  MPI_Barrier(parent->getCommunicator()->communicator());
36  exit(EXIT_FAILURE);
37  }
38  if (targetLCALayer->layerListsVerticesInParams() == true) {
39  if (parent->columnId() == 0) {
40  ErrorLog().printf(
41  "%s: LCAProbes require targetLayer \"%s\" to use "
42  "VThresh etc. instead of "
43  "verticesV/verticesV.\n",
44  getDescription_c(),
45  getTargetName());
46  }
47  MPI_Barrier(parent->getCommunicator()->communicator());
48  exit(EXIT_FAILURE);
49  }
50  coefficient = targetLCALayer->getVThresh();
51  return Response::SUCCESS;
52 }
53 
54 } /* namespace PV */
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override
bool layerListsVerticesInParams() const
Definition: ANNLayer.hpp:30
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override
const char * getTargetName()
Definition: BaseProbe.hpp:83
static bool completed(Status &a)
Definition: Response.hpp:49