Superclass for NodeCollections. More...
#include <node_collection.h>
Public Types | |
| using | const_iterator = nc_const_iterator |
Public Member Functions | |
| NodeCollection () | |
| Initializer gets current fingerprint from the kernel. | |
| virtual | ~NodeCollection ()=default |
| bool | valid () const |
| Check to see if the fingerprint of the NodeCollection matches that of the kernel. | |
| virtual std::ostream & | print_me (std::ostream &) const =0 |
| Print out the contents of the NodeCollection in a pretty and informative way. | |
| virtual size_t | operator[] (size_t) const =0 |
| Get the node ID in the specified index in the NodeCollection. | |
| virtual NodeCollectionPTR | operator+ (NodeCollectionPTR) const =0 |
| Join two NodeCollections. | |
| virtual bool | operator== (NodeCollectionPTR) const =0 |
| virtual bool | operator!= (NodeCollectionPTR) const |
| Check if two NodeCollections are equal. | |
| virtual const_iterator | begin (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const =0 |
| Method to get an iterator representing the beginning of the NodeCollection. | |
| virtual const_iterator | thread_local_begin (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const =0 |
| Return iterator stepping from first node on the thread it is called on over nodes on that thread. | |
| virtual const_iterator | rank_local_begin (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const =0 |
| Method to get an iterator representing the beginning of the NodeCollection. | |
| virtual const_iterator | end (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const =0 |
| Method to get an iterator representing the end of the NodeCollection. | |
| std::vector< size_t > | to_array (const std::string &selection) const |
| Method that creates a vector filled with node IDs from the NodeCollection; for debugging. | |
| virtual size_t | size () const =0 |
| Get the size of the NodeCollection. | |
| virtual size_t | stride () const =0 |
| Get the step of the NodeCollection. | |
| virtual bool | contains (const size_t node_id) const =0 |
| Check if the NodeCollection contains a specified node ID. | |
| virtual NodeCollectionPTR | slice (size_t start, size_t end, size_t stride) const =0 |
| Slices the NodeCollection to the boundaries, with an optional step parameter. | |
| virtual void | set_metadata (NodeCollectionMetadataPTR)=0 |
| Sets the metadata of the NodeCollection. | |
| virtual NodeCollectionMetadataPTR | get_metadata () const =0 |
| Gets the metadata of the NodeCollection. | |
| virtual bool | is_range () const =0 |
| virtual bool | empty () const =0 |
| Checks if the NodeCollection has no elements. | |
| virtual long | get_nc_index (const size_t) const =0 |
| Returns index of node with given node ID in NodeCollection. | |
| virtual bool | has_proxies () const =0 |
| Returns whether the NodeCollection contains any nodes with proxies or not. | |
| virtual bool | all_connect_as_neurons () const =0 |
| Returns true if all elements connect as neurons. | |
| virtual bool | all_connect_as_devices () const =0 |
| Returns true if all elements connect as devices. | |
| void | get_metadata_status (Dictionary &) const |
| Collect metadata into dictionary. | |
| size_t | get_first () const |
| return the first stored ID (i.e, ID at index zero) inside the NodeCollection | |
| size_t | get_last () const |
| return the last stored ID inside the NodeCollection | |
Static Public Member Functions | |
| static NodeCollectionPTR | create (const size_t node_id) |
| Create a NodeCollection from a single node ID. | |
| static NodeCollectionPTR | create (const Node *node) |
| Create a NodeCollection from a single node pointer. | |
| static NodeCollectionPTR | create (const std::vector< size_t > &node_ids) |
| Create a NodeCollection from an array of node IDs. | |
Static Private Member Functions | |
| static NodeCollectionPTR | create_ () |
| static NodeCollectionPTR | create_ (const std::vector< size_t > &) |
Private Attributes | |
| unsigned long | fingerprint_ |
| Unique identity of the kernel that created the NodeCollection. | |
Friends | |
| class | nc_const_iterator |
Superclass for NodeCollections.
The superclass acts as an interface to the primitive and composite NodeCollection types. It contains methods, mostly virtual, for the subclasses, and also create()-methods to be interfaced externally.
The superclass also contains handling of the fingerprint, a unique identity the NodeCollection gets from the kernel on creation, which ensures that the NodeCollection is not used after the kernel is reset.
There are two types of NodeCollections
For any node collection, three types of iterators can be obtained by different begin() methods:
There is only a single type of end iterator returned by end().
For more information on composite node collections, see the documentation for the derived class and nc_const_iterator.
| nest::NodeCollection::NodeCollection | ( | ) |
Initializer gets current fingerprint from the kernel.
References fingerprint_, and nest::kernel().
|
virtualdefault |
|
pure virtual |
Returns true if all elements connect as devices.
This includes most devices, but not globally receiving devices, e.g., the volume transmitter.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Returns true if all elements connect as neurons.
This includes neurons with proxies and devices such as the volume transmitter.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Method to get an iterator representing the beginning of the NodeCollection.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by get_first(), and get_last().
|
pure virtual |
Check if the NodeCollection contains a specified node ID.
| node_id | node ID to see if exists in the NodeCollection |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
static |
Create a NodeCollection from a single node pointer.
Results in a primitive unconditionally.
| node | Node pointer from which to create the NodeCollection |
References create(), create_(), and nest::Node::get_node_id().
|
static |
Create a NodeCollection from a single node ID.
Results in a primitive unconditionally.
| node_id | Node ID from which to create the NodeCollection |
References create_().
Referenced by create(), nest::NodeManager::get_nodes(), nest::CommonSynapseProperties::get_status(), nest::STDPDopaCommonProperties::get_status(), nest::make_nodecollection(), nest::node_collection_array_index(), nest::node_collection_array_index(), nest::select_nodes_by_mask(), and nest::weight_recorder::Parameters_::set().
|
static |
Create a NodeCollection from an array of node IDs.
Results in a primitive if the node IDs are homogeneous and contiguous, or a composite otherwise.
| node_ids | Array of node IDs from which to create the NodeCollection |
References create_().
|
staticprivate |
|
staticprivate |
References nest::ModelRangeManager::get_model_id(), nest::kernel(), and nest::KernelManager::modelrange_manager.
|
pure virtual |
Checks if the NodeCollection has no elements.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Method to get an iterator representing the end of the NodeCollection.
| offset | Index of element NC that iterator points to |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by nest::FreeLayer< D >::get_status(), slice(), and to_array().
|
inline |
return the first stored ID (i.e, ID at index zero) inside the NodeCollection
References begin().
|
inline |
return the last stored ID inside the NodeCollection
References begin(), and size().
|
pure virtual |
Gets the metadata of the NodeCollection.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by get_metadata_status().
| void nest::NodeCollection::get_metadata_status | ( | Dictionary & | d | ) | const |
Collect metadata into dictionary.
References get_metadata().
|
pure virtual |
Returns index of node with given node ID in NodeCollection.
Index here is into the sliced node collection, so that nc[ nc.get_nc_index( gid )].node_id == gid.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Returns whether the NodeCollection contains any nodes with proxies or not.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
inlinevirtual |
Check if two NodeCollections are equal.
| rhs | NodeCollection pointer to the NodeCollection to be checked against |
|
pure virtual |
Join two NodeCollections.
May return a primitive or composite, depending on the input.
| rhs | NodeCollection pointer to the NodeCollection to be added |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Get the node ID in the specified index in the NodeCollection.
| idx | Index in the NodeCollection |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Print out the contents of the NodeCollection in a pretty and informative way.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Method to get an iterator representing the beginning of the NodeCollection.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by nest::FreeLayer< D >::get_status(), and to_array().
|
inlinepure virtual |
Sets the metadata of the NodeCollection.
| meta | A Metadata pointer |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
|
pure virtual |
Get the size of the NodeCollection.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by get_last(), and nest::Layer< D >::get_status().
|
pure virtual |
Slices the NodeCollection to the boundaries, with an optional step parameter.
Note that the boundaries being specified are inclusive.
| start | Index of the NodeCollection to start at |
| end | One past the index of the NodeCollection to stop at |
| stride | Number of places between node IDs to skip. Defaults to 1 |
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
References end(), and stride().
|
pure virtual |
Get the step of the NodeCollection.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by slice().
|
pure virtual |
Return iterator stepping from first node on the thread it is called on over nodes on that thread.
Implemented in nest::NodeCollectionComposite, and nest::NodeCollectionPrimitive.
Referenced by to_array().
| std::vector< size_t > nest::NodeCollection::to_array | ( | const std::string & | selection | ) | const |
Method that creates a vector filled with node IDs from the NodeCollection; for debugging.
| selection | is "all", "rank" or "thread" |
References end(), nest::kernel(), rank_local_begin(), and thread_local_begin().
| bool nest::NodeCollection::valid | ( | ) | const |
Check to see if the fingerprint of the NodeCollection matches that of the kernel.
References fingerprint_, nest::KernelManager::get_fingerprint(), and nest::kernel().
Referenced by nest::NodeCollectionComposite::operator+(), nest::NodeCollectionPrimitive::operator+(), nest::NodeCollectionComposite::slice(), and nest::NodeCollectionPrimitive::slice().
|
friend |
References nc_const_iterator.
Referenced by nc_const_iterator.
|
private |
Unique identity of the kernel that created the NodeCollection.
Referenced by NodeCollection(), and valid().