8 #include "HyPerDelivery.hpp" 9 #include "columns/HyPerCol.hpp" 10 #include "utils/MapLookupByType.hpp" 14 HyPerDelivery::HyPerDelivery(
char const *name, HyPerCol *hc) { initialize(name, hc); }
16 HyPerDelivery::HyPerDelivery() {}
18 HyPerDelivery::~HyPerDelivery() {}
20 int HyPerDelivery::initialize(
char const *name, HyPerCol *hc) {
21 return BaseDelivery::initialize(name, hc);
24 void HyPerDelivery::setObjectType() { mObjectType =
"HyPerDelivery"; }
27 int status = PV_SUCCESS;
31 if (ioFlag == PARAMS_IO_READ) {
39 parent->parameters()->ioParamValue(
42 "convertRateToSpikeCount",
43 &mConvertRateToSpikeCount,
44 mConvertRateToSpikeCount );
48 HyPerDelivery::communicateInitInfo(std::shared_ptr<CommunicateInitInfoMessage const> message) {
49 auto status = BaseDelivery::communicateInitInfo(message);
53 mWeightsPair = mapLookupByType<WeightsPair>(message->mHierarchy, getDescription());
54 FatalIf(!mWeightsPair,
"%s requires a WeightsPair component.\n", getDescription_c());
56 return Response::POSTPONE;
59 mArborList = mapLookupByType<ArborList>(message->mHierarchy, getDescription());
60 FatalIf(!mArborList,
"%s requires an ArborList component.\n", getDescription_c());
62 return Response::POSTPONE;
64 return Response::SUCCESS;
67 Response::Status HyPerDelivery::allocateDataStructures() {
68 auto status = BaseDelivery::allocateDataStructures();
72 if (mAccumulateType == STOCHASTIC) {
73 mDeltaTimeFactor = (float)parent->getDeltaTime();
75 else if (mConvertRateToSpikeCount and !mPreLayer->activityIsSpiking()) {
77 (float)convertToRateDeltaTimeFactor(mPostLayer->getChannelTimeConst(mChannelCode));
80 mDeltaTimeFactor = 1.0f;
82 return Response::SUCCESS;
85 double HyPerDelivery::convertToRateDeltaTimeFactor(
double timeConstantTau)
const {
86 double dt = parent->getDeltaTime();
88 if (timeConstantTau > 0) {
89 dtFactor = std::exp(dt / timeConstantTau) - 1.0;
101 if (getChannelCode() != CHANNEL_NOUPDATE) {
103 for (
int a = 0; a < numArbors; a++) {
virtual void ioParam_convertRateToSpikeCount(enum ParamsIOFlag ioFlag)
convertRateToSpikeCount: If true, presynaptic activity is converted from a rate (spikes per second) t...
bool isExchangeFinished(int delay=0)
static bool completed(Status &a)
virtual bool isAllInputReady() override
int getNumAxonalArbors() const
virtual int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
int ioParamsFillGroup(enum ParamsIOFlag ioFlag) override
bool getInitInfoCommunicatedFlag() const