NEST main@caf0ae8
 
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1/*
2 * model.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef MODEL_H
24#define MODEL_H
25
26// C++ includes:
27#include <new>
28#include <string>
29#include <vector>
30
31// Includes from nestkernel:
32#include "node.h"
33
34
35namespace nest
36{
37class TimeConverter;
38
52class Model
53{
54public:
55 Model( const std::string& name );
56 Model( const Model& m )
57 : name_( m.name_ )
58 , type_id_( m.type_id_ )
59 , memory_( m.memory_ )
60 {
61 }
62
63 virtual ~Model()
64 {
65 }
66
70 virtual Model* clone( const std::string& ) const = 0;
71
79 void set_threads();
80
88 Node* create( size_t t );
89
94 void clear();
95
99 void reserve_additional( size_t t, size_t n );
100
110 std::string get_name() const;
111
118 size_t mem_available();
119
126 size_t mem_capacity();
127
128 virtual bool has_proxies() = 0;
129 virtual bool one_node_per_process() = 0;
130 virtual bool is_off_grid() = 0;
131 virtual void calibrate_time( const TimeConverter& tc ) = 0;
132
140 void set_status( const Dictionary& );
141
150
151 virtual size_t send_test_event( Node&, size_t, synindex, bool ) = 0;
152
158 virtual void sends_secondary_event( SICEvent& sic ) = 0;
159
167 virtual SignalType sends_signal() const = 0;
168
172 virtual size_t get_element_size() const = 0;
173
177 virtual Node const& get_prototype() const = 0;
178
182 virtual void set_model_id( int ) = 0;
183
187 virtual int get_model_id() = 0;
188
194 virtual void deprecation_warning( const std::string& ) = 0;
195
199 void
200 set_type_id( size_t id )
201 {
202 type_id_ = id;
203 }
204
205 size_t
207 {
208 return type_id_;
209 }
210
211private:
212 virtual void set_status_( const Dictionary& ) = 0;
213
214 virtual Dictionary get_status_() = 0;
215
216
221 void set_threads_( size_t t );
222
226 virtual Node* create_() = 0;
227
234 std::string name_;
235
243 size_t type_id_;
244
248 std::vector< std::vector< Node* > > memory_;
249};
250
251
252inline Node*
253Model::create( size_t t )
254{
255 assert( t < memory_.size() );
256 Node* n = create_();
257 memory_[ t ].emplace_back( n );
258 return n;
259}
260
261inline std::string
263{
264 return name_;
265}
266}
267#endif
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Event for rate model connections with delay.
Definition secondary_event.h:331
Event for diffusion connections (rate model connections for the siegert_neuron).
Definition secondary_event.h:348
Event for gap-junction information.
Definition secondary_event.h:299
Event for rate model connections without delay.
Definition secondary_event.h:315
Event for learning signal connections.
Definition secondary_event.h:384
Base class for all Models.
Definition model.h:53
virtual int get_model_id()=0
Get the model id from the prototype.
size_t mem_available()
Return the available memory.
Definition model.cpp:82
virtual void set_model_id(int)=0
Set the model id on the prototype.
virtual Node * create_()=0
Create a new object.
virtual bool is_off_grid()=0
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.
Definition model.cpp:47
virtual void sends_secondary_event(DelayedRateConnectionEvent &re)=0
virtual size_t get_element_size() const =0
Return the size of the prototype.
virtual void sends_secondary_event(SICEvent &sic)=0
std::string get_name() const
Return name of the Model.
Definition model.h:262
Model(const Model &m)
Definition model.h:56
virtual bool has_proxies()=0
std::vector< std::vector< Node * > > memory_
Memory for all nodes sorted by threads.
Definition model.h:248
size_t get_type_id() const
Definition model.h:206
virtual SignalType sends_signal() const =0
Check what type of signal this model is sending.
virtual void sends_secondary_event(GapJunctionEvent &ge)=0
virtual void sends_secondary_event(DiffusionConnectionEvent &de)=0
virtual bool one_node_per_process()=0
virtual size_t send_test_event(Node &, size_t, synindex, bool)=0
virtual void set_status_(const Dictionary &)=0
std::string name_
Name of the Model.
Definition model.h:234
virtual Node const & get_prototype() const =0
Return const reference to the prototype.
virtual void sends_secondary_event(InstantaneousRateConnectionEvent &re)=0
virtual ~Model()
Definition model.h:63
virtual void calibrate_time(const TimeConverter &tc)=0
virtual void deprecation_warning(const std::string &)=0
Issue deprecation warning on first call if model is deprecated.
virtual void sends_secondary_event(LearningSignalConnectionEvent &re)=0
Node * create(size_t t)
Allocate new Node and return its pointer.
Definition model.h:253
size_t mem_capacity()
Return the memory capacity.
Definition model.cpp:94
void reserve_additional(size_t t, size_t n)
Reserve space for n additional Nodes.
Definition model.cpp:68
void set_type_id(size_t id)
Set the model id on the prototype.
Definition model.h:200
virtual Dictionary get_status_()=0
void set_threads_(size_t t)
Set the number of threads.
Definition model.cpp:53
size_t type_id_
Identifier of the model C++ type.
Definition model.h:243
void clear()
Deletes all nodes which belong to this model.
Definition model.cpp:75
Base class for all NEST network objects.
Definition node.h:99
Event for slow inward current (SIC) connections between astrocytes and neurons.
Definition secondary_event.h:458
Class to convert times from one representation to another.
Definition nest_timeconverter.h:42
Dictionary get_status()
Export properties of the prototype node by setting entries in the status dictionary.
Definition model.cpp:119
void set_status(const Dictionary &)
Change properties of the prototype node according to the entries in the dictionary.
Definition model.cpp:106
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
SignalType
enum type of signal conveyed by spike events of a node.
Definition nest_types.h:165
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
Declarations for base class Node.