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


C++ TargetData::set_source_lid方法代码示例

本文整理汇总了C++中TargetData::set_source_lid方法的典型用法代码示例。如果您正苦于以下问题:C++ TargetData::set_source_lid方法的具体用法?C++ TargetData::set_source_lid怎么用?C++ TargetData::set_source_lid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TargetData的用法示例。


在下文中一共展示了TargetData::set_source_lid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

bool
nest::SourceTable::get_next_target_data( const thread tid,
  const thread rank_start,
  const thread rank_end,
  thread& source_rank,
  TargetData& next_target_data )
{
  SourceTablePosition& current_position = current_positions_[ tid ];

  // we stay in this loop either until we can return a valid
  // TargetData object or we have reached the end of the sources table
  while ( true )
  {
    current_position.wrap_position( sources_ );
    if ( current_position.is_at_end() )
    {
      return false; // reached the end of the sources table
    }

    // the current position contains an entry, so we retrieve it
    const Source& const_current_source =
      sources_[ current_position.tid ][ current_position
                                          .syn_id ][ current_position.lcid ];

    if ( const_current_source.is_processed()
      or const_current_source.is_disabled() )
    {
      // looks like we've processed this already, let's continue
      --current_position.lcid;
      continue;
    }

    source_rank = kernel().mpi_manager.get_process_id_of_gid(
      const_current_source.get_gid() );

    // determine whether this thread is responsible for this part of
    // the MPI buffer; if not we just continue with the next iteration
    // of the loop
    if ( source_rank < rank_start or source_rank >= rank_end )
    {
      --current_position.lcid;
      continue;
    }

    Source& current_source =
      sources_[ current_position.tid ][ current_position
                                          .syn_id ][ current_position.lcid ];

    // we have found a valid entry, so mark it as processed
    current_source.set_processed( true );

    // we need to set a marker stating whether the entry following this
    // entry, if existent, has the same source; start by assuming it
    // has a different source, only change if necessary
    kernel().connection_manager.set_has_source_subsequent_targets(
      current_position.tid,
      current_position.syn_id,
      current_position.lcid,
      false );
    if ( ( current_position.lcid + 1
             < static_cast< long >(
                 sources_[ current_position.tid ][ current_position.syn_id ]
                   .size() )
           and sources_[ current_position.tid ][ current_position.syn_id ]
                       [ current_position.lcid + 1 ].get_gid()
             == current_source.get_gid() ) )
    {
      kernel().connection_manager.set_has_source_subsequent_targets(
        current_position.tid,
        current_position.syn_id,
        current_position.lcid,
        true );
    }

    // decrease the position without returning a TargetData if the
    // entry preceding this entry has the same source, but only if
    // the preceding entry was not processed yet
    if ( ( current_position.lcid - 1 >= 0 )
      and ( sources_[ current_position.tid ][ current_position.syn_id ]
                    [ current_position.lcid - 1 ].get_gid()
            == current_source.get_gid() )
      and ( not sources_[ current_position.tid ][ current_position.syn_id ]
                        [ current_position.lcid - 1 ].is_processed() ) )
    {
      --current_position.lcid;
      continue;
    }
    // otherwise we return a valid TargetData
    else
    {
      // set values of next_target_data
      next_target_data.set_source_lid(
        kernel().vp_manager.gid_to_lid( current_source.get_gid() ) );
      next_target_data.set_source_tid( kernel().vp_manager.vp_to_thread(
        kernel().vp_manager.suggest_vp_for_gid( current_source.get_gid() ) ) );
      next_target_data.reset_marker();

      if ( current_source.is_primary() )
      {
        next_target_data.set_is_primary( true );
//.........这里部分代码省略.........
开发者ID:apeyser,项目名称:nest-simulator,代码行数:101,代码来源:source_table.cpp


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