NEST  2.6.0,not_revisioned_source_dir@0
Classes | Public Member Functions | Private Attributes | List of all members
nest::SparseNodeArray Class Reference

Provide sparse representation of local nodes. More...

#include <sparse_node_array.h>

Classes

struct  NodeEntry_
 

Public Member Functions

 SparseNodeArray ()
 Create empty spare node array. More...
 
size_t size () const
 Return size of container. More...
 
void reserve (size_t)
 Reserve space for given number of elements. More...
 
void clear ()
 Clear the array. More...
 
size_t max_size () const
 Return maximum size of underlying vector. More...
 
void add_local_node (Node &)
 Add single local node. More...
 
void add_remote_node (index)
 Register non-local node. More...
 
Nodeget_node_by_gid (index) const
 Lookup node based on GID. More...
 
Nodeget_node_by_index (size_t) const
 Lookup node based on index into container. More...
 
index get_max_gid () const
 Return largest GID in global network. More...
 
std::map< long, size_t > get_step_ctr () const
 

Private Attributes

std::vector< NodeEntry_nodes_
 stores local node information More...
 
index max_gid_
 largest GID in network More...
 
index local_min_gid_
 smallest local GID More...
 
index local_max_gid_
 largest local GID More...
 
double gid_idx_scale_
 interpolation factor More...
 
std::map< long, size_t > step_ctr_
 for analysis, measure misses More...
 

Detailed Description

Provide sparse representation of local nodes.

This class is a container providing lookup of local nodes (as Node*) based on GIDs.

Basically, this array is a vector containing only pointers to local nodes. For M MPI processes, we have

GID % M –> rank GID div M –> index on rank

so that the latter gives and index into the local node array. This index will be skewed due to nodes without proxies present on all ranks, whence computation may give an index that is too low and we must search to the right for the actual node. We never need to search to the left.

Constructor & Destructor Documentation

nest::SparseNodeArray::SparseNodeArray ( )

Create empty spare node array.

References step_ctr_.

Member Function Documentation

void nest::SparseNodeArray::add_local_node ( Node node)

Add single local node.

References assert(), and nest::Node::get_gid().

Referenced by nest::Network::add_node(), and nest::Network::init_().

void nest::SparseNodeArray::add_remote_node ( index  gid)

Register non-local node.

Ensures that array knows about non-local nodes with GIDs higher than highest local GID.

References assert().

Referenced by nest::Network::add_node().

void nest::SparseNodeArray::clear ( )
inline

Clear the array.

Referenced by nest::Network::destruct_nodes_().

nest::index nest::SparseNodeArray::get_max_gid ( ) const
inline

Return largest GID in global network.

See also
size

Referenced by nest::Network::add_node(), and nest::Network::size().

nest::Node * nest::SparseNodeArray::get_node_by_gid ( index  gid) const

Lookup node based on GID.

Returns 0 if GID is not local. For local nodes with siblings, it returns the pointer to the sibling container. The caller is responsible for (i) providing proper proxy node pointers for non-local nodes and (ii) selecting the correct sibling for a given thread for nodes that are sibling containers.

See also
get_node_by_index()

References assert().

Referenced by nest::Network::add_node(), nest::Network::get_node(), nest::Network::get_thread_siblings(), nest::Network::is_local_gid(), and nest::Network::set_status().

nest::Node * nest::SparseNodeArray::get_node_by_index ( size_t  idx) const
inline

Lookup node based on index into container.

Use this when you need to iterate over local nodes only.

See also
get_node_by_gid()

References assert().

Referenced by nest::Network::destruct_nodes_(), and nest::Network::reset_network().

std::map< long, size_t > nest::SparseNodeArray::get_step_ctr ( ) const
inline
size_t nest::SparseNodeArray::max_size ( ) const
inline

Return maximum size of underlying vector.

Referenced by nest::Network::add_node().

void nest::SparseNodeArray::reserve ( size_t  new_size)

Reserve space for given number of elements.

Referenced by nest::Network::add_node(), and nest::Network::init_().

size_t nest::SparseNodeArray::size ( void  ) const
inline

Return size of container.

See also
get_max_gid()

References nodes_.

Referenced by nest::Network::destruct_nodes_(), and nest::Network::reset_network().

Member Data Documentation

double nest::SparseNodeArray::gid_idx_scale_
private

interpolation factor

index nest::SparseNodeArray::local_max_gid_
private

largest local GID

index nest::SparseNodeArray::local_min_gid_
private

smallest local GID

index nest::SparseNodeArray::max_gid_
private

largest GID in network

std::vector<NodeEntry_> nest::SparseNodeArray::nodes_
private

stores local node information

Referenced by size().

std::map<long, size_t> nest::SparseNodeArray::step_ctr_
mutableprivate

for analysis, measure misses

Referenced by SparseNodeArray().


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