-
Notifications
You must be signed in to change notification settings - Fork 402
Expand file tree
/
Copy pathaeif_cond_alpha_multisynapse.cpp
More file actions
662 lines (562 loc) · 20.2 KB
/
Copy pathaeif_cond_alpha_multisynapse.cpp
File metadata and controls
662 lines (562 loc) · 20.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
/*
* aeif_cond_alpha_multisynapse.cpp
*
* This file is part of NEST.
*
* Copyright (C) 2004 The NEST Initiative
*
* NEST is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* NEST is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "aeif_cond_alpha_multisynapse.h"
#ifdef HAVE_GSL
// C++ includes:
#include <limits>
// Includes from libnestutil:
#include "dict_util.h"
#include "numerics.h"
// Includes from nestkernel:
#include "exceptions.h"
#include "kernel_manager.h"
// Includes from sli:
#include "dict.h"
#include "dictutils.h"
namespace nest // template specialization must be placed in namespace
{
void
register_aeif_cond_alpha_multisynapse( const std::string& name )
{
register_node_model< aeif_cond_alpha_multisynapse >( name );
}
/* ----------------------------------------------------------------
* Recordables map
* ---------------------------------------------------------------- */
// Override the create() method with one call to RecordablesMap::insert_()
// for each quantity to be recorded.
template <>
void
DynamicRecordablesMap< aeif_cond_alpha_multisynapse >::create( aeif_cond_alpha_multisynapse& host )
{
// use standard names wherever you can for consistency!
insert( names::V_m, host.get_data_access_functor( aeif_cond_alpha_multisynapse::State_::V_M ) );
insert( names::w, host.get_data_access_functor( aeif_cond_alpha_multisynapse::State_::W ) );
host.insert_conductance_recordables();
}
Name
aeif_cond_alpha_multisynapse::get_g_receptor_name( size_t receptor )
{
std::stringstream receptor_name;
receptor_name << "g_" << receptor + 1;
return Name( receptor_name.str() );
}
void
aeif_cond_alpha_multisynapse::insert_conductance_recordables( size_t first )
{
for ( size_t receptor = first; receptor < P_.E_rev.size(); ++receptor )
{
size_t elem = aeif_cond_alpha_multisynapse::State_::G
+ receptor * aeif_cond_alpha_multisynapse::State_::NUM_STATE_ELEMENTS_PER_RECEPTOR;
recordablesMap_.insert( get_g_receptor_name( receptor ), this->get_data_access_functor( elem ) );
}
}
DataAccessFunctor< aeif_cond_alpha_multisynapse >
aeif_cond_alpha_multisynapse::get_data_access_functor( size_t elem )
{
return DataAccessFunctor< aeif_cond_alpha_multisynapse >( *this, elem );
}
/* ----------------------------------------------------------------
* Right-hand side function
* ---------------------------------------------------------------- */
extern "C" int
aeif_cond_alpha_multisynapse_dynamics( double, const double y[], double f[], void* pnode )
{
// y[] is the state vector supplied by the integrator,
// not the state vector in the node, node.S_.y[].
typedef nest::aeif_cond_alpha_multisynapse::State_ S;
// get access to node so we can almost work as in a member function
assert( pnode );
const nest::aeif_cond_alpha_multisynapse& node =
*( reinterpret_cast< nest::aeif_cond_alpha_multisynapse* >( pnode ) );
const bool is_refractory = node.S_.r_ > 0;
// Clamp membrane potential to V_reset while refractory, otherwise bound
// it to V_peak. Do not use V_.V_peak_ here, since that is set to V_th if
// Delta_T == 0.
const double& V = is_refractory ? node.P_.V_reset_ : std::min( y[ S::V_M ], node.P_.V_peak_ );
const double& w = y[ S::W ];
// I_syn = - sum_k g_k (V - E_rev_k).
double I_syn = 0.0;
for ( size_t i = 0; i < node.P_.n_receptors(); ++i )
{
const size_t j = i * S::NUM_STATE_ELEMENTS_PER_RECEPTOR;
I_syn += y[ S::G + j ] * ( node.P_.E_rev[ i ] - V );
}
const double I_spike =
node.P_.Delta_T == 0. ? 0 : ( node.P_.Delta_T * node.P_.g_L * std::exp( ( V - node.P_.V_th ) / node.P_.Delta_T ) );
// dv/dt
f[ S::V_M ] = is_refractory
? 0
: ( -node.P_.g_L * ( V - node.P_.E_L ) + I_spike + I_syn - w + node.P_.I_e + node.B_.I_stim_ ) / node.P_.C_m;
// Adaptation current w.
f[ S::W ] = ( node.P_.a * ( V - node.P_.E_L ) - w ) / node.P_.tau_w;
for ( size_t i = 0; i < node.P_.n_receptors(); ++i )
{
const size_t j = i * S::NUM_STATE_ELEMENTS_PER_RECEPTOR;
// Synaptic conductance derivative dG/dt
f[ S::DG + j ] = -y[ S::DG + j ] / node.P_.tau_syn[ i ];
f[ S::G + j ] = y[ S::DG + j ] - y[ S::G + j ] / node.P_.tau_syn[ i ];
}
return GSL_SUCCESS;
}
/* ----------------------------------------------------------------
* Default constructors defining default parameters and state
* ---------------------------------------------------------------- */
aeif_cond_alpha_multisynapse::Parameters_::Parameters_()
: V_peak_( 0.0 ) // mV
, V_reset_( -60.0 ) // mV
, t_ref_( 0.0 ) // ms
, g_L( 30.0 ) // nS
, C_m( 281.0 ) // pF
, E_L( -70.6 ) // mV
, Delta_T( 2.0 ) // mV
, tau_w( 144.0 ) // ms
, a( 4.0 ) // nS
, b( 80.5 ) // pA
, V_th( -50.4 ) // mV
, tau_syn( 1, 2.0 ) // ms
, E_rev( 1, 0.0 ) // mV
, I_e( 0.0 ) // pA
, gsl_error_tol( 1e-6 )
, has_connections_( false )
{
}
aeif_cond_alpha_multisynapse::State_::State_( const Parameters_& p )
: y_( STATE_VECTOR_MIN_SIZE, 0.0 )
, r_( 0 )
{
y_[ 0 ] = p.E_L;
}
/* ----------------------------------------------------------------
* Parameter and state extractions and manipulation functions
* ---------------------------------------------------------------- */
void
aeif_cond_alpha_multisynapse::Parameters_::get( DictionaryDatum& d ) const
{
def< double >( d, names::C_m, C_m );
def< double >( d, names::V_th, V_th );
def< double >( d, names::t_ref, t_ref_ );
def< double >( d, names::g_L, g_L );
def< double >( d, names::E_L, E_L );
def< double >( d, names::V_reset, V_reset_ );
def< size_t >( d, names::n_receptors, n_receptors() );
ArrayDatum E_rev_ad( E_rev );
ArrayDatum tau_syn_ad( tau_syn );
def< ArrayDatum >( d, names::E_rev, E_rev_ad );
def< ArrayDatum >( d, names::tau_syn, tau_syn_ad );
def< double >( d, names::a, a );
def< double >( d, names::b, b );
def< double >( d, names::Delta_T, Delta_T );
def< double >( d, names::tau_w, tau_w );
def< double >( d, names::I_e, I_e );
def< double >( d, names::V_peak, V_peak_ );
def< double >( d, names::gsl_error_tol, gsl_error_tol );
def< bool >( d, names::has_connections, has_connections_ );
}
void
aeif_cond_alpha_multisynapse::Parameters_::set( const DictionaryDatum& d, Node* node )
{
updateValueParam< double >( d, names::V_th, V_th, node );
updateValueParam< double >( d, names::V_peak, V_peak_, node );
updateValueParam< double >( d, names::t_ref, t_ref_, node );
updateValueParam< double >( d, names::E_L, E_L, node );
updateValueParam< double >( d, names::V_reset, V_reset_, node );
updateValueParam< double >( d, names::C_m, C_m, node );
updateValueParam< double >( d, names::g_L, g_L, node );
const size_t old_n_receptors = n_receptors();
bool Erev_flag = updateValue< std::vector< double > >( d, names::E_rev, E_rev );
bool tau_flag = updateValue< std::vector< double > >( d, names::tau_syn, tau_syn );
if ( Erev_flag or tau_flag )
{ // receptor arrays have been modified
if ( ( E_rev.size() != old_n_receptors or tau_syn.size() != old_n_receptors )
and ( not Erev_flag or not tau_flag ) )
{
throw BadProperty(
"If the number of receptor ports is changed, both arrays "
"E_rev and tau_syn must be provided." );
}
if ( E_rev.size() != tau_syn.size() )
{
throw BadProperty(
"The reversal potential, and synaptic time constant arrays "
"must have the same size." );
}
if ( tau_syn.size() < old_n_receptors and has_connections_ )
{
throw BadProperty(
"The neuron has connections, therefore the number of ports cannot be "
"reduced." );
}
for ( size_t i = 0; i < tau_syn.size(); ++i )
{
if ( tau_syn[ i ] <= 0 )
{
throw BadProperty( "All synaptic time constants must be strictly positive" );
}
}
}
updateValueParam< double >( d, names::a, a, node );
updateValueParam< double >( d, names::b, b, node );
updateValueParam< double >( d, names::Delta_T, Delta_T, node );
updateValueParam< double >( d, names::tau_w, tau_w, node );
updateValueParam< double >( d, names::I_e, I_e, node );
updateValueParam< double >( d, names::gsl_error_tol, gsl_error_tol, node );
if ( V_peak_ < V_th )
{
throw BadProperty( "V_peak >= V_th required." );
}
if ( V_reset_ >= V_peak_ )
{
throw BadProperty( "Ensure that: V_reset < V_peak ." );
}
if ( Delta_T < 0. )
{
throw BadProperty( "Delta_T must be positive." );
}
else if ( Delta_T > 0. )
{
// check for possible numerical overflow with the exponential divergence at
// spike time, keep a 1e20 margin for the subsequent calculations
const double max_exp_arg = std::log( std::numeric_limits< double >::max() / 1e20 );
if ( ( V_peak_ - V_th ) / Delta_T >= max_exp_arg )
{
throw BadProperty(
"The current combination of V_peak, V_th and Delta_T"
"will lead to numerical overflow at spike time; try"
"for instance to increase Delta_T or to reduce V_peak"
"to avoid this problem." );
}
}
if ( C_m <= 0 )
{
throw BadProperty( "Capacitance must be strictly positive." );
}
if ( t_ref_ < 0 )
{
throw BadProperty( "Refractory time cannot be negative." );
}
if ( tau_w <= 0 )
{
throw BadProperty( "All time constants must be strictly positive." );
}
if ( gsl_error_tol <= 0. )
{
throw BadProperty( "The gsl_error_tol must be strictly positive." );
}
}
void
aeif_cond_alpha_multisynapse::State_::get( DictionaryDatum& d ) const
{
def< double >( d, names::V_m, y_[ V_M ] );
std::vector< double >* dg = new std::vector< double >();
std::vector< double >* g = new std::vector< double >();
for ( size_t i = 0;
i < ( ( y_.size() - State_::NUMBER_OF_FIXED_STATES_ELEMENTS ) / State_::NUM_STATE_ELEMENTS_PER_RECEPTOR );
++i )
{
dg->push_back( y_[ State_::DG + ( State_::NUM_STATE_ELEMENTS_PER_RECEPTOR * i ) ] );
g->push_back( y_[ State_::G + ( State_::NUM_STATE_ELEMENTS_PER_RECEPTOR * i ) ] );
}
( *d )[ names::dg ] = DoubleVectorDatum( dg );
( *d )[ names::g ] = DoubleVectorDatum( g );
def< double >( d, names::w, y_[ W ] );
}
void
aeif_cond_alpha_multisynapse::State_::set( const DictionaryDatum& d, Node* node )
{
updateValueParam< double >( d, names::V_m, y_[ V_M ], node );
updateValueParam< double >( d, names::w, y_[ W ], node );
}
aeif_cond_alpha_multisynapse::Buffers_::Buffers_( aeif_cond_alpha_multisynapse& n )
: logger_( n )
, s_( nullptr )
, c_( nullptr )
, e_( nullptr )
, step_( Time::get_resolution().get_ms() )
, IntegrationStep_( step_ )
, I_stim_( 0.0 )
{
}
aeif_cond_alpha_multisynapse::Buffers_::Buffers_( const Buffers_& b, aeif_cond_alpha_multisynapse& n )
: logger_( n )
, s_( nullptr )
, c_( nullptr )
, e_( nullptr )
, step_( b.step_ )
, IntegrationStep_( b.IntegrationStep_ )
, I_stim_( b.I_stim_ )
{
}
/* ----------------------------------------------------------------
* Default and copy constructor for node, and destructor
* ---------------------------------------------------------------- */
aeif_cond_alpha_multisynapse::aeif_cond_alpha_multisynapse()
: ArchivingNode()
, P_()
, S_( P_ )
, B_( *this )
{
recordablesMap_.create( *this );
}
aeif_cond_alpha_multisynapse::aeif_cond_alpha_multisynapse( const aeif_cond_alpha_multisynapse& n )
: ArchivingNode( n )
, P_( n.P_ )
, S_( n.S_ )
, B_( n.B_, *this )
{
recordablesMap_.create( *this );
}
aeif_cond_alpha_multisynapse::~aeif_cond_alpha_multisynapse()
{
// GSL structs may not have been allocated, so we need to protect destruction
if ( B_.s_ )
{
gsl_odeiv_step_free( B_.s_ );
}
if ( B_.c_ )
{
gsl_odeiv_control_free( B_.c_ );
}
if ( B_.e_ )
{
gsl_odeiv_evolve_free( B_.e_ );
}
}
/* ----------------------------------------------------------------
* Node initialization functions
* ---------------------------------------------------------------- */
void
aeif_cond_alpha_multisynapse::init_buffers_()
{
B_.spikes_.clear(); // includes resize
B_.currents_.clear(); // includes resize
ArchivingNode::clear_history();
B_.logger_.reset();
B_.step_ = Time::get_resolution().get_ms();
B_.IntegrationStep_ =
B_.step_; // reasonable initial value for numerical integrator step size; this will anyway be overwritten by
// gsl_odeiv_evolve_apply(), but it might confuse the integrator if it contains uninitialised data
if ( not B_.c_ )
{
B_.c_ = gsl_odeiv_control_yp_new( P_.gsl_error_tol, P_.gsl_error_tol );
}
else
{
gsl_odeiv_control_init( B_.c_, P_.gsl_error_tol, P_.gsl_error_tol, 0.0, 1.0 );
}
// Stepping function and evolution function are allocated in pre_run_hook()
B_.sys_.function = aeif_cond_alpha_multisynapse_dynamics;
B_.sys_.jacobian = nullptr;
B_.sys_.params = reinterpret_cast< void* >( this );
// B_.sys_.dimension is assigned in pre_run_hook()
B_.I_stim_ = 0.0;
}
void
aeif_cond_alpha_multisynapse::pre_run_hook()
{
// ensures initialization in case mm connected after Simulate
B_.logger_.init();
V_.g0_.resize( P_.n_receptors() );
// g0_ will be initialized in the loop below.
for ( size_t i = 0; i < P_.n_receptors(); ++i )
{
V_.g0_[ i ] = 1.0 * numerics::e / P_.tau_syn[ i ];
}
// set the right threshold depending on Delta_T
if ( P_.Delta_T > 0. )
{
V_.V_peak = P_.V_peak_;
}
else
{
V_.V_peak = P_.V_th; // same as IAF dynamics for spikes if Delta_T == 0.
}
V_.refractory_counts_ = Time( Time::ms( P_.t_ref_ ) ).get_steps();
B_.spikes_.resize( P_.n_receptors() );
S_.y_.resize(
State_::NUMBER_OF_FIXED_STATES_ELEMENTS + ( State_::NUM_STATE_ELEMENTS_PER_RECEPTOR * P_.n_receptors() ), 0.0 );
// reallocate instance of stepping function for ODE GSL solver
if ( B_.s_ )
{
gsl_odeiv_step_free( B_.s_ );
}
B_.s_ = gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, S_.y_.size() );
// reallocate instance of evolution function for ODE GSL solver
if ( B_.e_ )
{
gsl_odeiv_evolve_free( B_.e_ );
}
B_.e_ = gsl_odeiv_evolve_alloc( S_.y_.size() );
B_.sys_.dimension = S_.y_.size();
}
/* ----------------------------------------------------------------
* Update and spike handling functions
* ---------------------------------------------------------------- */
void
aeif_cond_alpha_multisynapse::update( Time const& origin, const long from, const long to )
{
assert( State_::V_M == 0 );
for ( long lag = from; lag < to; ++lag ) // proceed by stepsize B_.step_
{
double t = 0.0; // internal time of the integration period
// numerical integration with adaptive step size control:
// ------------------------------------------------------
// gsl_odeiv_evolve_apply performs only a single numerical
// integration step, starting from t and bounded by step;
// the while-loop ensures integration over the whole simulation
// step (0, step] if more than one integration step is needed due
// to a small integration step size;
// note that (t+IntegrationStep > step) leads to integration over
// (t, step] and afterwards setting t to step, but it does not
// enforce setting IntegrationStep to step-t; this is of advantage
// for a consistent and efficient integration across subsequent
// simulation intervals
while ( t < B_.step_ )
{
const int status = gsl_odeiv_evolve_apply( B_.e_,
B_.c_,
B_.s_,
&B_.sys_, // system of ODE
&t, // from t
B_.step_, // to t <= step
&B_.IntegrationStep_, // integration step size
&S_.y_[ 0 ] ); // neuronal state converted to double[]
if ( status != GSL_SUCCESS )
{
throw GSLSolverFailure( get_name(), status );
}
// check for unreasonable values; we allow V_M to explode
if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 )
{
throw NumericalInstability( get_name() );
}
if ( S_.r_ > 0 ) // if neuron is still in refractory period
{
S_.y_[ State_::V_M ] = P_.V_reset_; // clamp it to V_reset
}
else if ( S_.y_[ State_::V_M ] >= V_.V_peak ) // V_m >= V_peak: spike
{
S_.y_[ State_::V_M ] = P_.V_reset_;
S_.y_[ State_::W ] += P_.b; // spike-driven adaptation
/* Initialize refractory step counter.
* - We need to add 1 to compensate for count-down immediately after
* while loop.
* - If neuron has no refractory time, set to 0 to avoid refractory
* artifact inside while loop.
*/
S_.r_ = V_.refractory_counts_ > 0 ? V_.refractory_counts_ + 1 : 0;
set_spiketime( Time::step( origin.get_steps() + lag + 1 ) );
SpikeEvent se;
kernel().event_delivery_manager.send( *this, se, lag );
}
}
if ( S_.r_ > 0 )
{
--S_.r_;
}
for ( size_t i = 0; i < P_.n_receptors(); ++i )
{
S_.y_[ State_::DG + ( State_::NUM_STATE_ELEMENTS_PER_RECEPTOR * i ) ] +=
B_.spikes_[ i ].get_value( lag ) * V_.g0_[ i ]; // add incoming spike
}
// set new input current
B_.I_stim_ = B_.currents_.get_value( lag );
// log state data
B_.logger_.record_data( origin.get_steps() + lag );
} // for-loop
}
size_t
aeif_cond_alpha_multisynapse::handles_test_event( SpikeEvent&, size_t receptor_type )
{
if ( receptor_type <= 0 or receptor_type > P_.n_receptors() )
{
throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" );
}
P_.has_connections_ = true;
return receptor_type;
}
void
aeif_cond_alpha_multisynapse::handle( SpikeEvent& e )
{
if ( e.get_weight() < 0 )
{
throw BadProperty(
"Synaptic weights for conductance-based multisynapse models "
"must be positive." );
}
assert( e.get_delay_steps() > 0 );
assert( ( e.get_rport() > 0 ) and ( ( size_t ) e.get_rport() <= P_.n_receptors() ) );
B_.spikes_[ e.get_rport() - 1 ].add_value(
e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ), e.get_weight() * e.get_multiplicity() );
}
void
aeif_cond_alpha_multisynapse::handle( CurrentEvent& e )
{
assert( e.get_delay_steps() > 0 );
const double I = e.get_current();
const double w = e.get_weight();
// add weighted current; HEP 2002-10-04
B_.currents_.add_value( e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ), w * I );
}
void
aeif_cond_alpha_multisynapse::handle( DataLoggingRequest& e )
{
B_.logger_.handle( e );
}
void
aeif_cond_alpha_multisynapse::set_status( const DictionaryDatum& d )
{
Parameters_ ptmp = P_; // temporary copy in case of errors
ptmp.set( d, this ); // throws if BadProperty
State_ stmp = S_; // temporary copy in case of errors
stmp.set( d, this ); // throws if BadProperty
// We now know that (ptmp, stmp) are consistent. We do not
// write them back to (P_, S_) before we are also sure that
// the properties to be set in the parent class are internally
// consistent.
ArchivingNode::set_status( d );
/*
* Here is where we must update the recordablesMap_ if new receptors
* are added!
*/
if ( ptmp.E_rev.size() > P_.E_rev.size() ) // Number of receptors increased
{
for ( size_t receptor = P_.E_rev.size(); receptor < ptmp.E_rev.size(); ++receptor )
{
size_t elem = aeif_cond_alpha_multisynapse::State_::G
+ receptor * aeif_cond_alpha_multisynapse::State_::NUM_STATE_ELEMENTS_PER_RECEPTOR;
recordablesMap_.insert( get_g_receptor_name( receptor ), get_data_access_functor( elem ) );
}
}
else if ( ptmp.E_rev.size() < P_.E_rev.size() )
{ // Number of receptors decreased
for ( size_t receptor = ptmp.E_rev.size(); receptor < P_.E_rev.size(); ++receptor )
{
recordablesMap_.erase( get_g_receptor_name( receptor ) );
}
}
// if we get here, temporaries contain consistent set of properties
P_ = ptmp;
S_ = stmp;
}
} // namespace nest
#endif // HAVE_GSL