📄 mpnetwork.cpp
字号:
/*************************************************************************** mpnetwork.cpp - description ------------------- begin : Thu Dec 13 2001 copyright : (C) 2001 by Rudiger Koch email : rudiger_koch@yahoo.com ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include <iostream>#include "mpnetwork.h"#include "node.h"#include "neuron.h"#include "instance.h"MpNetwork::MpNetwork(Instance *inst){ instance = inst; Neuron::SetMPMode(true);}MpNetwork::~MpNetwork(){}void MpNetwork::IncrementSimTime(){ Node *node = Node::GetNodeRef(); if(!node->NNthreadSleep(simTime)) { simTime += simStepSize; node->NNthreadWakeUp(); }}bool MpNetwork::ConnectNeurons(Instance *postsynInst, AmIdInt presynNId, AmIdInt postsynNId, float weight, AmTimeInt delay){ MpNetwork *postNet = postsynInst->GetNetwork(); SMPSynapse* syn = new SMPSynapse((MpSpikeInput*)postNet->GetSpikeInput(), postNet->net[postsynNId], weight, delay); net[presynNId]->AddSMPSynapse(syn); if (delay > maxSpikeDelay) { maxSpikeDelay = delay; maxSpikeDelaySyn = syn; } return true;/* if(axonMap[presynInst] == NULL){ // FIXME: criterion for 'not found' is probably wrong axonMap[presynInst] = new hash_map <unsigned int, vector< Synapse * > *>; } hash_map <unsigned int, vector< Synapse* > *> *level1 = axonMap[presynInst]; if((*level1)[presynNId] == NULL){ (*level1)[presynNId] = new vector<Synapse *>; } vector< Synapse * > *dendrite = (*level1)[presynNId]; Neuron *neuron = net[postsynNId]; if(neuron == NULL){ cerr << "Alert: Instance " << instance->GetId() << " Neuron " << postsynNId << " does not exist!" << endl; throw string("Postsynaptic neuron does not exist"); } SMPSynapse *smpSynapse = new SMPSynapse((MpSpikeInput*)spikeInput , neuron, weight, 0);FIXME: synapse->first = neuron->NewVirtualPresynId();FIXME: synapse->second = neuron; dendrite->push_back(smpSynapse);FIXME: neuron->AddDendriteSyn(synapse->first, weight);*/}/*void MpNetwork::AddAxonSyn(unsigned int presynNId, unsigned int postsynInstance){ Neuron *neuron = (Neuron*)net[presynNId]; if(neuron == NULL){ cerr << "Alert: Instance " << instance->GetId() << " Neuron " << presynNId << " does not exist!" << endl; throw string("Presynaptic neuron does not exist"); } neuron->AddRemoteAxonInstance(postsynInstance);}*/Instance* MpNetwork::GetInstance(){ return instance;}vector< Synapse *> *MpNetwork::GetAxon(unsigned int instId, unsigned int nId){ hash_map<unsigned int, vector< Synapse * > *> *l1 = axonMap[instId]; return (*l1)[nId];}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -