@@ -66,9 +66,8 @@ struct ARB_SYMBOL_VISIBLE i_clamp {
66
66
const U::quantity& current):
67
67
t (time.value_as(U::ms)),
68
68
amplitude (current.value_as(U::nA)) {
69
-
70
- if (std::isnan (t)) throw std::domain_error{" Time must be finite and convertible to ms." };
71
- if (std::isnan (amplitude)) throw std::domain_error{" Amplitude must be finite and convertible to nA." };
69
+ if (!std::isfinite (t)) throw std::domain_error{" Time must be finite and convertible to ms." };
70
+ if (!std::isfinite (amplitude)) throw std::domain_error{" Amplitude must be finite and convertible to nA." };
72
71
}
73
72
double t; // [ms]
74
73
double amplitude; // [nA]
@@ -104,8 +103,8 @@ struct ARB_SYMBOL_VISIBLE i_clamp {
104
103
frequency(f.value_as(U::kHz )),
105
104
phase(phi.value_as(U::rad))
106
105
{
107
- if (std::isnan (frequency)) throw std::domain_error{" Frequency must be finite and convertible to kHz." };
108
- if (std::isnan (phase)) throw std::domain_error{" Phase must be finite and convertible to rad." };
106
+ if (! std::isfinite (frequency)) throw std::domain_error{" Frequency must be finite and convertible to kHz." };
107
+ if (! std::isfinite (phase)) throw std::domain_error{" Phase must be finite and convertible to rad." };
109
108
}
110
109
111
110
// A 'box' stimulus with fixed onset time, duration, and constant amplitude.
@@ -123,7 +122,7 @@ struct ARB_SYMBOL_VISIBLE i_clamp {
123
122
// Threshold detector description.
124
123
struct ARB_SYMBOL_VISIBLE threshold_detector {
125
124
threshold_detector (const U::quantity& m): threshold(m.value_as(U::mV )) {
126
- if (std::isnan (threshold)) throw std::domain_error{" Threshold must be finite and in [mV]." };
125
+ if (! std::isfinite (threshold)) throw std::domain_error{" Threshold must be finite and in [mV]." };
127
126
}
128
127
static threshold_detector from_raw_millivolts (double v) { return {v*U::mV }; }
129
128
double threshold; // [mV]
@@ -139,7 +138,7 @@ struct ARB_SYMBOL_VISIBLE init_membrane_potential {
139
138
init_membrane_potential () = default ;
140
139
init_membrane_potential (const U::quantity& m, iexpr scale=1 ):
141
140
value (m.value_as(U::mV )), scale{scale} {
142
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [mV]." };
141
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [mV]." };
143
142
}
144
143
};
145
144
@@ -151,7 +150,7 @@ struct ARB_SYMBOL_VISIBLE temperature {
151
150
temperature () = default ;
152
151
temperature (const U::quantity& m, iexpr scale=1 ):
153
152
value (m.value_as(U::Kelvin)), scale{scale} {
154
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [K]." };
153
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [K]." };
155
154
}
156
155
};
157
156
@@ -162,7 +161,7 @@ struct ARB_SYMBOL_VISIBLE axial_resistivity {
162
161
axial_resistivity () = default ;
163
162
axial_resistivity (const U::quantity& m, iexpr scale=1 ):
164
163
value (m.value_as(U::cm*U::Ohm)), scale{scale} {
165
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [Ω·cm]." };
164
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [Ω·cm]." };
166
165
}
167
166
};
168
167
@@ -173,7 +172,7 @@ struct ARB_SYMBOL_VISIBLE membrane_capacitance {
173
172
membrane_capacitance () = default ;
174
173
membrane_capacitance (const U::quantity& m, iexpr scale=1 ):
175
174
value (m.value_as(U::F/U::m2)), scale{scale} {
176
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [F/m²]." };
175
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [F/m²]." };
177
176
}
178
177
};
179
178
@@ -185,7 +184,7 @@ struct ARB_SYMBOL_VISIBLE init_int_concentration {
185
184
init_int_concentration () = default ;
186
185
init_int_concentration (const std::string& ion, const U::quantity& m, iexpr scale=1 ):
187
186
ion{ion}, value(m.value_as(U::mM )), scale{scale} {
188
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [mM]." };
187
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [mM]." };
189
188
}
190
189
};
191
190
@@ -197,7 +196,7 @@ struct ARB_SYMBOL_VISIBLE ion_diffusivity {
197
196
ion_diffusivity () = default ;
198
197
ion_diffusivity (const std::string& ion, const U::quantity& m, iexpr scale=1 ):
199
198
ion{ion}, value(m.value_as(U::m2/U::s)), scale{scale} {
200
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [m²/s]." };
199
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [m²/s]." };
201
200
}
202
201
};
203
202
@@ -209,7 +208,7 @@ struct ARB_SYMBOL_VISIBLE init_ext_concentration {
209
208
init_ext_concentration () = default ;
210
209
init_ext_concentration (const std::string& ion, const U::quantity& m, iexpr scale=1 ):
211
210
ion{ion}, value(m.value_as(U::mM )), scale{scale} {
212
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [mM]." };
211
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [mM]." };
213
212
}
214
213
};
215
214
@@ -221,7 +220,7 @@ struct ARB_SYMBOL_VISIBLE init_reversal_potential {
221
220
init_reversal_potential () = default ;
222
221
init_reversal_potential (const std::string& ion, const U::quantity& m, iexpr scale=1 ):
223
222
ion{ion}, value(m.value_as(U::mV )), scale{scale} {
224
- if (std::isnan (value)) throw std::domain_error{" Value must be finite and in [mV]." };
223
+ if (! std::isfinite (value)) throw std::domain_error{" Value must be finite and in [mV]." };
225
224
}
226
225
};
227
226
@@ -460,13 +459,13 @@ struct ARB_SYMBOL_VISIBLE cable_cell_global_properties {
460
459
461
460
auto &ion_data = default_parameters.ion_data [ion_name];
462
461
ion_data.init_int_concentration = init_iconc.value_as (U::mM );
463
- if (std::isnan (*ion_data.init_int_concentration )) throw std::domain_error (" init_int_concentration must be finite and convertible to mM" );
462
+ if (! std::isfinite (*ion_data.init_int_concentration )) throw std::domain_error (" init_int_concentration must be finite and convertible to mM" );
464
463
ion_data.init_ext_concentration = init_econc.value_as (U::mM );
465
- if (std::isnan (*ion_data.init_ext_concentration )) throw std::domain_error (" init_ext_concentration must be finite and convertible to mM" );
464
+ if (! std::isfinite (*ion_data.init_ext_concentration )) throw std::domain_error (" init_ext_concentration must be finite and convertible to mM" );
466
465
ion_data.init_reversal_potential = init_revpot.value_as (U::mV );
467
- if (std::isnan (*ion_data.init_reversal_potential )) throw std::domain_error (" init_reversal_potential must be finite and convertible to mV" );
466
+ if (! std::isfinite (*ion_data.init_reversal_potential )) throw std::domain_error (" init_reversal_potential must be finite and convertible to mV" );
468
467
ion_data.diffusivity = diffusivity.value_as (U::m2/U::s);
469
- if (std::isnan (*ion_data.diffusivity ) || *ion_data.diffusivity < 0 ) throw std::domain_error (" diffusivity must be positive, finite, and convertible to m2/s" );
468
+ if (! std::isfinite (*ion_data.diffusivity ) || *ion_data.diffusivity < 0 ) throw std::domain_error (" diffusivity must be positive, finite, and convertible to m2/s" );
470
469
}
471
470
472
471
void add_ion (const std::string& ion_name,
0 commit comments