diff --git a/libnestutil/lockptr.h b/libnestutil/lockptr.h index 19b5ebc1e5..21096cf20a 100644 --- a/libnestutil/lockptr.h +++ b/libnestutil/lockptr.h @@ -114,7 +114,7 @@ class lockPTR ~PointerObject() { assert( not locked ); - if ( ( pointee != NULL ) && deletable && ( not locked ) ) + if ( ( pointee != NULL ) and deletable and not locked ) { delete pointee; } diff --git a/libnestutil/sort.h b/libnestutil/sort.h index 68f01bc255..4712cde804 100644 --- a/libnestutil/sort.h +++ b/libnestutil/sort.h @@ -70,7 +70,7 @@ insertion_sort( BlockVector< T1 >& vec_sort, BlockVector< T2 >& vec_perm, const { for ( size_t i = lo + 1; i < hi + 1; ++i ) { - for ( size_t j = i; ( j > lo ) and ( vec_sort[ j ] < vec_sort[ j - 1 ] ); --j ) + for ( size_t j = i; j > lo and ( vec_sort[ j ] < vec_sort[ j - 1 ] ); --j ) { std::swap( vec_sort[ j ], vec_sort[ j - 1 ] ); std::swap( vec_perm[ j ], vec_perm[ j - 1 ] ); diff --git a/libnestutil/stopwatch.h b/libnestutil/stopwatch.h index 6692afda98..00091c7360 100644 --- a/libnestutil/stopwatch.h +++ b/libnestutil/stopwatch.h @@ -158,7 +158,7 @@ class Stopwatch inline bool Stopwatch::correct_timeunit( timeunit_t t ) { - return t == MICROSEC || t == MILLISEC || t == SECONDS || t == MINUTES || t == HOURS || t == DAYS; + return t == MICROSEC or t == MILLISEC or t == SECONDS or t == MINUTES or t == HOURS or t == DAYS; } inline void diff --git a/models/ac_generator.cpp b/models/ac_generator.cpp index e25a1ca2a7..e10852dc50 100644 --- a/models/ac_generator.cpp +++ b/models/ac_generator.cpp @@ -201,7 +201,7 @@ nest::ac_generator::pre_run_hook() void nest::ac_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); long start = origin.get_steps(); diff --git a/models/aeif_cond_alpha.cpp b/models/aeif_cond_alpha.cpp index 3d9df5bfb0..d8b060430a 100644 --- a/models/aeif_cond_alpha.cpp +++ b/models/aeif_cond_alpha.cpp @@ -267,7 +267,7 @@ nest::aeif_cond_alpha::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_syn_ex <= 0 || tau_syn_in <= 0 || tau_w <= 0 ) + if ( tau_syn_ex <= 0 or tau_syn_in <= 0 or tau_w <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -298,7 +298,7 @@ nest::aeif_cond_alpha::State_::set( const DictionaryDatum& d, const Parameters_& updateValueParam< double >( d, names::g_in, y_[ G_INH ], node ); updateValueParam< double >( d, names::dg_in, y_[ DG_INH ], node ); updateValueParam< double >( d, names::w, y_[ W ], node ); - if ( y_[ G_EXC ] < 0 || y_[ G_INH ] < 0 ) + if ( y_[ G_EXC ] < 0 or y_[ G_INH ] < 0 ) { throw BadProperty( "Conductances must not be negative." ); } @@ -444,7 +444,7 @@ nest::aeif_cond_alpha::pre_run_hook() void nest::aeif_cond_alpha::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -481,7 +481,7 @@ nest::aeif_cond_alpha::update( Time const& origin, const long from, const long t } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } diff --git a/models/aeif_cond_alpha_multisynapse.cpp b/models/aeif_cond_alpha_multisynapse.cpp index 66ca7a44be..6f6ac1888f 100644 --- a/models/aeif_cond_alpha_multisynapse.cpp +++ b/models/aeif_cond_alpha_multisynapse.cpp @@ -216,10 +216,10 @@ aeif_cond_alpha_multisynapse::Parameters_::set( const DictionaryDatum& d, 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 || tau_flag ) + if ( Erev_flag or tau_flag ) { // receptor arrays have been modified - if ( ( E_rev.size() != old_n_receptors || tau_syn.size() != old_n_receptors ) - and ( not Erev_flag || not tau_flag ) ) + 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 " @@ -231,7 +231,7 @@ aeif_cond_alpha_multisynapse::Parameters_::set( const DictionaryDatum& d, Node* "The reversal potential, and synaptic time constant arrays " "must have the same size." ); } - if ( tau_syn.size() < old_n_receptors && has_connections_ ) + if ( tau_syn.size() < old_n_receptors and has_connections_ ) { throw BadProperty( "The neuron has connections, therefore the number of ports cannot be " @@ -484,7 +484,7 @@ aeif_cond_alpha_multisynapse::pre_run_hook() void aeif_cond_alpha_multisynapse::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -522,7 +522,7 @@ aeif_cond_alpha_multisynapse::update( Time const& origin, const long from, const } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } @@ -572,7 +572,7 @@ aeif_cond_alpha_multisynapse::update( Time const& origin, const long from, const port aeif_cond_alpha_multisynapse::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } @@ -590,7 +590,7 @@ aeif_cond_alpha_multisynapse::handle( SpikeEvent& e ) "must be positive." ); } assert( e.get_delay_steps() > 0 ); - assert( ( e.get_rport() > 0 ) && ( ( size_t ) e.get_rport() <= P_.n_receptors() ) ); + 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() ); diff --git a/models/aeif_cond_beta_multisynapse.cpp b/models/aeif_cond_beta_multisynapse.cpp index 750c710019..fcdd436820 100644 --- a/models/aeif_cond_beta_multisynapse.cpp +++ b/models/aeif_cond_beta_multisynapse.cpp @@ -219,23 +219,23 @@ aeif_cond_beta_multisynapse::Parameters_::set( const DictionaryDatum& d, Node* n bool Erev_flag = updateValue< std::vector< double > >( d, names::E_rev, E_rev ); bool taur_flag = updateValue< std::vector< double > >( d, names::tau_rise, tau_rise ); bool taud_flag = updateValue< std::vector< double > >( d, names::tau_decay, tau_decay ); - if ( Erev_flag || taur_flag || taud_flag ) + if ( Erev_flag or taur_flag or taud_flag ) { // receptor arrays have been modified - if ( ( E_rev.size() != old_n_receptors || tau_rise.size() != old_n_receptors - || tau_decay.size() != old_n_receptors ) - && ( not Erev_flag || not taur_flag || not taud_flag ) ) + if ( ( E_rev.size() != old_n_receptors or tau_rise.size() != old_n_receptors + or tau_decay.size() != old_n_receptors ) + and ( not Erev_flag or not taur_flag or not taud_flag ) ) { throw BadProperty( "If the number of receptor ports is changed, all three arrays " "E_rev, tau_rise and tau_decay must be provided." ); } - if ( ( E_rev.size() != tau_rise.size() ) || ( E_rev.size() != tau_decay.size() ) ) + if ( ( E_rev.size() != tau_rise.size() ) or ( E_rev.size() != tau_decay.size() ) ) { throw BadProperty( "The reversal potential, synaptic rise time and synaptic decay time " "arrays must have the same size." ); } - if ( tau_rise.size() < old_n_receptors && has_connections_ ) + if ( tau_rise.size() < old_n_receptors and has_connections_ ) { throw BadProperty( "The neuron has connections, therefore the number of ports cannot be " @@ -243,7 +243,7 @@ aeif_cond_beta_multisynapse::Parameters_::set( const DictionaryDatum& d, Node* n } for ( size_t i = 0; i < tau_rise.size(); ++i ) { - if ( tau_rise[ i ] <= 0 || tau_decay[ i ] <= 0 ) + if ( tau_rise[ i ] <= 0 or tau_decay[ i ] <= 0 ) { throw BadProperty( "All synaptic time constants must be strictly positive" ); } @@ -493,7 +493,7 @@ aeif_cond_beta_multisynapse::pre_run_hook() void aeif_cond_beta_multisynapse::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -531,7 +531,7 @@ aeif_cond_beta_multisynapse::update( Time const& origin, const long from, const } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } @@ -581,7 +581,7 @@ aeif_cond_beta_multisynapse::update( Time const& origin, const long from, const port aeif_cond_beta_multisynapse::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } @@ -599,7 +599,7 @@ aeif_cond_beta_multisynapse::handle( SpikeEvent& e ) "must be positive." ); } assert( e.get_delay_steps() > 0 ); - assert( ( e.get_rport() > 0 ) && ( ( size_t ) e.get_rport() <= P_.n_receptors() ) ); + 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() ); diff --git a/models/aeif_cond_exp.cpp b/models/aeif_cond_exp.cpp index b59726fc37..486440c164 100644 --- a/models/aeif_cond_exp.cpp +++ b/models/aeif_cond_exp.cpp @@ -266,7 +266,7 @@ nest::aeif_cond_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_syn_ex <= 0 || tau_syn_in <= 0 || tau_w <= 0 ) + if ( tau_syn_ex <= 0 or tau_syn_in <= 0 or tau_w <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -293,7 +293,7 @@ nest::aeif_cond_exp::State_::set( const DictionaryDatum& d, const Parameters_&, updateValueParam< double >( d, names::g_ex, y_[ G_EXC ], node ); updateValueParam< double >( d, names::g_in, y_[ G_INH ], node ); updateValueParam< double >( d, names::w, y_[ W ], node ); - if ( y_[ G_EXC ] < 0 || y_[ G_INH ] < 0 ) + if ( y_[ G_EXC ] < 0 or y_[ G_INH ] < 0 ) { throw BadProperty( "Conductances must not be negative." ); } @@ -437,7 +437,7 @@ nest::aeif_cond_exp::pre_run_hook() void nest::aeif_cond_exp::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -471,7 +471,7 @@ nest::aeif_cond_exp::update( const Time& origin, const long from, const long to } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } diff --git a/models/aeif_psc_alpha.cpp b/models/aeif_psc_alpha.cpp index c7c53d358d..98afbdac15 100644 --- a/models/aeif_psc_alpha.cpp +++ b/models/aeif_psc_alpha.cpp @@ -257,7 +257,7 @@ nest::aeif_psc_alpha::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_syn_ex <= 0 || tau_syn_in <= 0 || tau_w <= 0 ) + if ( tau_syn_ex <= 0 or tau_syn_in <= 0 or tau_w <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -288,7 +288,7 @@ nest::aeif_psc_alpha::State_::set( const DictionaryDatum& d, const Parameters_&, updateValueParam< double >( d, names::I_syn_in, y_[ I_INH ], node ); updateValueParam< double >( d, names::dI_syn_in, y_[ DI_INH ], node ); updateValueParam< double >( d, names::w, y_[ W ], node ); - if ( y_[ I_EXC ] < 0 || y_[ I_INH ] < 0 ) + if ( y_[ I_EXC ] < 0 or y_[ I_INH ] < 0 ) { throw BadProperty( "Conductances must not be negative." ); } @@ -434,7 +434,7 @@ nest::aeif_psc_alpha::pre_run_hook() void nest::aeif_psc_alpha::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -471,7 +471,7 @@ nest::aeif_psc_alpha::update( Time const& origin, const long from, const long to } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } diff --git a/models/aeif_psc_delta.cpp b/models/aeif_psc_delta.cpp index 6dae22ebce..69dd30513f 100644 --- a/models/aeif_psc_delta.cpp +++ b/models/aeif_psc_delta.cpp @@ -412,7 +412,7 @@ nest::aeif_psc_delta::pre_run_hook() void nest::aeif_psc_delta::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); const double h = Time::get_resolution().get_ms(); @@ -447,7 +447,7 @@ nest::aeif_psc_delta::update( const Time& origin, const long from, const long to throw GSLSolverFailure( get_name(), status ); } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } @@ -461,7 +461,7 @@ nest::aeif_psc_delta::update( const Time& origin, const long from, const long to // if we have accumulated spikes from refractory period, // add and reset accumulator - if ( P_.with_refr_input_ && S_.refr_spikes_buffer_ != 0.0 ) + if ( P_.with_refr_input_ and S_.refr_spikes_buffer_ != 0.0 ) { S_.y_[ State_::V_M ] += S_.refr_spikes_buffer_; S_.refr_spikes_buffer_ = 0.0; diff --git a/models/aeif_psc_delta_clopath.cpp b/models/aeif_psc_delta_clopath.cpp index 662d12ade6..402fda9d46 100644 --- a/models/aeif_psc_delta_clopath.cpp +++ b/models/aeif_psc_delta_clopath.cpp @@ -94,7 +94,7 @@ nest::aeif_psc_delta_clopath_dynamics( double, const double y[], double f[], voi // Clamp membrane potential to V_reset while refractory, otherwise bound // it to V_peak. - const double& V = ( is_refractory || is_clamped ) ? ( is_clamped ? node.P_.V_clamp_ : node.P_.V_reset_ ) + const double& V = ( is_refractory or is_clamped ) ? ( is_clamped ? node.P_.V_clamp_ : node.P_.V_reset_ ) : std::min( y[ S::V_M ], node.P_.V_peak_ ); // shorthand for the other state variables const double& w = y[ S::W ]; @@ -108,7 +108,7 @@ nest::aeif_psc_delta_clopath_dynamics( double, const double y[], double f[], voi node.P_.Delta_T == 0. ? 0. : ( node.P_.g_L * node.P_.Delta_T * std::exp( ( V - V_th ) / node.P_.Delta_T ) ); // dv/dt - f[ S::V_M ] = ( is_refractory || is_clamped ) + f[ S::V_M ] = ( is_refractory or is_clamped ) ? 0.0 : ( -node.P_.g_L * ( V - node.P_.E_L ) + I_spike - w + z + node.P_.I_e + node.B_.I_stim_ ) / node.P_.C_m; @@ -471,7 +471,7 @@ nest::aeif_psc_delta_clopath::pre_run_hook() void nest::aeif_psc_delta_clopath::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -505,14 +505,14 @@ nest::aeif_psc_delta_clopath::update( const Time& origin, const long from, const throw GSLSolverFailure( get_name(), status ); } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } // spikes are handled inside the while-loop // due to spike-driven adaptation - if ( S_.r_ == 0 && S_.clamp_r_ == 0 ) + if ( S_.r_ == 0 and S_.clamp_r_ == 0 ) { // neuron not refractory S_.y_[ State_::V_M ] = S_.y_[ State_::V_M ] + B_.spikes_.get_value( lag ); @@ -529,7 +529,7 @@ nest::aeif_psc_delta_clopath::update( const Time& origin, const long from, const // Delta_T == 0. } - if ( S_.y_[ State_::V_M ] >= V_.V_peak_ && S_.clamp_r_ == 0 ) + if ( S_.y_[ State_::V_M ] >= V_.V_peak_ and S_.clamp_r_ == 0 ) { S_.y_[ State_::V_M ] = P_.V_clamp_; S_.y_[ State_::W ] += P_.b; // spike-driven adaptation diff --git a/models/aeif_psc_exp.cpp b/models/aeif_psc_exp.cpp index 2320ac7254..85c0f715fa 100644 --- a/models/aeif_psc_exp.cpp +++ b/models/aeif_psc_exp.cpp @@ -256,7 +256,7 @@ nest::aeif_psc_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_syn_ex <= 0 || tau_syn_in <= 0 || tau_w <= 0 ) + if ( tau_syn_ex <= 0 or tau_syn_in <= 0 or tau_w <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -283,7 +283,7 @@ nest::aeif_psc_exp::State_::set( const DictionaryDatum& d, const Parameters_&, N updateValueParam< double >( d, names::I_syn_ex, y_[ I_EXC ], node ); updateValueParam< double >( d, names::I_syn_in, y_[ I_INH ], node ); updateValueParam< double >( d, names::w, y_[ W ], node ); - if ( y_[ I_EXC ] < 0 || y_[ I_INH ] < 0 ) + if ( y_[ I_EXC ] < 0 or y_[ I_INH ] < 0 ) { throw BadProperty( "Conductances must not be negative." ); } @@ -427,7 +427,7 @@ nest::aeif_psc_exp::pre_run_hook() void nest::aeif_psc_exp::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( State_::V_M == 0 ); @@ -461,7 +461,7 @@ nest::aeif_psc_exp::update( const Time& origin, const long from, const long to ) } // check for unreasonable values; we allow V_M to explode - if ( S_.y_[ State_::V_M ] < -1e3 || S_.y_[ State_::W ] < -1e6 || S_.y_[ State_::W ] > 1e6 ) + if ( S_.y_[ State_::V_M ] < -1e3 or S_.y_[ State_::W ] < -1e6 or S_.y_[ State_::W ] > 1e6 ) { throw NumericalInstability( get_name() ); } diff --git a/models/amat2_psc_exp.cpp b/models/amat2_psc_exp.cpp index 8164f1685c..d2016ac6c5 100644 --- a/models/amat2_psc_exp.cpp +++ b/models/amat2_psc_exp.cpp @@ -154,18 +154,18 @@ nest::amat2_psc_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Capacitance must be strictly positive." ); } - if ( Tau_ <= 0 || tau_ex_ <= 0 || tau_in_ <= 0 || tau_ref_ <= 0 || tau_1_ <= 0 || tau_2_ <= 0 || tau_v_ <= 0 ) + if ( Tau_ <= 0 or tau_ex_ <= 0 or tau_in_ <= 0 or tau_ref_ <= 0 or tau_1_ <= 0 or tau_2_ <= 0 or tau_v_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } - if ( Tau_ == tau_ex_ || Tau_ == tau_in_ || Tau_ == tau_v_ ) + if ( Tau_ == tau_ex_ or Tau_ == tau_in_ or Tau_ == tau_v_ ) { throw BadProperty( "tau_m must differ from tau_syn_ex, tau_syn_in and tau_v. " "See note in documentation." ); } - if ( tau_v_ == tau_ex_ || tau_v_ == tau_in_ ) // tau_v_ == tau_m_ checked above + if ( tau_v_ == tau_ex_ or tau_v_ == tau_in_ ) // tau_v_ == tau_m_ checked above { throw BadProperty( "tau_v must differ from tau_syn_ex, tau_syn_in and tau_m. " @@ -361,7 +361,7 @@ nest::amat2_psc_exp::pre_run_hook() void nest::amat2_psc_exp::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); // evolve from timestep 'from' to timestep 'to' with steps of h each diff --git a/models/binary_neuron.h b/models/binary_neuron.h index 54ab5f1aef..3d34835411 100644 --- a/models/binary_neuron.h +++ b/models/binary_neuron.h @@ -456,7 +456,7 @@ template < class TGainfunction > void binary_neuron< TGainfunction >::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -536,7 +536,7 @@ binary_neuron< TGainfunction >::handle( SpikeEvent& e ) if ( m == 1 ) { // multiplicity == 1, either a single 1->0 event or the first or second of a // pair of 0->1 events - if ( node_id == S_.last_in_node_id_ && t_spike == S_.t_last_in_spike_ ) + if ( node_id == S_.last_in_node_id_ and t_spike == S_.t_last_in_spike_ ) { // received twice the same node ID, so transition 0->1 // take double weight to compensate for subtracting first event diff --git a/models/cm_default.cpp b/models/cm_default.cpp index 482f1eda95..d3b6dc1240 100644 --- a/models/cm_default.cpp +++ b/models/cm_default.cpp @@ -290,7 +290,7 @@ nest::cm_default::pre_run_hook() void nest::cm_default::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -301,7 +301,7 @@ nest::cm_default::update( Time const& origin, const long from, const long to ) c_tree_.solve_matrix(); // threshold crossing - if ( c_tree_.get_root()->v_comp >= V_th_ && v_0_prev < V_th_ ) + if ( c_tree_.get_root()->v_comp >= V_th_ and v_0_prev < V_th_ ) { set_spiketime( Time::step( origin.get_steps() + lag + 1 ) ); @@ -322,7 +322,7 @@ nest::cm_default::handle( SpikeEvent& e ) } assert( e.get_delay_steps() > 0 ); - assert( ( e.get_rport() >= 0 ) && ( ( size_t ) e.get_rport() < syn_buffers_.size() ) ); + assert( ( e.get_rport() >= 0 ) and ( ( size_t ) e.get_rport() < syn_buffers_.size() ) ); syn_buffers_[ e.get_rport() ].add_value( e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ), e.get_weight() * e.get_multiplicity() ); diff --git a/models/cm_default.h b/models/cm_default.h index f466ee4755..ca5609e710 100644 --- a/models/cm_default.h +++ b/models/cm_default.h @@ -300,7 +300,7 @@ nest::cm_default::send_test_event( Node& target, rport receptor_type, synindex, inline port cm_default::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( ( receptor_type < 0 ) or ( receptor_type >= static_cast< port >( syn_buffers_.size() ) ) ) + if ( receptor_type < 0 or ( receptor_type >= static_cast< port >( syn_buffers_.size() ) ) ) { std::ostringstream msg; msg << "Valid spike receptor ports for " << get_name() << " are in "; diff --git a/models/cm_tree.cpp b/models/cm_tree.cpp index c63811c496..25fd684ac6 100644 --- a/models/cm_tree.cpp +++ b/models/cm_tree.cpp @@ -241,14 +241,14 @@ nest::CompTree::get_compartment( const long compartment_index, Compartment* comp else { auto child_it = compartment->children.begin(); - while ( ( not r_compartment ) && child_it != compartment->children.end() ) + while ( not r_compartment and child_it != compartment->children.end() ) { r_compartment = get_compartment( compartment_index, &( *child_it ), 0 ); ++child_it; } } - if ( ( not r_compartment ) && raise_flag ) + if ( not r_compartment and raise_flag ) { std::string msg = "does not exist in tree"; throw UnknownCompartment( compartment_index, msg ); diff --git a/models/correlation_detector.cpp b/models/correlation_detector.cpp index 5205ae964e..10b5fcd006 100644 --- a/models/correlation_detector.cpp +++ b/models/correlation_detector.cpp @@ -165,7 +165,7 @@ nest::correlation_detector::State_::set( const DictionaryDatum& d, const Paramet std::vector< long > nev; if ( updateValue< std::vector< long > >( d, names::n_events, nev ) ) { - if ( nev.size() == 2 && nev[ 0 ] == 0 && nev[ 1 ] == 0 ) + if ( nev.size() == 2 and nev[ 0 ] == 0 and nev[ 1 ] == 0 ) { reset_required = true; } @@ -263,7 +263,7 @@ nest::correlation_detector::handle( SpikeEvent& e ) // If this assertion breaks, the sender does not honor the // receiver port during connection or sending. - assert( 0 <= sender && sender <= 1 ); + assert( 0 <= sender and sender <= 1 ); // accept spikes only if detector was active when spike was emitted Time const stamp = e.get_stamp(); @@ -279,7 +279,7 @@ nest::correlation_detector::handle( SpikeEvent& e ) // throw away all spikes of the other neuron which are too old to // enter the correlation window // subtract 0.5*other to make left interval closed, keep right interval open - while ( not otherSpikes.empty() && ( spike_i - otherSpikes.front().timestep_ ) - 0.5 * other >= tau_edge ) + while ( not otherSpikes.empty() and ( spike_i - otherSpikes.front().timestep_ ) - 0.5 * other >= tau_edge ) { otherSpikes.pop_front(); } @@ -294,7 +294,7 @@ nest::correlation_detector::handle( SpikeEvent& e ) // only count events in histogram, if the current event is within the time // window [Tstart, Tstop] // this is needed in order to prevent boundary effects - if ( P_.Tstart_ <= stamp && stamp <= P_.Tstop_ ) + if ( P_.Tstart_ <= stamp and stamp <= P_.Tstop_ ) { // calculate the effect of this spike immediately with respect to all // spikes in the past of the respectively other source diff --git a/models/correlation_detector.h b/models/correlation_detector.h index d6008c4af6..85d72eec3e 100644 --- a/models/correlation_detector.h +++ b/models/correlation_detector.h @@ -310,7 +310,7 @@ class correlation_detector : public Node inline port correlation_detector::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type < 0 || receptor_type > 1 ) + if ( receptor_type < 0 or receptor_type > 1 ) { throw UnknownReceptorType( receptor_type, get_name() ); } diff --git a/models/correlomatrix_detector.cpp b/models/correlomatrix_detector.cpp index ef4f5a786f..0688297768 100644 --- a/models/correlomatrix_detector.cpp +++ b/models/correlomatrix_detector.cpp @@ -294,7 +294,7 @@ nest::correlomatrix_detector::handle( SpikeEvent& e ) // If this assertion breaks, the sender does not honor the // receiver port during connection or sending. - assert( 0 <= sender && sender <= P_.N_channels_ - 1 ); + assert( 0 <= sender and sender <= P_.N_channels_ - 1 ); // accept spikes only if detector was active when spike was emitted Time const stamp = e.get_stamp(); @@ -319,7 +319,7 @@ nest::correlomatrix_detector::handle( SpikeEvent& e ) // throw away all spikes which are too old to // enter the correlation window const delay min_delay = kernel().connection_manager.get_min_delay(); - while ( not otherSpikes.empty() && ( spike_i - otherSpikes.front().timestep_ ) >= tau_edge + min_delay ) + while ( not otherSpikes.empty() and ( spike_i - otherSpikes.front().timestep_ ) >= tau_edge + min_delay ) { otherSpikes.pop_front(); } @@ -330,7 +330,7 @@ nest::correlomatrix_detector::handle( SpikeEvent& e ) // window [Tstart, // Tstop] // this is needed in order to prevent boundary effects - if ( P_.Tstart_ <= stamp && stamp <= P_.Tstop_ ) + if ( P_.Tstart_ <= stamp and stamp <= P_.Tstop_ ) { // calculate the effect of this spike immediately with respect to all // spikes in the past of the respectively other sources @@ -370,14 +370,14 @@ nest::correlomatrix_detector::handle( SpikeEvent& e ) { // weighted histogram S_.covariance_[ sender_ind ][ other_ind ][ bin ] += e.get_multiplicity() * e.get_weight() * spike_j->weight_; - if ( bin == 0 && ( spike_i - spike_j->timestep_ != 0 || other != sender ) ) + if ( bin == 0 and ( spike_i - spike_j->timestep_ != 0 or other != sender ) ) { S_.covariance_[ other_ind ][ sender_ind ][ bin ] += e.get_multiplicity() * e.get_weight() * spike_j->weight_; } // pure (unweighted) count histogram S_.count_covariance_[ sender_ind ][ other_ind ][ bin ] += e.get_multiplicity(); - if ( bin == 0 && ( spike_i - spike_j->timestep_ != 0 || other != sender ) ) + if ( bin == 0 and ( spike_i - spike_j->timestep_ != 0 or other != sender ) ) { S_.count_covariance_[ other_ind ][ sender_ind ][ bin ] += e.get_multiplicity(); } diff --git a/models/correlomatrix_detector.h b/models/correlomatrix_detector.h index d66719aa4d..983a600cb3 100644 --- a/models/correlomatrix_detector.h +++ b/models/correlomatrix_detector.h @@ -300,7 +300,7 @@ class correlomatrix_detector : public Node inline port correlomatrix_detector::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type < 0 || receptor_type > P_.N_channels_ - 1 ) + if ( receptor_type < 0 or receptor_type > P_.N_channels_ - 1 ) { throw UnknownReceptorType( receptor_type, get_name() ); } diff --git a/models/correlospinmatrix_detector.cpp b/models/correlospinmatrix_detector.cpp index 0b4f3a8d6e..cdff8edca4 100644 --- a/models/correlospinmatrix_detector.cpp +++ b/models/correlospinmatrix_detector.cpp @@ -304,7 +304,7 @@ nest::correlospinmatrix_detector::handle( SpikeEvent& e ) // If this assertion breaks, the sender does not honor the // receiver port during connection or sending. - assert( 0 <= curr_i && curr_i <= P_.N_channels_ - 1 ); + assert( 0 <= curr_i and curr_i <= P_.N_channels_ - 1 ); // accept spikes only if detector was active when spike was emitted Time const stamp = e.get_stamp(); @@ -328,7 +328,7 @@ nest::correlospinmatrix_detector::handle( SpikeEvent& e ) { // multiplicity == 1, either a single 1->0 event or the first or second of // a pair of 0->1 // events - if ( curr_i == S_.last_i_ && stamp == S_.t_last_in_spike_ ) + if ( curr_i == S_.last_i_ and stamp == S_.t_last_in_spike_ ) { // received twice the same node ID, so transition 0->1 // revise the last event written to the buffer @@ -397,7 +397,7 @@ nest::correlospinmatrix_detector::handle( SpikeEvent& e ) const double tau_edge = P_.tau_max_.get_steps() + P_.delta_tau_.get_steps(); const delay min_delay = kernel().connection_manager.get_min_delay(); - while ( not otherPulses.empty() && ( t_min_on - otherPulses.front().t_off_ ) >= tau_edge + min_delay ) + while ( not otherPulses.empty() and ( t_min_on - otherPulses.front().t_off_ ) >= tau_edge + min_delay ) { otherPulses.pop_front(); } diff --git a/models/correlospinmatrix_detector.h b/models/correlospinmatrix_detector.h index 7e697d9182..d7047fbe16 100644 --- a/models/correlospinmatrix_detector.h +++ b/models/correlospinmatrix_detector.h @@ -296,7 +296,7 @@ class correlospinmatrix_detector : public Node inline port correlospinmatrix_detector::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type < 0 || receptor_type > P_.N_channels_ - 1 ) + if ( receptor_type < 0 or receptor_type > P_.N_channels_ - 1 ) { throw UnknownReceptorType( receptor_type, get_name() ); } diff --git a/models/dc_generator.cpp b/models/dc_generator.cpp index dda66f131a..6394aceeb0 100644 --- a/models/dc_generator.cpp +++ b/models/dc_generator.cpp @@ -161,7 +161,7 @@ nest::dc_generator::pre_run_hook() void nest::dc_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); long start = origin.get_steps(); diff --git a/models/gamma_sup_generator.cpp b/models/gamma_sup_generator.cpp index 994ac0baf8..46e4262389 100644 --- a/models/gamma_sup_generator.cpp +++ b/models/gamma_sup_generator.cpp @@ -74,8 +74,8 @@ nest::gamma_sup_generator::Internal_states_::update( double transition_prob, Rng n >= 100 and np <= 10. Source: http://en.wikipedia.org/wiki/Binomial_distribution#Poisson_approximation */ - if ( ( occ_[ i ] >= 100 && transition_prob <= 0.01 ) - || ( occ_[ i ] >= 500 && transition_prob * occ_[ i ] <= 0.1 ) ) + if ( ( occ_[ i ] >= 100 and transition_prob <= 0.01 ) + or ( occ_[ i ] >= 500 and transition_prob * occ_[ i ] <= 0.1 ) ) { poisson_distribution::param_type param( transition_prob * occ_[ i ] ); n_trans[ i ] = poisson_dist_( rng, param ); @@ -229,10 +229,10 @@ nest::gamma_sup_generator::pre_run_hook() void nest::gamma_sup_generator::update( Time const& T, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); - if ( P_.rate_ <= 0 || P_.num_targets_ == 0 ) + if ( P_.rate_ <= 0 or P_.num_targets_ == 0 ) { return; } @@ -259,7 +259,7 @@ nest::gamma_sup_generator::event_hook( DSSpikeEvent& e ) const port prt = e.get_port(); // we handle only one port here, get reference to vector elem - assert( 0 <= prt && static_cast< size_t >( prt ) < B_.internal_states_.size() ); + assert( 0 <= prt and static_cast< size_t >( prt ) < B_.internal_states_.size() ); // age_distribution object propagates one time step and returns number of spikes unsigned long n_spikes = diff --git a/models/gif_cond_exp.cpp b/models/gif_cond_exp.cpp index 31a59ec254..e446f4c121 100644 --- a/models/gif_cond_exp.cpp +++ b/models/gif_cond_exp.cpp @@ -307,7 +307,7 @@ nest::gif_cond_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "All time constants must be strictly positive." ); } } - if ( tau_synE_ <= 0 || tau_synI_ <= 0 ) + if ( tau_synE_ <= 0 or tau_synI_ <= 0 ) { throw BadProperty( "Synapse time constants must be strictly positive." ); } @@ -473,7 +473,7 @@ void nest::gif_cond_exp::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/gif_cond_exp_multisynapse.cpp b/models/gif_cond_exp_multisynapse.cpp index 06613b2d9d..9da23d994d 100644 --- a/models/gif_cond_exp_multisynapse.cpp +++ b/models/gif_cond_exp_multisynapse.cpp @@ -206,10 +206,10 @@ nest::gif_cond_exp_multisynapse::Parameters_::set( const DictionaryDatum& d, Nod 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 || tau_flag ) + if ( Erev_flag or tau_flag ) { // receptor arrays have been modified - if ( ( E_rev_.size() != old_n_receptors || tau_syn_.size() != old_n_receptors ) - and ( not Erev_flag || not tau_flag ) ) + 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 " @@ -221,7 +221,7 @@ nest::gif_cond_exp_multisynapse::Parameters_::set( const DictionaryDatum& d, Nod "The reversal potential, and synaptic time constant arrays " "must have the same size." ); } - if ( tau_syn_.size() < old_n_receptors && has_connections_ ) + if ( tau_syn_.size() < old_n_receptors and has_connections_ ) { throw BadProperty( "The neuron has connections, therefore the number of ports cannot be " @@ -476,7 +476,7 @@ void nest::gif_cond_exp_multisynapse::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -591,7 +591,7 @@ nest::gif_cond_exp_multisynapse::handle( SpikeEvent& e ) "must be positive." ); } assert( e.get_delay_steps() > 0 ); - assert( ( e.get_rport() > 0 ) && ( ( size_t ) e.get_rport() <= P_.n_receptors() ) ); + 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() ); diff --git a/models/gif_cond_exp_multisynapse.h b/models/gif_cond_exp_multisynapse.h index b3432170ad..fd024dcb18 100644 --- a/models/gif_cond_exp_multisynapse.h +++ b/models/gif_cond_exp_multisynapse.h @@ -452,7 +452,7 @@ gif_cond_exp_multisynapse::send_test_event( Node& target, rport receptor_type, s inline port gif_cond_exp_multisynapse::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } diff --git a/models/gif_pop_psc_exp.cpp b/models/gif_pop_psc_exp.cpp index 15d85189ae..6118ba4535 100644 --- a/models/gif_pop_psc_exp.cpp +++ b/models/gif_pop_psc_exp.cpp @@ -473,7 +473,7 @@ nest::gif_pop_psc_exp::get_history_size() int k = tmax / V_.h_; int kmin = 5 * P_.tau_m_ / V_.h_; - while ( ( adaptation_kernel( k ) / P_.Delta_V_ < 0.1 ) and ( k > kmin ) ) + while ( ( adaptation_kernel( k ) / P_.Delta_V_ < 0.1 ) and k > kmin ) { k--; } diff --git a/models/gif_psc_exp.cpp b/models/gif_psc_exp.cpp index f89cfffddf..a855c3899c 100644 --- a/models/gif_psc_exp.cpp +++ b/models/gif_psc_exp.cpp @@ -208,7 +208,7 @@ nest::gif_psc_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "All time constants must be strictly positive." ); } } - if ( tau_ex_ <= 0 || tau_in_ <= 0 ) + if ( tau_ex_ <= 0 or tau_in_ <= 0 ) { throw BadProperty( "Synapse time constants must be strictly positive." ); } @@ -321,7 +321,7 @@ void nest::gif_psc_exp::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/gif_psc_exp_multisynapse.cpp b/models/gif_psc_exp_multisynapse.cpp index 6a3d875a52..0a28fe9a92 100644 --- a/models/gif_psc_exp_multisynapse.cpp +++ b/models/gif_psc_exp_multisynapse.cpp @@ -210,7 +210,7 @@ nest::gif_psc_exp_multisynapse::Parameters_::set( const DictionaryDatum& d, Node std::vector< double > tau_tmp; if ( updateValue< std::vector< double > >( d, names::tau_syn, tau_tmp ) ) { - if ( has_connections_ && tau_tmp.size() < tau_syn_.size() ) + if ( has_connections_ and tau_tmp.size() < tau_syn_.size() ) { throw BadProperty( "The neuron has connections, " @@ -343,7 +343,7 @@ void nest::gif_psc_exp_multisynapse::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -426,7 +426,7 @@ void gif_psc_exp_multisynapse::handle( SpikeEvent& e ) { assert( e.get_delay_steps() > 0 ); - assert( ( e.get_rport() > 0 ) && ( ( size_t ) e.get_rport() <= P_.n_receptors_() ) ); + 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() ); diff --git a/models/gif_psc_exp_multisynapse.h b/models/gif_psc_exp_multisynapse.h index 6f3405ff71..2a83ec4b70 100644 --- a/models/gif_psc_exp_multisynapse.h +++ b/models/gif_psc_exp_multisynapse.h @@ -420,7 +420,7 @@ gif_psc_exp_multisynapse::send_test_event( Node& target, rport receptor_type, sy inline port gif_psc_exp_multisynapse::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors_() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors_() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } diff --git a/models/glif_cond.cpp b/models/glif_cond.cpp index bc753325cb..d9d2864bf2 100644 --- a/models/glif_cond.cpp +++ b/models/glif_cond.cpp @@ -359,7 +359,7 @@ nest::glif_cond::Parameters_::set( const DictionaryDatum& d, Node* node ) bool Erev_flag = updateValue< std::vector< double > >( d, names::E_rev, E_rev_ ); // receptor arrays have been modified - if ( tau_flag || Erev_flag ) + if ( tau_flag or Erev_flag ) { if ( E_rev_.size() != tau_syn_.size() ) { @@ -767,7 +767,7 @@ nest::glif_cond::update( Time const& origin, const long from, const long to ) nest::port nest::glif_cond::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors_() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors_() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } diff --git a/models/glif_psc.cpp b/models/glif_psc.cpp index b4a49a485e..560f049f8c 100644 --- a/models/glif_psc.cpp +++ b/models/glif_psc.cpp @@ -280,7 +280,7 @@ nest::glif_psc::Parameters_::set( const DictionaryDatum& d, Node* node ) const size_t old_n_receptors = this->n_receptors_(); if ( updateValue< std::vector< double > >( d, names::tau_syn, tau_syn_ ) ) { - if ( this->n_receptors_() != old_n_receptors && has_connections_ ) + if ( this->n_receptors_() != old_n_receptors and has_connections_ ) { throw BadProperty( "The neuron has connections, therefore the number of ports cannot be " @@ -599,7 +599,7 @@ nest::glif_psc::update( Time const& origin, const long from, const long to ) nest::port nest::glif_psc::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors_() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors_() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } diff --git a/models/hh_cond_beta_gap_traub.cpp b/models/hh_cond_beta_gap_traub.cpp index b3b056549e..5cb10952e7 100644 --- a/models/hh_cond_beta_gap_traub.cpp +++ b/models/hh_cond_beta_gap_traub.cpp @@ -273,12 +273,12 @@ nest::hh_cond_beta_gap_traub::Parameters_::set( const DictionaryDatum& d, Node* throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_rise_ex <= 0 || tau_decay_ex <= 0 || tau_rise_in <= 0 || tau_decay_in <= 0 ) + if ( tau_rise_ex <= 0 or tau_decay_ex <= 0 or tau_rise_in <= 0 or tau_decay_in <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } - if ( g_K < 0 || g_Na < 0 || g_L < 0 ) + if ( g_K < 0 or g_Na < 0 or g_L < 0 ) { throw BadProperty( "All conductances must be non-negative." ); } @@ -300,7 +300,7 @@ nest::hh_cond_beta_gap_traub::State_::set( const DictionaryDatum& d, const Param updateValueParam< double >( d, names::Act_m, y_[ HH_M ], node ); updateValueParam< double >( d, names::Inact_h, y_[ HH_H ], node ); updateValueParam< double >( d, names::Act_n, y_[ HH_N ], node ); - if ( y_[ HH_M ] < 0 || y_[ HH_H ] < 0 || y_[ HH_N ] < 0 ) + if ( y_[ HH_M ] < 0 or y_[ HH_H ] < 0 or y_[ HH_N ] < 0 ) { throw BadProperty( "All (in)activation variables must be non-negative." ); } @@ -471,7 +471,7 @@ nest::hh_cond_beta_gap_traub::update_( Time const& origin, const bool called_from_wfr_update ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const size_t interpolation_order = kernel().simulation_manager.get_wfr_interpolation_order(); @@ -546,17 +546,15 @@ nest::hh_cond_beta_gap_traub::update_( Time const& origin, { --S_.r_; } - else - // ( threshold && maximum ) - if ( S_.y_[ State_::V_M ] >= P_.V_T + 30. && U_old > S_.y_[ State_::V_M ] ) - { - S_.r_ = V_.refractory_counts_; + else if ( S_.y_[ State_::V_M ] >= P_.V_T + 30. and U_old > S_.y_[ State_::V_M ] ) // ( threshold and maximum ) + { + S_.r_ = V_.refractory_counts_; - set_spiketime( Time::step( origin.get_steps() + lag + 1 ) ); + set_spiketime( Time::step( origin.get_steps() + lag + 1 ) ); - SpikeEvent se; - kernel().event_delivery_manager.send( *this, se, lag ); - } + SpikeEvent se; + kernel().event_delivery_manager.send( *this, se, lag ); + } // log state data B_.logger_.record_data( origin.get_steps() + lag ); diff --git a/models/hh_cond_exp_traub.cpp b/models/hh_cond_exp_traub.cpp index 59b5b651f7..a8a49922f8 100644 --- a/models/hh_cond_exp_traub.cpp +++ b/models/hh_cond_exp_traub.cpp @@ -222,7 +222,7 @@ nest::hh_cond_exp_traub::Parameters_::set( const DictionaryDatum& d, Node* node throw BadProperty( "Capacitance must be strictly positive." ); } - if ( tau_synE <= 0 || tau_synI <= 0 ) + if ( tau_synE <= 0 or tau_synI <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -249,7 +249,7 @@ nest::hh_cond_exp_traub::State_::set( const DictionaryDatum& d, const Parameters updateValueParam< double >( d, names::Act_m, y_[ HH_M ], node ); updateValueParam< double >( d, names::Inact_h, y_[ HH_H ], node ); updateValueParam< double >( d, names::Act_n, y_[ HH_N ], node ); - if ( y_[ HH_M ] < 0 || y_[ HH_H ] < 0 || y_[ HH_N ] < 0 ) + if ( y_[ HH_M ] < 0 or y_[ HH_H ] < 0 or y_[ HH_N ] < 0 ) { throw BadProperty( "All (in)activation variables must be non-negative." ); } @@ -380,7 +380,7 @@ nest::hh_cond_exp_traub::pre_run_hook() void nest::hh_cond_exp_traub::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -418,8 +418,8 @@ nest::hh_cond_exp_traub::update( Time const& origin, const long from, const long } else { - // (threshold && maximum ) - if ( S_.y_[ State_::V_M ] >= P_.V_T + 30. && V_.U_old_ > S_.y_[ State_::V_M ] ) + // (threshold and maximum ) + if ( S_.y_[ State_::V_M ] >= P_.V_T + 30. and V_.U_old_ > S_.y_[ State_::V_M ] ) { S_.r_ = V_.refractory_counts_; diff --git a/models/hh_psc_alpha.cpp b/models/hh_psc_alpha.cpp index f551264608..00ee7e6456 100644 --- a/models/hh_psc_alpha.cpp +++ b/models/hh_psc_alpha.cpp @@ -221,11 +221,11 @@ nest::hh_psc_alpha::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_synE <= 0 || tau_synI <= 0 ) + if ( tau_synE <= 0 or tau_synI <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } - if ( g_K < 0 || g_Na < 0 || g_L < 0 ) + if ( g_K < 0 or g_Na < 0 or g_L < 0 ) { throw BadProperty( "All conductances must be non-negative." ); } @@ -247,7 +247,7 @@ nest::hh_psc_alpha::State_::set( const DictionaryDatum& d, Node* node ) updateValueParam< double >( d, names::Act_m, y_[ HH_M ], node ); updateValueParam< double >( d, names::Inact_h, y_[ HH_H ], node ); updateValueParam< double >( d, names::Act_n, y_[ HH_N ], node ); - if ( y_[ HH_M ] < 0 || y_[ HH_H ] < 0 || y_[ HH_N ] < 0 ) + if ( y_[ HH_M ] < 0 or y_[ HH_H ] < 0 or y_[ HH_N ] < 0 ) { throw BadProperty( "All (in)activation variables must be non-negative." ); } @@ -384,7 +384,7 @@ void nest::hh_psc_alpha::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -430,17 +430,15 @@ nest::hh_psc_alpha::update( Time const& origin, const long from, const long to ) { --S_.r_; } - else - // ( threshold && maximum ) - if ( S_.y_[ State_::V_M ] >= 0 && U_old > S_.y_[ State_::V_M ] ) - { - S_.r_ = V_.RefractoryCounts_; + else if ( S_.y_[ State_::V_M ] >= 0 and U_old > S_.y_[ State_::V_M ] ) // ( threshold and maximum ) + { + S_.r_ = V_.RefractoryCounts_; - set_spiketime( Time::step( origin.get_steps() + lag + 1 ) ); + set_spiketime( Time::step( origin.get_steps() + lag + 1 ) ); - SpikeEvent se; - kernel().event_delivery_manager.send( *this, se, lag ); - } + SpikeEvent se; + kernel().event_delivery_manager.send( *this, se, lag ); + } // log state data B_.logger_.record_data( origin.get_steps() + lag ); diff --git a/models/hh_psc_alpha_clopath.cpp b/models/hh_psc_alpha_clopath.cpp index 9e09912033..62a0c19b52 100644 --- a/models/hh_psc_alpha_clopath.cpp +++ b/models/hh_psc_alpha_clopath.cpp @@ -273,7 +273,7 @@ nest::hh_psc_alpha_clopath::State_::set( const DictionaryDatum& d, Node* node ) updateValueParam< double >( d, names::u_bar_plus, y_[ U_BAR_PLUS ], node ); updateValueParam< double >( d, names::u_bar_minus, y_[ U_BAR_MINUS ], node ); updateValueParam< double >( d, names::u_bar_bar, y_[ U_BAR_BAR ], node ); - if ( y_[ HH_M ] < 0 || y_[ HH_H ] < 0 || y_[ HH_N ] < 0 ) + if ( y_[ HH_M ] < 0 or y_[ HH_H ] < 0 or y_[ HH_N ] < 0 ) { throw BadProperty( "All (in)activation variables must be non-negative." ); } @@ -412,7 +412,7 @@ void nest::hh_psc_alpha_clopath::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -466,8 +466,8 @@ nest::hh_psc_alpha_clopath::update( Time const& origin, const long from, const l --S_.r_; } else - // ( threshold && maximum ) - if ( S_.y_[ State_::V_M ] >= 0 && U_old > S_.y_[ State_::V_M ] ) + // ( threshold and maximum ) + if ( S_.y_[ State_::V_M ] >= 0 and U_old > S_.y_[ State_::V_M ] ) { S_.r_ = V_.RefractoryCounts_; diff --git a/models/hh_psc_alpha_gap.cpp b/models/hh_psc_alpha_gap.cpp index 5030a65ac9..f81ed6fd62 100644 --- a/models/hh_psc_alpha_gap.cpp +++ b/models/hh_psc_alpha_gap.cpp @@ -263,11 +263,11 @@ nest::hh_psc_alpha_gap::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_synE <= 0 || tau_synI <= 0 ) + if ( tau_synE <= 0 or tau_synI <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } - if ( g_Kv1 < 0 || g_Kv3 < 0 || g_Na < 0 || g_L < 0 ) + if ( g_Kv1 < 0 or g_Kv3 < 0 or g_Na < 0 or g_L < 0 ) { throw BadProperty( "All conductances must be non-negative." ); } @@ -291,7 +291,7 @@ nest::hh_psc_alpha_gap::State_::set( const DictionaryDatum& d, Node* node ) updateValueParam< double >( d, names::Inact_h, y_[ HH_H ], node ); updateValueParam< double >( d, names::Act_n, y_[ HH_N ], node ); updateValueParam< double >( d, names::Inact_p, y_[ HH_P ], node ); - if ( y_[ HH_M ] < 0 || y_[ HH_H ] < 0 || y_[ HH_N ] < 0 || y_[ HH_P ] < 0 ) + if ( y_[ HH_M ] < 0 or y_[ HH_H ] < 0 or y_[ HH_N ] < 0 or y_[ HH_P ] < 0 ) { throw BadProperty( "All (in)activation variables must be non-negative." ); } @@ -450,7 +450,7 @@ bool nest::hh_psc_alpha_gap::update_( Time const& origin, const long from, const long to, const bool called_from_wfr_update ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const size_t interpolation_order = kernel().simulation_manager.get_wfr_interpolation_order(); @@ -526,8 +526,8 @@ nest::hh_psc_alpha_gap::update_( Time const& origin, const long from, const long --S_.r_; } else - // ( threshold && maximum ) - if ( S_.y_[ State_::V_M ] >= 0 && U_old > S_.y_[ State_::V_M ] ) + // ( threshold and maximum ) + if ( S_.y_[ State_::V_M ] >= 0 and U_old > S_.y_[ State_::V_M ] ) { S_.r_ = V_.RefractoryCounts_; diff --git a/models/ht_neuron.cpp b/models/ht_neuron.cpp index b76a960914..cd9f545ce1 100644 --- a/models/ht_neuron.cpp +++ b/models/ht_neuron.cpp @@ -770,7 +770,7 @@ nest::ht_neuron::set_status( const DictionaryDatum& d ) void ht_neuron::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/ht_neuron.h b/models/ht_neuron.h index d2a2936a62..0a0596dd22 100644 --- a/models/ht_neuron.h +++ b/models/ht_neuron.h @@ -528,7 +528,7 @@ ht_neuron::handles_test_event( SpikeEvent&, rport receptor_type ) { assert( B_.spike_inputs_.size() == 4 ); - if ( not( INF_SPIKE_RECEPTOR < receptor_type && receptor_type < SUP_SPIKE_RECEPTOR ) ) + if ( not( INF_SPIKE_RECEPTOR < receptor_type and receptor_type < SUP_SPIKE_RECEPTOR ) ) { throw UnknownReceptorType( receptor_type, get_name() ); return 0; diff --git a/models/ht_synapse.h b/models/ht_synapse.h index 410446a293..435819bc72 100644 --- a/models/ht_synapse.h +++ b/models/ht_synapse.h @@ -249,12 +249,12 @@ ht_synapse< targetidentifierT >::set_status( const DictionaryDatum& d, Connector throw BadProperty( "tau_P > 0 required." ); } - if ( delta_P_ < 0.0 || delta_P_ > 1.0 ) + if ( delta_P_ < 0.0 or delta_P_ > 1.0 ) { throw BadProperty( "0 <= delta_P <= 1 required." ); } - if ( p_ < 0.0 || p_ > 1.0 ) + if ( p_ < 0.0 or p_ > 1.0 ) { throw BadProperty( "0 <= P <= 1 required." ); } diff --git a/models/iaf_chs_2007.cpp b/models/iaf_chs_2007.cpp index 69f2a82f7a..d1869d6c3b 100644 --- a/models/iaf_chs_2007.cpp +++ b/models/iaf_chs_2007.cpp @@ -113,7 +113,7 @@ nest::iaf_chs_2007::Parameters_::set( const DictionaryDatum& d, State_& s, Node* /* // TODO: How to handle setting U_noise first and noise later and still make sure they are consistent? - if ( U_noise_ > 0 && noise_.empty() ) + if ( U_noise_ > 0 and noise_.empty() ) throw BadProperty("Noise amplitude larger than zero while noise signal " "is missing."); */ @@ -126,7 +126,7 @@ nest::iaf_chs_2007::Parameters_::set( const DictionaryDatum& d, State_& s, Node* { throw BadProperty( "Reset potential cannot be negative." ); } - if ( tau_epsp_ <= 0 || tau_reset_ <= 0 ) + if ( tau_epsp_ <= 0 or tau_reset_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -217,7 +217,7 @@ nest::iaf_chs_2007::pre_run_hook() void nest::iaf_chs_2007::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); // evolve from timestep 'from' to timestep 'to' with steps of h each @@ -235,7 +235,7 @@ nest::iaf_chs_2007::update( const Time& origin, const long from, const long to ) // exponentially decaying ahp S_.V_spike_ *= V_.P30_; - double noise_term = P_.U_noise_ > 0.0 && not P_.noise_.empty() ? P_.U_noise_ * P_.noise_[ S_.position_++ ] : 0.0; + double noise_term = P_.U_noise_ > 0.0 and not P_.noise_.empty() ? P_.U_noise_ * P_.noise_[ S_.position_++ ] : 0.0; S_.V_m_ = S_.V_syn_ + S_.V_spike_ + noise_term; diff --git a/models/iaf_cond_alpha.cpp b/models/iaf_cond_alpha.cpp index 132bced375..a6b7db2915 100644 --- a/models/iaf_cond_alpha.cpp +++ b/models/iaf_cond_alpha.cpp @@ -230,7 +230,7 @@ nest::iaf_cond_alpha::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_synE <= 0 || tau_synI <= 0 ) + if ( tau_synE <= 0 or tau_synI <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -370,7 +370,7 @@ void nest::iaf_cond_alpha::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/iaf_cond_alpha_mc.cpp b/models/iaf_cond_alpha_mc.cpp index 7a454510b4..4d3048edd6 100644 --- a/models/iaf_cond_alpha_mc.cpp +++ b/models/iaf_cond_alpha_mc.cpp @@ -404,7 +404,7 @@ nest::iaf_cond_alpha_mc::Parameters_::set( const DictionaryDatum& d, Node* node { throw BadProperty( "Capacitance (" + comp_names_[ n ].toString() + ") must be strictly positive." ); } - if ( tau_synE[ n ] <= 0 || tau_synI[ n ] <= 0 ) + if ( tau_synE[ n ] <= 0 or tau_synI[ n ] <= 0 ) { throw BadProperty( "All time constants (" + comp_names_[ n ].toString() + ") must be strictly positive." ); } @@ -575,7 +575,7 @@ void nest::iaf_cond_alpha_mc::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -655,7 +655,7 @@ void nest::iaf_cond_alpha_mc::handle( SpikeEvent& e ) { assert( e.get_delay_steps() > 0 ); - assert( 0 <= e.get_rport() && e.get_rport() < 2 * NCOMP ); + assert( 0 <= e.get_rport() and e.get_rport() < 2 * NCOMP ); B_.spikes_[ e.get_rport() ].add_value( e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ), e.get_weight() * e.get_multiplicity() ); @@ -666,7 +666,7 @@ nest::iaf_cond_alpha_mc::handle( CurrentEvent& e ) { assert( e.get_delay_steps() > 0 ); // not 100% clean, should look at MIN, SUP - assert( 0 <= e.get_rport() && e.get_rport() < NCOMP ); + assert( 0 <= e.get_rport() and e.get_rport() < NCOMP ); // add weighted current; HEP 2002-10-04 B_.currents_[ e.get_rport() ].add_value( diff --git a/models/iaf_cond_alpha_mc.h b/models/iaf_cond_alpha_mc.h index 6fb829d7ab..1ddf27c72d 100644 --- a/models/iaf_cond_alpha_mc.h +++ b/models/iaf_cond_alpha_mc.h @@ -477,9 +477,9 @@ iaf_cond_alpha_mc::send_test_event( Node& target, rport receptor_type, synindex, inline port iaf_cond_alpha_mc::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type < MIN_SPIKE_RECEPTOR || receptor_type >= SUP_SPIKE_RECEPTOR ) + if ( receptor_type < MIN_SPIKE_RECEPTOR or receptor_type >= SUP_SPIKE_RECEPTOR ) { - if ( receptor_type < 0 || receptor_type >= SUP_CURR_RECEPTOR ) + if ( receptor_type < 0 or receptor_type >= SUP_CURR_RECEPTOR ) { throw UnknownReceptorType( receptor_type, get_name() ); } @@ -494,9 +494,9 @@ iaf_cond_alpha_mc::handles_test_event( SpikeEvent&, rport receptor_type ) inline port iaf_cond_alpha_mc::handles_test_event( CurrentEvent&, rport receptor_type ) { - if ( receptor_type < MIN_CURR_RECEPTOR || receptor_type >= SUP_CURR_RECEPTOR ) + if ( receptor_type < MIN_CURR_RECEPTOR or receptor_type >= SUP_CURR_RECEPTOR ) { - if ( receptor_type >= 0 && receptor_type < MIN_CURR_RECEPTOR ) + if ( receptor_type >= 0 and receptor_type < MIN_CURR_RECEPTOR ) { throw IncompatibleReceptorType( receptor_type, get_name(), "CurrentEvent" ); } @@ -513,7 +513,7 @@ iaf_cond_alpha_mc::handles_test_event( DataLoggingRequest& dlr, rport receptor_t { if ( receptor_type != 0 ) { - if ( receptor_type < 0 || receptor_type >= SUP_CURR_RECEPTOR ) + if ( receptor_type < 0 or receptor_type >= SUP_CURR_RECEPTOR ) { throw UnknownReceptorType( receptor_type, get_name() ); } diff --git a/models/iaf_cond_beta.cpp b/models/iaf_cond_beta.cpp index c1e6fcb326..409c3804fe 100644 --- a/models/iaf_cond_beta.cpp +++ b/models/iaf_cond_beta.cpp @@ -237,7 +237,7 @@ nest::iaf_cond_beta::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_rise_ex <= 0 || tau_decay_ex <= 0 || tau_rise_in <= 0 || tau_decay_in <= 0 ) + if ( tau_rise_ex <= 0 or tau_decay_ex <= 0 or tau_rise_in <= 0 or tau_decay_in <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -383,7 +383,7 @@ void nest::iaf_cond_beta::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/iaf_cond_exp.cpp b/models/iaf_cond_exp.cpp index f3597c6d23..ad3a9577b1 100644 --- a/models/iaf_cond_exp.cpp +++ b/models/iaf_cond_exp.cpp @@ -194,7 +194,7 @@ nest::iaf_cond_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_synE <= 0 || tau_synI <= 0 ) + if ( tau_synE <= 0 or tau_synI <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -345,7 +345,7 @@ void nest::iaf_cond_exp::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/iaf_cond_exp_sfa_rr.cpp b/models/iaf_cond_exp_sfa_rr.cpp index 14ed680674..b2496c7ca5 100644 --- a/models/iaf_cond_exp_sfa_rr.cpp +++ b/models/iaf_cond_exp_sfa_rr.cpp @@ -226,7 +226,7 @@ nest::iaf_cond_exp_sfa_rr::Parameters_::set( const DictionaryDatum& d, Node* nod { throw BadProperty( "Refractory time cannot be negative." ); } - if ( tau_synE <= 0 || tau_synI <= 0 || tau_sfa <= 0 || tau_rr <= 0 ) + if ( tau_synE <= 0 or tau_synI <= 0 or tau_sfa <= 0 or tau_rr <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -381,7 +381,7 @@ void nest::iaf_cond_exp_sfa_rr::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/iaf_psc_alpha.cpp b/models/iaf_psc_alpha.cpp index a6a4863cff..98d0d573ea 100644 --- a/models/iaf_psc_alpha.cpp +++ b/models/iaf_psc_alpha.cpp @@ -159,7 +159,7 @@ iaf_psc_alpha::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "Membrane time constant must be > 0." ); } - if ( tau_ex_ <= 0.0 || tau_in_ <= 0.0 ) + if ( tau_ex_ <= 0.0 or tau_in_ <= 0.0 ) { throw BadProperty( "All synaptic time constants must be > 0." ); } @@ -303,7 +303,7 @@ iaf_psc_alpha::pre_run_hook() void iaf_psc_alpha::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/iaf_psc_alpha_canon.cpp b/models/iaf_psc_alpha_canon.cpp index bf216d8caf..213b614e3b 100644 --- a/models/iaf_psc_alpha_canon.cpp +++ b/models/iaf_psc_alpha_canon.cpp @@ -152,7 +152,7 @@ nest::iaf_psc_alpha_canon::Parameters_::set( const DictionaryDatum& d, Node* nod long tmp; if ( updateValueParam< long >( d, names::Interpol_Order, tmp, node ) ) { - if ( NO_INTERPOL <= tmp && tmp < END_INTERP_ORDER ) + if ( NO_INTERPOL <= tmp and tmp < END_INTERP_ORDER ) { Interpol_ = static_cast< interpOrder >( tmp ); } @@ -180,7 +180,7 @@ nest::iaf_psc_alpha_canon::Parameters_::set( const DictionaryDatum& d, Node* nod { throw BadProperty( "Refractory time must be at least one time step." ); } - if ( tau_m_ <= 0 || tau_syn_ <= 0 ) + if ( tau_m_ <= 0 or tau_syn_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -320,7 +320,7 @@ nest::iaf_psc_alpha_canon::update( Time const& origin, const long from, const lo const long T = origin.get_steps() + lag; // if neuron returns from refractoriness during this step, place // pseudo-event in queue to mark end of refractory period - if ( S_.is_refractory_ && ( T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) ) + if ( S_.is_refractory_ and T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) { B_.events_.add_refractory( T, S_.last_spike_offset_ ); } @@ -654,11 +654,11 @@ nest::iaf_psc_alpha_canon::thresh_find3_( double const dt ) const // set tau to the smallest root above 0 double tau = ( tau1 >= 0 ) ? tau1 : 2 * h_ms; - if ( ( tau2 >= 0 ) && ( tau2 < tau ) ) + if ( tau2 >= 0 and tau2 < tau ) { tau = tau2; } - if ( ( tau3 >= 0 ) && ( tau3 < tau ) ) + if ( tau3 >= 0 and tau3 < tau ) { tau = tau3; } diff --git a/models/iaf_psc_alpha_multisynapse.cpp b/models/iaf_psc_alpha_multisynapse.cpp index 024f9c55b4..fe03175de6 100644 --- a/models/iaf_psc_alpha_multisynapse.cpp +++ b/models/iaf_psc_alpha_multisynapse.cpp @@ -183,7 +183,7 @@ iaf_psc_alpha_multisynapse::Parameters_::set( const DictionaryDatum& d, Node* no const size_t old_n_receptors = this->n_receptors_(); if ( updateValue< std::vector< double > >( d, "tau_syn", tau_syn_ ) ) { - if ( this->n_receptors_() != old_n_receptors && has_connections_ == true ) + if ( this->n_receptors_() != old_n_receptors and has_connections_ == true ) { throw BadProperty( "The neuron has connections, therefore the number of ports cannot be " @@ -326,7 +326,7 @@ iaf_psc_alpha_multisynapse::pre_run_hook() void iaf_psc_alpha_multisynapse::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -386,7 +386,7 @@ iaf_psc_alpha_multisynapse::update( Time const& origin, const long from, const l port iaf_psc_alpha_multisynapse::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors_() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors_() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } diff --git a/models/iaf_psc_alpha_ps.cpp b/models/iaf_psc_alpha_ps.cpp index bc9570ef63..0829334326 100644 --- a/models/iaf_psc_alpha_ps.cpp +++ b/models/iaf_psc_alpha_ps.cpp @@ -175,7 +175,7 @@ nest::iaf_psc_alpha_ps::Parameters_::set( const DictionaryDatum& d, Node* node ) throw BadProperty( "Refractory time must be at least one time step." ); } - if ( tau_m_ <= 0 || tau_syn_ex_ <= 0 || tau_syn_in_ <= 0 ) + if ( tau_m_ <= 0 or tau_syn_ex_ <= 0 or tau_syn_in_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -323,7 +323,7 @@ nest::iaf_psc_alpha_ps::update( Time const& origin, const long from, const long const long T = origin.get_steps() + lag; // if neuron returns from refractoriness during this step, place // pseudo-event in queue to mark end of refractory period - if ( S_.is_refractory_ && ( T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) ) + if ( S_.is_refractory_ and T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) { B_.events_.add_refractory( T, S_.last_spike_offset_ ); } diff --git a/models/iaf_psc_delta.cpp b/models/iaf_psc_delta.cpp index 0e393a33ab..e54680ee47 100644 --- a/models/iaf_psc_delta.cpp +++ b/models/iaf_psc_delta.cpp @@ -267,7 +267,7 @@ nest::iaf_psc_delta::pre_run_hook() void nest::iaf_psc_delta::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const double h = Time::get_resolution().get_ms(); @@ -280,7 +280,7 @@ nest::iaf_psc_delta::update( Time const& origin, const long from, const long to // if we have accumulated spikes from refractory period, // add and reset accumulator - if ( P_.with_refr_input_ && S_.refr_spikes_buffer_ != 0.0 ) + if ( P_.with_refr_input_ and S_.refr_spikes_buffer_ != 0.0 ) { S_.y3_ += S_.refr_spikes_buffer_; S_.refr_spikes_buffer_ = 0.0; diff --git a/models/iaf_psc_delta_ps.cpp b/models/iaf_psc_delta_ps.cpp index 924ec12511..966e79833f 100644 --- a/models/iaf_psc_delta_ps.cpp +++ b/models/iaf_psc_delta_ps.cpp @@ -302,7 +302,7 @@ iaf_psc_delta_ps::update( Time const& origin, const long from, const long to ) double t = V_.h_ms_; // place pseudo-event in queue to mark end of refractory period - if ( S_.is_refractory_ && ( T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) ) + if ( S_.is_refractory_ and T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) { B_.events_.add_refractory( T, S_.last_spike_offset_ ); } @@ -427,7 +427,7 @@ iaf_psc_delta_ps::update( Time const& origin, const long from, const long to ) // no events remaining, plain update step across remainder // of interval - if ( not S_.is_refractory_ && t > 0 ) // not at end of step, do remainder + if ( not S_.is_refractory_ and t > 0 ) // not at end of step, do remainder { propagate_( t ); if ( S_.U_ >= P_.U_th_ ) diff --git a/models/iaf_psc_exp.cpp b/models/iaf_psc_exp.cpp index a09b9b1a26..50169ece79 100644 --- a/models/iaf_psc_exp.cpp +++ b/models/iaf_psc_exp.cpp @@ -148,7 +148,7 @@ nest::iaf_psc_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Capacitance must be strictly positive." ); } - if ( Tau_ <= 0 || tau_ex_ <= 0 || tau_in_ <= 0 ) + if ( Tau_ <= 0 or tau_ex_ <= 0 or tau_in_ <= 0 ) { throw BadProperty( "Membrane and synapse time constants must be strictly positive." ); } @@ -281,7 +281,7 @@ nest::iaf_psc_exp::pre_run_hook() void nest::iaf_psc_exp::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const double h = Time::get_resolution().get_ms(); diff --git a/models/iaf_psc_exp_htum.cpp b/models/iaf_psc_exp_htum.cpp index 88de457fb1..f661199f1e 100644 --- a/models/iaf_psc_exp_htum.cpp +++ b/models/iaf_psc_exp_htum.cpp @@ -152,7 +152,7 @@ nest::iaf_psc_exp_htum::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Capacitance must be strictly positive." ); } - if ( Tau_ <= 0 || tau_ex_ <= 0 || tau_in_ <= 0 || tau_ref_tot_ <= 0 || tau_ref_abs_ <= 0 ) + if ( Tau_ <= 0 or tau_ex_ <= 0 or tau_in_ <= 0 or tau_ref_tot_ <= 0 or tau_ref_abs_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -293,7 +293,7 @@ nest::iaf_psc_exp_htum::pre_run_hook() void nest::iaf_psc_exp_htum::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); // evolve from timestep 'from' to timestep 'to' with steps of h each diff --git a/models/iaf_psc_exp_multisynapse.cpp b/models/iaf_psc_exp_multisynapse.cpp index a57f16cbc5..75ab701e50 100644 --- a/models/iaf_psc_exp_multisynapse.cpp +++ b/models/iaf_psc_exp_multisynapse.cpp @@ -301,7 +301,7 @@ nest::iaf_psc_exp_multisynapse::pre_run_hook() void iaf_psc_exp_multisynapse::update( const Time& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); // evolve from timestep 'from' to timestep 'to' with steps of h each @@ -352,7 +352,7 @@ iaf_psc_exp_multisynapse::update( const Time& origin, const long from, const lon port iaf_psc_exp_multisynapse::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type <= 0 || receptor_type > static_cast< port >( P_.n_receptors_() ) ) + if ( receptor_type <= 0 or receptor_type > static_cast< port >( P_.n_receptors_() ) ) { throw IncompatibleReceptorType( receptor_type, get_name(), "SpikeEvent" ); } diff --git a/models/iaf_psc_exp_ps.cpp b/models/iaf_psc_exp_ps.cpp index a076c9611b..501572bf06 100644 --- a/models/iaf_psc_exp_ps.cpp +++ b/models/iaf_psc_exp_ps.cpp @@ -175,7 +175,7 @@ nest::iaf_psc_exp_ps::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Refractory time must be at least one time step." ); } - if ( tau_m_ <= 0 || tau_ex_ <= 0 || tau_in_ <= 0 ) + if ( tau_m_ <= 0 or tau_ex_ <= 0 or tau_in_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -298,7 +298,7 @@ nest::iaf_psc_exp_ps::update( const Time& origin, const long from, const long to // if neuron returns from refractoriness during this step, place // pseudo-event in queue to mark end of refractory period - if ( S_.is_refractory_ && ( T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) ) + if ( S_.is_refractory_ and T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) { B_.events_.add_refractory( T, S_.last_spike_offset_ ); } diff --git a/models/iaf_psc_exp_ps_lossless.cpp b/models/iaf_psc_exp_ps_lossless.cpp index c0c8a77f3a..68b5d40b14 100644 --- a/models/iaf_psc_exp_ps_lossless.cpp +++ b/models/iaf_psc_exp_ps_lossless.cpp @@ -338,7 +338,7 @@ nest::iaf_psc_exp_ps_lossless::update( const Time& origin, const long from, cons // if neuron returns from refractoriness during this step, place // pseudo-event in queue to mark end of refractory period - if ( S_.is_refractory_ && ( T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) ) + if ( S_.is_refractory_ and T + 1 - S_.last_spike_step_ == V_.refractory_steps_ ) { B_.events_.add_refractory( T, S_.last_spike_offset_ ); } @@ -625,7 +625,7 @@ nest::iaf_psc_exp_ps_lossless::is_spike_( const double dt ) // no-spike, NS_1, (V <= g_h,I_e(I) and V < f_h,I_e(I)) if ( ( V_0 < ( ( ( I_0 + I_e ) * ( V_.b1_ * exp_tau_m + V_.b2_ * exp_tau_s ) + V_.b3_ * ( exp_tau_m - exp_tau_s ) ) / ( V_.b4_ * exp_tau_s ) ) ) - and ( V_0 <= f ) ) + and V_0 <= f ) { return numerics::nan; } diff --git a/models/izhikevich.cpp b/models/izhikevich.cpp index 627952671a..59052e9bf2 100644 --- a/models/izhikevich.cpp +++ b/models/izhikevich.cpp @@ -111,7 +111,7 @@ nest::izhikevich::Parameters_::set( const DictionaryDatum& d, Node* node ) updateValueParam< double >( d, names::d, d_, node ); updateValue< bool >( d, names::consistent_integration, consistent_integration_ ); const double h = Time::get_resolution().get_ms(); - if ( not consistent_integration_ && h != 1.0 ) + if ( not consistent_integration_ and h != 1.0 ) { LOG( M_INFO, "Parameters_::set", "Use 1.0 ms as resolution for consistency." ); } @@ -188,7 +188,7 @@ nest::izhikevich::pre_run_hook() void nest::izhikevich::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const double h = Time::get_resolution().get_ms(); diff --git a/models/mat2_psc_exp.cpp b/models/mat2_psc_exp.cpp index 709670acf0..cc578ddacc 100644 --- a/models/mat2_psc_exp.cpp +++ b/models/mat2_psc_exp.cpp @@ -143,11 +143,11 @@ nest::mat2_psc_exp::Parameters_::set( const DictionaryDatum& d, Node* node ) { throw BadProperty( "Capacitance must be strictly positive." ); } - if ( Tau_ <= 0 || tau_ex_ <= 0 || tau_in_ <= 0 || tau_ref_ <= 0 || tau_1_ <= 0 || tau_2_ <= 0 ) + if ( Tau_ <= 0 or tau_ex_ <= 0 or tau_in_ <= 0 or tau_ref_ <= 0 or tau_1_ <= 0 or tau_2_ <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } - if ( Tau_ == tau_ex_ || Tau_ == tau_in_ ) + if ( Tau_ == tau_ex_ or Tau_ == tau_in_ ) { throw BadProperty( "Membrane and synapse time constant(s) must differ." @@ -302,7 +302,7 @@ nest::mat2_psc_exp::pre_run_hook() void nest::mat2_psc_exp::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); // evolve from timestep 'from' to timestep 'to' with steps of h each diff --git a/models/mip_generator.cpp b/models/mip_generator.cpp index 5f03338517..b254517c7a 100644 --- a/models/mip_generator.cpp +++ b/models/mip_generator.cpp @@ -124,7 +124,7 @@ nest::mip_generator::update( Time const& T, const long from, const long to ) for ( long lag = from; lag < to; ++lag ) { - if ( not StimulationDevice::is_active( T ) || P_.rate_ <= 0 ) + if ( not StimulationDevice::is_active( T ) or P_.rate_ <= 0 ) { return; // no spikes to be generated } diff --git a/models/multimeter.cpp b/models/multimeter.cpp index 3242ac85e6..fd367ee3da 100644 --- a/models/multimeter.cpp +++ b/models/multimeter.cpp @@ -107,7 +107,7 @@ void nest::multimeter::Parameters_::set( const DictionaryDatum& d, const Buffers_& b, Node* node ) { if ( b.has_targets_ - && ( d->known( names::interval ) || d->known( names::offset ) || d->known( names::record_from ) ) ) + and ( d->known( names::interval ) or d->known( names::offset ) or d->known( names::record_from ) ) ) { throw BadProperty( "The recording interval, the interval offset and the list of properties " @@ -139,7 +139,7 @@ nest::multimeter::Parameters_::set( const DictionaryDatum& d, const Buffers_& b, { // if offset is different from the default value (0), it must be at least // as large as the resolution - if ( v != 0 && Time( Time::ms( v ) ) < Time::get_resolution() ) + if ( v != 0 and Time( Time::ms( v ) ) < Time::get_resolution() ) { throw BadProperty( "The offset for the sampling interval must be at least as long as the " @@ -183,7 +183,7 @@ multimeter::update( Time const& origin, const long from, const long ) previous slice if we are called at the beginning of the slice. Otherwise, we do nothing. */ - if ( origin.get_steps() == 0 || from != 0 ) + if ( origin.get_steps() == 0 or from != 0 ) { return; } diff --git a/models/multimeter.h b/models/multimeter.h index fec4383602..109bd8d46c 100644 --- a/models/multimeter.h +++ b/models/multimeter.h @@ -252,7 +252,7 @@ nest::multimeter::set_status( const DictionaryDatum& d ) { // protect multimeter from being frozen bool freeze = false; - if ( updateValue< bool >( d, names::frozen, freeze ) && freeze ) + if ( updateValue< bool >( d, names::frozen, freeze ) and freeze ) { throw BadProperty( "multimeter cannot be frozen." ); } diff --git a/models/music_cont_in_proxy.cpp b/models/music_cont_in_proxy.cpp index 35746d9bf2..b744f0bb44 100644 --- a/models/music_cont_in_proxy.cpp +++ b/models/music_cont_in_proxy.cpp @@ -68,7 +68,7 @@ void nest::music_cont_in_proxy::Parameters_::set( const DictionaryDatum& d, State_& s ) { // TODO: This is not possible, as P_ does not know about get_name() - // if(d->known(names::port_name) && s.published_) + // if(d->known(names::port_name) and s.published_) // throw MUSICPortAlreadyPublished(get_name(), P_.port_name_); if ( not s.published_ ) diff --git a/models/music_cont_out_proxy.cpp b/models/music_cont_out_proxy.cpp index f3c19d5f56..d03ac81984 100644 --- a/models/music_cont_out_proxy.cpp +++ b/models/music_cont_out_proxy.cpp @@ -122,7 +122,7 @@ nest::music_cont_out_proxy::Parameters_::set( const DictionaryDatum& d, updateValue< string >( d, names::port_name, port_name_ ); } - if ( buffers.has_targets_ && ( d->known( names::interval ) || d->known( names::record_from ) ) ) + if ( buffers.has_targets_ and ( d->known( names::interval ) or d->known( names::record_from ) ) ) { throw BadProperty( "The recording interval and the list of properties to record " @@ -341,7 +341,7 @@ nest::music_cont_out_proxy::update( Time const& origin, const long from, const l the previous slice if we are called at the beginning of the slice. Otherwise, we do nothing. */ - if ( origin.get_steps() == 0 || from != 0 ) + if ( origin.get_steps() == 0 or from != 0 ) { return; } diff --git a/models/music_event_out_proxy.cpp b/models/music_event_out_proxy.cpp index 4e763f4326..52a24a45a7 100644 --- a/models/music_event_out_proxy.cpp +++ b/models/music_event_out_proxy.cpp @@ -70,7 +70,7 @@ void nest::music_event_out_proxy::Parameters_::set( const DictionaryDatum& d, State_& s ) { // TODO: This is not possible, as P_ does not know about get_name() - // if(d->known(names::port_name) && s.published_) + // if(d->known(names::port_name) and s.published_) // throw MUSICPortAlreadyPublished(get_name(), P_.port_name_); if ( not s.published_ ) diff --git a/models/music_rate_in_proxy.cpp b/models/music_rate_in_proxy.cpp index 355f370a56..4ede7f56a6 100644 --- a/models/music_rate_in_proxy.cpp +++ b/models/music_rate_in_proxy.cpp @@ -68,7 +68,7 @@ void nest::music_rate_in_proxy::Parameters_::set( const DictionaryDatum& d, State_& s ) { // TODO: This is not possible, as P_ does not know about get_name() - // if(d->known(names::port_name) && s.registered_) + // if(d->known(names::port_name) and s.registered_) // throw MUSICPortAlreadyPublished(get_name(), P_.port_name_); if ( not s.registered_ ) diff --git a/models/music_rate_out_proxy.cpp b/models/music_rate_out_proxy.cpp index 1006126aab..c9ded0acd1 100644 --- a/models/music_rate_out_proxy.cpp +++ b/models/music_rate_out_proxy.cpp @@ -80,7 +80,7 @@ void nest::music_rate_out_proxy::Parameters_::set( const DictionaryDatum& d, State_& s ) { // TODO: This is not possible, as P_ does not know about get_name() - // if(d->known(names::port_name) && s.published_) + // if(d->known(names::port_name) and s.published_) // throw MUSICPortAlreadyPublished(get_name(), P_.port_name_); if ( not s.published_ ) diff --git a/models/noise_generator.cpp b/models/noise_generator.cpp index 9838e8424d..b11fd6f216 100644 --- a/models/noise_generator.cpp +++ b/models/noise_generator.cpp @@ -288,7 +288,7 @@ nest::noise_generator::send_test_event( Node& target, rport receptor_type, synin void nest::noise_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const long start = origin.get_steps(); @@ -346,7 +346,7 @@ nest::noise_generator::event_hook( DSCurrentEvent& e ) const port prt = e.get_port(); // we handle only one port here, get reference to vector elem - assert( 0 <= prt && static_cast< size_t >( prt ) < B_.amps_.size() ); + assert( 0 <= prt and static_cast< size_t >( prt ) < B_.amps_.size() ); e.set_current( B_.amps_[ prt ] ); e.get_receiver().handle( e ); diff --git a/models/parrot_neuron.cpp b/models/parrot_neuron.cpp index 853966f069..cc79d2cd7a 100644 --- a/models/parrot_neuron.cpp +++ b/models/parrot_neuron.cpp @@ -52,7 +52,7 @@ parrot_neuron::init_buffers_() void parrot_neuron::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/poisson_generator.cpp b/models/poisson_generator.cpp index 0a6d96c485..00de605b42 100644 --- a/models/poisson_generator.cpp +++ b/models/poisson_generator.cpp @@ -117,7 +117,7 @@ nest::poisson_generator::pre_run_hook() void nest::poisson_generator::update( Time const& T, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); if ( P_.rate_ <= 0 ) diff --git a/models/poisson_generator_ps.cpp b/models/poisson_generator_ps.cpp index 412673e36d..b59c82f915 100644 --- a/models/poisson_generator_ps.cpp +++ b/models/poisson_generator_ps.cpp @@ -178,10 +178,10 @@ nest::poisson_generator_ps::pre_run_hook() void nest::poisson_generator_ps::update( Time const& T, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); - if ( P_.rate_ <= 0 || P_.num_targets_ == 0 ) + if ( P_.rate_ <= 0 or P_.num_targets_ == 0 ) { return; } @@ -213,7 +213,7 @@ nest::poisson_generator_ps::event_hook( DSSpikeEvent& e ) const port prt = e.get_port(); // we handle only one port here, get reference to vector elem - assert( 0 <= prt && static_cast< size_t >( prt ) < B_.next_spike_.size() ); + assert( 0 <= prt and static_cast< size_t >( prt ) < B_.next_spike_.size() ); // obtain rng RngPtr rng = get_vp_specific_rng( get_thread() ); diff --git a/models/pp_cond_exp_mc_urbanczik.cpp b/models/pp_cond_exp_mc_urbanczik.cpp index c1e6ef7f84..ad8161d215 100644 --- a/models/pp_cond_exp_mc_urbanczik.cpp +++ b/models/pp_cond_exp_mc_urbanczik.cpp @@ -406,7 +406,7 @@ nest::pp_cond_exp_mc_urbanczik::Parameters_::set( const DictionaryDatum& d ) throw BadProperty( "Capacitance (" + comp_names_[ n ].toString() + ") must be strictly positive." ); } - if ( urbanczik_params.tau_syn_ex[ n ] <= 0 || urbanczik_params.tau_syn_in[ n ] <= 0 ) + if ( urbanczik_params.tau_syn_ex[ n ] <= 0 or urbanczik_params.tau_syn_in[ n ] <= 0 ) { throw BadProperty( "All time constants must be strictly positive." ); } @@ -574,7 +574,7 @@ void nest::pp_cond_exp_mc_urbanczik::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -695,7 +695,7 @@ void nest::pp_cond_exp_mc_urbanczik::handle( SpikeEvent& e ) { assert( e.get_delay_steps() > 0 ); - assert( 0 <= e.get_rport() && e.get_rport() < 2 * NCOMP ); + assert( 0 <= e.get_rport() and e.get_rport() < 2 * NCOMP ); B_.spikes_[ e.get_rport() ].add_value( e.get_rel_delivery_steps( kernel().simulation_manager.get_slice_origin() ), e.get_weight() * e.get_multiplicity() ); @@ -706,7 +706,7 @@ nest::pp_cond_exp_mc_urbanczik::handle( CurrentEvent& e ) { assert( e.get_delay_steps() > 0 ); // not 100% clean, should look at MIN, SUP - assert( 0 <= e.get_rport() && e.get_rport() < NCOMP ); + assert( 0 <= e.get_rport() and e.get_rport() < NCOMP ); // add weighted current; HEP 2002-10-04 B_.currents_[ e.get_rport() ].add_value( diff --git a/models/pp_cond_exp_mc_urbanczik.h b/models/pp_cond_exp_mc_urbanczik.h index 8a640610cc..0a69b64aa5 100644 --- a/models/pp_cond_exp_mc_urbanczik.h +++ b/models/pp_cond_exp_mc_urbanczik.h @@ -557,9 +557,9 @@ pp_cond_exp_mc_urbanczik::send_test_event( Node& target, rport receptor_type, sy inline port pp_cond_exp_mc_urbanczik::handles_test_event( SpikeEvent&, rport receptor_type ) { - if ( receptor_type < MIN_SPIKE_RECEPTOR || receptor_type >= SUP_SPIKE_RECEPTOR ) + if ( receptor_type < MIN_SPIKE_RECEPTOR or receptor_type >= SUP_SPIKE_RECEPTOR ) { - if ( receptor_type < 0 || receptor_type >= SUP_CURR_RECEPTOR ) + if ( receptor_type < 0 or receptor_type >= SUP_CURR_RECEPTOR ) { throw UnknownReceptorType( receptor_type, get_name() ); } @@ -574,9 +574,9 @@ pp_cond_exp_mc_urbanczik::handles_test_event( SpikeEvent&, rport receptor_type ) inline port pp_cond_exp_mc_urbanczik::handles_test_event( CurrentEvent&, rport receptor_type ) { - if ( receptor_type < MIN_CURR_RECEPTOR || receptor_type >= SUP_CURR_RECEPTOR ) + if ( receptor_type < MIN_CURR_RECEPTOR or receptor_type >= SUP_CURR_RECEPTOR ) { - if ( receptor_type >= 0 && receptor_type < MIN_CURR_RECEPTOR ) + if ( receptor_type >= 0 and receptor_type < MIN_CURR_RECEPTOR ) { throw IncompatibleReceptorType( receptor_type, get_name(), "CurrentEvent" ); } @@ -593,7 +593,7 @@ pp_cond_exp_mc_urbanczik::handles_test_event( DataLoggingRequest& dlr, rport rec { if ( receptor_type != 0 ) { - if ( receptor_type < 0 || receptor_type >= SUP_CURR_RECEPTOR ) + if ( receptor_type < 0 or receptor_type >= SUP_CURR_RECEPTOR ) { throw UnknownReceptorType( receptor_type, get_name() ); } diff --git a/models/pp_psc_delta.cpp b/models/pp_psc_delta.cpp index 44418f7df2..45522cf472 100644 --- a/models/pp_psc_delta.cpp +++ b/models/pp_psc_delta.cpp @@ -297,7 +297,7 @@ nest::pp_psc_delta::pre_run_hook() V_.P33_ = std::exp( -V_.h_ / P_.tau_m_ ); V_.P30_ = 1 / P_.c_m_ * ( 1 - V_.P33_ ) * P_.tau_m_; - if ( P_.dead_time_ != 0 && P_.dead_time_ < V_.h_ ) + if ( P_.dead_time_ != 0 and P_.dead_time_ < V_.h_ ) { P_.dead_time_ = V_.h_; } @@ -357,7 +357,7 @@ void nest::pp_psc_delta::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) diff --git a/models/ppd_sup_generator.cpp b/models/ppd_sup_generator.cpp index 3cabd68eff..f1412f8e19 100644 --- a/models/ppd_sup_generator.cpp +++ b/models/ppd_sup_generator.cpp @@ -69,7 +69,7 @@ nest::ppd_sup_generator::Age_distribution_::update( double hazard_step, RngPtr r of thumb, this approximation is good if n >= 20 and p <= 0.05, or if n >= 100 and np <= 10. Source: http://en.wikipedia.org/wiki/Binomial_distribution#Poisson_approximation */ - if ( ( occ_active_ >= 100 && hazard_step <= 0.01 ) || ( occ_active_ >= 500 && hazard_step * occ_active_ <= 0.1 ) ) + if ( ( occ_active_ >= 100 and hazard_step <= 0.01 ) or ( occ_active_ >= 500 and hazard_step * occ_active_ <= 0.1 ) ) { poisson_distribution::param_type param( hazard_step * occ_active_ ); n_spikes = poisson_dist_( rng, param ); @@ -231,10 +231,10 @@ nest::ppd_sup_generator::pre_run_hook() void nest::ppd_sup_generator::update( Time const& T, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); - if ( P_.rate_ <= 0 || P_.num_targets_ == 0 ) + if ( P_.rate_ <= 0 or P_.num_targets_ == 0 ) { return; } @@ -249,7 +249,7 @@ nest::ppd_sup_generator::update( Time const& T, const long from, const long to ) } // get current (time-dependent) hazard rate and store it. - if ( P_.amplitude_ > 0.0 && ( P_.frequency_ > 0.0 || P_.frequency_ < 0.0 ) ) + if ( P_.amplitude_ > 0.0 and P_.frequency_ != 0.0 ) { double t_ms = t.get_ms(); V_.hazard_step_t_ = V_.hazard_step_ * ( 1.0 + P_.amplitude_ * std::sin( V_.omega_ * t_ms ) ); @@ -272,7 +272,7 @@ nest::ppd_sup_generator::event_hook( DSSpikeEvent& e ) const port prt = e.get_port(); // we handle only one port here, get reference to vector element - assert( 0 <= prt && static_cast< size_t >( prt ) < B_.age_distributions_.size() ); + assert( 0 <= prt and static_cast< size_t >( prt ) < B_.age_distributions_.size() ); // age_distribution object propagates one time step and returns number of // spikes diff --git a/models/rate_neuron_ipn_impl.h b/models/rate_neuron_ipn_impl.h index 2f316281dd..42b13a1d06 100644 --- a/models/rate_neuron_ipn_impl.h +++ b/models/rate_neuron_ipn_impl.h @@ -270,7 +270,7 @@ nest::rate_neuron_ipn< TNonlinearities >::update_( Time const& origin, const long to, const bool called_from_wfr_update ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const size_t buffer_size = kernel().connection_manager.get_min_delay(); diff --git a/models/rate_neuron_opn_impl.h b/models/rate_neuron_opn_impl.h index 13aa05b39f..409a5924d1 100644 --- a/models/rate_neuron_opn_impl.h +++ b/models/rate_neuron_opn_impl.h @@ -246,7 +246,7 @@ nest::rate_neuron_opn< TNonlinearities >::update_( Time const& origin, const long to, const bool called_from_wfr_update ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const size_t buffer_size = kernel().connection_manager.get_min_delay(); diff --git a/models/rate_transformer_node_impl.h b/models/rate_transformer_node_impl.h index 715b2a91c5..1b971dab90 100644 --- a/models/rate_transformer_node_impl.h +++ b/models/rate_transformer_node_impl.h @@ -181,7 +181,7 @@ nest::rate_transformer_node< TNonlinearities >::update_( Time const& origin, const long to, const bool called_from_wfr_update ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const size_t buffer_size = kernel().connection_manager.get_min_delay(); diff --git a/models/siegert_neuron.cpp b/models/siegert_neuron.cpp index 103cb253e1..22a91d41d9 100644 --- a/models/siegert_neuron.cpp +++ b/models/siegert_neuron.cpp @@ -305,7 +305,7 @@ nest::siegert_neuron::pre_run_hook() bool nest::siegert_neuron::update_( Time const& origin, const long from, const long to, const bool called_from_wfr_update ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const size_t buffer_size = kernel().connection_manager.get_min_delay(); diff --git a/models/sinusoidal_gamma_generator.cpp b/models/sinusoidal_gamma_generator.cpp index 08c29220d5..44178fd407 100644 --- a/models/sinusoidal_gamma_generator.cpp +++ b/models/sinusoidal_gamma_generator.cpp @@ -144,7 +144,7 @@ nest::sinusoidal_gamma_generator::Parameters_::set( const DictionaryDatum& d, const sinusoidal_gamma_generator& n, Node* node ) { - if ( not n.is_model_prototype() && d->known( names::individual_spike_trains ) ) + if ( not n.is_model_prototype() and d->known( names::individual_spike_trains ) ) { throw BadProperty( "The individual_spike_trains property can only be set as" @@ -259,7 +259,7 @@ nest::sinusoidal_gamma_generator::deltaLambda_( const Parameters_& p, double t_a } double deltaLambda = p.order_ * p.rate_ * ( t_b - t_a ); - if ( std::abs( p.amplitude_ ) > 0 && std::abs( p.om_ ) > 0 ) + if ( std::abs( p.amplitude_ ) > 0 and std::abs( p.om_ ) > 0 ) { deltaLambda += -p.order_ * p.amplitude_ / p.om_ * ( std::cos( p.om_ * t_b + p.phi_ ) - std::cos( p.om_ * t_a + p.phi_ ) ); @@ -309,7 +309,7 @@ nest::sinusoidal_gamma_generator::hazard_( port tgt_idx ) const void nest::sinusoidal_gamma_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); for ( long lag = from; lag < to; ++lag ) @@ -348,7 +348,7 @@ nest::sinusoidal_gamma_generator::event_hook( DSSpikeEvent& e ) { // get port number --- see #737 const port tgt_idx = e.get_port(); - assert( 0 <= tgt_idx && static_cast< size_t >( tgt_idx ) < B_.t0_ms_.size() ); + assert( 0 <= tgt_idx and static_cast< size_t >( tgt_idx ) < B_.t0_ms_.size() ); if ( V_.rng_->drand() < hazard_( tgt_idx ) ) { diff --git a/models/sinusoidal_poisson_generator.cpp b/models/sinusoidal_poisson_generator.cpp index 8dacd50859..65e8a4a1f1 100644 --- a/models/sinusoidal_poisson_generator.cpp +++ b/models/sinusoidal_poisson_generator.cpp @@ -138,7 +138,7 @@ nest::sinusoidal_poisson_generator::Parameters_::set( const DictionaryDatum& d, const sinusoidal_poisson_generator& n, Node* node ) { - if ( not n.is_model_prototype() && d->known( names::individual_spike_trains ) ) + if ( not n.is_model_prototype() and d->known( names::individual_spike_trains ) ) { throw BadProperty( "The individual_spike_trains property can only be set as" @@ -229,7 +229,7 @@ nest::sinusoidal_poisson_generator::pre_run_hook() void nest::sinusoidal_poisson_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); const long start = origin.get_steps(); diff --git a/models/spike_generator.cpp b/models/spike_generator.cpp index 8878a38d16..55e856de3a 100644 --- a/models/spike_generator.cpp +++ b/models/spike_generator.cpp @@ -68,7 +68,7 @@ nest::spike_generator::Parameters_::get( DictionaryDatum& d ) const const size_t n_spikes = spike_stamps_.size(); const size_t n_offsets = spike_offsets_.size(); - assert( ( precise_times_ && n_offsets == n_spikes ) || ( not precise_times_ && n_offsets == 0 ) ); + assert( ( precise_times_ and n_offsets == n_spikes ) or ( not precise_times_ and n_offsets == 0 ) ); auto* times_ms = new std::vector< double >(); times_ms->reserve( n_spikes ); @@ -91,7 +91,7 @@ nest::spike_generator::Parameters_::get( DictionaryDatum& d ) const void nest::spike_generator::Parameters_::assert_valid_spike_time_and_insert_( double t, const Time& origin, const Time& now ) { - if ( t == 0.0 && not shift_now_spikes_ ) + if ( t == 0.0 and not shift_now_spikes_ ) { throw BadProperty( "spike time cannot be set to 0." ); } @@ -124,7 +124,7 @@ nest::spike_generator::Parameters_::assert_valid_spike_time_and_insert_( double } assert( t_spike.is_grid_time() ); - if ( origin + t_spike == now && shift_now_spikes_ ) + if ( origin + t_spike == now and shift_now_spikes_ ) { t_spike.advance(); } @@ -143,7 +143,7 @@ nest::spike_generator::Parameters_::assert_valid_spike_time_and_insert_( double // The second part of the test handles subnormal values of offset. if ( ( std::fabs( offset ) < std::numeric_limits< double >::epsilon() * std::fabs( t_spike.get_ms() + t ) * 2.0 ) - || ( std::fabs( offset ) < std::numeric_limits< double >::min() ) ) + or ( std::fabs( offset ) < std::numeric_limits< double >::min() ) ) { // if difference is smaller than scaled epsilon it is zero offset = 0.0; @@ -165,7 +165,7 @@ nest::spike_generator::Parameters_::set( const DictionaryDatum& d, bool allow_offgrid_times_changed = updateValueParam< bool >( d, names::allow_offgrid_times, allow_offgrid_times_, node ); bool flags_changed = precise_times_changed or shift_now_spikes_changed or allow_offgrid_times_changed; - if ( precise_times_ && ( allow_offgrid_times_ || shift_now_spikes_ ) ) + if ( precise_times_ and ( allow_offgrid_times_ or shift_now_spikes_ ) ) { throw BadProperty( "Option precise_times cannot be set to true when either " @@ -173,7 +173,7 @@ nest::spike_generator::Parameters_::set( const DictionaryDatum& d, } const bool updated_spike_times = d->known( names::spike_times ); - if ( flags_changed && not( updated_spike_times || spike_stamps_.empty() ) ) + if ( flags_changed and not( updated_spike_times or spike_stamps_.empty() ) ) { throw BadProperty( "Options can only be set together with spike times or if no " @@ -264,7 +264,7 @@ nest::spike_generator::Parameters_::set( const DictionaryDatum& d, } // Set position to start if something changed - if ( updated_spike_times || updated_spike_weights || updated_spike_multiplicities || d->known( names::origin ) ) + if ( updated_spike_times or updated_spike_weights or updated_spike_multiplicities or d->known( names::origin ) ) { s.position_ = 0; } @@ -324,9 +324,9 @@ nest::spike_generator::update( Time const& sliceT0, const long from, const long return; } - assert( not P_.precise_times_ || P_.spike_stamps_.size() == P_.spike_offsets_.size() ); - assert( P_.spike_weights_.empty() || P_.spike_stamps_.size() == P_.spike_weights_.size() ); - assert( P_.spike_multiplicities_.empty() || P_.spike_stamps_.size() == P_.spike_multiplicities_.size() ); + assert( not P_.precise_times_ or P_.spike_stamps_.size() == P_.spike_offsets_.size() ); + assert( P_.spike_weights_.empty() or P_.spike_stamps_.size() == P_.spike_weights_.size() ); + assert( P_.spike_multiplicities_.empty() or P_.spike_stamps_.size() == P_.spike_multiplicities_.size() ); const Time tstart = sliceT0 + Time::step( from ); const Time tstop = sliceT0 + Time::step( to ); diff --git a/models/spin_detector.cpp b/models/spin_detector.cpp index af613b8f83..2aca63a90d 100644 --- a/models/spin_detector.cpp +++ b/models/spin_detector.cpp @@ -127,7 +127,7 @@ nest::spin_detector::handle( SpikeEvent& e ) long m = e.get_multiplicity(); index node_id = e.get_sender_node_id(); const Time& t_spike = e.get_stamp(); - if ( m == 1 && node_id == last_in_node_id_ && t_spike == t_last_in_spike_ ) + if ( m == 1 and node_id == last_in_node_id_ and t_spike == t_last_in_spike_ ) { // received twice the same node ID, so transition 0->1 // revise the last event diff --git a/models/stdp_dopamine_synapse.h b/models/stdp_dopamine_synapse.h index 7862dfe4d9..191192d639 100644 --- a/models/stdp_dopamine_synapse.h +++ b/models/stdp_dopamine_synapse.h @@ -458,7 +458,7 @@ stdp_dopamine_synapse< targetidentifierT >::process_dopa_spikes_( const std::vec // process dopa spikes in (t0, t1] // propagate weight from t0 to t1 if ( ( dopa_spikes.size() > dopa_spikes_idx_ + 1 ) - && ( t1 - dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ > -1.0 * kernel().connection_manager.get_stdp_eps() ) ) + and ( t1 - dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ > -1.0 * kernel().connection_manager.get_stdp_eps() ) ) { // there is at least 1 dopa spike in (t0, t1] // propagate weight up to first dopa spike and update dopamine trace @@ -472,7 +472,7 @@ stdp_dopamine_synapse< targetidentifierT >::process_dopa_spikes_( const std::vec // process remaining dopa spikes in (t0, t1] double cd; while ( ( dopa_spikes.size() > dopa_spikes_idx_ + 1 ) - && ( t1 - dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ > -1.0 * kernel().connection_manager.get_stdp_eps() ) ) + and ( t1 - dopa_spikes[ dopa_spikes_idx_ + 1 ].spike_time_ > -1.0 * kernel().connection_manager.get_stdp_eps() ) ) { // propagate weight up to next dopa spike and update dopamine trace // weight and dopamine trace n are at time of last dopa spike td but diff --git a/models/stdp_synapse_facetshw_hom.h b/models/stdp_synapse_facetshw_hom.h index 674af88b43..b949e1b927 100644 --- a/models/stdp_synapse_facetshw_hom.h +++ b/models/stdp_synapse_facetshw_hom.h @@ -433,7 +433,7 @@ stdp_facetshw_synapse_hom< targetidentifierT >::send( Event& e, bool eval_1 = eval_function_( a_causal_, a_acausal_, a_thresh_th_, a_thresh_tl_, cp.configbit_1_ ); // select LUT, update weight and reset capacitors - if ( eval_0 == true && eval_1 == false ) + if ( eval_0 == true and eval_1 == false ) { discrete_weight_ = lookup_( discrete_weight_, cp.lookuptable_0_ ); if ( cp.reset_pattern_[ 0 ] ) @@ -445,7 +445,7 @@ stdp_facetshw_synapse_hom< targetidentifierT >::send( Event& e, a_acausal_ = 0; } } - else if ( eval_0 == false && eval_1 == true ) + else if ( eval_0 == false and eval_1 == true ) { discrete_weight_ = lookup_( discrete_weight_, cp.lookuptable_1_ ); if ( cp.reset_pattern_[ 2 ] ) @@ -457,7 +457,7 @@ stdp_facetshw_synapse_hom< targetidentifierT >::send( Event& e, a_acausal_ = 0; } } - else if ( eval_0 == true && eval_1 == true ) + else if ( eval_0 == true and eval_1 == true ) { discrete_weight_ = lookup_( discrete_weight_, cp.lookuptable_2_ ); if ( cp.reset_pattern_[ 4 ] ) diff --git a/models/stdp_synapse_facetshw_hom_impl.h b/models/stdp_synapse_facetshw_hom_impl.h index 76da53a759..1c91735268 100644 --- a/models/stdp_synapse_facetshw_hom_impl.h +++ b/models/stdp_synapse_facetshw_hom_impl.h @@ -192,7 +192,7 @@ STDPFACETSHWHomCommonProperties< targetidentifierT >::set_status( const Dictiona // are look-up table entries out of bounds? for ( size_t i = 0; i < size_t( lookuptable_0_.size() ); ++i ) { - if ( ( lookuptable_0_[ i ] < 0 ) || ( lookuptable_0_[ i ] > 15 ) ) + if ( lookuptable_0_[ i ] < 0 or lookuptable_0_[ i ] > 15 ) { throw BadProperty( "Look-up table entries must be integers in [0,15]" ); } @@ -211,7 +211,7 @@ STDPFACETSHWHomCommonProperties< targetidentifierT >::set_status( const Dictiona // are look-up table entries out of bounds? for ( size_t i = 0; i < size_t( lookuptable_1_.size() ); ++i ) { - if ( ( lookuptable_1_[ i ] < 0 ) || ( lookuptable_1_[ i ] > 15 ) ) + if ( lookuptable_1_[ i ] < 0 or lookuptable_1_[ i ] > 15 ) { throw BadProperty( "Look-up table entries must be integers in [0,15]" ); } @@ -230,7 +230,7 @@ STDPFACETSHWHomCommonProperties< targetidentifierT >::set_status( const Dictiona // are look-up table entries out of bounds? for ( size_t i = 0; i < size_t( lookuptable_2_.size() ); ++i ) { - if ( ( lookuptable_2_[ i ] < 0 ) || ( lookuptable_2_[ i ] > 15 ) ) + if ( lookuptable_2_[ i ] < 0 or lookuptable_2_[ i ] > 15 ) { throw BadProperty( "Look-up table entries must be integers in [0,15]" ); } diff --git a/models/step_current_generator.cpp b/models/step_current_generator.cpp index 086907042b..e4b29d51ca 100644 --- a/models/step_current_generator.cpp +++ b/models/step_current_generator.cpp @@ -272,7 +272,7 @@ nest::step_current_generator::pre_run_hook() void nest::step_current_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( P_.amp_time_stamps_.size() == P_.amp_values_.size() ); @@ -282,7 +282,7 @@ nest::step_current_generator::update( Time const& origin, const long from, const // Skip any times in the past. Since we must send events proactively, // idx_ must point to times in the future. const long first = t0 + from; - while ( B_.idx_ < P_.amp_time_stamps_.size() && P_.amp_time_stamps_[ B_.idx_ ].get_steps() <= first ) + while ( B_.idx_ < P_.amp_time_stamps_.size() and P_.amp_time_stamps_[ B_.idx_ ].get_steps() <= first ) { ++B_.idx_; } @@ -296,7 +296,7 @@ nest::step_current_generator::update( Time const& origin, const long from, const // Keep the amplitude up-to-date at all times. // We need to change the amplitude one step ahead of time, see comment // on class SimulatingDevice. - if ( B_.idx_ < P_.amp_time_stamps_.size() && curr_time + 1 == P_.amp_time_stamps_[ B_.idx_ ].get_steps() ) + if ( B_.idx_ < P_.amp_time_stamps_.size() and curr_time + 1 == P_.amp_time_stamps_[ B_.idx_ ].get_steps() ) { B_.amp_ = P_.amp_values_[ B_.idx_ ]; B_.idx_++; diff --git a/models/step_rate_generator.cpp b/models/step_rate_generator.cpp index f5e7135284..2cd309aa9d 100644 --- a/models/step_rate_generator.cpp +++ b/models/step_rate_generator.cpp @@ -273,7 +273,7 @@ nest::step_rate_generator::pre_run_hook() void nest::step_rate_generator::update( Time const& origin, const long from, const long to ) { - assert( to >= 0 && ( delay ) from < kernel().connection_manager.get_min_delay() ); + assert( to >= 0 and ( delay ) from < kernel().connection_manager.get_min_delay() ); assert( from < to ); assert( P_.amp_time_stamps_.size() == P_.amp_values_.size() ); @@ -287,7 +287,7 @@ nest::step_rate_generator::update( Time const& origin, const long from, const lo // Skip any times in the past. Since we must send events proactively, // idx_ must point to times in the future. const long first = t0 + from; - while ( B_.idx_ < P_.amp_time_stamps_.size() && P_.amp_time_stamps_[ B_.idx_ ].get_steps() <= first ) + while ( B_.idx_ < P_.amp_time_stamps_.size() and P_.amp_time_stamps_[ B_.idx_ ].get_steps() <= first ) { ++B_.idx_; } @@ -302,7 +302,7 @@ nest::step_rate_generator::update( Time const& origin, const long from, const lo // Keep the amplitude up-to-date at all times. // We need to change the amplitude one step ahead of time, see comment // on class SimulatingDevice. - if ( B_.idx_ < P_.amp_time_stamps_.size() && curr_time + 1 == P_.amp_time_stamps_[ B_.idx_ ].get_steps() ) + if ( B_.idx_ < P_.amp_time_stamps_.size() and curr_time + 1 == P_.amp_time_stamps_[ B_.idx_ ].get_steps() ) { B_.amp_ = P_.amp_values_[ B_.idx_ ]; B_.idx_++; diff --git a/models/tsodyks2_synapse.h b/models/tsodyks2_synapse.h index 4cda0ada97..08cedf5c73 100644 --- a/models/tsodyks2_synapse.h +++ b/models/tsodyks2_synapse.h @@ -270,13 +270,13 @@ tsodyks2_synapse< targetidentifierT >::set_status( const DictionaryDatum& d, Con updateValue< double >( d, names::weight, weight_ ); updateValue< double >( d, names::dU, U_ ); - if ( U_ > 1.0 || U_ < 0.0 ) + if ( U_ > 1.0 or U_ < 0.0 ) { throw BadProperty( "U must be in [0,1]." ); } updateValue< double >( d, names::u, u_ ); - if ( u_ > 1.0 || u_ < 0.0 ) + if ( u_ > 1.0 or u_ < 0.0 ) { throw BadProperty( "u must be in [0,1]." ); } diff --git a/models/tsodyks_synapse.h b/models/tsodyks_synapse.h index f92dd058f3..404678e543 100644 --- a/models/tsodyks_synapse.h +++ b/models/tsodyks_synapse.h @@ -336,7 +336,7 @@ tsodyks_synapse< targetidentifierT >::set_status( const DictionaryDatum& d, Conn updateValue< double >( d, names::weight, weight_ ); updateValue< double >( d, names::U, U_ ); - if ( U_ > 1.0 || U_ < 0.0 ) + if ( U_ > 1.0 or U_ < 0.0 ) { throw BadProperty( "U must be in [0,1]." ); } diff --git a/models/tsodyks_synapse_hom.cpp b/models/tsodyks_synapse_hom.cpp index 538492a6bb..a2d1c1bf70 100644 --- a/models/tsodyks_synapse_hom.cpp +++ b/models/tsodyks_synapse_hom.cpp @@ -58,7 +58,7 @@ TsodyksHomCommonProperties::set_status( const DictionaryDatum& d, ConnectorModel CommonPropertiesHomW::set_status( d, cm ); updateValue< double >( d, names::U, U_ ); - if ( U_ > 1.0 || U_ < 0.0 ) + if ( U_ > 1.0 or U_ < 0.0 ) { throw BadProperty( "U must be in [0,1]." ); } diff --git a/nestkernel/clopath_archiving_node.cpp b/nestkernel/clopath_archiving_node.cpp index 4617c78829..4e2b8a1c2f 100644 --- a/nestkernel/clopath_archiving_node.cpp +++ b/nestkernel/clopath_archiving_node.cpp @@ -134,7 +134,7 @@ double nest::ClopathArchivingNode::get_LTD_value( double t ) { std::vector< histentry_extended >::iterator runner; - if ( ltd_history_.empty() || t < 0.0 ) + if ( ltd_history_.empty() or t < 0.0 ) { return 0.0; } @@ -173,12 +173,12 @@ nest::ClopathArchivingNode::get_LTP_history( double t1, // To have a well defined discretization of the integral, we make sure // that we exclude the entry at t1 but include the one at t2 by subtracting // a small number so that runner->t_ is never equal to t1 or t2. - while ( ( runner != ltp_history_.end() ) && ( runner->t_ - 1.0e-6 < t1 ) ) + while ( ( runner != ltp_history_.end() ) and runner->t_ - 1.0e-6 < t1 ) { ++runner; } *start = runner; - while ( ( runner != ltp_history_.end() ) && ( runner->t_ - 1.0e-6 < t2 ) ) + while ( ( runner != ltp_history_.end() ) and runner->t_ - 1.0e-6 < t2 ) { ( runner->access_counter_ )++; ++runner; @@ -209,7 +209,7 @@ nest::ClopathArchivingNode::write_clopath_history( Time const& t_sp, double del_u_bar_minus = delayed_u_bar_minus_[ delayed_u_bars_idx_ ]; // save data for Clopath STDP if necessary - if ( ( u > theta_plus_ ) && ( del_u_bar_plus > theta_minus_ ) ) + if ( u > theta_plus_ and del_u_bar_plus > theta_minus_ ) { write_LTP_history( t_ms, u, del_u_bar_plus ); } diff --git a/nestkernel/conn_builder_conngen.cpp b/nestkernel/conn_builder_conngen.cpp index d6f2f6119f..b835ebeab9 100644 --- a/nestkernel/conn_builder_conngen.cpp +++ b/nestkernel/conn_builder_conngen.cpp @@ -101,8 +101,8 @@ ConnectionGeneratorBuilder::connect_() const size_t d_idx = ( *params_map_ )[ names::delay ]; const size_t w_idx = ( *params_map_ )[ names::weight ]; - const bool d_idx_is_0_or_1 = ( d_idx == 0 ) or ( d_idx == 1 ); - const bool w_idx_is_0_or_1 = ( w_idx == 0 ) or ( w_idx == 1 ); + const bool d_idx_is_0_or_1 = d_idx == 0 or ( d_idx == 1 ); + const bool w_idx_is_0_or_1 = w_idx == 0 or ( w_idx == 1 ); const bool indices_differ = ( w_idx != d_idx ); if ( not( d_idx_is_0_or_1 and w_idx_is_0_or_1 and indices_differ ) ) { diff --git a/nestkernel/connection_creator_impl.h b/nestkernel/connection_creator_impl.h index 6955d762ad..eb57c5ecfd 100644 --- a/nestkernel/connection_creator_impl.h +++ b/nestkernel/connection_creator_impl.h @@ -88,7 +88,7 @@ ConnectionCreator::connect_to_target_( Iterator from, const bool without_kernel = not kernel_.get(); for ( Iterator iter = from; iter != to; ++iter ) { - if ( ( not allow_autapses_ ) and ( iter->second == tgt_ptr->get_node_id() ) ) + if ( not allow_autapses_ and ( iter->second == tgt_ptr->get_node_id() ) ) { continue; } @@ -422,8 +422,8 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, } if ( positions.empty() - or ( ( not allow_autapses_ ) and ( positions.size() == 1 ) and ( positions[ 0 ].second == target_id ) ) - or ( ( not allow_multapses_ ) and ( positions.size() < number_of_connections_ ) ) ) + or ( not allow_autapses_ and ( positions.size() == 1 ) and positions[ 0 ].second == target_id ) + or ( not allow_multapses_ and ( positions.size() < number_of_connections_ ) ) ) { std::string msg = String::compose( "Global target ID %1: Not enough sources found inside mask", target_id ); throw KernelException( msg.c_str() ); @@ -443,14 +443,14 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, for ( int i = 0; i < ( int ) number_of_connections_; ++i ) { index random_id = lottery( rng ); - if ( ( not allow_multapses_ ) and ( is_selected[ random_id ] ) ) + if ( not allow_multapses_ and is_selected[ random_id ] ) { --i; continue; } index source_id = positions[ random_id ].second; - if ( ( not allow_autapses_ ) and ( source_id == target_id ) ) + if ( not allow_autapses_ and source_id == target_id ) { --i; continue; @@ -473,8 +473,8 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, // no kernel if ( positions.empty() - or ( ( not allow_autapses_ ) and ( positions.size() == 1 ) and ( positions[ 0 ].second == target_id ) ) - or ( ( not allow_multapses_ ) and ( positions.size() < number_of_connections_ ) ) ) + or ( not allow_autapses_ and ( positions.size() == 1 ) and positions[ 0 ].second == target_id ) + or ( not allow_multapses_ and ( positions.size() < number_of_connections_ ) ) ) { std::string msg = String::compose( "Global target ID %1: Not enough sources found inside mask", target_id ); throw KernelException( msg.c_str() ); @@ -488,7 +488,7 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, for ( int i = 0; i < ( int ) number_of_connections_; ++i ) { index random_id = rng->ulrand( positions.size() ); - if ( ( not allow_multapses_ ) and ( is_selected[ random_id ] ) ) + if ( not allow_multapses_ and is_selected[ random_id ] ) { --i; continue; @@ -527,8 +527,8 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, const std::vector< double > target_pos_vector = target_pos.get_vector(); if ( ( positions->size() == 0 ) - or ( ( not allow_autapses_ ) and ( positions->size() == 1 ) and ( ( *positions )[ 0 ].second == target_id ) ) - or ( ( not allow_multapses_ ) and ( positions->size() < number_of_connections_ ) ) ) + or ( not allow_autapses_ and ( positions->size() == 1 ) and ( ( *positions )[ 0 ].second == target_id ) ) + or ( not allow_multapses_ and ( positions->size() < number_of_connections_ ) ) ) { std::string msg = String::compose( "Global target ID %1: Not enough sources found", target_id ); throw KernelException( msg.c_str() ); @@ -567,14 +567,14 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, for ( int i = 0; i < ( int ) number_of_connections_; ++i ) { index random_id = lottery( rng ); - if ( ( not allow_multapses_ ) and ( is_selected[ random_id ] ) ) + if ( not allow_multapses_ and is_selected[ random_id ] ) { --i; continue; } index source_id = ( *positions )[ random_id ].second; - if ( ( not allow_autapses_ ) and ( source_id == target_id ) ) + if ( not allow_autapses_ and source_id == target_id ) { --i; continue; @@ -605,14 +605,14 @@ ConnectionCreator::fixed_indegree_( Layer< D >& source, for ( int i = 0; i < ( int ) number_of_connections_; ++i ) { index random_id = rng->ulrand( positions->size() ); - if ( ( not allow_multapses_ ) and ( is_selected[ random_id ] ) ) + if ( not allow_multapses_ and is_selected[ random_id ] ) { --i; continue; } index source_id = ( *positions )[ random_id ].second; - if ( ( not allow_autapses_ ) and ( source_id == target_id ) ) + if ( not allow_autapses_ and source_id == target_id ) { --i; continue; @@ -719,7 +719,7 @@ ConnectionCreator::fixed_outdegree_( Layer< D >& source, } if ( target_pos_node_id_pairs.empty() - or ( ( not allow_multapses_ ) and ( target_pos_node_id_pairs.size() < number_of_connections_ ) ) ) + or ( not allow_multapses_ and ( target_pos_node_id_pairs.size() < number_of_connections_ ) ) ) { std::string msg = String::compose( "Global source ID %1: Not enough targets found", source_id ); throw KernelException( msg.c_str() ); @@ -739,13 +739,13 @@ ConnectionCreator::fixed_outdegree_( Layer< D >& source, for ( long i = 0; i < ( long ) number_of_connections_; ++i ) { index random_id = lottery( get_rank_synced_rng() ); - if ( ( not allow_multapses_ ) and ( is_selected[ random_id ] ) ) + if ( not allow_multapses_ and is_selected[ random_id ] ) { --i; continue; } index target_id = target_pos_node_id_pairs[ random_id ].second; - if ( ( not allow_autapses_ ) and ( source_id == target_id ) ) + if ( not allow_autapses_ and source_id == target_id ) { --i; continue; diff --git a/nestkernel/connection_id.cpp b/nestkernel/connection_id.cpp index f4cd7d1259..bba8b60123 100644 --- a/nestkernel/connection_id.cpp +++ b/nestkernel/connection_id.cpp @@ -87,8 +87,8 @@ ConnectionID::to_ArrayDatum() const bool ConnectionID::operator==( const ConnectionID& c ) const { - return ( source_node_id_ == c.source_node_id_ ) and ( target_node_id_ == c.target_node_id_ ) - and ( target_thread_ == c.target_thread_ ) and ( port_ == c.port_ ) and ( synapse_modelid_ == c.synapse_modelid_ ); + return source_node_id_ == c.source_node_id_ and ( target_node_id_ == c.target_node_id_ ) + and target_thread_ == c.target_thread_ and port_ == c.port_ and ( synapse_modelid_ == c.synapse_modelid_ ); } void diff --git a/nestkernel/connection_manager.cpp b/nestkernel/connection_manager.cpp index 53ed61be8c..af985d087c 100644 --- a/nestkernel/connection_manager.cpp +++ b/nestkernel/connection_manager.cpp @@ -1462,7 +1462,7 @@ nest::ConnectionManager::connection_required( Node*& source, Node*& target, thre const bool target_vp_local = kernel().vp_manager.is_local_vp( target_vp ); const thread target_thread = kernel().vp_manager.vp_to_thread( target_vp ); - if ( target_vp_local && target_thread == tid ) + if ( target_vp_local and target_thread == tid ) { const index source_node_id = source->get_node_id(); source = kernel().node_manager.get_node_or_proxy( source_node_id, target_thread ); diff --git a/nestkernel/event.h b/nestkernel/event.h index 2847077dae..2a585d628c 100644 --- a/nestkernel/event.h +++ b/nestkernel/event.h @@ -1290,7 +1290,7 @@ Event::receiver_is_valid() const inline bool Event::is_valid() const { - return ( sender_is_valid() and receiver_is_valid() and ( d_ > 0 ) ); + return ( sender_is_valid() and receiver_is_valid() and d_ > 0 ); } inline void diff --git a/nestkernel/grid_layer.h b/nestkernel/grid_layer.h index 3e52554687..54408747f8 100644 --- a/nestkernel/grid_layer.h +++ b/nestkernel/grid_layer.h @@ -88,12 +88,12 @@ class GridLayer : public Layer< D > bool operator==( const masked_iterator& other ) const { - return ( other.layer_.get_metadata() == layer_.get_metadata() ) && ( other.node_ == node_ ); + return ( other.layer_.get_metadata() == layer_.get_metadata() ) and ( other.node_ == node_ ); } bool operator!=( const masked_iterator& other ) const { - return ( other.layer_.get_metadata() != layer_.get_metadata() ) || ( other.node_ != node_ ); + return ( other.layer_.get_metadata() != layer_.get_metadata() ) or ( other.node_ != node_ ); } protected: diff --git a/nestkernel/layer_impl.h b/nestkernel/layer_impl.h index c67d3d0a88..ced851de42 100644 --- a/nestkernel/layer_impl.h +++ b/nestkernel/layer_impl.h @@ -416,7 +416,7 @@ MaskedLayer< D >::check_mask_( Layer< D >& layer, bool allow_oversized ) for ( int i = 0; i < D; ++i ) { oversize |= - layer.get_periodic_mask()[ i ] and ( bb.upper_right[ i ] - bb.lower_left[ i ] ) > layer.get_extent()[ i ]; + layer.get_periodic_mask()[ i ] and bb.upper_right[ i ] - bb.lower_left[ i ] > layer.get_extent()[ i ]; } if ( oversize ) { diff --git a/nestkernel/mask.cpp b/nestkernel/mask.cpp index b2ecf943a0..d825edfb0e 100644 --- a/nestkernel/mask.cpp +++ b/nestkernel/mask.cpp @@ -280,7 +280,7 @@ BoxMask< 2 >::inside( const Position< 2 >& p ) const // If the box is not rotated we just check if the point is inside the box. if ( not is_rotated_ ) { - return ( lower_left_ <= p ) && ( p <= upper_right_ ); + return lower_left_ <= p and ( p <= upper_right_ ); } // If we have a rotated box, we rotate the point down to the unrotated box, @@ -297,7 +297,7 @@ BoxMask< 2 >::inside( const Position< 2 >& p ) const const Position< 2 > new_p( new_x, new_y ); // We need to add a small epsilon in case of rounding errors. - return ( lower_left_ - eps_ <= new_p ) && ( new_p <= upper_right_ + eps_ ); + return lower_left_ - eps_ <= new_p and ( new_p <= upper_right_ + eps_ ); } template <> @@ -307,7 +307,7 @@ BoxMask< 3 >::inside( const Position< 3 >& p ) const // If the box is not rotated we just check if the point is inside the box. if ( not is_rotated_ ) { - return ( lower_left_ <= p ) && ( p <= upper_right_ ); + return lower_left_ <= p and ( p <= upper_right_ ); } // If we have a rotated box, we rotate the point down to the unrotated box, @@ -330,7 +330,7 @@ BoxMask< 3 >::inside( const Position< 3 >& p ) const const Position< 3 > new_p( new_x, new_y, new_z ); // We need to add a small epsilon in case of rounding errors. - return ( lower_left_ - eps_ <= new_p ) && ( new_p <= upper_right_ + eps_ ); + return lower_left_ - eps_ <= new_p and ( new_p <= upper_right_ + eps_ ); } template <> diff --git a/nestkernel/mask_impl.h b/nestkernel/mask_impl.h index 2736ab2331..d62bab2e58 100644 --- a/nestkernel/mask_impl.h +++ b/nestkernel/mask_impl.h @@ -78,7 +78,7 @@ Mask< D >::outside( const Box< D >& b ) const Box< D > bb = get_bbox(); for ( int i = 0; i < D; ++i ) { - if ( ( b.upper_right[ i ] < bb.lower_left[ i ] ) || ( b.lower_left[ i ] > bb.upper_right[ i ] ) ) + if ( b.upper_right[ i ] < bb.lower_left[ i ] or b.lower_left[ i ] > bb.upper_right[ i ] ) { return true; } @@ -105,7 +105,7 @@ BoxMask< D >::outside( const Box< D >& b ) const // so we don't know if it is an actual problem. for ( int i = 0; i < D; ++i ) { - if ( ( b.upper_right[ i ] < min_values_[ i ] ) || ( b.lower_left[ i ] > max_values_[ i ] ) ) + if ( b.upper_right[ i ] < min_values_[ i ] or b.lower_left[ i ] > max_values_[ i ] ) { return true; } @@ -175,7 +175,7 @@ BallMask< D >::outside( const Box< D >& b ) const // the ball. This could be made more refined. for ( int i = 0; i < D; ++i ) { - if ( ( b.upper_right[ i ] < center_[ i ] - radius_ ) || ( b.lower_left[ i ] > center_[ i ] + radius_ ) ) + if ( b.upper_right[ i ] < center_[ i ] - radius_ or b.lower_left[ i ] > center_[ i ] + radius_ ) { return true; } @@ -259,7 +259,7 @@ EllipseMask< D >::outside( const Box< D >& b ) const for ( int i = 0; i < D; ++i ) { - if ( ( b.upper_right[ i ] < bb.lower_left[ i ] ) || ( b.lower_left[ i ] > bb.upper_right[ i ] ) ) + if ( b.upper_right[ i ] < bb.lower_left[ i ] or b.lower_left[ i ] > bb.upper_right[ i ] ) { return true; } @@ -302,21 +302,21 @@ template < int D > bool IntersectionMask< D >::inside( const Position< D >& p ) const { - return mask1_->inside( p ) && mask2_->inside( p ); + return mask1_->inside( p ) and mask2_->inside( p ); } template < int D > bool IntersectionMask< D >::inside( const Box< D >& b ) const { - return mask1_->inside( b ) && mask2_->inside( b ); + return mask1_->inside( b ) and mask2_->inside( b ); } template < int D > bool IntersectionMask< D >::outside( const Box< D >& b ) const { - return mask1_->outside( b ) || mask2_->outside( b ); + return mask1_->outside( b ) or mask2_->outside( b ); } template < int D > @@ -350,21 +350,21 @@ template < int D > bool UnionMask< D >::inside( const Position< D >& p ) const { - return mask1_->inside( p ) || mask2_->inside( p ); + return mask1_->inside( p ) or mask2_->inside( p ); } template < int D > bool UnionMask< D >::inside( const Box< D >& b ) const { - return mask1_->inside( b ) || mask2_->inside( b ); + return mask1_->inside( b ) or mask2_->inside( b ); } template < int D > bool UnionMask< D >::outside( const Box< D >& b ) const { - return mask1_->outside( b ) && mask2_->outside( b ); + return mask1_->outside( b ) and mask2_->outside( b ); } template < int D > @@ -398,21 +398,21 @@ template < int D > bool DifferenceMask< D >::inside( const Position< D >& p ) const { - return mask1_->inside( p ) && not mask2_->inside( p ); + return mask1_->inside( p ) and not mask2_->inside( p ); } template < int D > bool DifferenceMask< D >::inside( const Box< D >& b ) const { - return mask1_->inside( b ) && mask2_->outside( b ); + return mask1_->inside( b ) and mask2_->outside( b ); } template < int D > bool DifferenceMask< D >::outside( const Box< D >& b ) const { - return mask1_->outside( b ) || mask2_->inside( b ); + return mask1_->outside( b ) or mask2_->inside( b ); } template < int D > diff --git a/nestkernel/modelrange.h b/nestkernel/modelrange.h index bc9092d050..74cbc0f7c8 100644 --- a/nestkernel/modelrange.h +++ b/nestkernel/modelrange.h @@ -36,7 +36,7 @@ class modelrange bool is_in_range( index node_id ) const { - return ( ( node_id >= first_node_id_ ) and ( node_id <= last_node_id_ ) ); + return ( node_id >= first_node_id_ and node_id <= last_node_id_ ); } index get_model_id() const diff --git a/nestkernel/modelrange_manager.h b/nestkernel/modelrange_manager.h index 398bdb5432..f8bd4a4f8e 100644 --- a/nestkernel/modelrange_manager.h +++ b/nestkernel/modelrange_manager.h @@ -99,7 +99,7 @@ nest::ModelRangeManager::get_status( DictionaryDatum& ) inline bool nest::ModelRangeManager::is_in_range( index node_id ) const { - return ( ( node_id <= last_node_id_ ) and ( node_id >= first_node_id_ ) ); + return ( node_id <= last_node_id_ and node_id >= first_node_id_ ); } inline std::vector< modelrange >::const_iterator diff --git a/nestkernel/ntree.h b/nestkernel/ntree.h index 6713c2417a..8443da4f6b 100644 --- a/nestkernel/ntree.h +++ b/nestkernel/ntree.h @@ -125,12 +125,12 @@ class Ntree bool operator==( const iterator& other ) const { - return ( other.ntree_ == ntree_ ) && ( other.node_ == node_ ); + return other.ntree_ == ntree_ and ( other.node_ == node_ ); } bool operator!=( const iterator& other ) const { - return ( other.ntree_ != ntree_ ) || ( other.node_ != node_ ); + return ( other.ntree_ != ntree_ ) or ( other.node_ != node_ ); } protected: @@ -210,12 +210,12 @@ class Ntree bool operator==( const masked_iterator& other ) const { - return ( other.ntree_ == ntree_ ) && ( other.node_ == node_ ); + return other.ntree_ == ntree_ and ( other.node_ == node_ ); } bool operator!=( const masked_iterator& other ) const { - return ( other.ntree_ != ntree_ ) || ( other.node_ != node_ ); + return ( other.ntree_ != ntree_ ) or ( other.node_ != node_ ); } protected: diff --git a/nestkernel/ntree_impl.h b/nestkernel/ntree_impl.h index 42400f29f4..203b066612 100644 --- a/nestkernel/ntree_impl.h +++ b/nestkernel/ntree_impl.h @@ -83,7 +83,7 @@ Ntree< D, T, max_capacity, max_depth >::iterator::next_leaf_() { // If we are on the last subntree, move up - while ( ntree_ && ( ntree_ != top_ ) && ( ntree_->my_subquad_ == N - 1 ) ) + while ( ntree_ and ( ntree_ != top_ ) and ntree_->my_subquad_ == N - 1 ) { ntree_ = ntree_->parent_; } @@ -203,7 +203,7 @@ Ntree< D, T, max_capacity, max_depth >::masked_iterator::init_() first_leaf_(); } - if ( ntree_->nodes_.empty() || ( not mask_->inside( ntree_->nodes_[ node_ ].first - anchor_ ) ) ) + if ( ntree_->nodes_.empty() or ( not mask_->inside( ntree_->nodes_[ node_ ].first - anchor_ ) ) ) { ++( *this ); } @@ -250,7 +250,7 @@ Ntree< D, T, max_capacity, max_depth >::masked_iterator::next_leaf_() // state: all in // If we are on the last subtree, move up - while ( ntree_ && ( ntree_ != allin_top_ ) && ( ntree_->my_subquad_ == N - 1 ) ) + while ( ntree_ and ( ntree_ != allin_top_ ) and ntree_->my_subquad_ == N - 1 ) { ntree_ = ntree_->parent_; } @@ -283,7 +283,7 @@ Ntree< D, T, max_capacity, max_depth >::masked_iterator::next_leaf_() { // If we are on the last subtree, move up - while ( ntree_ && ( ntree_ != top_ ) && ( ntree_->my_subquad_ == N - 1 ) ) + while ( ntree_ and ( ntree_ != top_ ) and ntree_->my_subquad_ == N - 1 ) { ntree_ = ntree_->parent_; } @@ -357,7 +357,7 @@ Ntree< D, T, max_capacity, max_depth >::masked_iterator::operator++() if ( allin_top_ == 0 ) { while ( - ( node_ < ntree_->nodes_.size() ) && ( not anchored_position_inside_mask( ntree_->nodes_[ node_ ].first ) ) ) + ( node_ < ntree_->nodes_.size() ) and ( not anchored_position_inside_mask( ntree_->nodes_[ node_ ].first ) ) ) { ++node_; } @@ -376,7 +376,7 @@ Ntree< D, T, max_capacity, max_depth >::masked_iterator::operator++() if ( allin_top_ == 0 ) { while ( - ( node_ < ntree_->nodes_.size() ) && ( not anchored_position_inside_mask( ntree_->nodes_[ node_ ].first ) ) ) + ( node_ < ntree_->nodes_.size() ) and ( not anchored_position_inside_mask( ntree_->nodes_[ node_ ].first ) ) ) { ++node_; } @@ -478,7 +478,7 @@ Ntree< D, T, max_capacity, max_depth >::insert( Position< D > pos, const T& node } } - if ( leaf_ && ( nodes_.size() >= max_capacity ) && ( my_depth_ < max_depth ) ) + if ( leaf_ and ( nodes_.size() >= max_capacity ) and my_depth_ < max_depth ) { split_(); } diff --git a/nestkernel/recording_backend_ascii.cpp b/nestkernel/recording_backend_ascii.cpp index 744b10f546..9fafd34082 100644 --- a/nestkernel/recording_backend_ascii.cpp +++ b/nestkernel/recording_backend_ascii.cpp @@ -251,7 +251,7 @@ nest::RecordingBackendASCII::DeviceData::open_file() std::string filename = compute_filename_(); std::ifstream test( filename.c_str() ); - if ( test.good() && not kernel().io_manager.overwrite_files() ) + if ( test.good() and not kernel().io_manager.overwrite_files() ) { std::string msg = String::compose( "The file '%1' already exists and overwriting files is disabled. To overwrite files, set " diff --git a/nestkernel/recording_backend_sionlib.cpp b/nestkernel/recording_backend_sionlib.cpp index 106905c028..2af52133b7 100644 --- a/nestkernel/recording_backend_sionlib.cpp +++ b/nestkernel/recording_backend_sionlib.cpp @@ -144,7 +144,7 @@ nest::RecordingBackendSIONlib::pre_run_hook() void nest::RecordingBackendSIONlib::open_files_() { - if ( files_opened_ or ( num_enrolled_devices_ == 0 ) ) + if ( files_opened_ or num_enrolled_devices_ == 0 ) { return; } @@ -276,7 +276,7 @@ nest::RecordingBackendSIONlib::close_files_() const thread t = kernel().vp_manager.get_thread_id(); const thread task = kernel().vp_manager.thread_to_vp( t ); - assert( ( files_.find( task ) != files_.end() ) && "initialize() was not called before calling cleanup()" ); + assert( ( files_.find( task ) != files_.end() ) and "initialize() was not called before calling cleanup()" ); FileEntry& file = files_[ task ]; SIONBuffer& buffer = file.buffer; diff --git a/nestkernel/recording_device.cpp b/nestkernel/recording_device.cpp index 0eb7d294ea..205fde2e6b 100644 --- a/nestkernel/recording_device.cpp +++ b/nestkernel/recording_device.cpp @@ -205,7 +205,7 @@ nest::RecordingDevice::is_active( Time const& T ) const { const long stamp = T.get_steps(); - return get_t_min_() < stamp && stamp <= get_t_max_(); + return get_t_min_() < stamp and stamp <= get_t_max_(); } void diff --git a/nestkernel/simulation_manager.cpp b/nestkernel/simulation_manager.cpp index 051def93e8..39f4667b26 100644 --- a/nestkernel/simulation_manager.cpp +++ b/nestkernel/simulation_manager.cpp @@ -369,7 +369,7 @@ nest::SimulationManager::set_status( const DictionaryDatum& d ) long interp_order; if ( updateValue< long >( d, names::wfr_interpolation_order, interp_order ) ) { - if ( ( interp_order < 0 ) or ( interp_order == 2 ) or ( interp_order > 3 ) ) + if ( interp_order < 0 or interp_order == 2 or interp_order > 3 ) { LOG( M_ERROR, "SimulationManager::set_status", "Interpolation order must be 0, 1, or 3." ); throw KernelException(); diff --git a/nestkernel/slice_ring_buffer.h b/nestkernel/slice_ring_buffer.h index 0cdfe04a1b..7380a96320 100644 --- a/nestkernel/slice_ring_buffer.h +++ b/nestkernel/slice_ring_buffer.h @@ -181,7 +181,7 @@ SliceRingBuffer::get_next_spike( const long req_stamp, bool& end_of_refract ) { end_of_refract = false; - if ( deliver_->empty() || refract_ <= deliver_->back() ) + if ( deliver_->empty() or refract_ <= deliver_->back() ) { if ( refract_.stamp_ == req_stamp ) { // if relies on stamp_==long::max() if not refractory diff --git a/nestkernel/source_table_position.h b/nestkernel/source_table_position.h index fdf182b6c8..6ae8c270ad 100644 --- a/nestkernel/source_table_position.h +++ b/nestkernel/source_table_position.h @@ -139,7 +139,7 @@ SourceTablePosition::decrease() inline bool operator==( const SourceTablePosition& lhs, const SourceTablePosition& rhs ) { - return ( ( lhs.tid == rhs.tid ) and ( lhs.syn_id == rhs.syn_id ) and ( lhs.lcid == rhs.lcid ) ); + return ( lhs.tid == rhs.tid and lhs.syn_id == rhs.syn_id and lhs.lcid == rhs.lcid ); } inline bool diff --git a/nestkernel/spatial.cpp b/nestkernel/spatial.cpp index 20edc85161..87455f82c4 100644 --- a/nestkernel/spatial.cpp +++ b/nestkernel/spatial.cpp @@ -446,7 +446,7 @@ dump_layer_connections( const Token& syn_model, DictionaryDatum get_layer_status( NodeCollectionPTR ) { - assert( false && "not implemented" ); + assert( false and "not implemented" ); return DictionaryDatum(); } diff --git a/nestkernel/universal_data_logger.h b/nestkernel/universal_data_logger.h index 3999909eac..6480fa8981 100644 --- a/nestkernel/universal_data_logger.h +++ b/nestkernel/universal_data_logger.h @@ -502,7 +502,7 @@ nest::DynamicUniversalDataLogger< HostNode >::connect_logging_device( const Data const index mm_node_id = req.get_sender().get_node_id(); const size_t n_loggers = data_loggers_.size(); size_t j = 0; - while ( j < n_loggers && data_loggers_[ j ].get_mm_node_id() != mm_node_id ) + while ( j < n_loggers and data_loggers_[ j ].get_mm_node_id() != mm_node_id ) { ++j; } @@ -552,7 +552,7 @@ nest::DynamicUniversalDataLogger< HostNode >::DataLogger_::DataLogger_( const Da num_vars_ = node_access_.size(); - if ( num_vars_ > 0 && req.get_recording_interval() < Time::step( 1 ) ) + if ( num_vars_ > 0 and req.get_recording_interval() < Time::step( 1 ) ) { throw IllegalConnection( "Recording interval must be >= resolution." ); } diff --git a/nestkernel/universal_data_logger_impl.h b/nestkernel/universal_data_logger_impl.h index ce5559f15a..a26b78cf1e 100644 --- a/nestkernel/universal_data_logger_impl.h +++ b/nestkernel/universal_data_logger_impl.h @@ -143,7 +143,7 @@ template < typename HostNode > void nest::DynamicUniversalDataLogger< HostNode >::DataLogger_::record_data( const HostNode&, long step ) { - if ( num_vars_ < 1 || step < next_rec_step_ ) + if ( num_vars_ < 1 or step < next_rec_step_ ) { return; } diff --git a/nestkernel/urbanczik_archiving_node_impl.h b/nestkernel/urbanczik_archiving_node_impl.h index 99c739d64a..62c105fff2 100644 --- a/nestkernel/urbanczik_archiving_node_impl.h +++ b/nestkernel/urbanczik_archiving_node_impl.h @@ -78,12 +78,12 @@ nest::UrbanczikArchivingNode< urbanczik_parameters >::get_urbanczik_history( dou // To have a well defined discretization of the integral, we make sure // that we exclude the entry at t1 but include the one at t2 by subtracting // a small number so that runner->t_ is never equal to t1 or t2. - while ( ( runner != urbanczik_history_[ comp - 1 ].end() ) && ( runner->t_ - 1.0e-6 < t1 ) ) + while ( ( runner != urbanczik_history_[ comp - 1 ].end() ) and runner->t_ - 1.0e-6 < t1 ) { ++runner; } *start = runner; - while ( ( runner != urbanczik_history_[ comp - 1 ].end() ) && ( runner->t_ - 1.0e-6 < t2 ) ) + while ( ( runner != urbanczik_history_[ comp - 1 ].end() ) and runner->t_ - 1.0e-6 < t2 ) { ( runner->access_counter_ )++; ++runner; diff --git a/nestkernel/vp_manager.cpp b/nestkernel/vp_manager.cpp index 690b2ff905..aaaaaa0ef4 100644 --- a/nestkernel/vp_manager.cpp +++ b/nestkernel/vp_manager.cpp @@ -106,7 +106,7 @@ nest::VPManager::set_status( const DictionaryDatum& d ) if ( n_threads_updated or n_vps_updated ) { - if ( kernel().sp_manager.is_structural_plasticity_enabled() and ( n_threads > 1 ) ) + if ( kernel().sp_manager.is_structural_plasticity_enabled() and n_threads > 1 ) { throw KernelException( "Structural plasticity enabled: multithreading cannot be enabled." ); } @@ -157,7 +157,7 @@ nest::VPManager::get_status( DictionaryDatum& d ) void nest::VPManager::set_num_threads( nest::thread n_threads ) { - if ( kernel().sp_manager.is_structural_plasticity_enabled() and ( n_threads > 1 ) ) + if ( kernel().sp_manager.is_structural_plasticity_enabled() and n_threads > 1 ) { throw KernelException( "Multiple threads can not be used if structural plasticity is enabled" ); } diff --git a/nestkernel/vp_manager.h b/nestkernel/vp_manager.h index ac472493fd..d35186c641 100644 --- a/nestkernel/vp_manager.h +++ b/nestkernel/vp_manager.h @@ -64,7 +64,7 @@ class VPManager : public ManagerInterface /** * Gets ID of local thread. - * Returns thread ID if OPENMP is installed + * Returns thread ID if OpenMP is installed * and zero otherwise. */ thread get_thread_id() const; diff --git a/sli/dict.h b/sli/dict.h index e29d221b93..8e665479cd 100644 --- a/sli/dict.h +++ b/sli/dict.h @@ -39,7 +39,7 @@ typedef std::map< Name, Token, std::less< Name > > TokenMap; inline bool operator==( const TokenMap& x, const TokenMap& y ) { - return ( x.size() == y.size() ) && equal( x.begin(), x.end(), y.begin() ); + return ( x.size() == y.size() ) and equal( x.begin(), x.end(), y.begin() ); } /** A class that associates names and tokens. diff --git a/sli/dictutils.cc b/sli/dictutils.cc index b6f0201017..85df9fcdbe 100644 --- a/sli/dictutils.cc +++ b/sli/dictutils.cc @@ -63,12 +63,12 @@ provide_property( DictionaryDatum& d, Name propname, const std::vector< double > DoubleVectorDatum* arrd = dynamic_cast< DoubleVectorDatum* >( t.datum() ); assert( arrd ); - if ( ( *arrd )->empty() && not prop.empty() ) // not data from before, add + if ( ( *arrd )->empty() and not prop.empty() ) // not data from before, add { ( *arrd )->insert( ( *arrd )->end(), prop.begin(), prop.end() ); } - assert( prop.empty() || **arrd == prop ); // not testing for **arrd.empty() + assert( prop.empty() or **arrd == prop ); // not testing for **arrd.empty() // since that implies prop.empty() } @@ -81,12 +81,12 @@ provide_property( DictionaryDatum& d, Name propname, const std::vector< long >& IntVectorDatum* arrd = dynamic_cast< IntVectorDatum* >( t.datum() ); assert( arrd ); - if ( ( *arrd )->empty() && not prop.empty() ) // not data from before, add + if ( ( *arrd )->empty() and not prop.empty() ) // not data from before, add { ( *arrd )->insert( ( *arrd )->end(), prop.begin(), prop.end() ); } - assert( prop.empty() || **arrd == prop ); // not testing for **arrd.empty() + assert( prop.empty() or **arrd == prop ); // not testing for **arrd.empty() // since that implies prop.empty() } diff --git a/sli/fdstream.h b/sli/fdstream.h index b5852fdc8e..826f9d65c2 100644 --- a/sli/fdstream.h +++ b/sli/fdstream.h @@ -156,7 +156,7 @@ class fdbuf : public std::streambuf sync() override { std::streamsize size = pptr() - pbase(); - if ( size > 0 && ::write( m_fd, m_outbuf, size ) != size ) + if ( size > 0 and ::write( m_fd, m_outbuf, size ) != size ) { return -1; } diff --git a/sli/filesystem.cc b/sli/filesystem.cc index da2c3b1ef9..64e22246e1 100644 --- a/sli/filesystem.cc +++ b/sli/filesystem.cc @@ -351,7 +351,7 @@ FilesystemModule::CompareFilesFunction::execute( SLIInterpreter* i ) const std::ifstream as( flA->c_str(), std::ifstream::in | std::ifstream::binary ); std::ifstream bs( flB->c_str(), std::ifstream::in | std::ifstream::binary ); - if ( not( as.good() && bs.good() ) ) + if ( not( as.good() and bs.good() ) ) { as.close(); bs.close(); @@ -359,12 +359,12 @@ FilesystemModule::CompareFilesFunction::execute( SLIInterpreter* i ) const } bool equal = true; - while ( equal && as.good() && bs.good() ) + while ( equal and as.good() and bs.good() ) { const int ac = as.get(); const int bc = bs.get(); - if ( not( as.fail() || bs.fail() ) ) + if ( not( as.fail() or bs.fail() ) ) { equal = ac == bc; } diff --git a/sli/interpret.cc b/sli/interpret.cc index f462f6cbd4..76d6df393b 100644 --- a/sli/interpret.cc +++ b/sli/interpret.cc @@ -875,7 +875,7 @@ SLIInterpreter::message( std::ostream& out, for ( size_t i = 0; i < text_str.size(); ++i ) { - if ( text_str.at( i ) == '\n' && i != text_str.size() - 1 ) + if ( text_str.at( i ) == '\n' and i != text_str.size() - 1 ) { // Print a lineshift followed by an indented whitespace // Manually inserted lineshift at the end of the message @@ -899,8 +899,8 @@ SLIInterpreter::message( std::ostream& out, // Start on a new line if the next word is longer than the // space available (as long as the word is shorter than the // total width of the printout). - if ( i != 0 && text_str.at( i - 1 ) == ' ' - && static_cast< int >( space - i ) > static_cast< int >( width - pos ) ) + if ( i != 0 and text_str.at( i - 1 ) == ' ' + and static_cast< int >( space - i ) > static_cast< int >( width - pos ) ) { out << std::endl << std::string( indent, ' ' ); pos = 0; @@ -908,7 +908,7 @@ SLIInterpreter::message( std::ostream& out, // Only print character if we're not at the end of the // line and the last character is a space. - if ( not( width - pos == 0 && text_str.at( i ) == ' ' ) ) + if ( not( width - pos == 0 and text_str.at( i ) == ' ' ) ) { // Print the actual character. out << text_str.at( i ); @@ -1092,7 +1092,7 @@ SLIInterpreter::debug_commandline( Token& next ) { stack_backtrace( EStack.load() ); } - else if ( arg == "next" || arg == "n" ) + else if ( arg == "next" or arg == "n" ) { std::cerr << "Next token: "; next.pprint( std::cerr ); @@ -1122,13 +1122,13 @@ SLIInterpreter::debug_commandline( Token& next ) catch_errors_ = not catch_errors_; std::cerr << "Catch error mode is now " << ( catch_errors_ ? " On." : "Off." ) << std::endl; } - else if ( arg == "tailrecursion" || arg == "tail" ) + else if ( arg == "tailrecursion" or arg == "tail" ) { opt_tailrecursion_ = not opt_tailrecursion_; std::cerr << "Tail-recursion optimization is now " << ( opt_tailrecursion_ ? " On." : "Off." ) << std::endl; } } - else if ( command == "list" || command == "l" ) + else if ( command == "list" or command == "l" ) { c = 'l'; break; @@ -1144,11 +1144,11 @@ SLIInterpreter::debug_commandline( Token& next ) catch_errors_ = true; std::cerr << "Catch error mode is now " << ( catch_errors_ ? " On." : "Off." ) << std::endl; } - else if ( command == "where" || command == "w" ) + else if ( command == "where" or command == "w" ) { stack_backtrace( EStack.load() ); } - else if ( command == "edit" || command == "break" || command == "e" ) + else if ( command == "edit" or command == "break" or command == "e" ) { debug_mode_off(); std::cerr << "Type 'continue', to exit interactive mode." << std::endl; @@ -1167,15 +1167,15 @@ SLIInterpreter::debug_commandline( Token& next ) { EStack.dump( std::cerr ); } - else if ( command == "help" || command == "?" || command == "h" ) + else if ( command == "help" or command == "?" or command == "h" ) { debug_options(); } - else if ( command == "next" || command == "n" ) + else if ( command == "next" or command == "n" ) { break; } - else if ( command == "continue" || command == "cont" || command == "c" ) + else if ( command == "continue" or command == "cont" or command == "c" ) { max_call_depth_ = call_depth_; // will show lower levels only } @@ -1183,7 +1183,7 @@ SLIInterpreter::debug_commandline( Token& next ) { max_call_depth_ = call_depth_ + 1; // will this level and lower. } - else if ( command == "quit" || command == "q" ) + else if ( command == "quit" or command == "q" ) { debug_mode_ = false; break; @@ -1203,7 +1203,7 @@ SLIInterpreter::startup() static bool is_initialized = false; int exitcode = EXIT_SUCCESS; - if ( not is_initialized && EStack.load() > 0 ) + if ( not is_initialized and EStack.load() > 0 ) { exitcode = execute_(); // run the interpreter is_initialized = true; diff --git a/sli/interpret.h b/sli/interpret.h index 07a134b10c..ed09eb9361 100644 --- a/sli/interpret.h +++ b/sli/interpret.h @@ -435,7 +435,7 @@ class SLIInterpreter bool step_mode() const { - return debug_mode_ && ( call_depth_ < max_call_depth_ ); + return debug_mode_ and ( call_depth_ < max_call_depth_ ); } /** diff --git a/sli/lockptrdatum.h b/sli/lockptrdatum.h index ff43a2d356..3f49ff866c 100644 --- a/sli/lockptrdatum.h +++ b/sli/lockptrdatum.h @@ -123,7 +123,7 @@ bool lockPTRDatum< D, slt >::equals( const Datum* dat ) const { const lockPTRDatum< D, slt >* ddc = dynamic_cast< const lockPTRDatum< D, slt >* >( dat ); - return ddc && lockPTR< D >::operator==( *ddc ); + return ddc and lockPTR< D >::operator==( *ddc ); } template < class D, SLIType* slt > diff --git a/sli/parser.cc b/sli/parser.cc index 4b97a43d4e..e7c17da8e1 100644 --- a/sli/parser.cc +++ b/sli/parser.cc @@ -177,7 +177,7 @@ Parser::operator()( Token& t ) } // if(ok) // else std::cerr << " : unable to scan input, Result:" << ok // << '\n'; - } while ( ( result == tokencontinue ) || ( result == scancontinue ) ); + } while ( result == tokencontinue or result == scancontinue ); if ( result != tokencompleted ) { diff --git a/sli/processes.cc b/sli/processes.cc index 270ec42b6e..2b4fd4b659 100644 --- a/sli/processes.cc +++ b/sli/processes.cc @@ -131,7 +131,7 @@ Processes::fd( std::ostream* s ) { return STDOUT_FILENO; } - else if ( ( s == &std::cerr ) || ( s == &std::clog ) ) + else if ( ( s == &std::cerr ) or ( s == &std::clog ) ) { return STDERR_FILENO; } @@ -662,7 +662,7 @@ Processes::AvailableFunction::execute( SLIInterpreter* i ) const // fcntl(fd,F_SETFL,flags); //reset to old value // // ------------------------------ - // if ( (peekchar==-1) && (errno!=EAGAIN) && (errno!=ESPIPE) ) + // if ( (peekchar==-1) and (errno!=EAGAIN) and (errno!=ESPIPE) ) // {// some unexpected error occured! // i->raiseerror(systemerror(i)); // } diff --git a/sli/scanner.cc b/sli/scanner.cc index 71fa92c370..4d2a10047d 100644 --- a/sli/scanner.cc +++ b/sli/scanner.cc @@ -547,7 +547,7 @@ Scanner::operator()( Token& t ) do { - if ( not in->eof() && not in->good() ) + if ( not in->eof() and not in->good() ) { std::cout << "I/O Error in scanner input stream." << std::endl; state = error; @@ -564,7 +564,7 @@ Scanner::operator()( Token& t ) ++line; } - if ( c == '\0' || in->bad() ) + if ( c == '\0' or in->bad() ) { c = endof; } @@ -603,7 +603,7 @@ Scanner::operator()( Token& t ) { IntegerDatum id( lng ); t = id; - if ( c != endoln && c != endof ) + if ( c != endoln and c != endof ) { in->unget(); --col; @@ -653,7 +653,7 @@ Scanner::operator()( Token& t ) ds.clear(); t.move( doubletoken ); - if ( c != endoln && c != endof ) + if ( c != endoln and c != endof ) { in->unget(); --col; @@ -704,7 +704,7 @@ Scanner::operator()( Token& t ) state = alphast; break; case sgalphast: - assert( sgc == '+' || sgc == '-' ); + assert( sgc == '+' or sgc == '-' ); s.append( 1, sgc ); state = alphast; /* no break */ @@ -738,7 +738,7 @@ Scanner::operator()( Token& t ) /* no break */ case aheadalphst: { - if ( c != endoln && c != endof ) + if ( c != endoln and c != endof ) { in->unget(); --col; @@ -751,7 +751,7 @@ Scanner::operator()( Token& t ) case aheadlitst: { - if ( c != endoln && c != endof ) + if ( c != endoln and c != endof ) { in->unget(); --col; @@ -803,7 +803,7 @@ Scanner::operator()( Token& t ) default: break; } - } while ( ( state != error ) && ( state != end ) ); + } while ( ( state != error ) and ( state != end ) ); return ( state == end ); } diff --git a/sli/sharedptrdatum.h b/sli/sharedptrdatum.h index 4b9fa0f8f1..7a8bf7c259 100644 --- a/sli/sharedptrdatum.h +++ b/sli/sharedptrdatum.h @@ -91,7 +91,7 @@ class sharedPtrDatum : public std::shared_ptr< D >, public TypedDatum< slt > equals( const Datum* other ) const { const sharedPtrDatum< D, slt >* other_dc = dynamic_cast< const sharedPtrDatum< D, slt >* >( other ); - return other_dc && *this == *other_dc; + return other_dc and *this == *other_dc; } }; diff --git a/sli/sli_io.cc b/sli/sli_io.cc index 2ec9e3bb64..c7bd2c9d70 100644 --- a/sli/sli_io.cc +++ b/sli/sli_io.cc @@ -965,7 +965,7 @@ IOSScientificFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -993,7 +993,7 @@ IOSDefaultFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1021,7 +1021,7 @@ IOSShowpointFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1048,7 +1048,7 @@ IOSNoshowpointFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1076,7 +1076,7 @@ IOSOctFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1103,7 +1103,7 @@ IOSHexFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1130,7 +1130,7 @@ IOSDecFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1157,7 +1157,7 @@ IOSShowbaseFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1184,7 +1184,7 @@ IOSNoshowbaseFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1211,7 +1211,7 @@ IOSLeftFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1240,7 +1240,7 @@ IOSRightFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1269,7 +1269,7 @@ IOSInternalFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.pick( 0 ).datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1310,7 +1310,7 @@ GetcFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1350,7 +1350,7 @@ GetsFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1399,14 +1399,14 @@ GetlineFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); throw TypeMismatch( d.gettypename().toString(), t.datum()->gettypename().toString() ); } - if ( ( *istreamdatum )->good() && not( *istreamdatum )->eof() ) + if ( ( *istreamdatum )->good() and not( *istreamdatum )->eof() ) { string s; getline( **istreamdatum, s ); @@ -1453,7 +1453,7 @@ IGoodFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1494,7 +1494,7 @@ IClearFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1528,7 +1528,7 @@ OClearFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.top().datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1563,7 +1563,7 @@ IFailFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1605,7 +1605,7 @@ OGoodFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.top().datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1646,7 +1646,7 @@ IEofFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1688,7 +1688,7 @@ OEofFunction::execute( SLIInterpreter* i ) const OstreamDatum* ostreamdatum = dynamic_cast< OstreamDatum* >( i->OStack.top().datum() ); - if ( not ostreamdatum || not ostreamdatum->valid() ) + if ( not ostreamdatum or not ostreamdatum->valid() ) { OstreamDatum const d; Token t = i->OStack.top(); @@ -1743,7 +1743,7 @@ In_AvailFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); @@ -1860,7 +1860,7 @@ ReadWordFunction::execute( SLIInterpreter* i ) const IstreamDatum* istreamdatum = dynamic_cast< IstreamDatum* >( i->OStack.top().datum() ); - if ( not istreamdatum || not istreamdatum->valid() ) + if ( not istreamdatum or not istreamdatum->valid() ) { IstreamDatum const d; Token t = i->OStack.top(); diff --git a/sli/sliarray.cc b/sli/sliarray.cc index 359d3e7fc5..64cf2dd332 100644 --- a/sli/sliarray.cc +++ b/sli/sliarray.cc @@ -103,7 +103,7 @@ SLIArrayModule::RangeFunction::execute( SLIInterpreter* i ) const { IntegerDatum* n1d = dynamic_cast< IntegerDatum* >( ad->get( 0 ).datum() ); IntegerDatum* n2d = dynamic_cast< IntegerDatum* >( ad->get( 1 ).datum() ); - if ( ( n1d ) && ( n2d ) ) + if ( n1d and n2d ) { long n = 1 + n2d->get() - n1d->get(); @@ -127,7 +127,7 @@ SLIArrayModule::RangeFunction::execute( SLIInterpreter* i ) const { DoubleDatum* n1d = dynamic_cast< DoubleDatum* >( ad->get( 0 ).datum() ); DoubleDatum* n2d = dynamic_cast< DoubleDatum* >( ad->get( 1 ).datum() ); - if ( ( n1d ) && ( n2d ) ) + if ( n1d and n2d ) { long n = 1 + static_cast< long >( n2d->get() - n1d->get() ); @@ -158,7 +158,7 @@ SLIArrayModule::RangeFunction::execute( SLIInterpreter* i ) const IntegerDatum* n1d = dynamic_cast< IntegerDatum* >( ad->get( 0 ).datum() ); IntegerDatum* n2d = dynamic_cast< IntegerDatum* >( ad->get( 1 ).datum() ); IntegerDatum* n3d = dynamic_cast< IntegerDatum* >( ad->get( 2 ).datum() ); - if ( ( n1d ) && ( n2d ) && ( n3d ) ) + if ( n1d and n2d and n3d ) { long di = n3d->get(); long start = n1d->get(); @@ -189,7 +189,7 @@ SLIArrayModule::RangeFunction::execute( SLIInterpreter* i ) const DoubleDatum* n1d = dynamic_cast< DoubleDatum* >( ad->get( 0 ).datum() ); DoubleDatum* n2d = dynamic_cast< DoubleDatum* >( ad->get( 1 ).datum() ); DoubleDatum* n3d = dynamic_cast< DoubleDatum* >( ad->get( 2 ).datum() ); - if ( ( n1d ) && ( n2d ) && ( n3d ) ) + if ( n1d and n2d and n3d ) { double di = n3d->get(); double start = n1d->get(); @@ -283,7 +283,7 @@ SLIArrayModule::ArangeFunction::execute( SLIInterpreter* i ) const { IntegerDatum* n1d = dynamic_cast< IntegerDatum* >( ad->get( 0 ).datum() ); IntegerDatum* n2d = dynamic_cast< IntegerDatum* >( ad->get( 1 ).datum() ); - if ( ( n1d ) && ( n2d ) ) + if ( n1d and n2d ) { const long start = n1d->get(); const long stop = n2d->get(); @@ -307,7 +307,7 @@ SLIArrayModule::ArangeFunction::execute( SLIInterpreter* i ) const { DoubleDatum* n1d = dynamic_cast< DoubleDatum* >( ad->get( 0 ).datum() ); DoubleDatum* n2d = dynamic_cast< DoubleDatum* >( ad->get( 1 ).datum() ); - if ( ( n1d ) && ( n2d ) ) + if ( n1d and n2d ) { double start = n1d->get(); double stop = n2d->get(); @@ -335,7 +335,7 @@ SLIArrayModule::ArangeFunction::execute( SLIInterpreter* i ) const IntegerDatum* n1d = dynamic_cast< IntegerDatum* >( ad->get( 0 ).datum() ); IntegerDatum* n2d = dynamic_cast< IntegerDatum* >( ad->get( 1 ).datum() ); IntegerDatum* n3d = dynamic_cast< IntegerDatum* >( ad->get( 2 ).datum() ); - if ( ( n1d ) && ( n2d ) && ( n3d ) ) + if ( n1d and n2d and n3d ) { long di = n3d->get(); long start = n1d->get(); @@ -369,7 +369,7 @@ SLIArrayModule::ArangeFunction::execute( SLIInterpreter* i ) const DoubleDatum* n1d = dynamic_cast< DoubleDatum* >( ad->get( 0 ).datum() ); DoubleDatum* n2d = dynamic_cast< DoubleDatum* >( ad->get( 1 ).datum() ); DoubleDatum* n3d = dynamic_cast< DoubleDatum* >( ad->get( 2 ).datum() ); - if ( ( n1d ) && ( n2d ) && ( n3d ) ) + if ( n1d and n2d and n3d ) { double di = n3d->get(); double start = n1d->get(); @@ -904,7 +904,7 @@ SLIArrayModule::ArraycreateFunction::execute( SLIInterpreter* i ) const const Token mark_token( new LiteralDatum( i->mark_name ) ); bool found = false; - while ( ( n < depth ) && not found ) + while ( n < depth and not found ) { found = ( i->OStack.pick( n ) == mark_token ); ++n; @@ -2736,7 +2736,7 @@ SLIArrayModule::GaborFunction::execute( SLIInterpreter* i ) const i->raiseerror( "RangeCheck" ); return; } - if ( ( ncol < 2 ) || ( nrow < 2 ) ) + if ( ncol < 2 or nrow < 2 ) { i->message( SLIInterpreter::M_ERROR, "Gabor_", "Matrix must have at least two rows and two columns." ); i->raiseerror( "RangeCheck" ); @@ -2844,7 +2844,7 @@ SLIArrayModule::Gauss2dFunction::execute( SLIInterpreter* i ) const i->raiseerror( "RangeCheck" ); return; } - if ( ( ncol < 2 ) || ( nrow < 2 ) ) + if ( ncol < 2 or nrow < 2 ) { i->message( SLIInterpreter::M_ERROR, "gauss2d_", "Matrix must have at least two rows and two columns." ); i->raiseerror( "RangeCheck" ); @@ -3927,7 +3927,7 @@ SLIArrayModule::FiniteQ_dFunction::execute( SLIInterpreter* i ) const i->assert_stack_load( 1 ); const double x = getValue< double >( i->OStack.pick( 0 ) ); - BoolDatum res( -std::numeric_limits< double >::max() <= x && x <= std::numeric_limits< double >::max() ); + BoolDatum res( -std::numeric_limits< double >::max() <= x and x <= std::numeric_limits< double >::max() ); i->OStack.push( res ); i->EStack.pop(); } @@ -4132,7 +4132,7 @@ eq_execute( SLIInterpreter* i ) op1->unlock(); const std::vector< D >* d2 = op2->get(); op2->unlock(); - bool eq = ( d1 == d2 || *d1 == *d2 ); + bool eq = ( d1 == d2 or *d1 == *d2 ); i->OStack.pop( 2 ); i->OStack.push_by_pointer( new BoolDatum( eq ) ); diff --git a/sli/slibuiltins.cc b/sli/slibuiltins.cc index 77307a1f94..dddc0b2ecd 100644 --- a/sli/slibuiltins.cc +++ b/sli/slibuiltins.cc @@ -233,8 +233,8 @@ IforFunction::execute( SLIInterpreter* i ) const IntegerDatum* inc = static_cast< IntegerDatum* >( i->EStack.pick( 5 ).datum() ); - if ( ( ( inc->get() > 0 ) && ( count->get() <= lim->get() ) ) - || ( ( inc->get() < 0 ) && ( count->get() >= lim->get() ) ) ) + if ( ( ( inc->get() > 0 ) and ( count->get() <= lim->get() ) ) + or ( ( inc->get() < 0 ) and ( count->get() >= lim->get() ) ) ) { pos = 0; // reset procedure interator diff --git a/sli/slicontrol.cc b/sli/slicontrol.cc index 47b5196c66..55548bec82 100644 --- a/sli/slicontrol.cc +++ b/sli/slicontrol.cc @@ -180,7 +180,7 @@ ExitFunction::execute( SLIInterpreter* i ) const size_t n = 1; size_t load = i->EStack.load(); - while ( ( load > n ) && not( i->EStack.pick( n++ ) == mark ) ) + while ( load > n and not( i->EStack.pick( n++ ) == mark ) ) { // do nothing } @@ -441,19 +441,19 @@ StopFunction::execute( SLIInterpreter* i ) const bool found = false; size_t n = 1; - while ( ( load > n ) && not( found ) ) + while ( load > n and not( found ) ) { found = i->EStack.pick( n++ ).contains( istopped ); } - if ( i->catch_errors() && not found ) + if ( i->catch_errors() and not found ) { i->debug_mode_on(); } - if ( i->get_debug_mode() || i->show_backtrace() ) + if ( i->get_debug_mode() or i->show_backtrace() ) { - if ( i->show_backtrace() || not found ) + if ( i->show_backtrace() or not found ) { i->stack_backtrace( load - 1 ); } @@ -505,19 +505,19 @@ CloseinputFunction::execute( SLIInterpreter* i ) const bool found = false; size_t n = 1; - while ( ( load > n ) && not( found ) ) + while ( load > n and not( found ) ) { found = i->EStack.pick( n++ )->isoftype( SLIInterpreter::XIstreamtype ); } - if ( i->catch_errors() || not found ) + if ( i->catch_errors() or not found ) { i->debug_mode_on(); } - if ( i->get_debug_mode() || i->show_backtrace() ) + if ( i->get_debug_mode() or i->show_backtrace() ) { - if ( i->show_backtrace() || not found ) + if ( i->show_backtrace() or not found ) { i->stack_backtrace( n ); } @@ -599,7 +599,7 @@ CurrentnameFunction::execute( SLIInterpreter* i ) const bool found = false; - while ( ( load > n ) && not found ) + while ( load > n and not found ) { found = i->EStack.pick( n++ ) == i->baselookup( i->ilookup_name ); } @@ -1168,7 +1168,7 @@ RaiseerrorFunction::execute( SLIInterpreter* i ) const Name* errorname = dynamic_cast< Name* >( err.datum() ); Name* cmdname = dynamic_cast< Name* >( cmd.datum() ); - if ( ( not errorname ) || ( not cmdname ) ) + if ( not errorname or not cmdname ) { i->message( SLIInterpreter::M_ERROR, "raiseerror", "Usage: /command /errorname raiserror" ); i->raiseerror( "ArgumentType" ); @@ -1387,7 +1387,7 @@ SwitchFunction::execute( SLIInterpreter* i ) const bool found = ( i->OStack.pick( pos ) == mark_token ); - while ( ( pos < depth ) && not found ) + while ( pos < depth and not found ) { i->EStack.push_move( i->OStack.pick( pos ) ); found = ( i->OStack.pick( ++pos ) == mark_token ); @@ -1427,8 +1427,8 @@ SwitchdefaultFunction::execute( SLIInterpreter* i ) const throw TypeMismatch( "At least 1 argument.", "Nothing." ); } - if ( depth > 1 && i->OStack.pick( 1 ) != mark_token // default action - && i->OStack.pick( 0 ) != mark_token ) // is not the only one + // default action is not the only one + if ( depth > 1 and i->OStack.pick( 1 ) != mark_token and i->OStack.pick( 0 ) != mark_token ) { i->OStack.pop(); // thus pop it! } @@ -1436,7 +1436,7 @@ SwitchdefaultFunction::execute( SLIInterpreter* i ) const bool found = ( i->OStack.pick( pos ) == mark_token ); - while ( ( pos < depth ) && not found ) + while ( pos < depth and not found ) { i->EStack.push_move( i->OStack.pick( pos ) ); found = ( i->OStack.pick( ++pos ) == mark_token ); @@ -1493,7 +1493,7 @@ CounttomarkFunction::execute( SLIInterpreter* i ) const bool found = false; - while ( ( pos < depth ) && not found ) + while ( pos < depth and not found ) { found = ( i->OStack.pick( pos ) == mark_token ); ++pos; diff --git a/sli/slidata.cc b/sli/slidata.cc index 3d23a37d46..e5d4870cb0 100644 --- a/sli/slidata.cc +++ b/sli/slidata.cc @@ -66,7 +66,7 @@ Get_aFunction::execute( SLIInterpreter* i ) const assert( obj ); - if ( ( idx->get() >= 0 ) && ( ( size_t ) idx->get() < obj->size() ) ) + if ( ( idx->get() >= 0 ) and ( ( size_t ) idx->get() < obj->size() ) ) { i->EStack.pop(); Token objT( obj->get( idx->get() ) ); @@ -119,7 +119,7 @@ Get_a_aFunction::execute( SLIInterpreter* i ) const continue; } - if ( not( ( id->get() >= 0 ) && ( ( size_t ) id->get() < obj->size() ) ) ) + if ( not( ( id->get() >= 0 ) and ( ( size_t ) id->get() < obj->size() ) ) ) { std::ostringstream sout; sout << "At position " << ( size_t ) ( t - idx->begin() ) << "." << std::ends; @@ -158,7 +158,7 @@ Get_pFunction::execute( SLIInterpreter* i ) const assert( obj ); - if ( ( idx->get() >= 0 ) && ( ( size_t ) idx->get() < obj->size() ) ) + if ( ( idx->get() >= 0 ) and ( ( size_t ) idx->get() < obj->size() ) ) { i->EStack.pop(); Token objT( obj->get( idx->get() ) ); @@ -182,7 +182,7 @@ Get_lpFunction::execute( SLIInterpreter* i ) const LitprocedureDatum* obj = dynamic_cast< LitprocedureDatum* >( i->OStack.pick( 1 ).datum() ); assert( obj ); - if ( ( idx->get() >= 0 ) && ( ( size_t ) idx->get() < obj->size() ) ) + if ( ( idx->get() >= 0 ) and ( ( size_t ) idx->get() < obj->size() ) ) { i->EStack.pop(); Token objT( obj->get( idx->get() ) ); @@ -250,7 +250,7 @@ Append_sFunction::execute( SLIInterpreter* i ) const StringDatum* sd = dynamic_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( sd && id ); + assert( sd and id ); ( *sd ) += static_cast< char >( id->get() ); @@ -306,7 +306,7 @@ Join_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* a1 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 1 ).datum() ); ArrayDatum* a2 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 0 ).datum() ); - assert( a1 && a2 ); + assert( a1 and a2 ); a1->append_move( *a2 ); @@ -324,7 +324,7 @@ Join_pFunction::execute( SLIInterpreter* i ) const ProcedureDatum* a1 = dynamic_cast< ProcedureDatum* >( i->OStack.pick( 1 ).datum() ); ProcedureDatum* a2 = dynamic_cast< ProcedureDatum* >( i->OStack.pick( 0 ).datum() ); - assert( a1 && a2 ); + assert( a1 and a2 ); a1->append_move( *a2 ); @@ -354,9 +354,9 @@ Insert_sFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); StringDatum* s2 = dynamic_cast< StringDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && s2 ); + assert( s1 and id and s2 ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { i->EStack.pop(); s1->insert( id->get(), *s2 ); @@ -390,9 +390,9 @@ InsertElement_sFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* c = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && c ); + assert( s1 and id and c ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { i->EStack.pop(); s1->insert( id->get(), 1, static_cast< char >( c->get() ) ); @@ -429,7 +429,7 @@ Prepend_sFunction::execute( SLIInterpreter* i ) const StringDatum* s1 = dynamic_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* c = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && c ); + assert( s1 and c ); s1->insert( ( size_t ) 0, 1, static_cast< char >( c->get() ) ); @@ -446,9 +446,9 @@ Insert_aFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); ArrayDatum* a2 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 0 ).datum() ); - assert( a1 && id && a2 ); + assert( a1 and id and a2 ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < a1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < a1->size() ) ) { i->EStack.pop(); a1->insert_move( id->get(), *a2 ); // ArrayDatum is a TokenArray. @@ -469,9 +469,9 @@ InsertElement_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* a1 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 2 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); - assert( a1 && id ); + assert( a1 and id ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < a1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < a1->size() ) ) { i->EStack.pop(); a1->insert_move( id->get(), i->OStack.top() ); @@ -543,9 +543,9 @@ Replace_sFunction::execute( SLIInterpreter* i ) const IntegerDatum* n = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); StringDatum* s2 = dynamic_cast< StringDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && n && s2 ); + assert( s1 and id and n and s2 ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { if ( n->get() >= 0 ) { @@ -575,9 +575,9 @@ Replace_aFunction::execute( SLIInterpreter* i ) const IntegerDatum* n = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); ArrayDatum* s2 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && n && s2 ); + assert( s1 and id and n and s2 ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { if ( n->get() >= 0 ) { @@ -620,9 +620,9 @@ Erase_sFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* n = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && n ); + assert( s1 and id and n ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { if ( n->get() >= 0 ) { @@ -651,9 +651,9 @@ Erase_aFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* n = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && n ); + assert( s1 and id and n ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { if ( n->get() >= 0 ) { @@ -682,9 +682,9 @@ Erase_pFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* n = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && n ); + assert( s1 and id and n ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { if ( n->get() >= 0 ) { @@ -714,9 +714,9 @@ Put_sFunction::execute( SLIInterpreter* i ) const IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* cd = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && id && cd ); + assert( s1 and id and cd ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < s1->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < s1->size() ) ) { i->EStack.pop(); ( *s1 )[ id->get() ] = static_cast< char >( cd->get() ); @@ -738,9 +738,9 @@ Put_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* ad = dynamic_cast< ArrayDatum* >( i->OStack.pick( 2 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); - assert( ad && id ); + assert( ad and id ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < ad->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < ad->size() ) ) { i->EStack.pop(); ad->assign_move( id->get(), i->OStack.top() ); // its safe to empty top() because @@ -762,9 +762,9 @@ Put_pFunction::execute( SLIInterpreter* i ) const ProcedureDatum* ad = dynamic_cast< ProcedureDatum* >( i->OStack.pick( 2 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); - assert( ad && id ); + assert( ad and id ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < ad->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < ad->size() ) ) { i->EStack.pop(); ad->assign_move( id->get(), i->OStack.top() ); // its safe to empty top() because @@ -786,9 +786,9 @@ Put_lpFunction::execute( SLIInterpreter* i ) const LitprocedureDatum* ad = dynamic_cast< LitprocedureDatum* >( i->OStack.pick( 2 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); - assert( ad && id ); + assert( ad and id ); - if ( ( id->get() >= 0 ) && ( ( size_t ) id->get() < ad->size() ) ) + if ( ( id->get() >= 0 ) and ( ( size_t ) id->get() < ad->size() ) ) { i->EStack.pop(); ad->assign_move( id->get(), i->OStack.top() ); // its safe to empty top() because @@ -982,7 +982,7 @@ Reserve_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* ad = dynamic_cast< ArrayDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( ad && id ); + assert( ad and id ); if ( id->get() >= 0 ) { i->EStack.pop(); @@ -1017,7 +1017,7 @@ Resize_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* ad = dynamic_cast< ArrayDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( ad && id ); + assert( ad and id ); if ( id->get() >= 0 ) { i->EStack.pop(); @@ -1134,7 +1134,7 @@ Reserve_sFunction::execute( SLIInterpreter* i ) const StringDatum* ad = dynamic_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( ad && id ); + assert( ad and id ); if ( id->get() >= 0 ) { @@ -1157,7 +1157,7 @@ Resize_sFunction::execute( SLIInterpreter* i ) const StringDatum* ad = dynamic_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( ad && id ); + assert( ad and id ); if ( id->get() >= 0 ) { @@ -1228,12 +1228,12 @@ Getinterval_sFunction::execute( SLIInterpreter* i ) const StringDatum* sd = dynamic_cast< StringDatum* >( i->OStack.pick( 2 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* cd = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( sd && id && cd ); + assert( sd and id and cd ); if ( cd->get() >= 0 ) { - if ( id->get() >= 0 && static_cast< size_t >( id->get() ) < sd->size() - && static_cast< size_t >( id->get() + cd->get() ) <= sd->size() ) + if ( id->get() >= 0 and static_cast< size_t >( id->get() ) < sd->size() + and static_cast< size_t >( id->get() + cd->get() ) <= sd->size() ) { i->EStack.pop(); sd->assign( *sd, id->get(), cd->get() ); @@ -1260,13 +1260,13 @@ Getinterval_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* sd = dynamic_cast< ArrayDatum* >( i->OStack.pick( 2 ).datum() ); IntegerDatum* id = dynamic_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* cd = dynamic_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( sd && id && cd ); + assert( sd and id and cd ); if ( cd->get() >= 0 ) { - if ( id->get() >= 0 && static_cast< size_t >( id->get() ) < sd->size() - && static_cast< size_t >( id->get() + cd->get() ) <= sd->size() ) + if ( id->get() >= 0 and static_cast< size_t >( id->get() ) < sd->size() + and static_cast< size_t >( id->get() + cd->get() ) <= sd->size() ) { i->EStack.pop(); sd->reduce( id->get(), cd->get() ); @@ -1402,7 +1402,7 @@ Get_sFunction::execute( SLIInterpreter* i ) const assert( obj ); - if ( ( idx->get() >= 0 ) && ( ( size_t ) idx->get() < obj->size() ) ) + if ( ( idx->get() >= 0 ) and ( ( size_t ) idx->get() < obj->size() ) ) { i->EStack.pop(); Token objT( new IntegerDatum( ( *obj )[ idx->get() ] ) ); @@ -1438,7 +1438,7 @@ Search_sFunction::execute( SLIInterpreter* i ) const StringDatum* s1 = dynamic_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); StringDatum* s2 = dynamic_cast< StringDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && s2 ); + assert( s1 and s2 ); size_t p = s1->find( *s2 ); @@ -1473,7 +1473,7 @@ Search_aFunction::execute( SLIInterpreter* i ) const ArrayDatum* s1 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 1 ).datum() ); ArrayDatum* s2 = dynamic_cast< ArrayDatum* >( i->OStack.pick( 0 ).datum() ); - assert( s1 && s2 ); + assert( s1 and s2 ); Token* p = std::search( s1->begin(), s1->end(), s2->begin(), s2->end() ); diff --git a/sli/slidict.cc b/sli/slidict.cc index 47b5d5daee..b3792edaea 100644 --- a/sli/slidict.cc +++ b/sli/slidict.cc @@ -643,7 +643,7 @@ DictconstructFunction::execute( SLIInterpreter* i ) const static Token mark = i->baselookup( i->mark_name ); size_t n = 0; //!< pick(1) is the first literal, then we count in steps of 2 - while ( ( n < load ) && not( i->OStack.pick( n ) == mark ) ) + while ( n < load and not( i->OStack.pick( n ) == mark ) ) { Token& val = ( i->OStack.pick( n ) ); key = dynamic_cast< LiteralDatum* >( i->OStack.pick( n + 1 ).datum() ); diff --git a/sli/sliexceptions.cc b/sli/sliexceptions.cc index bee4a13abf..2069df8f01 100644 --- a/sli/sliexceptions.cc +++ b/sli/sliexceptions.cc @@ -51,7 +51,7 @@ DivisionByZero::message() const std::string TypeMismatch::message() const { - if ( not provided_.empty() && not expected_.empty() ) + if ( not provided_.empty() and not expected_.empty() ) { return "Expected datatype: " + expected_ + "\nProvided datatype: " + provided_; } diff --git a/sli/sligraphics.cc b/sli/sligraphics.cc index e8193ae240..c4a8baa534 100644 --- a/sli/sligraphics.cc +++ b/sli/sligraphics.cc @@ -191,13 +191,13 @@ SLIgraphics::ReadPGMFunction::readImage( std::istream* in, if ( std::string( magic ) == std::string( "P2" ) ) // ASCII PGM { int tmp; - while ( ( *in >> tmp ) && not( in->eof() ) ) + while ( *in >> tmp and not in->eof() ) { image.push_back( ( long ) tmp ); } } else if ( std::string( magic ) == std::string( "P5" ) - || std::string( magic ) == std::string( "P6" ) ) // Raw PGM (resp. PPM) + or std::string( magic ) == std::string( "P6" ) ) // Raw PGM (resp. PPM) { if ( maxval > 255 ) { @@ -208,7 +208,7 @@ SLIgraphics::ReadPGMFunction::readImage( std::istream* in, in->read( &tmp, 1 ); // throw away LF after maxval // TODO: Protect this from reading too much data like trailing // newlines: use for instead of while - while ( in->read( &tmp, 1 ) && not( in->eof() ) ) + while ( in->read( &tmp, 1 ) and not( in->eof() ) ) { tmp2 = ( unsigned char ) tmp; image.push_back( ( long ) tmp2 ); diff --git a/sli/slimath.cc b/sli/slimath.cc index c28a79c217..e768c30ac2 100644 --- a/sli/slimath.cc +++ b/sli/slimath.cc @@ -600,7 +600,7 @@ Pow_diFunction::execute( SLIInterpreter* i ) const DoubleDatum* op1 = static_cast< DoubleDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* op2 = static_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); // can raise anything to an integer power, except zero to neg power - if ( not( op1->get() == 0.0 && op2->get() < 0 ) ) + if ( not( op1->get() == 0.0 and op2->get() < 0 ) ) { // cast explicitly to double to avoid overloading ambiguity *op1 = std::pow( op1->get(), static_cast< double >( op2->get() ) ); @@ -1116,7 +1116,7 @@ OrFunction::execute( SLIInterpreter* i ) const BoolDatum* op1 = static_cast< BoolDatum* >( i->OStack.pick( 1 ).datum() ); BoolDatum* op2 = static_cast< BoolDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); op1->get() = ( op1->get() or op2->get() ); @@ -1146,7 +1146,7 @@ XorFunction::execute( SLIInterpreter* i ) const BoolDatum* op1 = static_cast< BoolDatum* >( i->OStack.pick( 1 ).datum() ); BoolDatum* op2 = static_cast< BoolDatum* >( i->OStack.pick( 0 ).datum() ); - op1->get() = ( ( *op1 || *op2 ) && not( *op1 && *op2 ) ); + op1->get() = ( ( *op1 or *op2 ) and not( *op1 and *op2 ) ); i->OStack.pop(); } @@ -1174,7 +1174,7 @@ AndFunction::execute( SLIInterpreter* i ) const BoolDatum* op1 = static_cast< BoolDatum* >( i->OStack.pick( 1 ).datum() ); BoolDatum* op2 = static_cast< BoolDatum* >( i->OStack.pick( 0 ).datum() ); - op1->get() = ( *op1 && *op2 ); + op1->get() = ( *op1 and *op2 ); i->OStack.pop(); } @@ -1258,7 +1258,7 @@ Gt_iiFunction::execute( SLIInterpreter* i ) const IntegerDatum* op1 = static_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* op2 = static_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = op1->get() > op2->get(); @@ -1275,7 +1275,7 @@ Gt_ddFunction::execute( SLIInterpreter* i ) const DoubleDatum* op1 = static_cast< DoubleDatum* >( i->OStack.pick( 1 ).datum() ); DoubleDatum* op2 = static_cast< DoubleDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = op1->get() > op2->get(); @@ -1293,7 +1293,7 @@ Gt_ssFunction::execute( SLIInterpreter* i ) const StringDatum* op1 = static_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); StringDatum* op2 = static_cast< StringDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = *op1 > *op2; @@ -1320,7 +1320,7 @@ Lt_idFunction::execute( SLIInterpreter* i ) const IntegerDatum* op1 = static_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); DoubleDatum* op2 = static_cast< DoubleDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = op1->get() < op2->get(); @@ -1337,7 +1337,7 @@ Lt_diFunction::execute( SLIInterpreter* i ) const IntegerDatum* op2 = static_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); DoubleDatum* op1 = static_cast< DoubleDatum* >( i->OStack.pick( 1 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = op1->get() < op2->get(); @@ -1355,7 +1355,7 @@ Lt_iiFunction::execute( SLIInterpreter* i ) const IntegerDatum* op1 = static_cast< IntegerDatum* >( i->OStack.pick( 1 ).datum() ); IntegerDatum* op2 = static_cast< IntegerDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = op1->get() < op2->get(); @@ -1372,7 +1372,7 @@ Lt_ddFunction::execute( SLIInterpreter* i ) const DoubleDatum* op1 = static_cast< DoubleDatum* >( i->OStack.pick( 1 ).datum() ); DoubleDatum* op2 = static_cast< DoubleDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = op1->get() < op2->get(); @@ -1390,7 +1390,7 @@ Lt_ssFunction::execute( SLIInterpreter* i ) const StringDatum* op1 = static_cast< StringDatum* >( i->OStack.pick( 1 ).datum() ); StringDatum* op2 = static_cast< StringDatum* >( i->OStack.pick( 0 ).datum() ); - assert( op1 && op2 ); + assert( op1 and op2 ); bool result = *op1 < *op2; diff --git a/sli/slistartup.cc b/sli/slistartup.cc index 0dd7d5e9bc..527d55c468 100644 --- a/sli/slistartup.cc +++ b/sli/slistartup.cc @@ -207,7 +207,7 @@ SLIStartup::SLIStartup( int argc, char** argv ) StringDatum* sd = new StringDatum( argv[ i ] ); args_array.push_back( Token( sd ) ); - if ( *sd == "-d" || *sd == "--debug" ) + if ( *sd == "-d" or *sd == "--debug" ) { debug_ = true; verbosity_ = SLIInterpreter::M_ALL; // make the interpreter verbose. diff --git a/sli/specialfunctionsmodule.cc b/sli/specialfunctionsmodule.cc index 6167ef2d7c..b3a850629b 100644 --- a/sli/specialfunctionsmodule.cc +++ b/sli/specialfunctionsmodule.cc @@ -341,7 +341,7 @@ SpecialFunctionsModule::GaussDiskConvFunction::execute( SLIInterpreter* i ) cons { /* Gaussian in disk */ result = 1.0; } - else if ( y > 1 && r0 > R + sqrt( -log( GSL_DBL_EPSILON / y ) ) ) + else if ( y > 1 and r0 > R + sqrt( -log( GSL_DBL_EPSILON / y ) ) ) { /* tail */ result = 0.25 * R / r0 * ( std::exp( -( r0 - R ) * ( r0 - R ) ) - std::exp( -( r0 + R ) * ( r0 + R ) ) ); } diff --git a/sli/tarrayobj.cc b/sli/tarrayobj.cc index 919ac172bb..ded44e05cf 100644 --- a/sli/tarrayobj.cc +++ b/sli/tarrayobj.cc @@ -133,7 +133,7 @@ TokenArrayObj::resize( size_t s, size_t alloc, const Token& t ) { alloc_block_size = ( alloc == 0 ) ? alloc_block_size : alloc; - if ( ( s != size() && ( s != 0 ) ) || ( size() == 0 && alloc_block_size != 0 ) ) + if ( ( s != size() and ( s != 0 ) ) or ( size() == 0 and alloc_block_size != 0 ) ) { allocate( s, s + alloc_block_size, alloc_block_size, t ); } @@ -240,7 +240,7 @@ TokenArrayObj::rotate( Token* first, Token* middle, Token* last ) { // This algorithm is taken from the HP STL implementation. - if ( ( first < middle ) && ( middle < last ) ) + if ( first < middle and middle < last ) { for ( Token* i = middle;; ) { @@ -617,22 +617,11 @@ TokenArrayObj::append_move( TokenArrayObj& a ) bool TokenArrayObj::operator==( const TokenArrayObj& a ) const { - - // std::cout << "comparison of TokenArrayObj" << std::endl; - // std::cout << "p: " << p << std::endl; - // std::cout << "a.p: " << a.p << std::endl; - if ( p == a.p ) { return true; } - // experimentally replaced by line below 090120, Diesmann - // because [] cvx has non NULL p - // - // if( p == NULL || a.p == NULL || size() != a.size()) - // return false; - if ( size() != a.size() ) { return false; diff --git a/sli/token.h b/sli/token.h index 658e245ef9..acb07077d8 100644 --- a/sli/token.h +++ b/sli/token.h @@ -341,7 +341,7 @@ class Token bool contains( const Datum& d ) const { - return ( p ) and p->equals( &d ); + return p and p->equals( &d ); } bool diff --git a/sli/tokenarray.h b/sli/tokenarray.h index 0e4dc7a04c..5e1d57d8ee 100644 --- a/sli/tokenarray.h +++ b/sli/tokenarray.h @@ -398,7 +398,7 @@ class TokenArray void erase( size_t i, size_t n ) { - if ( i < size() && n > 0 ) + if ( i < size() and n > 0 ) { clone(); data->erase( i, n ); @@ -409,7 +409,7 @@ class TokenArray void reduce( size_t i, size_t n ) { - if ( i > 0 || n < size() ) + if ( i > 0 or n < size() ) { clone(); data->reduce( i, n ); @@ -474,7 +474,7 @@ TokenArray::reverse() inline void TokenArray::rotate( long n = 1 ) { - if ( size() == 0 || n == 0 ) + if ( size() == 0 or n == 0 ) { return; } diff --git a/sli/tokenstack.h b/sli/tokenstack.h index 7ffb99ba35..a7ccccf6f3 100644 --- a/sli/tokenstack.h +++ b/sli/tokenstack.h @@ -160,7 +160,7 @@ class TokenStack : private TokenArrayObj void roll( size_t n, long k ) { - if ( n < 2 || k == 0 ) + if ( n < 2 or k == 0 ) { return; // nothing to do } diff --git a/sli/typechk.h b/sli/typechk.h index dd86e3ab38..461fca61ed 100644 --- a/sli/typechk.h +++ b/sli/typechk.h @@ -199,7 +199,7 @@ inline TypeTrie::~TypeTrie() inline bool TypeTrie::equals( const Name& t1, const Name& t2 ) const { - return ( t1 == t2 || t2 == sli::any || t1 == sli::any ); + return ( t1 == t2 or t2 == sli::any or t1 == sli::any ); } inline const Token&