NEST main@f146f75
Loading...
Searching...
No Matches
nest::Layer< D > Class Template Referenceabstract

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

#include <layer.h>

Inheritance diagram for nest::Layer< D >:
[legend]
Collaboration diagram for nest::Layer< D >:
[legend]

Public Member Functions

 Layer ()
 Creates an empty layer.
 Layer (const Layer &other_layer)
 ~Layer () override
void set_status (const Dictionary &) override
 Change properties of the layer according to the entries in the dictionary.
void get_status (Dictionary &, NodeCollection const *const) const override
 Retrieve status, slice according to node collection if given.
unsigned int get_num_dimensions () const override
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 (size_t sind) const =0
 Get position of node.
std::vector< double > get_position_vector (const size_t sind) const override
Position< D > compute_displacement (const Position< D > &from_pos, const Position< D > &to_pos) const
 Returns displacement of a position from another position.
double compute_displacement (const std::vector< double > &from_pos, const std::vector< double > &to_pos, const unsigned int dimension) const override
Position< D > compute_displacement (const Position< D > &from_pos, const size_t to) const
 Returns displacement of node from given position.
std::vector< double > compute_displacement (const std::vector< double > &from_pos, const size_t to) const override
 Returns displacement of node from given position.
double compute_distance (const Position< D > &from_pos, const size_t lid) const
 Returns distance to node from given position.
double compute_distance (const std::vector< double > &from_pos, const size_t lid) const override
 Returns distance to node from given position.
double compute_distance (const std::vector< double > &from_pos, const std::vector< double > &to_pos) const override
std::shared_ptr< Ntree< D, size_t > > get_global_positions_ntree (NodeCollectionPTR node_collection)
 Get positions for all nodes in layer, including nodes on other MPI processes.
std::shared_ptr< Ntree< D, size_t > > get_global_positions_ntree (std::bitset< D > periodic, Position< D > lower_left, Position< D > extent, NodeCollectionPTR node_collection)
 Get positions globally, overriding the dimensions of the layer and the periodic flags.
std::vector< std::pair< Position< D >, size_t > > * get_global_positions_vector (NodeCollectionPTR node_collection)
virtual std::vector< std::pair< Position< D >, size_t > > get_global_positions_vector (const MaskPTR mask, const Position< D > &anchor, bool allow_oversized, NodeCollectionPTR node_collection)
std::vector< size_t > get_global_nodes (const MaskPTR mask, const std::vector< double > &anchor, bool allow_oversized, NodeCollectionPTR node_collection) override
 Return a vector with the node IDs of the nodes inside the mask.
void connect (NodeCollectionPTR source_nc, AbstractLayerPTR target, NodeCollectionPTR target_nc, ConnectionCreator &connector) override
 Connect this layer to the given target layer.
void dump_nodes (std::ostream &os) const override
 Write layer data to stream.
void dump_connections (std::ostream &out, NodeCollectionPTR node_collection, AbstractLayerPTR target_layer, const std::string &syn_model) override
 Dumps information about all connections of the given type having their source in the given layer to the given output stream.
Public Member Functions inherited from nest::AbstractLayer
 AbstractLayer ()
virtual ~AbstractLayer ()
void set_node_collection (NodeCollectionPTR)
NodeCollectionPTR get_node_collection ()

Protected Member Functions

void clear_ntree_cache_ () const override
 Clear the cache for global position information.
void clear_vector_cache_ () const override
 Clear the cache for global position information.
std::shared_ptr< Ntree< D, size_t > > do_get_global_positions_ntree_ (NodeCollectionPTR node_collection)
virtual void insert_global_positions_ntree_ (Ntree< D, size_t > &tree, NodeCollectionPTR node_collection)=0
 Insert global position info into ntree.
virtual void insert_global_positions_vector_ (std::vector< std::pair< Position< D >, size_t > > &, NodeCollectionPTR)=0
 Insert global position info into vector.
Protected Member Functions inherited from nest::AbstractLayer
NodeCollectionMetadataPTR get_metadata () const
 Gets metadata of the NodeCollection to which this layer belongs.

Protected Attributes

Position< D > lower_left_
 lower left corner (minimum coordinates) of layer
Position< D > extent_
 size of layer
std::bitset< D > periodic_
 periodic b.c.
Protected Attributes inherited from nest::AbstractLayer
NodeCollectionPTR node_collection_
 The NodeCollection to which the layer belongs.

Static Protected Attributes

static std::shared_ptr< Ntree< D, size_t > > cached_ntree_
 Global position information for a single layer.
static std::vector< std::pair< Position< D >, size_t > > * cached_vector_
Static Protected Attributes inherited from nest::AbstractLayer
static NodeCollectionMetadataPTR cached_ntree_md_ = NodeCollectionMetadataPTR( nullptr )
 Metadata for the layer for which we cache global position information.
static NodeCollectionMetadataPTR cached_vector_md_ = NodeCollectionMetadataPTR( nullptr )
 Metadata for the layer for which we cache global position information.

Friends

class MaskedLayer< D >

Additional Inherited Members

Static Public Member Functions inherited from nest::AbstractLayer
static NodeCollectionPTR create_layer (const Dictionary &)
 Factory function for layers.

Detailed Description

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

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

Constructor & Destructor Documentation

◆ Layer() [1/2]

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

Creates an empty layer.

References extent_, and lower_left_.

Referenced by connect(), dump_connections(), nest::GridLayer< D >::GridLayer(), nest::GridLayer< D >::GridLayer(), and Layer().

Here is the caller graph for this function:

◆ Layer() [2/2]

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

References nest::AbstractLayer::AbstractLayer(), extent_, Layer(), lower_left_, and periodic_.

Here is the call graph for this function:

◆ ~Layer()

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

References nest::AbstractLayer::cached_ntree_md_, nest::AbstractLayer::cached_vector_md_, clear_ntree_cache_(), clear_vector_cache_(), and nest::get_metadata().

Here is the call graph for this function:

Member Function Documentation

◆ clear_ntree_cache_()

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

Clear the cache for global position information.

Implements nest::AbstractLayer.

References cached_ntree_, and nest::AbstractLayer::cached_ntree_md_.

Referenced by get_global_positions_ntree(), get_global_positions_ntree(), get_global_positions_vector(), and ~Layer().

Here is the caller graph for this function:

◆ clear_vector_cache_()

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

Clear the cache for global position information.

Implements nest::AbstractLayer.

References cached_vector_, and nest::AbstractLayer::cached_vector_md_.

Referenced by do_get_global_positions_ntree_(), get_global_positions_ntree(), get_global_positions_vector(), and ~Layer().

Here is the caller graph for this function:

◆ compute_displacement() [1/4]

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

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

References extent_, and periodic_.

Referenced by compute_displacement(), compute_displacement(), compute_distance(), compute_distance(), and compute_distance().

Here is the caller graph for this function:

◆ compute_displacement() [2/4]

template<int D>
Position< D > nest::Layer< D >::compute_displacement ( const Position< D > & from_pos,
const size_t 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

References compute_displacement(), and nest::get_position().

Here is the call graph for this function:

◆ compute_displacement() [3/4]

template<int D>
std::vector< double > nest::Layer< D >::compute_displacement ( const std::vector< double > & from_pos,
const size_t to ) const
inlineoverridevirtual

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.

References compute_displacement().

Here is the call graph for this function:

◆ compute_displacement() [4/4]

template<int D>
double nest::Layer< D >::compute_displacement ( const std::vector< double > & from_pos,
const std::vector< double > & to_pos,
const unsigned int dimension ) const
overridevirtual

Implements nest::AbstractLayer.

References nest::displacement(), extent_, and periodic_.

Here is the call graph for this function:

◆ compute_distance() [1/3]

template<int D>
double nest::Layer< D >::compute_distance ( const Position< D > & from_pos,
const size_t lid ) 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

References compute_displacement().

Here is the call graph for this function:

◆ compute_distance() [2/3]

template<int D>
double nest::Layer< D >::compute_distance ( const std::vector< double > & from_pos,
const size_t lid ) const
inlineoverridevirtual

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.

References compute_displacement().

Here is the call graph for this function:

◆ compute_distance() [3/3]

template<int D>
double nest::Layer< D >::compute_distance ( const std::vector< double > & from_pos,
const std::vector< double > & to_pos ) const
inlineoverridevirtual

Implements nest::AbstractLayer.

References compute_displacement(), and nest::displacement().

Here is the call graph for this function:

◆ connect()

template<int D>
void nest::Layer< D >::connect ( NodeCollectionPTR source_nc,
AbstractLayerPTR target,
NodeCollectionPTR target_nc,
ConnectionCreator & connector )
overridevirtual

Connect this layer to the given target layer.

The actual connections are made in class ConnectionCreator.

Parameters
source_ncNodeCollection to the source layer.
targettarget layer to connect to. Must have same dimension as this layer.
target_ncNodeCollection to the target layer.
connectorconnection properties

Implements nest::AbstractLayer.

References nest::AbstractLayer::AbstractLayer(), nest::ConnectionCreator::connect(), and Layer().

Here is the call graph for this function:

◆ do_get_global_positions_ntree_()

template<int D>
std::shared_ptr< Ntree< D, size_t > > nest::Layer< D >::do_get_global_positions_ntree_ ( NodeCollectionPTR node_collection)
protected

References cached_ntree_, nest::AbstractLayer::cached_ntree_md_, cached_vector_, nest::AbstractLayer::cached_vector_md_, clear_vector_cache_(), and insert_global_positions_ntree_().

Referenced by get_global_positions_ntree(), and get_global_positions_ntree().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump_connections()

template<int D>
void nest::Layer< D >::dump_connections ( std::ostream & out,
NodeCollectionPTR node_collection,
AbstractLayerPTR target_layer,
const std::string & syn_model )
overridevirtual

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
node_collectionNodeCollection of the layer
target_layerTarget layer
synapse_idtype of connection

Implements nest::AbstractLayer.

References nest::KernelManager::connection_manager, nest::names::delay(), Dictionary::get(), nest::ConnectionManager::get_connections(), get_global_positions_vector(), nest::ConnectionManager::get_synapse_status(), nest::kernel(), Layer(), nest::names::source(), nest::names::synapse_model(), nest::names::target(), and nest::names::weight().

Here is the call graph for this function:

◆ dump_nodes()

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

Write layer data to stream.

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

Parameters
osoutput stream

Implements nest::AbstractLayer.

References nest::get_position(), and nest::AbstractLayer::node_collection_.

Here is the call graph for this function:

◆ get_center()

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

References extent_, and lower_left_.

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

Here is the caller graph for this function:

◆ get_extent()

template<int D>
const Position< D > & nest::Layer< D >::get_extent ( ) const
inline
Returns
extent of layer.

References extent_.

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

Here is the caller graph for this function:

◆ get_global_nodes()

template<int D>
std::vector< size_t > nest::Layer< D >::get_global_nodes ( const MaskPTR mask,
const std::vector< double > & anchor,
bool allow_oversized,
NodeCollectionPTR node_collection )
overridevirtual

Return a vector with the node IDs of the nodes inside the mask.

Implements nest::AbstractLayer.

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

Here is the call graph for this function:

◆ get_global_positions_ntree() [1/2]

template<int D>
std::shared_ptr< Ntree< D, size_t > > nest::Layer< D >::get_global_positions_ntree ( NodeCollectionPTR node_collection)

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 cached_ntree_, nest::AbstractLayer::cached_ntree_md_, clear_ntree_cache_(), do_get_global_positions_ntree_(), extent_, lower_left_, and periodic_.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_global_positions_ntree() [2/2]

template<int D>
std::shared_ptr< Ntree< D, size_t > > nest::Layer< D >::get_global_positions_ntree ( std::bitset< D > periodic,
Position< D > lower_left,
Position< D > extent,
NodeCollectionPTR node_collection )

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 cached_ntree_, nest::AbstractLayer::cached_ntree_md_, clear_ntree_cache_(), clear_vector_cache_(), do_get_global_positions_ntree_(), extent_, and lower_left_.

Here is the call graph for this function:

◆ get_global_positions_vector() [1/2]

template<int D>
std::vector< std::pair< Position< D >, size_t > > nest::Layer< D >::get_global_positions_vector ( const MaskPTR mask,
const Position< D > & anchor,
bool allow_oversized,
NodeCollectionPTR node_collection )
virtual

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

Here is the call graph for this function:

◆ get_global_positions_vector() [2/2]

template<int D>
std::vector< std::pair< Position< D >, size_t > > * nest::Layer< D >::get_global_positions_vector ( NodeCollectionPTR node_collection)

References cached_ntree_, nest::AbstractLayer::cached_ntree_md_, cached_vector_, nest::AbstractLayer::cached_vector_md_, clear_ntree_cache_(), clear_vector_cache_(), and insert_global_positions_vector_().

Referenced by dump_connections().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_lower_left()

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

References lower_left_.

◆ get_num_dimensions()

template<int D>
unsigned int nest::Layer< D >::get_num_dimensions ( ) const
inlineoverridevirtual

Implements nest::AbstractLayer.

◆ get_periodic_mask()

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

References periodic_.

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

Here is the caller graph for this function:

◆ get_position()

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

Get position of node.

Only possible for local nodes.

Parameters
sindindex of node
Returns
position of node.

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

◆ get_position_vector()

template<int D>
std::vector< double > nest::Layer< D >::get_position_vector ( const size_t sind) const
inlineoverridevirtual
Parameters
sindindex of node
Returns
position of node as std::vector

Implements nest::AbstractLayer.

References nest::get_position().

Here is the call graph for this function:

◆ get_status()

template<int D>
void nest::Layer< D >::get_status ( Dictionary & d,
NodeCollection const * const nc ) const
overridevirtual

Retrieve status, slice according to node collection if given.

Implements nest::AbstractLayer.

References nest::names::center(), nest::names::edge_wrap(), nest::names::extent(), extent_, lower_left_, nest::names::network_size(), periodic_, and nest::NodeCollection::size().

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insert_global_positions_ntree_()

template<int D>
virtual void nest::Layer< D >::insert_global_positions_ntree_ ( Ntree< D, size_t > & tree,
NodeCollectionPTR node_collection )
protectedpure virtual

Insert global position info into ntree.

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

Referenced by do_get_global_positions_ntree_().

Here is the caller graph for this function:

◆ insert_global_positions_vector_()

template<int D>
virtual void nest::Layer< D >::insert_global_positions_vector_ ( std::vector< std::pair< Position< D >, size_t > > & ,
NodeCollectionPTR  )
protectedpure virtual

Insert global position info into vector.

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

Referenced by get_global_positions_vector().

Here is the caller graph for this function:

◆ set_status()

template<int D>
void nest::Layer< D >::set_status ( const Dictionary & d)
overridevirtual

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

Parameters
dDictionary with named parameter settings.

Implements nest::AbstractLayer.

References nest::names::edge_wrap(), and periodic_.

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

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MaskedLayer< D >

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

Member Data Documentation

◆ cached_ntree_

template<int D>
std::shared_ptr< Ntree< D, size_t > > nest::Layer< D >::cached_ntree_
staticprotected

◆ cached_vector_

template<int D>
std::vector< std::pair< Position< D >, size_t > >* nest::Layer< D >::cached_vector_
staticprotected

◆ extent_

◆ lower_left_

◆ periodic_


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