8 #include "DependentArborList.hpp" 9 #include "columns/HyPerCol.hpp" 10 #include "columns/ObjectMapComponent.hpp" 11 #include "components/OriginalConnNameParam.hpp" 12 #include "connections/BaseConnection.hpp" 13 #include "utils/MapLookupByType.hpp" 17 DependentArborList::DependentArborList(
char const *name, HyPerCol *hc) { initialize(name, hc); }
19 DependentArborList::DependentArborList() {}
21 DependentArborList::~DependentArborList() {}
23 int DependentArborList::initialize(
char const *name, HyPerCol *hc) {
24 return ArborList::initialize(name, hc);
27 void DependentArborList::setObjectType() { mObjectType =
"DependentArborList"; }
34 if (ioFlag == PARAMS_IO_READ) {
35 parent->parameters()->handleUnnecessaryParameter(name,
"numAxonalArbors");
41 DependentArborList::communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) {
42 auto hierarchy = message->mHierarchy;
44 char const *originalConnName = getOriginalConnName(hierarchy);
45 pvAssert(originalConnName);
47 auto *originalArborList = getOriginalArborList(hierarchy, originalConnName);
48 pvAssert(originalArborList);
50 if (!originalArborList->getInitInfoCommunicatedFlag()) {
51 if (parent->getCommunicator()->globalCommRank() == 0) {
53 "%s must wait until original connection \"%s\" has finished its communicateInitInfo " 58 return Response::POSTPONE;
60 mNumAxonalArbors = originalArborList->getNumAxonalArbors();
61 parent->parameters()->handleUnnecessaryParameter(name,
"numAxonalArbors", mNumAxonalArbors);
63 auto status = ArborList::communicateInitInfo(message);
67 return Response::SUCCESS;
71 DependentArborList::getOriginalConnName(std::map<std::string, Observer *>
const hierarchy)
const {
73 mapLookupByType<OriginalConnNameParam>(hierarchy, getDescription());
75 originalConnNameParam ==
nullptr,
76 "%s requires an OriginalConnNameParam component.\n",
78 char const *originalConnName = originalConnNameParam->getOriginalConnName();
79 return originalConnName;
82 ArborList *DependentArborList::getOriginalArborList(
83 std::map<std::string, Observer *>
const hierarchy,
84 char const *originalConnName)
const {
86 mapLookupByType<ObjectMapComponent>(hierarchy, getDescription());
87 pvAssert(objectMapComponent);
89 objectMapComponent->lookup<
BaseConnection>(std::string(originalConnName));
90 if (originalConn ==
nullptr) {
91 if (parent->getCommunicator()->globalCommRank() == 0) {
93 "%s: originalConnName \"%s\" does not correspond to a BaseConnection in the " 98 MPI_Barrier(parent->getCommunicator()->globalCommunicator());
102 auto *originalArborList = originalConn->getComponentByType<
ArborList>();
104 originalArborList ==
nullptr,
105 "%s original connection \"%s\" does not have an ArborList.\n",
108 return originalArborList;
virtual void ioParam_numAxonalArbors(enum ParamsIOFlag ioFlag) override
numAxonalArbors: DependentArborList does not use the numAxonalArbors parameter, but gets the number o...
static bool completed(Status &a)
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override