bool ModelManager::connector_requires_symmetric( synindex syn_id ) const { assert_valid_syn_id( syn_id ); return prototypes_[ 0 ][ syn_id ]->requires_symmetric(); }
DictionaryDatum ConnectionManager::get_synapse_status( index gid, synindex syn_id, port p, thread tid ) { assert_valid_syn_id( syn_id ); DictionaryDatum dict( new Dictionary ); validate_pointer( connections_[ tid ].get( gid ) )->get_synapse_status( syn_id, dict, p ); ( *dict )[ names::source ] = gid; ( *dict )[ names::synapse_model ] = LiteralDatum( get_synapse_prototype( syn_id ).get_name() ); return dict; }
DictionaryDatum ConnectionManager::get_prototype_status( synindex syn_id ) const { assert_valid_syn_id( syn_id ); DictionaryDatum dict( new Dictionary ); for ( thread t = 0; t < net_.get_num_threads(); ++t ) prototypes_[ t ][ syn_id ]->get_status( dict ); // each call adds to num_connections return dict; }
void ConnectionManager::set_prototype_status( synindex syn_id, const DictionaryDatum& d ) { assert_valid_syn_id( syn_id ); for ( thread t = 0; t < net_.get_num_threads(); ++t ) { try { prototypes_[ t ][ syn_id ]->set_status( d ); } catch ( BadProperty& e ) { throw BadProperty( String::compose( "Setting status of prototype '%1': %2", prototypes_[ t ][ syn_id ]->get_name(), e.message() ) ); } } }
void ConnectionManager::set_synapse_status( index gid, synindex syn_id, port p, thread tid, const DictionaryDatum& dict ) { assert_valid_syn_id( syn_id ); try { validate_pointer( connections_[ tid ].get( gid ) ) ->set_synapse_status( syn_id, *( prototypes_[ tid ][ syn_id ] ), dict, p ); } catch ( BadProperty& e ) { throw BadProperty( String::compose( "Setting status of '%1' connecting from GID %2 to port %3: %4", prototypes_[ tid ][ syn_id ]->get_name(), gid, p, e.message() ) ); } }
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; }