NEST  2.6.0,not_revisioned_source_dir@0
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
nest::Layer< D > Class Template Referenceabstract

Abstract base class for Layer of given dimension (D=2 or 3). More...

#include <connection_creator.h>

Inheritance diagram for nest::Layer< D >:
nest::AbstractLayer nest::Subnet nest::Node nest::FreeLayer< D > nest::GridLayer< D >

Public Member Functions

 Layer ()
 Creates an empty layer. More...
 
 Layer (const Layer &l)
 Copy constructor. More...
 
 ~Layer ()
 Virtual destructor. More...
 
void set_status (const DictionaryDatum &)
 Change properties of the layer according to the entries in the dictionary. More...
 
void get_status (DictionaryDatum &) const
 Export properties of the layer by setting entries in the status dictionary. More...
 
const Position< D > & get_lower_left () const
 
const Position< D > & get_extent () const
 
Position< D > get_center () const
 
std::bitset< D > get_periodic_mask () const
 
virtual Position< D > get_position (index sind) const =0
 Get position of node. More...
 
std::vector< double_tget_position_vector (const index sind) const
 
virtual Position< D > compute_displacement (const Position< D > &from_pos, const Position< D > &to_pos) const
 Returns displacement of a position from another position. More...
 
Position< D > compute_displacement (const Position< D > &from_pos, const index to) const
 Returns displacement of node from given position. More...
 
std::vector< double_tcompute_displacement (const std::vector< double_t > &from_pos, const index to) const
 Returns displacement of node from given position. More...
 
double_t compute_distance (const Position< D > &from_pos, const index to) const
 Returns distance to node from given position. More...
 
double_t compute_distance (const std::vector< double_t > &from_pos, const index to) const
 Returns distance to node from given position. More...
 
lockPTR< Ntree< D, index > > get_local_positions_ntree (Selector filter=Selector())
 Get positions for local nodes in layer. More...
 
lockPTR< Ntree< D, index > > get_global_positions_ntree (Selector filter=Selector())
 Get positions for all nodes in layer, including nodes on other MPI processes. More...
 
lockPTR< Ntree< D, index > > get_global_positions_ntree (Selector filter, std::bitset< D > periodic, Position< D > lower_left, Position< D > extent)
 Get positions globally, overriding the dimensions of the layer and the periodic flags. More...
 
std::vector< std::pair
< Position< D >, index > > * 
get_global_positions_vector (Selector filter=Selector())
 
virtual std::vector< std::pair
< Position< D >, index > > 
get_global_positions_vector (Selector filter, const MaskDatum &mask, const Position< D > &anchor, bool allow_oversized)
 
std::vector< indexget_global_nodes (const MaskDatum &mask, const std::vector< double_t > &anchor, bool allow_oversized)
 Return a vector with the GIDs of the nodes inside the mask. More...
 
void connect (AbstractLayer &target, ConnectionCreator &connector)
 Connect this layer to the given target layer. More...
 
void dump_nodes (std::ostream &os) const
 Write layer data to stream. More...
 
void dump_connections (std::ostream &out, const Token &syn_model)
 Dumps information about all connections of the given type having their source in the given layer to the given output stream. More...
 
bool is_subnet () const
 Layers do not allow entry to the ChangeSubnet command, nodes can not be added by the user. More...
 
- Public Member Functions inherited from nest::AbstractLayer
 AbstractLayer ()
 Constructor. More...
 
virtual ~AbstractLayer ()
 Virtual destructor. More...
 
std::vector< Node * >::iterator local_begin (int_t depth)
 Start of local children at given depth. More...
 
std::vector< Node * >::iterator local_end (int_t depth)
 End of local children at given depth. More...
 
std::vector< Node * >
::const_iterator 
local_begin (int_t depth) const
 Start of local children at given depth. More...
 
std::vector< Node * >
::const_iterator 
local_end (int_t depth) const
 End of local children at given depth. More...
 
- Public Member Functions inherited from nest::Subnet
 Subnet ()
 
 Subnet (const Subnet &)
 
virtual ~Subnet ()
 
void set_status (const DictionaryDatum &)
 
void get_status (DictionaryDatum &) const
 
bool has_proxies () const
 Returns true if the node has proxies on remote threads. More...
 
size_t global_size () const
 Returns total number of children. More...
 
size_t local_size () const
 Returns number of childern in local process. More...
 
bool global_empty () const
 returns true if subnet is empty globally More...
 
bool local_empty () const
 returns true if subnet has no local nodes More...
 
void reserve (size_t)
 
index add_node (Node *)
 Add a local node to the subnet. More...
 
index add_remote_node (index gid, index mid)
 Add a remote node to the subnet. More...
 
vector< Node * >::iterator local_begin ()
 Return iterator to the first local child node. More...
 
vector< Node * >::iterator local_end ()
 Return iterator to the end of the local child-list. More...
 
vector< Node * >::const_iterator local_begin () const
 Return const iterator to the first local child node. More...
 
vector< Node * >::const_iterator local_end () const
 Return const iterator to the end of the local child-list. More...
 
Nodeat_lid (index) const
 Return pointer to Node at given LID if it is local. More...
 
std::string get_label () const
 Return the subnets's user label. More...
 
void set_label (std::string const)
 Set the subnet's user label. More...
 
DictionaryDatum get_customdict () const
 Set the subnet's custom dictionary. More...
 
void set_customdict (DictionaryDatum const dict)
 Return pointer to the subnet's custom dictionary. More...
 
std::string print_network (int, int, std::string="")
 Prints out one line of the tree view of the network. More...
 
bool is_homogeneous () const
 
- Public Member Functions inherited from nest::Node
 Node ()
 
 Node (Node const &)
 
virtual ~Node ()
 
virtual Nodeclone () const
 Virtual copy constructor. More...
 
virtual bool potential_global_receiver () const
 Returns true for potential global receivers (e.g. More...
 
virtual void set_has_proxies (const bool)
 Sets has_proxies_ member variable (to switch to global spike detection mode) More...
 
virtual void set_local_receiver (const bool)
 Sets local_receiver_ member variable (to switch to global spike detection mode) More...
 
virtual bool local_receiver () const
 Returns true if the node only receives events from nodes/devices on the same thread. More...
 
virtual bool one_node_per_process () const
 Returns true if the node exists only once per process, but does not have proxies on remote threads. More...
 
virtual bool is_off_grid () const
 Returns true if the node if it sends/receives -grid events This is used to discriminate between different types of nodes, when adding new nodes to the network. More...
 
virtual bool is_proxy () const
 Returns true if the node is a proxy node. More...
 
std::string get_name () const
 Return class name. More...
 
index get_gid () const
 Return global Network ID. More...
 
index get_lid () const
 Return local node ID. More...
 
index get_subnet_index () const
 Return the index to the node in the node array of the parent subnet. More...
 
int get_model_id () const
 Return model ID of the node. More...
 
Subnetget_parent () const
 Return pointer to parent subnet. More...
 
bool is_frozen () const
 Returns true if node is frozen, i.e., shall not be updated. More...
 
bool is_local () const
 Returns true if the node is allocated in the local process. More...
 
void init_state ()
 Set state variables to the default values for the model. More...
 
void init_buffers ()
 Initialize buffers of a node. More...
 
virtual void finalize ()
 Finalize node. More...
 
virtual void set_status (const DictionaryDatum &)=0
 Change properties of the node according to the entries in the dictionary. More...
 
virtual void get_status (DictionaryDatum &) const =0
 Export properties of the node by setting entries in the status dictionary. More...
 
virtual port send_test_event (Node &receiving_node, rport receptor_type, synindex syn_id, bool dummy_target)
 Send an event to the receiving_node passed as an argument. More...
 
virtual port handles_test_event (SpikeEvent &, rport receptor_type)
 Check if the node can handle a particular event and receptor type. More...
 
virtual port handles_test_event (RateEvent &, rport receptor_type)
 
virtual port handles_test_event (DataLoggingRequest &, rport receptor_type)
 
virtual port handles_test_event (CurrentEvent &, rport receptor_type)
 
virtual port handles_test_event (ConductanceEvent &, rport receptor_type)
 
virtual port handles_test_event (DoubleDataEvent &, rport receptor_type)
 
virtual port handles_test_event (DSSpikeEvent &, rport receptor_type)
 
virtual port handles_test_event (DSCurrentEvent &, rport receptor_type)
 
virtual void register_stdp_connection (double_t)
 Register a STDP connection. More...
 
virtual void unregister_stdp_connection (double_t)
 Unregister a STDP connection. More...
 
virtual void handle (SpikeEvent &e)
 Handle incoming spike events. More...
 
virtual void handle (RateEvent &e)
 Handler for rate events. More...
 
virtual void handle (DataLoggingRequest &e)
 Handler for universal data logging request. More...
 
virtual void handle (DataLoggingReply &e)
 Handler for universal data logging request. More...
 
virtual void handle (CurrentEvent &e)
 Handler for current events. More...
 
virtual void handle (ConductanceEvent &e)
 Handler for conductance events. More...
 
virtual void handle (DoubleDataEvent &e)
 Handler for DoubleData events. More...
 
virtual double_t get_K_value (double_t t)
 return the Kminus value at t (in ms). More...
 
virtual void get_K_values (double_t t, double_t &Kminus, double_t &triplet_Kminus)
 write the Kminus and triplet_Kminus values at t (in ms) to the provided locations. More...
 
virtual void get_history (double_t t1, double_t t2, std::deque< histentry >::iterator *start, std::deque< histentry >::iterator *finish)
 return the spike history for (t1,t2]. More...
 
virtual void event_hook (DSSpikeEvent &)
 Modify Event object parameters during event delivery. More...
 
virtual void event_hook (DSCurrentEvent &)
 
void set_thread (thread)
 Store the number of the thread to which the node is assigned. More...
 
thread get_thread () const
 Retrieve the number of the thread to which the node is assigned. More...
 
void set_vp (thread)
 Store the number of the virtual process to which the node is assigned. More...
 
thread get_vp () const
 Retrieve the number of the virtual process to which the node is assigned. More...
 
void set_model_id (int)
 Set the model id. More...
 
DictionaryDatum get_status_base ()
 Return a dictionary with the node's properties. More...
 
void set_status_base (const DictionaryDatum &)
 Set status dictionary of a node. More...
 
bool is_model_prototype () const
 Returns true if node is model prototype. More...
 
void set_thread_lid (const index)
 set thread local index More...
 
index get_thread_lid () const
 get thread local index More...
 
bool buffers_initialized () const
 True if buffers have been initialized. More...
 
void set_buffers_initialized (bool initialized)
 

Protected Member Functions

void clear_ntree_cache_ () const
 Clear the cache for global position information. More...
 
void clear_vector_cache_ () const
 Clear the cache for global position information. More...
 
lockPTR< Ntree< D, index > > do_get_global_positions_ntree_ (const Selector &filter)
 
virtual void insert_global_positions_ntree_ (Ntree< D, index > &tree, const Selector &filter)=0
 Insert global position info into ntree. More...
 
virtual void insert_global_positions_vector_ (std::vector< std::pair< Position< D >, index > > &, const Selector &filter)=0
 Insert global position info into vector. More...
 
virtual void insert_local_positions_ntree_ (Ntree< D, index > &tree, const Selector &filter)=0
 Insert local position info into ntree. More...
 
- Protected Member Functions inherited from nest::Subnet
void init_node_ (const Node &)
 
void init_state_ (const Node &)
 Private function to initialize the state of a node to model defaults. More...
 
void init_buffers_ ()
 Private function to initialize the buffers of a node. More...
 
void calibrate ()
 Re-calculate dependent parameters of the node. More...
 
void update (Time const &, const long_t, const long_t)
 Bring the node from state $t$ to $t+n*dt$. More...
 
- Protected Member Functions inherited from nest::Node
virtual size_t num_thread_siblings_ () const
 Return the number of thread siblings in SiblingContainer. More...
 
virtual Nodeget_thread_sibling_ (index) const
 Return the specified member of a SiblingContainer. More...
 
virtual Nodeget_thread_sibling_safe_ (index) const
 Return specified member of a SiblingContainer, with access control. More...
 
Modelget_model_ () const
 
void set_frozen_ (bool frozen)
 Mark node as frozen. More...
 
template<typename ConcreteNode >
const ConcreteNode & downcast (const Node &)
 Auxiliary function to downcast a Node to a concrete class derived from Node. More...
 

Protected Attributes

Position< D > lower_left_
 lower left corner (minimum coordinates) of layer More...
 
Position< D > extent_
 size of layer More...
 
std::bitset< D > periodic_
 periodic b.c. More...
 
- Protected Attributes inherited from nest::AbstractLayer
int_t depth_
 number of neurons at each position More...
 
- Protected Attributes inherited from nest::Subnet
vector< Node * > nodes_
 Pointer to child nodes. More...
 
Multirange gids_
 GIDs of global child nodes. More...
 

Static Protected Attributes

static lockPTR< Ntree< D, index > > cached_ntree_
 Global position information for a single layer. More...
 
static std::vector< std::pair
< Position< D >, index > > * 
cached_vector_ = 0
 
static Selector cached_selector_
 
- Static Protected Attributes inherited from nest::AbstractLayer
static index cached_ntree_layer_ = -1
 GID for the single layer for which we cache global position information. More...
 
static index cached_vector_layer_ = -1
 GID for the single layer for which we cache global position information. More...
 
- Static Protected Attributes inherited from nest::Node
static Networknet_ =NULL
 Pointer to global network driver. More...
 

Friends

class MaskedLayer< D >
 

Additional Inherited Members

- Static Public Member Functions inherited from nest::AbstractLayer
static index create_layer (const DictionaryDatum &)
 Factory function for layers. More...
 
- Static Public Member Functions inherited from nest::Node
static Networknetwork ()
 Return pointer to network driver class. More...
 

Detailed Description

template<int D>
class nest::Layer< D >

Abstract base class for Layer of given dimension (D=2 or 3).

Constructor & Destructor Documentation

template<int D>
nest::Layer< D >::Layer ( )
inline

Creates an empty layer.

template<int D>
nest::Layer< D >::Layer ( const Layer< D > &  l)
inline

Copy constructor.

template<int D>
nest::Layer< D >::~Layer ( )
inline

Virtual destructor.

Member Function Documentation

template<int D>
void nest::Layer< D >::clear_ntree_cache_ ( ) const
inlineprotectedvirtual

Clear the cache for global position information.

Implements nest::AbstractLayer.

template<int D>
void nest::Layer< D >::clear_vector_cache_ ( ) const
inlineprotectedvirtual

Clear the cache for global position information.

Implements nest::AbstractLayer.

template<int D>
Position< D > nest::Layer< D >::compute_displacement ( const Position< D > &  from_pos,
const Position< D > &  to_pos 
) const
virtual

Returns displacement of a position from another position.

When using periodic boundary conditions, will return minimum displacement.

Parameters
from_posposition vector in layer
to_posposition to which displacement is to be computed
Returns
vector pointing from from_pos to to_pos

Referenced by nest::ConnectionCreator::connect_to_target_(), nest::ConnectionCreator::convergent_connect_(), nest::ConnectionCreator::divergent_connect_(), nest::Layer< D >::dump_connections(), and nest::ConnectionCreator::source_driven_connect_().

template<int D>
Position< D > nest::Layer< D >::compute_displacement ( const Position< D > &  from_pos,
const index  to 
) const
inline

Returns displacement of node from given position.

When using periodic boundary conditions, will return minimum displacement.

Parameters
from_posposition vector in layer
tonode in layer to which displacement is to be computed
Returns
vector pointing from from_pos to node to's position
template<int D>
std::vector< double_t > nest::Layer< D >::compute_displacement ( const std::vector< double_t > &  from_pos,
const index  to 
) const
inlinevirtual

Returns displacement of node from given position.

When using periodic boundary conditions, will return minimum displacement.

Parameters
from_posposition vector in layer
tonode in layer to which displacement is to be computed
Returns
vector pointing from from_pos to node to's position

Implements nest::AbstractLayer.

template<int D>
double_t nest::Layer< D >::compute_distance ( const Position< D > &  from_pos,
const index  to 
) const
inline

Returns distance to node from given position.

When using periodic boundary conditions, will return minimum distance.

Parameters
from_posposition vector in layer
tonode in layer to which displacement is to be computed
Returns
length of vector pointing from from_pos to node to's position
template<int D>
double_t nest::Layer< D >::compute_distance ( const std::vector< double_t > &  from_pos,
const index  to 
) const
inlinevirtual

Returns distance to node from given position.

When using periodic boundary conditions, will return minimum distance.

Parameters
from_posposition vector in layer
tonode in layer to which displacement is to be computed
Returns
length of vector pointing from from_pos to node to's position

Implements nest::AbstractLayer.

template<int D>
void nest::Layer< D >::connect ( AbstractLayer< D > &  target,
ConnectionCreator connector 
)
virtual

Connect this layer to the given target layer.

The actual connections are made in class ConnectionCreator.

Parameters
targettarget layer to connect to. Must have same dimension as this layer.
connectorconnection properties

Implements nest::AbstractLayer.

References nest::ConnectionCreator::connect(), and numerics::e.

template<int D>
lockPTR< Ntree< D, index > > nest::Layer< D >::do_get_global_positions_ntree_ ( const Selector filter)
protected
template<int D>
void nest::Layer< D >::dump_connections ( std::ostream &  out,
const Token syn_model 
)
virtual

Dumps information about all connections of the given type having their source in the given layer to the given output stream.

For distributed simulations this function will dump the connections with local targets only.

Parameters
outoutput stream
synapse_idtype of connection

Implements nest::AbstractLayer.

References assert(), nest::Layer< D >::compute_displacement(), def(), nest::names::delay, TokenArray::get(), nest::names::n, TokenArray::size(), nest::names::source, nest::names::synapse_model, nest::names::target, and nest::names::weight.

template<int D>
void nest::Layer< D >::dump_nodes ( std::ostream &  os) const
virtual

Write layer data to stream.

For each node in layer, write one line to stream containing: GID x-position y-position [z-position]

Parameters
osoutput stream

Implements nest::AbstractLayer.

template<int D>
Position<D> nest::Layer< D >::get_center ( ) const
inline
Returns
center of layer.

References nest::Layer< D >::extent_, and nest::Layer< D >::lower_left_.

template<int D>
const Position<D>& nest::Layer< D >::get_extent ( ) const
inline
template<int D>
std::vector< index > nest::Layer< D >::get_global_nodes ( const MaskDatum mask,
const std::vector< double_t > &  anchor,
bool  allow_oversized 
)
virtual

Return a vector with the GIDs of the nodes inside the mask.

Implements nest::AbstractLayer.

References nest::MaskedLayer< D >::begin(), and nest::MaskedLayer< D >::end().

template<int D>
lockPTR< Ntree< D, index > > nest::Layer< D >::get_global_positions_ntree ( Selector  filter = Selector())

Get positions for all nodes in layer, including nodes on other MPI processes.

The positions will be cached so that subsequent calls for the same layer are fast. One one layer is cached at the time, so the user should group together all ConnectLayers calls using the same pool layer.

References assert().

Referenced by nest::MaskedLayer< D >::MaskedLayer().

template<int D>
lockPTR< Ntree< D, index > > nest::Layer< D >::get_global_positions_ntree ( Selector  filter,
std::bitset< D >  periodic,
Position< D >  lower_left,
Position< D >  extent 
)

Get positions globally, overriding the dimensions of the layer and the periodic flags.

The supplied lower left corner and extent coordinates are only used for the dimensions where the supplied periodic flag is set.

References nest::names::extent.

template<int D>
std::vector< std::pair< Position< D >, index > > * nest::Layer< D >::get_global_positions_vector ( Selector  filter = Selector())
template<int D>
std::vector< std::pair< Position< D >, index > > nest::Layer< D >::get_global_positions_vector ( Selector  filter,
const MaskDatum mask,
const Position< D > &  anchor,
bool  allow_oversized 
)
virtual
template<int D>
lockPTR< Ntree< D, index > > nest::Layer< D >::get_local_positions_ntree ( Selector  filter = Selector())

Get positions for local nodes in layer.

Referenced by nest::MaskedLayer< D >::MaskedLayer().

template<int D>
const Position<D>& nest::Layer< D >::get_lower_left ( ) const
inline
Returns
The bottom left position of the layer

References nest::Layer< D >::lower_left_.

Referenced by nest::MaskedLayer< D >::MaskedLayer().

template<int D>
std::bitset<D> nest::Layer< D >::get_periodic_mask ( ) const
inline
Returns
a bitmask specifying which directions are periodic

References nest::Layer< D >::periodic_.

Referenced by nest::MaskedLayer< D >::check_mask_(), and nest::MaskedLayer< D >::MaskedLayer().

template<int D>
virtual Position<D> nest::Layer< D >::get_position ( index  sind) const
pure virtual

Get position of node.

Only possible for local nodes.

Parameters
sindlocal subnet index of node
Returns
position of node identified by Subnet local index value.

Implemented in nest::GridLayer< D >, and nest::FreeLayer< D >.

Referenced by nest::ConnectionCreator::convergent_connect_(), nest::ConnectionCreator::source_driven_connect_(), and nest::ConnectionCreator::target_driven_connect_().

template<int D>
std::vector< double_t > nest::Layer< D >::get_position_vector ( const index  sind) const
inlinevirtual
Parameters
sindlocal subnet index of node
Returns
position of node as std::vector

Implements nest::AbstractLayer.

template<int D>
void nest::Layer< D >::get_status ( DictionaryDatum d) const

Export properties of the layer by setting entries in the status dictionary.

Parameters
dDictionary.

References nest::names::center, nest::names::depth, nest::names::edge_wrap, nest::names::extent, nest::Subnet::get_status(), and nest::names::topology.

Referenced by nest::FreeLayer< D >::get_status(), and nest::GridLayer< D >::get_status().

template<int D>
virtual void nest::Layer< D >::insert_global_positions_ntree_ ( Ntree< D, index > &  tree,
const Selector filter 
)
protectedpure virtual

Insert global position info into ntree.

Implemented in nest::GridLayer< D >, and nest::FreeLayer< D >.

template<int D>
virtual void nest::Layer< D >::insert_global_positions_vector_ ( std::vector< std::pair< Position< D >, index > > &  ,
const Selector filter 
)
protectedpure virtual

Insert global position info into vector.

Implemented in nest::GridLayer< D >, and nest::FreeLayer< D >.

template<int D>
virtual void nest::Layer< D >::insert_local_positions_ntree_ ( Ntree< D, index > &  tree,
const Selector filter 
)
protectedpure virtual

Insert local position info into ntree.

Implemented in nest::GridLayer< D >, and nest::FreeLayer< D >.

template<int D>
bool nest::Layer< D >::is_subnet ( ) const
inlinevirtual

Layers do not allow entry to the ChangeSubnet command, nodes can not be added by the user.

Returns
false

Reimplemented from nest::Subnet.

template<int D>
void nest::Layer< D >::set_status ( const DictionaryDatum d)

Change properties of the layer according to the entries in the dictionary.

Parameters
dDictionary with named parameter settings.

References nest::names::center, nest::names::d, nest::names::edge_wrap, nest::names::extent, getValue< bool >(), and nest::Subnet::set_status().

Referenced by nest::FreeLayer< D >::set_status(), and nest::GridLayer< D >::set_status().

Friends And Related Function Documentation

template<int D>
friend class MaskedLayer< D >
friend

Member Data Documentation

template<int D>
lockPTR< Ntree< D, index > > nest::Layer< D >::cached_ntree_
staticprotected

Global position information for a single layer.

template<int D>
Selector nest::Layer< D >::cached_selector_
staticprotected
template<int D>
std::vector< std::pair< Position< D >, index > > * nest::Layer< D >::cached_vector_ = 0
staticprotected
template<int D>
Position<D> nest::Layer< D >::extent_
protected
template<int D>
Position<D> nest::Layer< D >::lower_left_
protected
template<int D>
std::bitset<D> nest::Layer< D >::periodic_
protected

The documentation for this class was generated from the following files: