本文整理汇总了C++中DSSpikeEvent::get_multiplicity方法的典型用法代码示例。如果您正苦于以下问题:C++ DSSpikeEvent::get_multiplicity方法的具体用法?C++ DSSpikeEvent::get_multiplicity怎么用?C++ DSSpikeEvent::get_multiplicity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DSSpikeEvent
的用法示例。
在下文中一共展示了DSSpikeEvent::get_multiplicity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
nest::mip_generator::event_hook( DSSpikeEvent& e )
{
// note: event_hook() receives a reference of the spike event that
// was originally created in the update function. there we set
// the multiplicty to store the number of mother spikes. the *same*
// reference will be delivered multiple times to the event hook,
// once for every receiver. when calling handle() of the receiver
// above, we need to change the multiplicty to the number of copied
// child process spikes, so afterwards it needs to be reset to correctly
// store the number of mother spikes again during the next call of event_hook().
// reichert
librandom::RngPtr rng = net_->get_rng( get_thread() );
ulong_t n_mother_spikes = e.get_multiplicity();
ulong_t n_spikes = 0;
for ( ulong_t n = 0; n < n_mother_spikes; n++ )
{
if ( rng->drand() < P_.p_copy_ )
n_spikes++;
}
if ( n_spikes > 0 )
{
e.set_multiplicity( n_spikes );
e.get_receiver().handle( e );
}
e.set_multiplicity( n_mother_spikes );
}