Subclass for the primitive NodeCollection type. More...
#include <node_collection.h>
Public Member Functions | |
| NodeCollectionPrimitive (size_t first, size_t last, size_t model_id, NodeCollectionMetadataPTR) | |
| Create a primitive from a range of node IDs, with provided model ID and metadata pointer. | |
| NodeCollectionPrimitive (size_t first, size_t last, size_t model_id) | |
| Create a primitive from a range of node IDs, with provided model ID. | |
| NodeCollectionPrimitive (size_t first, size_t last) | |
| Create a primitive from a range of node IDs. | |
| NodeCollectionPrimitive (const NodeCollectionPrimitive &)=default | |
| Primitive copy constructor. | |
| NodeCollectionPrimitive & | operator= (const NodeCollectionPrimitive &)=default |
| Primitive assignment operator. | |
| NodeCollectionPrimitive () | |
| Create empty NodeCollection. | |
| std::ostream & | print_me (std::ostream &) const override |
| Print out the contents of the NodeCollection in a pretty and informative way. | |
| void | print_primitive (std::ostream &) const |
| size_t | operator[] (const size_t) const override |
| Get the node ID in the specified index in the NodeCollection. | |
| NodeCollectionPTR | operator+ (NodeCollectionPTR rhs) const override |
| Join two NodeCollections. | |
| bool | operator== (const NodeCollectionPTR rhs) const override |
| bool | operator== (const NodeCollectionPrimitive &rhs) const |
| const_iterator | begin (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const override |
| Method to get an iterator representing the beginning of the NodeCollection. | |
| const_iterator | thread_local_begin (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const override |
| Return iterator stepping from first node on the thread it is called on over nodes on that thread. | |
| const_iterator | rank_local_begin (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const override |
| Method to get an iterator representing the beginning of the NodeCollection. | |
| const_iterator | end (NodeCollectionPTR=NodeCollectionPTR(nullptr)) const override |
| Method to get an iterator representing the end of the NodeCollection. | |
| size_t | size () const override |
| Returns total number of node IDs in the primitive. | |
| size_t | stride () const override |
| Returns the stride between node IDs in the primitive (always 1). | |
| bool | contains (const size_t node_id) const override |
| Check if the NodeCollection contains a specified node ID. | |
| NodeCollectionPTR | slice (size_t start, size_t end, size_t stride=1) const override |
| Slices the NodeCollection to the boundaries, with an optional step parameter. | |
| void | set_metadata (NodeCollectionMetadataPTR) override |
| Sets the metadata of the NodeCollection. | |
| NodeCollectionMetadataPTR | get_metadata () const override |
| Gets the metadata of the NodeCollection. | |
| bool | is_range () const override |
| bool | empty () const override |
| Checks if the NodeCollection has no elements. | |
| long | get_nc_index (const size_t) const override |
| Returns index of node with given node ID in NodeCollection. | |
| bool | has_proxies () const override |
| Returns whether the NodeCollection contains any nodes with proxies or not. | |
| bool | is_contiguous_ascending (const NodeCollectionPrimitive &other) const |
| Checks if node IDs in another primitive is a continuation of node IDs in this primitive. | |
| bool | overlapping (const NodeCollectionPrimitive &rhs) const |
| Checks if node IDs of another primitive is overlapping node IDs of this primitive. | |
Public Member Functions inherited from nest::NodeCollection | |
| 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 bool | operator!= (NodeCollectionPTR) const |
| Check if two NodeCollections are equal. | |
| 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. | |
| 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 | |
Private Member Functions | |
| void | assert_consistent_model_ids_ (const size_t) const |
| Raise an error if the model IDs of all nodes in the primitive are not the same as the expected model id. | |
Private Attributes | |
| size_t | first_ |
| The first node ID in the primitive. | |
| size_t | last_ |
| The last node ID in the primitive. | |
| size_t | model_id_ |
| Model ID of the node IDs. | |
| NodeCollectionMetadataPTR | metadata_ |
| Pointer to the metadata of the node IDs. | |
| bool | nodes_have_no_proxies_ |
| Whether the primitive contains devices or not. | |
Friends | |
| class | nc_const_iterator |
Additional Inherited Members | |
Public Types inherited from nest::NodeCollection | |
| using | const_iterator = nc_const_iterator |
Static Public Member Functions inherited from nest::NodeCollection | |
| 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. | |
Subclass for the primitive NodeCollection type.
The primitive type contains only homogeneous and contiguous node IDs. It also contains model ID and metadata of the node IDs.
| nest::NodeCollectionPrimitive::NodeCollectionPrimitive | ( | size_t | first, |
| size_t | last, | ||
| size_t | model_id, | ||
| NodeCollectionMetadataPTR | meta | ||
| ) |
Create a primitive from a range of node IDs, with provided model ID and metadata pointer.
| first | The first node ID in the primitive |
| last | The last node ID in the primitive |
| model_id | Model ID of the node IDs |
| meta | Metadata pointer of the node IDs |
References assert_consistent_model_ids_(), first_, last_, and model_id_.
| nest::NodeCollectionPrimitive::NodeCollectionPrimitive | ( | size_t | first, |
| size_t | last, | ||
| size_t | model_id | ||
| ) |
| nest::NodeCollectionPrimitive::NodeCollectionPrimitive | ( | size_t | first, |
| size_t | last | ||
| ) |
Create a primitive from a range of node IDs.
The model ID has to be found by the constructor.
| first | The first node ID in the primitive |
| last | The last node ID in the primitive |
References first_, nest::ModelRangeManager::get_model_id(), nest::ModelManager::get_node_model(), nest::Model::has_proxies(), nest::kernel(), last_, model_id_, nest::KernelManager::model_manager, nest::KernelManager::modelrange_manager, and nodes_have_no_proxies_.
|
default |
Primitive copy constructor.
| rhs | Primitive to copy |
| nest::NodeCollectionPrimitive::NodeCollectionPrimitive | ( | ) |
Create empty NodeCollection.
|
private |
Raise an error if the model IDs of all nodes in the primitive are not the same as the expected model id.
| model_id | Expected model id. |
References first_, nest::ModelRangeManager::get_model_id(), nest::ModelRangeManager::get_model_of_node_id(), nest::Model::get_name(), nest::kernel(), last_, nest::message(), and nest::KernelManager::modelrange_manager.
Referenced by NodeCollectionPrimitive().
|
inlineoverridevirtual |
Method to get an iterator representing the beginning of the NodeCollection.
Implements nest::NodeCollection.
References nc_const_iterator.
|
inlineoverridevirtual |
Check if the NodeCollection contains a specified node ID.
| node_id | node ID to see if exists in the NodeCollection |
Implements nest::NodeCollection.
|
inlineoverridevirtual |
Checks if the NodeCollection has no elements.
Implements nest::NodeCollection.
References last_.
Referenced by operator+(), and print_me().
|
inlineoverridevirtual |
Method to get an iterator representing the end of the NodeCollection.
| offset | Index of element NC that iterator points to |
Implements nest::NodeCollection.
References nest::nc_const_iterator::END, nc_const_iterator, and size().
Referenced by slice().
|
inlineoverridevirtual |
Gets the metadata of the NodeCollection.
Implements nest::NodeCollection.
References metadata_.
Referenced by nest::NodeCollectionComposite::operator+(), and operator+().
|
inlineoverridevirtual |
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.
Implements nest::NodeCollection.
|
inlineoverridevirtual |
Returns whether the NodeCollection contains any nodes with proxies or not.
Implements nest::NodeCollection.
References nodes_have_no_proxies_.
| bool nest::NodeCollectionPrimitive::is_contiguous_ascending | ( | const NodeCollectionPrimitive & | other | ) | const |
Checks if node IDs in another primitive is a continuation of node IDs in this primitive.
| other | Primitive to check for continuity |
|
inlineoverridevirtual |
Implements nest::NodeCollection.
|
overridevirtual |
Join two NodeCollections.
May return a primitive or composite, depending on the input.
| rhs | NodeCollection pointer to the NodeCollection to be added |
Implements nest::NodeCollection.
References empty(), first_, get_metadata(), last_, metadata_, model_id_, overlapping(), and nest::NodeCollection::valid().
|
default |
Primitive assignment operator.
| rhs | Primitive to assign |
|
inline |
|
inlineoverridevirtual |
Implements nest::NodeCollection.
|
inlineoverridevirtual |
Get the node ID in the specified index in the NodeCollection.
| idx | Index in the NodeCollection |
Implements nest::NodeCollection.
| bool nest::NodeCollectionPrimitive::overlapping | ( | const NodeCollectionPrimitive & | rhs | ) | const |
Checks if node IDs of another primitive is overlapping node IDs of this primitive.
| rhs | Primitive to be checked. |
Referenced by operator+().
|
overridevirtual |
Print out the contents of the NodeCollection in a pretty and informative way.
Implements nest::NodeCollection.
References empty(), metadata_, and print_primitive().
| void nest::NodeCollectionPrimitive::print_primitive | ( | std::ostream & | out | ) | const |
References first_, nest::Model::get_name(), nest::ModelManager::get_node_model(), nest::kernel(), last_, model_id_, nest::KernelManager::model_manager, and size().
Referenced by print_me().
|
overridevirtual |
Method to get an iterator representing the beginning of the NodeCollection.
Implements nest::NodeCollection.
References nest::nc_const_iterator::END, first_, nest::MPIManager::get_num_processes(), nest::MPIManager::get_process_id_of_vp(), nest::MPIManager::get_rank(), nest::kernel(), nest::KernelManager::mpi_manager, nest::nc_const_iterator::RANK_LOCAL, and size().
|
inlineoverridevirtual |
Sets the metadata of the NodeCollection.
| meta | A Metadata pointer |
Implements nest::NodeCollection.
References metadata_.
|
inlineoverridevirtual |
Returns total number of node IDs in the primitive.
Implements nest::NodeCollection.
Referenced by end(), nest::nc_const_iterator::find_next_within_part_(), nest::nc_const_iterator::nc_const_iterator(), print_primitive(), rank_local_begin(), slice(), and thread_local_begin().
|
overridevirtual |
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 |
Implements nest::NodeCollection.
References end(), first_, metadata_, model_id_, size(), stride(), and nest::NodeCollection::valid().
|
inlineoverridevirtual |
Returns the stride between node IDs in the primitive (always 1).
Implements nest::NodeCollection.
Referenced by slice().
|
overridevirtual |
Return iterator stepping from first node on the thread it is called on over nodes on that thread.
Implements nest::NodeCollection.
References nest::nc_const_iterator::END, first_, nest::VPManager::get_num_virtual_processes(), nest::kernel(), nc_const_iterator, nest::VPManager::node_id_to_vp(), size(), nest::nc_const_iterator::THREAD_LOCAL, nest::VPManager::thread_to_vp(), and nest::KernelManager::vp_manager.
|
friend |
Referenced by begin(), end(), and thread_local_begin().
|
private |
The first node ID in the primitive.
Referenced by assert_consistent_model_ids_(), contains(), get_nc_index(), NodeCollectionPrimitive(), NodeCollectionPrimitive(), NodeCollectionPrimitive(), nest::nc_const_iterator::operator*(), operator+(), operator==(), operator[](), overlapping(), print_primitive(), rank_local_begin(), size(), slice(), and thread_local_begin().
|
private |
The last node ID in the primitive.
Referenced by assert_consistent_model_ids_(), contains(), empty(), get_nc_index(), is_contiguous_ascending(), NodeCollectionPrimitive(), NodeCollectionPrimitive(), NodeCollectionPrimitive(), nest::nc_const_iterator::operator*(), operator+(), operator==(), operator[](), overlapping(), print_primitive(), and size().
|
private |
Pointer to the metadata of the node IDs.
Referenced by get_metadata(), operator+(), operator==(), print_me(), set_metadata(), and slice().
|
private |
Model ID of the node IDs.
Referenced by is_contiguous_ascending(), NodeCollectionPrimitive(), NodeCollectionPrimitive(), nest::nc_const_iterator::operator*(), operator+(), operator==(), print_primitive(), and slice().
|
private |
Whether the primitive contains devices or not.
Referenced by has_proxies(), and NodeCollectionPrimitive().