ModelRange Manager¶
The ModelRangeManager in NEST groups node IDs into contiguous ranges per model, enabling efficient model lookups via binary search and minimizing storage by merging adjacent ranges. It tracks first/last node IDs and provides methods to retrieve models for specific nodes, ensuring fast access during simulations.
-
class ModelRangeManager : public nest::ManagerInterface¶
Public Functions
-
virtual void initialize(const bool) override¶
Prepare manager for operation.
After this method has completed, the manager should be completely initialized and “ready for action”.
See also
Note
Initialization of any given manager may depend on other managers having been initialized before. KernelManager::initialize() is responsible for calling the initialization routines on the specific managers in correct order.
- Parameters:
adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() or RandomManager::get_status() to limit operations to those necessary for thread adjustment or switch or re-seeding of RNG.
-
virtual void finalize(const bool) override¶
Take down manager after operation.
After this method has completed, all dynamic data structures created by the manager shall be deallocated and containers emptied. Plain variables need not be reset.
See also
Note
Finalization of any given manager may depend on other managers not having been finalized yet. KernelManager::finalize() is responsible for calling the initialization routines on the specific managers in correct order, i.e., the opposite order of initialize() calls.
- Parameters:
adjust_number_of_threads_or_rng_only – Pass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.
-
inline virtual void set_status(const DictionaryDatum&) override¶
Set the status of the manager.
See also
-
inline virtual void get_status(DictionaryDatum&) override¶
Retrieve the status of the manager.
See also
Note
This would ideally be a const function. However, some managers delay the update of internal variables up to the point where they are needed (e.g., before reporting their values to the user, or before simulate is called). An example for this pattern is the call to update_delay_extrema_() right at the beginning of ConnectionManager::get_status().
-
void add_range(size_t model, size_t first_node_id, size_t last_node_id)¶
Assign a range of node IDs for the given model.
-
inline bool is_in_range(size_t node_id) const¶
Check whether a node ID is with the range of assigned node IDs.
-
size_t get_model_id(size_t node_id) const¶
Get the ID of the model to which this node ID is assigned.
-
Model *get_model_of_node_id(size_t)¶
Return the Model for a given node ID.
-
const modelrange &get_contiguous_node_id_range(size_t node_id) const¶
Return the contiguous range of IDs of nodes assigned to the same model as the node with the given node ID.
-
virtual void initialize(const bool) override¶