NEST main@a355080
 
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 local_receiver() = 0;
130 virtual bool one_node_per_process() = 0;
131 virtual bool is_off_grid() = 0;
132 virtual void calibrate_time( const TimeConverter& tc ) = 0;
133
141 void set_status( const Dictionary& );
142
151
152 virtual size_t send_test_event( Node&, size_t, synindex, bool ) = 0;
153
159 virtual void sends_secondary_event( SICEvent& sic ) = 0;
160
168 virtual SignalType sends_signal() const = 0;
169
173 virtual size_t get_element_size() const = 0;
174
178 virtual Node const& get_prototype() const = 0;
179
183 virtual void set_model_id( int ) = 0;
184
188 virtual int get_model_id() = 0;
189
195 virtual void deprecation_warning( const std::string& ) = 0;
196
200 void
201 set_type_id( size_t id )
202 {
203 type_id_ = id;
204 }
205
206 size_t
208 {
209 return type_id_;
210 }
211
212private:
213 virtual void set_status_( const Dictionary& ) = 0;
214
215 virtual Dictionary get_status_() = 0;
216
217
222 void set_threads_( size_t t );
223
227 virtual Node* create_() = 0;
228
235 std::string name_;
236
244 size_t type_id_;
245
249 std::vector< std::vector< Node* > > memory_;
250};
251
252
253inline Node*
254Model::create( size_t t )
255{
256 assert( t < memory_.size() );
257 Node* n = create_();
258 memory_[ t ].emplace_back( n );
259 return n;
260}
261
262inline std::string
264{
265 return name_;
266}
267}
268#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:263
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:249
size_t get_type_id() const
Definition model.h:207
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
virtual bool local_receiver()=0
std::string name_
Name of the Model.
Definition model.h:235
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:254
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:201
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:244
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.