Base class for all Models. More...
#include <model.h>
Public Member Functions | |
| Model (const std::string &name) | |
| Model (const Model &m) | |
| virtual | ~Model () |
| virtual Model * | clone (const std::string &) const =0 |
| Create clone with new name. | |
| void | set_threads () |
| Set number of threads based on number set in network. | |
| Node * | create (size_t t) |
| Allocate new Node and return its pointer. | |
| void | clear () |
| Deletes all nodes which belong to this model. | |
| void | reserve_additional (size_t t, size_t n) |
| Reserve space for n additional Nodes. | |
| std::string | get_name () const |
| Return name of the Model. | |
| size_t | mem_available () |
| Return the available memory. | |
| size_t | mem_capacity () |
| Return the memory capacity. | |
| virtual bool | has_proxies ()=0 |
| virtual bool | one_node_per_process ()=0 |
| virtual bool | is_off_grid ()=0 |
| virtual void | calibrate_time (const TimeConverter &tc)=0 |
| void | set_status (const Dictionary &) |
| Change properties of the prototype node according to the entries in the dictionary. | |
| Dictionary | get_status () |
| Export properties of the prototype node by setting entries in the status dictionary. | |
| virtual size_t | send_test_event (Node &, size_t, synindex, bool)=0 |
| virtual void | sends_secondary_event (GapJunctionEvent &ge)=0 |
| virtual void | sends_secondary_event (InstantaneousRateConnectionEvent &re)=0 |
| virtual void | sends_secondary_event (DiffusionConnectionEvent &de)=0 |
| virtual void | sends_secondary_event (DelayedRateConnectionEvent &re)=0 |
| virtual void | sends_secondary_event (LearningSignalConnectionEvent &re)=0 |
| virtual void | sends_secondary_event (SICEvent &sic)=0 |
| virtual SignalType | sends_signal () const =0 |
| Check what type of signal this model is sending. | |
| virtual size_t | get_element_size () const =0 |
| Return the size of the prototype. | |
| virtual Node const & | get_prototype () const =0 |
| Return const reference to the prototype. | |
| virtual void | set_model_id (int)=0 |
| Set the model id on the prototype. | |
| virtual int | get_model_id ()=0 |
| Get the model id from the prototype. | |
| virtual void | deprecation_warning (const std::string &)=0 |
| Issue deprecation warning on first call if model is deprecated. | |
| void | set_type_id (size_t id) |
| Set the model id on the prototype. | |
| size_t | get_type_id () const |
Private Member Functions | |
| virtual void | set_status_ (const Dictionary &)=0 |
| virtual Dictionary | get_status_ ()=0 |
| void | set_threads_ (size_t t) |
| Set the number of threads. | |
| virtual Node * | create_ ()=0 |
| Create a new object. | |
Private Attributes | |
| std::string | name_ |
| Name of the Model. | |
| size_t | type_id_ |
| Identifier of the model C++ type. | |
| std::vector< std::vector< Node * > > | memory_ |
| Memory for all nodes sorted by threads. | |
Base class for all Models.
Each Node class is associated with a corresponding Model class. The Model class is responsible for the creation and class wide parametrisation of its associated Node objects.
class Model manages the thread-sorted memory pool of the model. The default constructor uses one thread as default. Use set_threads() to use more than one thread.
| nest::Model::Model | ( | const std::string & | name | ) |
|
inline |
|
inlinevirtual |
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
| void nest::Model::clear | ( | ) |
Deletes all nodes which belong to this model.
References memory_, and set_threads_().
|
pure virtual |
Create clone with new name.
Implemented in nest::GenericModel< ElementT >.
Referenced by nest::ModelManager::copy_node_model_().
|
inline |
Allocate new Node and return its pointer.
create() is not const, because it is allowed to modify the Model object for 'administrative' purposes.
References create_(), and memory_.
Referenced by nest::ModelManager::create_proxynode_().
|
privatepure virtual |
Create a new object.
Implemented in nest::GenericModel< ElementT >.
Referenced by create().
|
pure virtual |
Issue deprecation warning on first call if model is deprecated.
| calling | function |
Implemented in nest::GenericModel< ElementT >.
Referenced by nest::ModelManager::copy_node_model_().
|
pure virtual |
Return the size of the prototype.
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Get the model id from the prototype.
Implemented in nest::GenericModel< ElementT >.
|
inline |
Return name of the Model.
This function returns the name of the Model as C++ string. The name is defined by the constructor. The result is identical to the value of Node::get_name();
References name_.
Referenced by nest::NodeCollectionPrimitive::assert_consistent_model_ids_(), nest::ModelManager::compare_model_by_id_(), nest::Node::get_name(), get_status(), nest::ModelManager::memory_info(), nest::NodeManager::print(), nest::NodeCollectionComposite::print_me(), nest::NodeCollectionPrimitive::print_primitive(), and set_status().
|
pure virtual |
Return const reference to the prototype.
Implemented in nest::GenericModel< ElementT >.
|
privatepure virtual |
Implemented in nest::GenericModel< ElementT >.
Referenced by get_status().
|
inline |
References type_id_.
Referenced by nest::GenericModel< ElementT >::GenericModel().
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
Referenced by nest::NodeCollectionPrimitive::NodeCollectionPrimitive().
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
| size_t nest::Model::mem_available | ( | ) |
Return the available memory.
The result is given in number of elements, not in bytes.
Note that this function reports a sum over all threads.
References memory_.
| size_t nest::Model::mem_capacity | ( | ) |
Return the memory capacity.
The result is given in number of elements, not in bytes.
Note that this function reports a sum over all threads.
References memory_.
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
| void nest::Model::reserve_additional | ( | size_t | t, |
| size_t | n | ||
| ) |
Reserve space for n additional Nodes.
References memory_.
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
Referenced by nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), nest::proxynode::sends_secondary_event(), and nest::proxynode::sends_secondary_event().
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Implemented in nest::GenericModel< ElementT >.
|
pure virtual |
Check what type of signal this model is sending.
Required so that proxynode can formward this call to model that in turn delegates the call to the underlying prototype.
Implemented in nest::GenericModel< ElementT >.
Referenced by nest::proxynode::sends_signal().
|
pure virtual |
Set the model id on the prototype.
Implemented in nest::GenericModel< ElementT >.
Referenced by nest::ModelManager::copy_node_model_().
|
privatepure virtual |
Implemented in nest::GenericModel< ElementT >.
Referenced by set_status().
| void nest::Model::set_threads | ( | ) |
Set number of threads based on number set in network.
As long as no nodes of the model have been allocated, the number of threads may be changed.
References nest::kernel(), and set_threads_().
Referenced by nest::GenericModel< ElementT >::GenericModel(), nest::GenericModel< ElementT >::GenericModel(), and nest::ModelManager::initialize().
|
private |
Set the number of threads.
References memory_.
Referenced by clear(), and set_threads().
|
inline |
Set the model id on the prototype.
References type_id_.
Referenced by nest::GenericModel< ElementT >::GenericModel(), and nest::ModelManager::initialize().
|
private |
Memory for all nodes sorted by threads.
Referenced by clear(), create(), get_status(), mem_available(), mem_capacity(), reserve_additional(), and set_threads_().
|
private |
Name of the Model.
This name will be used to identify all Nodes which are created by this model object.
Referenced by get_name().
|
private |
Identifier of the model C++ type.
For pristine models, the type_id equals the model_id. For copied models, the type_id equals the type_id of the base model. This number is needed to automatically save and restore copied models.
Referenced by get_status(), get_type_id(), and set_type_id().