当前位置: 首页>>代码示例>>C++>>正文


C++ DSSpikeEvent::get_multiplicity方法代码示例

本文整理汇总了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 );
}
开发者ID:JanneM,项目名称:nest-simulator,代码行数:31,代码来源:mip_generator.cpp


注:本文中的DSSpikeEvent::get_multiplicity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。