Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vera fixes on models starting with w to models starting with h. #8

Merged
merged 4 commits into from
Mar 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions models/hh_cond_exp_traub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,17 @@ nest::hh_cond_exp_traub::~hh_cond_exp_traub()
{
// 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_ );
}
}

/* ----------------------------------------------------------------
Expand Down Expand Up @@ -359,22 +365,28 @@ nest::hh_cond_exp_traub::init_buffers_()
B_.I_stim_ = 0.0;

if ( B_.s_ == 0 )
{
B_.s_ =
gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_step_reset( B_.s_ );
}

if ( B_.c_ == 0 )
{
B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 );
}
else
{
gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 );
}

if ( B_.e_ == 0 )
{
B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_evolve_reset( B_.e_ );
Expand Down
16 changes: 16 additions & 0 deletions models/hh_psc_alpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,17 @@ nest::hh_psc_alpha::~hh_psc_alpha()
{
// 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_ );
}
}

/* ----------------------------------------------------------------
Expand Down Expand Up @@ -351,22 +357,28 @@ nest::hh_psc_alpha::init_buffers_()
B_.IntegrationStep_ = B_.step_;

if ( B_.s_ == 0 )
{
B_.s_ =
gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_step_reset( B_.s_ );
}

if ( B_.c_ == 0 )
{
B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 );
}
else
{
gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 );
}

if ( B_.e_ == 0 )
{
B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_evolve_reset( B_.e_ );
Expand Down Expand Up @@ -447,7 +459,9 @@ nest::hh_psc_alpha::update( Time const& origin, const long from, const long to )
// sending spikes: crossing 0 mV, pseudo-refractoriness and local maximum...
// refractory?
if ( S_.r_ > 0 )
{
--S_.r_;
}
else
// ( threshold && maximum )
if ( S_.y_[ State_::V_M ] >= 0 && U_old > S_.y_[ State_::V_M ] )
Expand All @@ -474,9 +488,11 @@ nest::hh_psc_alpha::handle( SpikeEvent& e )
assert( e.get_delay() > 0 );

if ( e.get_weight() > 0.0 )
{
B_.spike_exc_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
else
{
B_.spike_inh_.add_value( e.get_rel_delivery_steps(
Expand Down
16 changes: 16 additions & 0 deletions models/hh_psc_alpha_gap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,17 @@ nest::hh_psc_alpha_gap::~hh_psc_alpha_gap()
{
// 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_ );
}
}

/* ----------------------------------------------------------------
Expand Down Expand Up @@ -429,22 +435,28 @@ nest::hh_psc_alpha_gap::init_buffers_()
B_.IntegrationStep_ = B_.step_;

if ( B_.s_ == 0 )
{
B_.s_ =
gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_step_reset( B_.s_ );
}

if ( B_.c_ == 0 )
{
B_.c_ = gsl_odeiv_control_y_new( 1e-6, 0.0 );
}
else
{
gsl_odeiv_control_init( B_.c_, 1e-6, 0.0, 1.0, 0.0 );
}

if ( B_.e_ == 0 )
{
B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_evolve_reset( B_.e_ );
Expand Down Expand Up @@ -560,7 +572,9 @@ nest::hh_psc_alpha_gap::update_( Time const& origin,
// maximum...
// refractory?
if ( S_.r_ > 0 )
{
--S_.r_;
}
else
// ( threshold && maximum )
if ( S_.y_[ State_::V_M ] >= 0 && U_old > S_.y_[ State_::V_M ] )
Expand Down Expand Up @@ -659,9 +673,11 @@ nest::hh_psc_alpha_gap::handle( SpikeEvent& e )
assert( e.get_delay() > 0 );

if ( e.get_weight() > 0.0 )
{
B_.spike_exc_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
else
{
B_.spike_inh_.add_value( e.get_rel_delivery_steps(
Expand Down
6 changes: 6 additions & 0 deletions models/ht_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,19 @@ HTConnection< targetidentifierT >::set_status( const DictionaryDatum& d,
updateValue< double >( d, names::P, p_ );

if ( tau_P_ <= 0.0 )
{
throw BadProperty( "tau_P > 0 required." );
}

if ( delta_P_ < 0.0 || delta_P_ > 1.0 )
{
throw BadProperty( "0 <= delta_P <= 1 required." );
}

if ( p_ < 0.0 || p_ > 1.0 )
{
throw BadProperty( "0 <= P <= 1 required." );
}
}

} // namespace
Expand Down
2 changes: 2 additions & 0 deletions models/ht_neuron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,9 @@ ht_neuron::update( Time const& origin, const long from, const long to )
}

if ( S_.ref_steps_ > 0 )
{
--S_.ref_steps_;
}

/* Add arriving spikes.
*
Expand Down
2 changes: 1 addition & 1 deletion models/ht_neuron.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ ht_neuron::handles_test_event( SpikeEvent&, rport receptor_type )
{
assert( B_.spike_inputs_.size() == 4 );

if ( !( INF_SPIKE_RECEPTOR < receptor_type
if ( not( INF_SPIKE_RECEPTOR < receptor_type
&& receptor_type < SUP_SPIKE_RECEPTOR ) )
{
throw UnknownReceptorType( receptor_type, get_name() );
Expand Down
4 changes: 4 additions & 0 deletions models/iaf_chs_2007.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ nest::iaf_chs_2007::Parameters_::set( const DictionaryDatum& d, State_& s )
}

if ( U_reset_ < 0 ) // sign switched above
{
throw BadProperty( "Reset potential cannot be negative." );
}
if ( tau_epsp_ <= 0 || tau_reset_ <= 0 )
{
throw BadProperty( "All time constants must be strictly positive." );
Expand Down Expand Up @@ -286,9 +288,11 @@ nest::iaf_chs_2007::handle( SpikeEvent& e )
assert( e.get_delay() > 0 );

if ( e.get_weight() >= 0.0 )
{
B_.spikes_ex_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
}

void
Expand Down
16 changes: 16 additions & 0 deletions models/iaf_chxk_2008.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ nest::iaf_chxk_2008::State_& nest::iaf_chxk_2008::State_::operator=(
const State_& s )
{
if ( this == &s ) // avoid assignment to self
{
return *this;
}
for ( size_t i = 0; i < STATE_VEC_SIZE; ++i )
{
y[ i ] = s.y[ i ];
Expand Down Expand Up @@ -287,11 +289,17 @@ nest::iaf_chxk_2008::~iaf_chxk_2008()
{
// 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_ );
}
}

/* ----------------------------------------------------------------
Expand Down Expand Up @@ -320,22 +328,28 @@ nest::iaf_chxk_2008::init_buffers_()
B_.IntegrationStep_ = B_.step_;

if ( B_.s_ == 0 )
{
B_.s_ =
gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_step_reset( B_.s_ );
}

if ( B_.c_ == 0 )
{
B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 );
}
else
{
gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 );
}

if ( B_.e_ == 0 )
{
B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_evolve_reset( B_.e_ );
Expand Down Expand Up @@ -462,9 +476,11 @@ nest::iaf_chxk_2008::handle( SpikeEvent& e )
assert( e.get_delay() > 0 );

if ( e.get_weight() > 0.0 )
{
B_.spike_exc_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
else
{
B_.spike_inh_.add_value( e.get_rel_delivery_steps(
Expand Down
16 changes: 16 additions & 0 deletions models/iaf_cond_alpha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ nest::iaf_cond_alpha::State_& nest::iaf_cond_alpha::State_::operator=(
const State_& s )
{
if ( this == &s ) // avoid assignment to self
{
return *this;
}
for ( size_t i = 0; i < STATE_VEC_SIZE; ++i )
{
y[ i ] = s.y[ i ];
Expand Down Expand Up @@ -284,11 +286,17 @@ nest::iaf_cond_alpha::~iaf_cond_alpha()
{
// 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_ );
}
}

/* ----------------------------------------------------------------
Expand Down Expand Up @@ -317,22 +325,28 @@ nest::iaf_cond_alpha::init_buffers_()
B_.IntegrationStep_ = B_.step_;

if ( B_.s_ == 0 )
{
B_.s_ =
gsl_odeiv_step_alloc( gsl_odeiv_step_rkf45, State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_step_reset( B_.s_ );
}

if ( B_.c_ == 0 )
{
B_.c_ = gsl_odeiv_control_y_new( 1e-3, 0.0 );
}
else
{
gsl_odeiv_control_init( B_.c_, 1e-3, 0.0, 1.0, 0.0 );
}

if ( B_.e_ == 0 )
{
B_.e_ = gsl_odeiv_evolve_alloc( State_::STATE_VEC_SIZE );
}
else
{
gsl_odeiv_evolve_reset( B_.e_ );
Expand Down Expand Up @@ -445,9 +459,11 @@ nest::iaf_cond_alpha::handle( SpikeEvent& e )
assert( e.get_delay() > 0 );

if ( e.get_weight() > 0.0 )
{
B_.spike_exc_.add_value( e.get_rel_delivery_steps(
kernel().simulation_manager.get_slice_origin() ),
e.get_weight() * e.get_multiplicity() );
}
else
{
B_.spike_inh_.add_value( e.get_rel_delivery_steps(
Expand Down
Loading