Exemplo n.º 1
0
ArrayDatum
get_connections( const DictionaryDatum& dict )
{
  dict->clear_access_flags();

  ArrayDatum array = kernel().connection_builder_manager.get_connections( dict );

  ALL_ENTRIES_ACCESSED( *dict, "GetConnections", "Unread dictionary entries: " );

  return array;
}
Exemplo n.º 2
0
void
ModelManager::set_node_defaults_( index model_id,
  const DictionaryDatum& params )
{
  params->clear_access_flags();

  get_model( model_id )->set_status( params );

  ALL_ENTRIES_ACCESSED( *params,
    "ModelManager::set_node_defaults_",
    "Unread dictionary entries: " );
}
Exemplo n.º 3
0
void
set_connection_status( const ConnectionDatum& conn, const DictionaryDatum& dict )
{
  DictionaryDatum conn_dict = conn.get_dict();
  long synapse_id = getValue< long >( conn_dict, nest::names::synapse_modelid );
  long port = getValue< long >( conn_dict, nest::names::port );
  long gid = getValue< long >( conn_dict, nest::names::source );
  thread tid = getValue< long >( conn_dict, nest::names::target_thread );
  kernel().node_manager.get_node( gid ); // Just to check if the node exists

  dict->clear_access_flags();

  kernel().connection_builder_manager.set_synapse_status( gid, synapse_id, port, tid, dict );

  ALL_ENTRIES_ACCESSED2( *dict,
    "SetStatus",
    "Unread dictionary entries: ",
    "Maybe you tried to set common synapse properties through an individual synapse?" );
}
Exemplo n.º 4
0
void
NodeManager::set_status_single_node_( Node& target,
  const DictionaryDatum& d,
  bool clear_flags )
{
  // proxies have no properties
  if ( not target.is_proxy() )
  {
    if ( clear_flags )
    {
      d->clear_access_flags();
    }
    target.set_status_base( d );

    // TODO: Not sure this check should be at single neuron level; advantage is
    // it stops after first failure.
    ALL_ENTRIES_ACCESSED(
      *d, "NodeManager::set_status", "Unread dictionary entries: " );
  }
}
Exemplo n.º 5
0
void
ModelManager::set_synapse_defaults_( index model_id,
  const DictionaryDatum& params )
{
  params->clear_access_flags();
  assert_valid_syn_id( model_id );

  BadProperty* tmp_exception = NULL;
#ifdef _OPENMP
#pragma omp parallel
  {
    index t = kernel().vp_manager.get_thread_id();
#else // clang-format off
  for ( index t = 0; t < kernel().vp_manager.get_num_threads(); ++t )
  {
#endif // clang-format on
#pragma omp critical
    {
      try
      {
        prototypes_[ t ][ model_id ]->set_status( params );
      }
      catch ( BadProperty& e )
      {
        if ( tmp_exception == NULL )
        {
          tmp_exception = new BadProperty(
            String::compose( "Setting status of prototype '%1': %2",
              prototypes_[ t ][ model_id ]->get_name(),
              e.message() ) );
        }
      }
    }
  }

  if ( tmp_exception != NULL )
  {
    BadProperty e = *tmp_exception;
    delete tmp_exception;
    throw e;
  }

  ALL_ENTRIES_ACCESSED( *params,
    "ModelManager::set_synapse_defaults_",
    "Unread dictionary entries: " );
}

// TODO: replace int with index and return value -1 with invalid_index, also
// change all pertaining code
int
ModelManager::get_model_id( const Name name ) const
{
  const Name model_name( name );
  for ( int i = 0; i < ( int ) models_.size(); ++i )
  {
    assert( models_[ i ] != NULL );
    if ( model_name == models_[ i ]->get_name() )
      return i;
  }
  return -1;
}


DictionaryDatum
ModelManager::get_connector_defaults( synindex syn_id ) const
{
  assert_valid_syn_id( syn_id );

  DictionaryDatum dict( new Dictionary() );

  for ( thread t = 0;
        t < static_cast< thread >( kernel().vp_manager.get_num_threads() );
        ++t )
    prototypes_[ t ][ syn_id ]->get_status(
      dict ); // each call adds to num_connections

  ( *dict )[ "num_connections" ] =
    kernel().connection_manager.get_num_connections( syn_id );

  return dict;
}
Exemplo n.º 6
0
void
set_kernel_status( const DictionaryDatum& dict )
{
  dict->clear_access_flags();
  kernel().set_status( dict );
}