#include <SingleThreadSimEngine.h>
Public Member Functions | |
SingleThreadSimEngine (int ID, SpikeScheduler &scheduler, AnalogMessageDispatcher &analogMsgDispatcher, SimNetwork &net) | |
virtual | ~SingleThreadSimEngine () |
SimObjectPool * | getPool () |
virtual void | reset () |
Reset all sim elements; i.e. set the simulation time back to zero. | |
virtual void | initialize () |
Initializes the engine and all the objects it contains, so that they are ready for simulation. | |
virtual void | advance (int nSteps=1) |
Advance all elements by a certain number of time steps. | |
virtual void | advanceOneFullCycle () |
Advance all elements for one cycle (equal to minDelay time steps). | |
virtual void | advanceSeveralStepsWithinACycle (int nsteps) |
virtual void | finalizeCycle () |
virtual void | addObject (SimObjectFactory const &objFactory, SimObject::ID &id) |
Add a new object to the simulation engine. | |
virtual SimObject * | getObject (const SimObject::ID &id) |
Get a pointer of a object identified by the id and type. | |
virtual void | mount (const SimObjectFactory &objFactory, const SimObject::ID &mountpoint, SimObject::ID &gid) |
virtual void | insert (const SimObjectFactory &objFactory, const SimObject::ID &container, SimObject::ID &gid) |
void | two_way_link (const SimObject::ID &o1, const SimObject::ID &o2) |
Make two way tight coupling between to objects. | |
void | one_way_link (const SimObject::ID &src, const SimObject::ID &dst) |
Make one way tight coupling between to objects. | |
const Time & | getSimulationTime () const |
Seed the random number engine for noise in the simulation objects | |
virtual void | seed (vector< uint32 > const &noiseSeed) |
virtual void | seed (uint32 noiseSeed) |
ThreadSpecificRandomEngineType * | noiseRandomEngine () const |
Protected Member Functions | |
void | addSpikePorts (SimObject *obj, SimObject::ID &id) |
Definition at line 20 of file SingleThreadSimEngine.h.
SingleThreadSimEngine::SingleThreadSimEngine | ( | int | ID, | |
SpikeScheduler & | scheduler, | |||
AnalogMessageDispatcher & | analogMsgDispatcher, | |||
SimNetwork & | net | |||
) |
Definition at line 16 of file SingleThreadSimEngine.cpp.
References RandomEngineBoostImplementation< boost_engine >::seed(), SimNetwork::simParameter(), and SimParameter::simulationRNGSeed.
SingleThreadSimEngine::~SingleThreadSimEngine | ( | ) | [virtual] |
Definition at line 32 of file SingleThreadSimEngine.cpp.
References theThreadSpecificRandomEngine, and ThreadSpecificRandomEngine::unset().
SimObjectPool* SingleThreadSimEngine::getPool | ( | ) | [inline] |
Definition at line 29 of file SingleThreadSimEngine.h.
void SingleThreadSimEngine::reset | ( | ) | [virtual] |
Reset all sim elements; i.e. set the simulation time back to zero.
Implements SimEngine.
Definition at line 109 of file SingleThreadSimEngine.cpp.
References SimObjectPool::beginObject(), SimObjectPool::endObject(), SimNetwork::get_dt(), Time::in_sec(), initialize(), SimNetwork::initialized, Time::ms(), SimEngine::network, SimObjectPool::numOfTypes(), RESETFLAG_ACTIVATE, ThreadSpecificRandomEngine::set(), theThreadSpecificRandomEngine, and SimObjectPool::updateObjects().
Referenced by SingleThreadNetwork::_reset_(), advance(), and SimEngineResetJob::start().
void SingleThreadSimEngine::initialize | ( | ) | [virtual] |
Initializes the engine and all the objects it contains, so that they are ready for simulation.
Includes reset() operation inside.
Implements SimEngine.
Definition at line 143 of file SingleThreadSimEngine.cpp.
References SimObjectPool::beginObject(), SimObjectPool::endObject(), SimNetwork::initialized, SimEngine::network, SimObjectPool::numOfTypes(), ThreadSpecificRandomEngine::set(), and theThreadSpecificRandomEngine.
Referenced by SingleThreadNetwork::_initialize_(), reset(), and SimEngineInitializeJob::start().
void SingleThreadSimEngine::advance | ( | int | nSteps = 1 |
) | [virtual] |
Advance all elements by a certain number of time steps.
nSteps | number of time steps to advance |
Implements SimEngine.
Definition at line 165 of file SingleThreadSimEngine.cpp.
References SpikeScheduler::advance(), ADVANCEFLAG_DEACTIVATE, SimObjectRegistry::FirstIndexOf::AdvancePhase2, SimObjectPool::beginObject(), SpikeScheduler::deliverSpikes(), AnalogMessageDispatcher::dispatchAnalogMsgs(), SimEngine::eid, SimObjectPool::endObject(), SimNetwork::get_dt(), Time::in_sec(), SimEngine::network, SimObjectRegistry::FirstIndexOf::NoAdvance, reset(), ThreadSpecificRandomEngine::set(), SimObjectRegistry::FirstIndexOf::SpikeDriven, SimEngine::spikeScheduler, AdvanceInfo::t, and theThreadSpecificRandomEngine.
Referenced by SingleThreadNetwork::_advance_(), advanceOneFullCycle(), advanceSeveralStepsWithinACycle(), and SimEngineAdvanceJob::start().
void SingleThreadSimEngine::advanceOneFullCycle | ( | ) | [virtual] |
Advance all elements for one cycle (equal to minDelay time steps).
Implements SimEngine.
Definition at line 229 of file SingleThreadSimEngine.cpp.
References advance(), SimEngine::default_steps_per_cycle, SpikeScheduler::nextCycle(), and SimEngine::spikeScheduler.
void SingleThreadSimEngine::advanceSeveralStepsWithinACycle | ( | int | nsteps | ) | [virtual] |
Implements SimEngine.
Definition at line 235 of file SingleThreadSimEngine.cpp.
References advance().
void SingleThreadSimEngine::finalizeCycle | ( | ) | [virtual] |
void SingleThreadSimEngine::addObject | ( | SimObjectFactory const & | objFactory, | |
SimObject::ID & | id | |||
) | [virtual] |
Add a new object to the simulation engine.
obj | Pointer to the object to add | |
id | Resulting identifier of the object. id.type and id.localid are set. |
Implements SimEngine.
Definition at line 48 of file SingleThreadSimEngine.cpp.
References SimObjectPool::addObject(), addSpikePorts(), SimObjectPool::getObject(), SimObjectFactory::getObjectTypeID(), SimNetwork::getObjectVariationRNDEngine(), and SimEngine::network.
Referenced by SingleThreadNetwork::_addObject_(), STAnalogMessageCreator::addAnalogMessage(), insert(), and mount().
SimObject * SingleThreadSimEngine::getObject | ( | const SimObject::ID & | id | ) | [inline, virtual] |
Get a pointer of a object identified by the id and type.
Implements SimEngine.
Definition at line 122 of file SingleThreadSimEngine.h.
References SimObjectPool::getObject().
Referenced by SingleThreadNetwork::_addSpikeMessage_(), SingleThreadNetwork::_connect_(), SingleThreadNetwork::_getObject_(), STAnalogMessageCreator::addAnalogMessage(), DistributedAnalogMessageCreator::addIncomingAnalogMessage(), and DistributedAnalogMessageCreator::addOutgoingAnalogMessage().
void SingleThreadSimEngine::mount | ( | const SimObjectFactory & | objFactory, | |
const SimObject::ID & | mountpoint, | |||
SimObject::ID & | gid | |||
) | [virtual] |
Implements SimEngine.
Definition at line 75 of file SingleThreadSimEngine.cpp.
References addObject(), and one_way_link().
Referenced by SingleThreadNetwork::_mount_().
void SingleThreadSimEngine::insert | ( | const SimObjectFactory & | objFactory, | |
const SimObject::ID & | container, | |||
SimObject::ID & | gid | |||
) | [virtual] |
Implements SimEngine.
Definition at line 81 of file SingleThreadSimEngine.cpp.
References addObject(), and two_way_link().
Referenced by SingleThreadNetwork::_insert_().
void SingleThreadSimEngine::two_way_link | ( | const SimObject::ID & | o1, | |
const SimObject::ID & | o2 | |||
) |
Make two way tight coupling between to objects.
Definition at line 87 of file SingleThreadSimEngine.cpp.
References SimObjectPool::getObject(), SimObject::incoming(), SimObject::ID::localid, SimEngine::network, SimObject::outgoing(), and SimObject::ID::type.
Referenced by insert().
void SingleThreadSimEngine::one_way_link | ( | const SimObject::ID & | src, | |
const SimObject::ID & | dst | |||
) |
Make one way tight coupling between to objects.
Definition at line 100 of file SingleThreadSimEngine.cpp.
References SimObjectPool::getObject(), SimObject::incoming(), SimObject::ID::localid, SimEngine::network, SimObject::outgoing(), and SimObject::ID::type.
Referenced by mount().
void SingleThreadSimEngine::seed | ( | vector< uint32 > const & | noiseSeed | ) | [virtual] |
Implements SimEngine.
Definition at line 38 of file SingleThreadSimEngine.cpp.
References RandomEngineBoostImplementation< boost_engine >::seed().
Referenced by SingleThreadNetwork::seed_noise_rng().
void SingleThreadSimEngine::seed | ( | uint32 | noiseSeed | ) | [virtual] |
Implements SimEngine.
Definition at line 43 of file SingleThreadSimEngine.cpp.
References RandomEngineBoostImplementation< boost_engine >::seed().
ThreadSpecificRandomEngineType* SingleThreadSimEngine::noiseRandomEngine | ( | ) | const [inline] |
Definition at line 63 of file SingleThreadSimEngine.h.
const Time& SingleThreadSimEngine::getSimulationTime | ( | ) | const [inline] |
Definition at line 66 of file SingleThreadSimEngine.h.
void SingleThreadSimEngine::addSpikePorts | ( | SimObject * | obj, | |
SimObject::ID & | id | |||
) | [protected] |
Definition at line 56 of file SingleThreadSimEngine.cpp.
References MultipleOutputSpikeSender::getSpikePort(), SingleOutputSpikeSender::getSpikePort(), SimObject::nAnalogOutputPorts(), SimObject::nSpikeOutputPorts(), SimObject::outputPortType(), SpikeOutputPort::setID(), and SimObject::spiking.
Referenced by addObject().