PetaVision  Alpha
BaseHyPerConnProbe.cpp
1 /*
2  * BaseHyPerConnProbe.cpp
3  *
4  * Created on: Oct 28, 2014
5  * Author: pschultz
6  */
7 
8 #include "BaseHyPerConnProbe.hpp"
9 
10 namespace PV {
11 
12 BaseHyPerConnProbe::BaseHyPerConnProbe(const char *name, HyPerCol *hc) { initialize(name, hc); }
13 
14 BaseHyPerConnProbe::BaseHyPerConnProbe() {}
15 
16 int BaseHyPerConnProbe::initialize(const char *name, HyPerCol *hc) {
17  return BaseConnectionProbe::initialize(name, hc);
18 }
19 
20 Response::Status
21 BaseHyPerConnProbe::communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) {
22  auto status = BaseConnectionProbe::communicateInitInfo(message);
23  if (!Response::completed(status)) {
24  return status;
25  }
26  pvAssert(getTargetConn());
27  if (getTargetHyPerConn() == nullptr) {
28  if (parent->getCommunicator()->globalCommRank() == 0) {
29  ErrorLog().printf(
30  "%s: targetConn \"%s\" must be a HyPerConn or "
31  "HyPerConn-derived class.\n",
32  getDescription_c(),
33  mTargetConn->getName());
34  }
35  MPI_Barrier(parent->getCommunicator()->globalCommunicator());
36  exit(EXIT_FAILURE);
37  }
38  return status;
39 }
40 
41 bool BaseHyPerConnProbe::needRecalc(double timevalue) {
42  return getLastUpdateTime() < getTargetHyPerConn()->getLastUpdateTime();
43 }
44 
46  return getTargetHyPerConn()->getLastUpdateTime();
47 }
48 
49 BaseHyPerConnProbe::~BaseHyPerConnProbe() {}
50 
51 } /* namespace PV */
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override
double getLastUpdateTime()
Definition: BaseProbe.hpp:102
virtual bool needRecalc(double timevalue) override
static bool completed(Status &a)
Definition: Response.hpp:49
virtual double referenceUpdateTime() const override
virtual Response::Status communicateInitInfo(std::shared_ptr< CommunicateInitInfoMessage const > message) override