コード例 #1
0
ファイル: spike_generator.cpp プロジェクト: QJonny/CyNest
void nest::spike_generator::Parameters_::get(DictionaryDatum &d) const
{
    const size_t n_spikes = spike_stamps_.size();
    const size_t n_offsets = spike_offsets_.size();
    assert(   ( precise_times_ && n_offsets == n_spikes )
              || (!precise_times_ && n_offsets == 0        ) );

    std::vector<double_t>* times_ms = new std::vector<double_t>();
    times_ms->reserve(n_spikes);
    for ( size_t n = 0 ; n < n_spikes ; ++n )
    {
        times_ms->push_back(spike_stamps_[n].get_ms());
        if ( precise_times_ )
            (*times_ms)[n] -= spike_offsets_[n];
    }
    (*d)[names::spike_times] = DoubleVectorDatum(times_ms);
    (*d)["spike_weights"] = DoubleVectorDatum(new std::vector<double_t>(spike_weights_));
    (*d)[names::precise_times] = BoolDatum(precise_times_);
    (*d)["allow_offgrid_spikes"] = BoolDatum(allow_offgrid_spikes_);
    (*d)["shift_now_spikes"] = BoolDatum(shift_now_spikes_);
}
コード例 #2
0
/*BeginDocumentation

  Name: topology::Inside - test if a point is inside a mask

  Synopsis:
  point mask Inside -> bool

  Parameters:
  point - array of coordinates
  mask - mask object

  Returns:
  bool - true if the point is inside the mask
*/
void
TopologyModule::Inside_a_MFunction::execute( SLIInterpreter* i ) const
{
  i->assert_stack_load( 2 );

  std::vector< double_t > point = getValue< std::vector< double_t > >( i->OStack.pick( 1 ) );
  MaskDatum mask = getValue< MaskDatum >( i->OStack.pick( 0 ) );

  bool ret = inside( point, mask );

  i->OStack.pop( 2 );
  i->OStack.push( Token( BoolDatum( ret ) ) );
  i->EStack.pop();
}