NEST
2.6.0,not_revisioned_source_dir@0
|
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... | |
Node * | get_node_by_gid (index) const |
Lookup node based on GID. More... | |
Node * | get_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... | |
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.
nest::SparseNodeArray::SparseNodeArray | ( | ) |
Create empty spare node array.
References step_ctr_.
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().
|
inline |
Clear the array.
Referenced by nest::Network::destruct_nodes_().
|
inline |
Return largest GID in global network.
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.
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().
|
inline |
Lookup node based on index into container.
Use this when you need to iterate over local nodes only.
References assert().
Referenced by nest::Network::destruct_nodes_(), and nest::Network::reset_network().
|
inline |
Referenced by nest::Network::get_status().
|
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_().
|
inline |
Return size of container.
References nodes_.
Referenced by nest::Network::destruct_nodes_(), and nest::Network::reset_network().
|
private |
interpolation factor
|
private |
largest local GID
|
private |
smallest local GID
|
private |
largest GID in network
|
private |
stores local node information
Referenced by size().
|
mutableprivate |
for analysis, measure misses
Referenced by SparseNodeArray().