MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HHGate Class Reference

#include <HHGate.h>

+ Collaboration diagram for HHGate:

Public Member Functions

bool checkOriginal (Id id, const string &field) const
 
vector< double > getAlpha (const Eref &e) const
 
vector< double > getAlphaParms (const Eref &e) const
 
vector< double > getBeta (const Eref &e) const
 
unsigned int getDivs (const Eref &e) const
 
double getMax (const Eref &e) const
 
double getMin (const Eref &e) const
 
vector< double > getMinfinity (const Eref &e) const
 
vector< double > getTableA (const Eref &e) const
 
vector< double > getTableB (const Eref &e) const
 
vector< double > getTau (const Eref &e) const
 
bool getUseInterpolation (const Eref &e) const
 
 HHGate ()
 
 HHGate (Id originalChanId, Id originalGateId)
 
bool isOriginalChannel (Id id) const
 
bool isOriginalGate (Id id) const
 
double lookupA (double v) const
 
double lookupB (double v) const
 
void lookupBoth (double v, double *A, double *B) const
 
double lookupTable (const vector< double > &tab, double v) const
 
Id originalChannelId () const
 
Id originalGateId () const
 
void setAlpha (const Eref &e, vector< double > val)
 
void setBeta (const Eref &e, vector< double > val)
 
void setDivs (const Eref &e, unsigned int val)
 
void setMax (const Eref &e, double val)
 
void setMin (const Eref &e, double val)
 
void setMinfinity (const Eref &e, vector< double > val)
 
void setTableA (const Eref &e, vector< double > v)
 
void setTableB (const Eref &e, vector< double > v)
 
void setTau (const Eref &e, vector< double > val)
 
void setupAlpha (const Eref &e, vector< double > parms)
 
void setupGate (const Eref &e, vector< double > parms)
 
void setupTables (const vector< double > &parms, bool doTau)
 
void setupTau (const Eref &e, vector< double > parms)
 
void setUseInterpolation (const Eref &e, bool val)
 
void tabFill (vector< double > &table, unsigned int newXdivs, double newXmin, double newXmax)
 
void tweakAlpha ()
 
void tweakTables (bool doTau)
 
void tweakTau ()
 
void updateAlphaBeta ()
 
void updateTables ()
 
void updateTauMinf ()
 

Static Public Member Functions

static const CinfoinitCinfo ()
 

Private Attributes

vector< double > A_
 The actual lookup table for calculations. Holds alpha(V). More...
 
vector< double > alpha_
 5 parameters for alpha More...
 
vector< double > B_
 The lookup table for calculations. Holds alpha(V) + beta(V). More...
 
vector< double > beta_
 5 parameters for beta More...
 
double invDx_
 increment of the range. More...
 
bool isDirectTable_
 
bool lookupByInterpolation_
 
vector< double > mInfinity_
 5 parameters for mInfinity More...
 
Id originalChanId_
 
Id originalGateId_
 
vector< double > tau_
 5 parameters for tau More...
 
double xmax_
 Max of the voltage (or conc) range. More...
 
double xmin_
 Minimum of the voltage (or conc) range. More...
 

Friends

void testHHGateLookup ()
 
void testHHGateSetup ()
 

Detailed Description

This class handles a single gate on an HHChannel. It is equivalent to the m and h terms on the Hodgkin-Huxley Na channel, or the n term on the K channel. It stores the voltage-dependence (sometimes concentration-dependence) of the gating variables for opening the channel. It does so in a tabular form which can be directly filled using experimental data points. It also provides a set of utility functions for defining the gate in functional forms, and accessing those original functional forms. The HHGate is accessed as a FieldElement, which means that it is available as a pointer on the HHChannel. HHGates are typically shared. This means that when you make a copy or a vector of an HHChannel, there is only a single HHGate created, and its pointer is used by all the copies. The lookup functions are thread-safe. Field assignment to the HHGate should be possible only from the original HHChannel, but all the others do have read permission.

Definition at line 31 of file HHGate.h.

Constructor & Destructor Documentation

HHGate::HHGate ( )

Dummy constructor, to keep Dinfo happy. Should never be used

Definition at line 227 of file HHGate.cpp.

228  : xmin_(0), xmax_(1), invDx_(1),
229  originalChanId_(0),
230  originalGateId_(0),
232  isDirectTable_(0)
233 {;}
Id originalGateId_
Definition: HHGate.h:224
bool isDirectTable_
Definition: HHGate.h:238
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool lookupByInterpolation_
Definition: HHGate.h:230
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211
Id originalChanId_
Definition: HHGate.h:217
HHGate::HHGate ( Id  originalChanId,
Id  originalGateId 
)

This constructor is the one meant to be used. It takes the originalId of the parent HHChannel as a required argument, so that any subsequent 'write' functions can be checked to see if they are legal. Also tracks its own Id.

Definition at line 235 of file HHGate.cpp.

236  :
237  A_( 1, 0.0 ),
238  B_( 1, 0.0 ),
239  xmin_(0), xmax_(1), invDx_(1),
240  originalChanId_( originalChanId ),
241  originalGateId_( originalGateId ),
243  isDirectTable_(0)
244 {;}
Id originalGateId_
Definition: HHGate.h:224
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
bool isDirectTable_
Definition: HHGate.h:238
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool lookupByInterpolation_
Definition: HHGate.h:230
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211
Id originalChanId_
Definition: HHGate.h:217

Member Function Documentation

bool HHGate::checkOriginal ( Id  id,
const string &  field 
) const

Checks if the provided Id is the one that the HHGate was created on. If true, fine, otherwise complains about trying to set the field.

Definition at line 776 of file HHGate.cpp.

References originalGateId_.

Referenced by setAlpha(), setBeta(), setDivs(), setMax(), setMin(), setMinfinity(), setTableA(), setTableB(), setTau(), setupAlpha(), setupGate(), setupTau(), and setUseInterpolation().

777 {
778  if ( id == originalGateId_ )
779  return 1;
780 
781  cout << "Warning: HHGate: attempt to set field '" << field << "' on " <<
782  id.path() << "\nwhich is not the original Gate element. Ignored.\n";
783  return 0;
784 }
Id originalGateId_
Definition: HHGate.h:224

+ Here is the caller graph for this function:

vector< double > HHGate::getAlpha ( const Eref e) const

Definition at line 298 of file HHGate.cpp.

References alpha_.

Referenced by initCinfo().

299 {
300  return alpha_;
301 }
vector< double > alpha_
5 parameters for alpha
Definition: HHGate.h:187

+ Here is the caller graph for this function:

vector< double > HHGate::getAlphaParms ( const Eref e) const

Definition at line 509 of file HHGate.cpp.

References A_, alpha_, beta_, xmax_, and xmin_.

Referenced by initCinfo().

510 {
511  vector< double > ret = alpha_;
512  ret.insert( ret.end(), beta_.begin(), beta_.end() );
513  ret.push_back( A_.size() );
514  ret.push_back( xmin_ );
515  ret.push_back( xmax_ );
516 
517  return ret;
518 }
vector< double > beta_
5 parameters for beta
Definition: HHGate.h:190
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
vector< double > alpha_
5 parameters for alpha
Definition: HHGate.h:187

+ Here is the caller graph for this function:

vector< double > HHGate::getBeta ( const Eref e) const

Definition at line 318 of file HHGate.cpp.

References beta_.

Referenced by initCinfo().

319 {
320  return beta_;
321 }
vector< double > beta_
5 parameters for beta
Definition: HHGate.h:190

+ Here is the caller graph for this function:

unsigned int HHGate::getDivs ( const Eref e) const

Definition at line 421 of file HHGate.cpp.

References A_.

Referenced by initCinfo().

422 {
423  return A_.size() - 1;
424 }
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199

+ Here is the caller graph for this function:

double HHGate::getMax ( const Eref e) const

Definition at line 399 of file HHGate.cpp.

References xmax_.

Referenced by initCinfo().

400 {
401  return xmax_;
402 }
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208

+ Here is the caller graph for this function:

double HHGate::getMin ( const Eref e) const

Definition at line 378 of file HHGate.cpp.

References xmin_.

Referenced by initCinfo().

379 {
380  return xmin_;
381 }
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205

+ Here is the caller graph for this function:

vector< double > HHGate::getMinfinity ( const Eref e) const

Definition at line 358 of file HHGate.cpp.

References mInfinity_.

Referenced by initCinfo().

359 {
360  return mInfinity_;
361 }
vector< double > mInfinity_
5 parameters for mInfinity
Definition: HHGate.h:196

+ Here is the caller graph for this function:

vector< double > HHGate::getTableA ( const Eref e) const

Definition at line 443 of file HHGate.cpp.

References A_.

Referenced by initCinfo().

444 {
445  return A_;
446 }
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199

+ Here is the caller graph for this function:

vector< double > HHGate::getTableB ( const Eref e) const

Definition at line 463 of file HHGate.cpp.

References B_.

Referenced by initCinfo().

464 {
465  return B_;
466 }
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202

+ Here is the caller graph for this function:

vector< double > HHGate::getTau ( const Eref e) const

Definition at line 338 of file HHGate.cpp.

References tau_.

Referenced by initCinfo().

339 {
340  return tau_;
341 }
vector< double > tau_
5 parameters for tau
Definition: HHGate.h:193

+ Here is the caller graph for this function:

bool HHGate::getUseInterpolation ( const Eref e) const

Definition at line 480 of file HHGate.cpp.

References lookupByInterpolation_.

Referenced by initCinfo().

481 {
482  return lookupByInterpolation_;
483 }
bool lookupByInterpolation_
Definition: HHGate.h:230

+ Here is the caller graph for this function:

const Cinfo * HHGate::initCinfo ( )
static

Definition at line 16 of file HHGate.cpp.

References getAlpha(), getAlphaParms(), getBeta(), getDivs(), getMax(), getMin(), getMinfinity(), getTableA(), getTableB(), getTau(), getUseInterpolation(), Neutral::initCinfo(), lookupA(), lookupB(), setAlpha(), setBeta(), setDivs(), setMax(), setMin(), setMinfinity(), setTableA(), setTableB(), setTau(), setupAlpha(), setupGate(), setupTau(), setUseInterpolation(), tweakAlpha(), and tweakTau().

Referenced by HHChannelBase::initCinfo().

17 {
19  // Field definitions.
22  "lookupA: Look up the A gate value from a double. Usually does"
23  "so by direct scaling and offset to an integer lookup, using"
24  "a fine enough table granularity that there is little error."
25  "Alternatively uses linear interpolation."
26  "The range of the double is predefined based on knowledge of"
27  "voltage or conc ranges, and the granularity is specified by"
28  "the xmin, xmax, and dV fields.",
29  &HHGate::lookupA );
31  "lookupB: Look up the B gate value from a double."
32  "Note that this looks up the raw tables, which are transformed"
33  "from the reference parameters.",
34  &HHGate::lookupB );
35 
36  static ElementValueFinfo< HHGate, vector< double > > alpha( "alpha",
37  "Parameters for voltage-dependent rates, alpha:"
38  "Set up alpha term using 5 parameters, as follows:"
39  "y(x) = (A + B * x) / (C + exp((x + D) / F))"
40  "The original HH equations can readily be cast into this form",
43  );
44 
45  static ElementValueFinfo< HHGate, vector< double > > beta( "beta",
46  "Parameters for voltage-dependent rates, beta:"
47  "Set up beta term using 5 parameters, as follows:"
48  "y(x) = (A + B * x) / (C + exp((x + D) / F))"
49  "The original HH equations can readily be cast into this form",
52  );
53 
55  "Parameters for voltage-dependent rates, tau:"
56  "Set up tau curve using 5 parameters, as follows:"
57  "y(x) = (A + B * x) / (C + exp((x + D) / F))",
60  );
61 
63  "mInfinity",
64  "Parameters for voltage-dependent rates, mInfinity:"
65  "Set up mInfinity curve using 5 parameters, as follows:"
66  "y(x) = (A + B * x) / (C + exp((x + D) / F))"
67  "The original HH equations can readily be cast into this form",
70  );
71 
72  static ElementValueFinfo< HHGate, double > min( "min",
73  "Minimum range for lookup",
76  );
77 
78  static ElementValueFinfo< HHGate, double > max( "max",
79  "Minimum range for lookup",
82  );
83 
85  "Divisions for lookup. Zero means to use linear interpolation",
88  );
89 
91  "tableA",
92  "Table of A entries",
95  );
96 
98  "tableB",
99  "Table of alpha + beta entries",
102  );
103 
104  static ElementValueFinfo< HHGate, bool > useInterpolation(
105  "useInterpolation",
106  "Flag: use linear interpolation if true, else direct lookup",
109  );
110 
112  "alphaParms",
113  "Set up both gates using 13 parameters, as follows:"
114  "setupAlpha AA AB AC AD AF BA BB BC BD BF xdivs xmin xmax"
115  "Here AA-AF are Coefficients A to F of the alpha (forward) term"
116  "Here BA-BF are Coefficients A to F of the beta (reverse) term"
117  "Here xdivs is the number of entries in the table,"
118  "xmin and xmax define the range for lookup."
119  "Outside this range the returned value will be the low [high]"
120  "entry of the table."
121  "The equation describing each table is:"
122  "y(x) = (A + B * x) / (C + exp((x + D) / F))"
123  "The original HH equations can readily be cast into this form",
126  );
127 
129  // DestFinfos
131  static DestFinfo setupAlpha( "setupAlpha",
132  "Set up both gates using 13 parameters, as follows:"
133  "setupAlpha AA AB AC AD AF BA BB BC BD BF xdivs xmin xmax"
134  "Here AA-AF are Coefficients A to F of the alpha (forward) term"
135  "Here BA-BF are Coefficients A to F of the beta (reverse) term"
136  "Here xdivs is the number of entries in the table,"
137  "xmin and xmax define the range for lookup."
138  "Outside this range the returned value will be the low [high]"
139  "entry of the table."
140  "The equation describing each table is:"
141  "y(x) = (A + B * x) / (C + exp((x + D) / F))"
142  "The original HH equations can readily be cast into this form",
143  new EpFunc1< HHGate, vector< double > >( &HHGate::setupAlpha )
144  );
145  static DestFinfo setupTau( "setupTau",
146  "Identical to setupAlpha, except that the forms specified by"
147  "the 13 parameters are for the tau and m-infinity curves rather"
148  "than the alpha and beta terms. So the parameters are:"
149  "setupTau TA TB TC TD TF MA MB MC MD MF xdivs xmin xmax"
150  "As before, the equation describing each curve is:"
151  "y(x) = (A + B * x) / (C + exp((x + D) / F))",
152  new EpFunc1< HHGate, vector< double > >( &HHGate::setupTau )
153  );
154  static DestFinfo tweakAlpha( "tweakAlpha",
155  "Dummy function for backward compatibility. It used to convert"
156  "the tables from alpha, beta values to alpha, alpha+beta"
157  "because the internal calculations used these forms. Not"
158  "needed now, deprecated.",
160  );
161  static DestFinfo tweakTau( "tweakTau",
162  "Dummy function for backward compatibility. It used to convert"
163  "the tables from tau, minf values to alpha, alpha+beta"
164  "because the internal calculations used these forms. Not"
165  "needed now, deprecated.",
167  );
168  static DestFinfo setupGate( "setupGate",
169  "Sets up one gate at a time using the alpha/beta form."
170  "Has 9 parameters, as follows:"
171  "setupGate A B C D F xdivs xmin xmax is_beta"
172  "This sets up the gate using the equation:"
173  "y(x) = (A + B * x) / (C + exp((x + D) / F))"
174  "Deprecated.",
175  new EpFunc1< HHGate, vector< double > >( &HHGate::setupGate )
176  );
177  static Finfo* HHGateFinfos[] =
178  {
179  &A, // ReadOnlyLookupValue
180  &B, // ReadOnlyLookupValue
181  &alpha, // ElementValue
182  &beta, // ElementValue
183  &tau, // ElementValue
184  &mInfinity, // ElementValue
185  &min, // ElementValue
186  &max, // ElementValue
187  &divs, // ElementValue
188  &tableA, // ElementValue
189  &tableB, // ElementValue
190  &useInterpolation, // ElementValue
191  &alphaParms, // ElementValue
192  &setupAlpha, // Dest
193  &setupTau, // Dest
194  &tweakAlpha, // Dest
195  &tweakTau, // Dest
196  &setupGate, // Dest
197  };
198 
199  static string doc[] =
200  {
201  "Name", "HHGate",
202  "Author", "Upinder S. Bhalla, 2011, NCBS",
203  "Description", "HHGate: Gate for Hodkgin-Huxley type channels, equivalent to the "
204  "m and h terms on the Na squid channel and the n term on K. "
205  "This takes the voltage and state variable from the channel, "
206  "computes the new value of the state variable and a scaling, "
207  "depending on gate power, for the conductance.",
208  };
209 
210  static Dinfo< HHGate > dinfo;
211  static Cinfo HHGateCinfo(
212  "HHGate",
214  HHGateFinfos, sizeof(HHGateFinfos)/sizeof(Finfo *),
215  &dinfo,
216  doc,
217  sizeof(doc)/sizeof(string)
218  );
219 
220  return &HHGateCinfo;
221 }
vector< double > getTableB(const Eref &e) const
Definition: HHGate.cpp:463
double getMin(const Eref &e) const
Definition: HHGate.cpp:378
Definition: HHGate.h:31
void setBeta(const Eref &e, vector< double > val)
Definition: HHGate.cpp:323
Definition: Dinfo.h:60
void setTableA(const Eref &e, vector< double > v)
Definition: HHGate.cpp:448
Definition: EpFunc.h:64
void setUseInterpolation(const Eref &e, bool val)
Definition: HHGate.cpp:485
vector< double > getAlpha(const Eref &e) const
Definition: HHGate.cpp:298
double lookupA(double v) const
Definition: HHGate.cpp:265
double lookupB(double v) const
Definition: HHGate.cpp:270
void setTau(const Eref &e, vector< double > val)
Definition: HHGate.cpp:343
void setupTau(const Eref &e, vector< double > parms)
Definition: HHGate.cpp:524
vector< double > getTau(const Eref &e) const
Definition: HHGate.cpp:338
vector< double > getBeta(const Eref &e) const
Definition: HHGate.cpp:318
void tweakTau()
Definition: HHGate.cpp:541
void tweakAlpha()
Definition: HHGate.cpp:536
unsigned int getDivs(const Eref &e) const
Definition: HHGate.cpp:421
vector< double > getMinfinity(const Eref &e) const
Definition: HHGate.cpp:358
void setMax(const Eref &e, double val)
Definition: HHGate.cpp:404
void setMin(const Eref &e, double val)
Definition: HHGate.cpp:383
vector< double > getAlphaParms(const Eref &e) const
Definition: HHGate.cpp:509
void setDivs(const Eref &e, unsigned int val)
Definition: HHGate.cpp:426
void setupAlpha(const Eref &e, vector< double > parms)
Definition: HHGate.cpp:491
vector< double > getTableA(const Eref &e) const
Definition: HHGate.cpp:443
void setupGate(const Eref &e, vector< double > parms)
Definition: HHGate.cpp:674
void setTableB(const Eref &e, vector< double > v)
Definition: HHGate.cpp:468
bool getUseInterpolation(const Eref &e) const
Definition: HHGate.cpp:480
void setAlpha(const Eref &e, vector< double > val)
Definition: HHGate.cpp:303
Definition: OpFunc.h:13
void setMinfinity(const Eref &e, vector< double > val)
Definition: HHGate.cpp:363
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
Definition: Cinfo.h:18
double getMax(const Eref &e) const
Definition: HHGate.cpp:399
Definition: Finfo.h:12

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool HHGate::isOriginalChannel ( Id  id) const

isOriginalChannel returns true if the provided Id is the Id of the channel on which the HHGate was created.

Definition at line 786 of file HHGate.cpp.

References originalChanId_.

Referenced by HHChannel::checkOriginal().

787 {
788  return ( id == originalChanId_ );
789 }
Id originalChanId_
Definition: HHGate.h:217

+ Here is the caller graph for this function:

bool HHGate::isOriginalGate ( Id  id) const

isOriginalChannel returns true if the provided Id is the Id of the Gate created at the same time as the original channel.

Definition at line 791 of file HHGate.cpp.

References originalGateId_.

792 {
793  return ( id == originalGateId_ );
794 }
Id originalGateId_
Definition: HHGate.h:224
double HHGate::lookupA ( double  v) const

lookupA: Look up the A vector from a double. Typically does so by direct scaling and offset to an integer lookup, using a fine enough table granularity that there is little error. Alternatively uses linear interpolation. The range of the double is predefined based on knowledge of voltage or conc ranges, and the granularity is specified by the xmin, xmax, and invDx fields.

Definition at line 265 of file HHGate.cpp.

References A_, and lookupTable().

Referenced by initCinfo().

266 {
267  return lookupTable( A_, v );
268 }
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
double lookupTable(const vector< double > &tab, double v) const
Definition: HHGate.cpp:250

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double HHGate::lookupB ( double  v) const

lookupB: Look up the B vector from a double, similar to lookupA.

Definition at line 270 of file HHGate.cpp.

References B_, and lookupTable().

Referenced by initCinfo().

271 {
272  return lookupTable( B_, v );
273 }
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
double lookupTable(const vector< double > &tab, double v) const
Definition: HHGate.cpp:250

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::lookupBoth ( double  v,
double *  A,
double *  B 
) const

Single call to get both A and B values by lookup

Definition at line 275 of file HHGate.cpp.

References A_, B_, invDx_, lookupByInterpolation_, xmax_, and xmin_.

Referenced by HSolveUtils::rates(), HHChannel::vProcess(), and HHChannel::vReinit().

276 {
277  if ( v <= xmin_ ) {
278  *A = A_[0];
279  *B = B_[0];
280  } else if ( v >= xmax_ ) {
281  *A = A_.back();
282  *B = B_.back();
283  } else {
284  unsigned int index =
285  static_cast< unsigned int >( ( v - xmin_ ) * invDx_ );
286  assert( A_.size() > index && B_.size() > index );
287  if ( lookupByInterpolation_ ) {
288  double frac = ( v - xmin_ - index / invDx_ ) * invDx_;
289  *A = A_[ index ] * ( 1 - frac ) + A_[ index + 1 ] * frac;
290  *B = B_[ index ] * ( 1 - frac ) + B_[ index + 1 ] * frac;
291  } else {
292  *A = A_[ index ];
293  *B = B_[ index ];
294  }
295  }
296 }
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool lookupByInterpolation_
Definition: HHGate.h:230
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the caller graph for this function:

double HHGate::lookupTable ( const vector< double > &  tab,
double  v 
) const

Returns looked up value of specified table

Definition at line 250 of file HHGate.cpp.

References invDx_, lookupByInterpolation_, xmax_, and xmin_.

Referenced by lookupA(), lookupB(), and tabFill().

251 {
252  if ( v <= xmin_ ) return tab[0];
253  if ( v >= xmax_ ) return tab.back();
254  if ( lookupByInterpolation_ ) {
255  unsigned int index =
256  static_cast< unsigned int >( ( v - xmin_ ) * invDx_ );
257  assert( tab.size() > index );
258  double frac = ( v - xmin_ - index / invDx_ ) * invDx_;
259  return tab[ index ] * ( 1 - frac ) + tab[ index + 1 ] * frac;
260  } else {
261  return tab[ static_cast< unsigned int >( (v - xmin_) * invDx_ ) ];
262  }
263 }
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool lookupByInterpolation_
Definition: HHGate.h:230
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the caller graph for this function:

Id HHGate::originalChannelId ( ) const

Returns the Id of the original Channel.

Definition at line 796 of file HHGate.cpp.

References originalChanId_.

797 {
798  return originalChanId_;
799 }
Id originalChanId_
Definition: HHGate.h:217
Id HHGate::originalGateId ( ) const

Returns the Id of the original Gate.

Definition at line 801 of file HHGate.cpp.

References originalGateId_.

Referenced by HSolveUtils::gates(), and HSolveUtils::rates().

802 {
803  return originalGateId_;
804 }
Id originalGateId_
Definition: HHGate.h:224

+ Here is the caller graph for this function:

void HHGate::setAlpha ( const Eref e,
vector< double >  val 
)

Definition at line 303 of file HHGate.cpp.

References alpha_, checkOriginal(), Eref::id(), Id::path(), updateTables(), and updateTauMinf().

Referenced by initCinfo().

304 {
305  if ( val.size() != 5 ) {
306  cout << "Error: HHGate::setAlpha on " << e.id().path() <<
307  ": Number of entries on argument vector should be 5, was " <<
308  val.size() << endl;
309  return;
310  }
311  if ( checkOriginal( e.id(), "alpha" ) ) {
312  alpha_ = val;
313  updateTauMinf();
314  updateTables();
315  }
316 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
void updateTauMinf()
Definition: HHGate.cpp:810
void updateTables()
Definition: HHGate.cpp:814
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
vector< double > alpha_
5 parameters for alpha
Definition: HHGate.h:187

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setBeta ( const Eref e,
vector< double >  val 
)

Definition at line 323 of file HHGate.cpp.

References beta_, checkOriginal(), Eref::id(), Id::path(), updateTables(), and updateTauMinf().

Referenced by initCinfo().

324 {
325  if ( val.size() != 5 ) {
326  cout << "Error: HHGate::setBeta on " << e.id().path() <<
327  ": Number of entries on argument vector should be 5, was " <<
328  val.size() << endl;
329  return;
330  }
331  if ( checkOriginal( e.id(), "beta" ) ) {
332  beta_ = val;
333  updateTauMinf();
334  updateTables();
335  }
336 }
Id id() const
Definition: Eref.cpp:62
vector< double > beta_
5 parameters for beta
Definition: HHGate.h:190
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
void updateTauMinf()
Definition: HHGate.cpp:810
void updateTables()
Definition: HHGate.cpp:814
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setDivs ( const Eref e,
unsigned int  val 
)

Stuff here to redo sizes.

Definition at line 426 of file HHGate.cpp.

References A_, B_, checkOriginal(), Eref::id(), invDx_, isDirectTable_, tabFill(), updateTables(), xmax_, and xmin_.

Referenced by initCinfo().

427 {
428  if ( checkOriginal( e.id(), "divs" ) ) {
429  if ( isDirectTable_ ) {
430  invDx_ = static_cast< double >( val ) / ( xmax_ - xmin_ );
431  tabFill( A_, val, xmin_, xmax_ );
432  tabFill( B_, val, xmin_, xmax_ );
433  } else {
435  A_.resize( val + 1 );
436  B_.resize( val + 1 );
437  invDx_ = static_cast< double >( val ) / ( xmax_ - xmin_ );
438  updateTables();
439  }
440  }
441 }
Id id() const
Definition: Eref.cpp:62
void tabFill(vector< double > &table, unsigned int newXdivs, double newXmin, double newXmax)
Definition: HHGate.cpp:755
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
bool isDirectTable_
Definition: HHGate.h:238
void updateTables()
Definition: HHGate.cpp:814
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setMax ( const Eref e,
double  val 
)

Definition at line 404 of file HHGate.cpp.

References A_, B_, checkOriginal(), Eref::id(), invDx_, isDirectTable_, tabFill(), updateTables(), xmax_, and xmin_.

Referenced by initCinfo().

405 {
406  if ( checkOriginal( e.id(), "max" ) ) {
407  xmax_ = val;
408  unsigned int xdivs = A_.size() - 1;
409  if ( isDirectTable_ && xdivs > 0 ) {
410  // Set up using direct assignment of table values.
411  invDx_ = static_cast< double >( xdivs ) / ( val - xmin_ );
412  tabFill( A_, xdivs, xmin_, val );
413  tabFill( B_, xdivs, xmin_, val );
414  } else {
415  // Set up using functional form. here we just recalculate.
416  updateTables();
417  }
418  }
419 }
Id id() const
Definition: Eref.cpp:62
void tabFill(vector< double > &table, unsigned int newXdivs, double newXmin, double newXmax)
Definition: HHGate.cpp:755
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
bool isDirectTable_
Definition: HHGate.h:238
void updateTables()
Definition: HHGate.cpp:814
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setMin ( const Eref e,
double  val 
)

Definition at line 383 of file HHGate.cpp.

References A_, B_, checkOriginal(), Eref::id(), invDx_, isDirectTable_, tabFill(), updateTables(), xmax_, and xmin_.

Referenced by initCinfo().

384 {
385  if ( checkOriginal( e.id(), "min" ) ) {
386  xmin_ = val;
387  unsigned int xdivs = A_.size() - 1;
388  if ( isDirectTable_ && xdivs > 0 ) {
389  // Stuff here to stretch out table using interpolation.
390  invDx_ = static_cast< double >( xdivs ) / ( xmax_ - val );
391  tabFill( A_, xdivs, val, xmax_ );
392  tabFill( B_, xdivs, val, xmax_ );
393  } else {
394  updateTables();
395  }
396  }
397 }
Id id() const
Definition: Eref.cpp:62
void tabFill(vector< double > &table, unsigned int newXdivs, double newXmin, double newXmax)
Definition: HHGate.cpp:755
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
bool isDirectTable_
Definition: HHGate.h:238
void updateTables()
Definition: HHGate.cpp:814
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setMinfinity ( const Eref e,
vector< double >  val 
)

Definition at line 363 of file HHGate.cpp.

References checkOriginal(), Eref::id(), mInfinity_, Id::path(), updateAlphaBeta(), and updateTables().

Referenced by initCinfo().

364 {
365  if ( val.size() != 5 ) {
366  cout << "Error: HHGate::setMinfinity on " << e.id().path() <<
367  ": Number of entries on argument vector should be 5, was " <<
368  val.size() << endl;
369  return;
370  }
371  if ( checkOriginal( e.id(), "mInfinity" ) ) {
372  mInfinity_ = val;
373  updateAlphaBeta();
374  updateTables();
375  }
376 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
void updateAlphaBeta()
Definition: HHGate.cpp:806
vector< double > mInfinity_
5 parameters for mInfinity
Definition: HHGate.h:196
void updateTables()
Definition: HHGate.cpp:814
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setTableA ( const Eref e,
vector< double >  v 
)

Definition at line 448 of file HHGate.cpp.

References A_, checkOriginal(), Eref::id(), invDx_, isDirectTable_, Id::path(), xmax_, and xmin_.

Referenced by initCinfo().

449 {
450  if ( v.size() < 2 ) {
451  cout << "Warning: HHGate::setTableA: size must be >= 2 entries on "
452  << e.id().path() << endl;
453  return;
454  }
455  if ( checkOriginal( e.id(), "tableA" ) ) {
456  isDirectTable_ = 1;
457  A_ = v;
458  unsigned int xdivs = A_.size() - 1;
459  invDx_ = static_cast< double >( xdivs ) / ( xmax_ - xmin_ );
460  }
461 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
bool isDirectTable_
Definition: HHGate.h:238
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setTableB ( const Eref e,
vector< double >  v 
)

Definition at line 468 of file HHGate.cpp.

References A_, B_, checkOriginal(), Eref::id(), and isDirectTable_.

Referenced by initCinfo().

469 {
470  if ( checkOriginal( e.id(), "tableB" ) ) {
471  isDirectTable_ = 1;
472  if ( A_.size() != v.size() ) {
473  cout << "Warning: HHGate::setTableB: size should be same as table A: " << v.size() << " != " << A_.size() << ". Ignoring.\n";
474  return;
475  }
476  B_ = v;
477  }
478 }
Id id() const
Definition: Eref.cpp:62
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
bool isDirectTable_
Definition: HHGate.h:238
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setTau ( const Eref e,
vector< double >  val 
)

Definition at line 343 of file HHGate.cpp.

References checkOriginal(), Eref::id(), Id::path(), tau_, updateAlphaBeta(), and updateTables().

Referenced by initCinfo().

344 {
345  if ( val.size() != 5 ) {
346  cout << "Error: HHGate::setTau on " << e.id().path() <<
347  ": Number of entries on argument vector should be 5, was " <<
348  val.size() << endl;
349  return;
350  }
351  if ( checkOriginal( e.id(), "tau" ) ) {
352  tau_ = val;
353  updateAlphaBeta();
354  updateTables();
355  }
356 }
Id id() const
Definition: Eref.cpp:62
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
vector< double > tau_
5 parameters for tau
Definition: HHGate.h:193
void updateAlphaBeta()
Definition: HHGate.cpp:806
void updateTables()
Definition: HHGate.cpp:814
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setupAlpha ( const Eref e,
vector< double >  parms 
)

Definition at line 491 of file HHGate.cpp.

References alpha_, beta_, checkOriginal(), Eref::id(), and setupTables().

Referenced by initCinfo().

493 {
494  if ( checkOriginal( e.id(), "setupAlpha" ) ) {
495  if ( parms.size() != 13 ) {
496  cout << "HHGate::setupAlpha: Error: parms.size() != 13\n";
497  return;
498  }
499  setupTables( parms, false );
500  alpha_.resize( 5, 0 );
501  beta_.resize( 5, 0 );
502  for ( unsigned int i = 0; i < 5; ++i )
503  alpha_[i] = parms[i];
504  for ( unsigned int i = 5; i < 10; ++i )
505  beta_[i - 5] = parms[i];
506  }
507 }
Id id() const
Definition: Eref.cpp:62
vector< double > beta_
5 parameters for beta
Definition: HHGate.h:190
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
vector< double > alpha_
5 parameters for alpha
Definition: HHGate.h:187
void setupTables(const vector< double > &parms, bool doTau)
Definition: HHGate.cpp:551

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setupGate ( const Eref e,
vector< double >  parms 
)

Definition at line 674 of file HHGate.cpp.

References A_, B_, checkOriginal(), Eref::id(), SINGULARITY, tabFill(), tweakTables(), xmax_, and xmin_.

Referenced by initCinfo().

676 {
677  // The nine arguments are :
678  // A B C D F size min max isbeta
679  // If size == 0 then we check that the gate has already been allocated.
680  // If isbeta is true then we also have to do the conversion to
681  // HHGate form of alpha, alpha+beta, assuming that the alpha gate
682  // has already been setup. This uses tweakTables.
683  // We may need to resize the tables if they don't match here.
684  if ( !checkOriginal( e.id(), "setupGate" ) )
685  return;
686 
687  if ( parms.size() != 9 ) {
688  cout << "HHGate::setupGate: Error: parms.size() != 9\n";
689  return;
690  }
691 
692  double A = parms[0];
693  double B = parms[1];
694  double C = parms[2];
695  double D = parms[3];
696  double F = parms[4];
697  int size = static_cast< int > (parms[5] );
698  double min = parms[6];
699  double max = parms[7];
700  bool isBeta = static_cast< bool >( parms[8] );
701 
702  vector< double >& ip = ( isBeta ) ? B_ : A_;
703 
704  if ( size <= 0 ) { // Look up size, min, max from the interpol
705  size = ip.size() - 1;
706  if ( size <= 0 ) {
707  cout << "Error: setupGate has zero size\n";
708  return;
709  }
710  } else {
711  ip.resize( size + 1 );
712  }
713 
714  double dx = ( max - min ) / static_cast< double >( size );
715  double x = min + dx / 2.0;
716  for ( int i = 0; i <= size; i++ ) {
717  if ( fabs ( F ) < SINGULARITY ) {
718  ip[i] = 0.0;
719  } else {
720  double temp2 = C + exp( ( x + D ) / F );
721  if ( fabs( temp2 ) < SINGULARITY )
722  ip[i] = ip[i-1];
723  else
724  ip[i] = ( A + B * x ) / temp2;
725  }
726  }
727 
728  if ( isBeta ) {
729  assert( A_.size() > 0 );
730  // Here we ensure that the tables are the same size
731  if ( A_.size() != B_.size() ) {
732  if ( A_.size() > B_.size() ) {
733  // Note that the tabFill expects to allocate the
734  // terminating entry, so we put in size - 1.
735  tabFill( B_, A_.size() - 1, xmin_, xmax_ );
736  } else {
737  tabFill( A_, B_.size() - 1, xmin_, xmax_ );
738  }
739  }
740  // Then we do the tweaking to convert to HHChannel form.
741  tweakTables( 0 );
742  }
743 }
Id id() const
Definition: Eref.cpp:62
static const double SINGULARITY
Definition: HHGate.cpp:14
void tabFill(vector< double > &table, unsigned int newXdivs, double newXmin, double newXmax)
Definition: HHGate.cpp:755
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
void tweakTables(bool doTau)
Definition: HHGate.cpp:650
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setupTables ( const vector< double > &  parms,
bool  doTau 
)

Sets up the tables one at a time. Based on GENESIS/src/olf/new_interp.c, function setup_tab_values, fine tuned by Erik De Schutter.

Definition at line 551 of file HHGate.cpp.

References A_, B_, invDx_, SINGULARITY, xmax_, and xmin_.

Referenced by setupAlpha(), setupTau(), and updateTables().

552 {
553  assert( parms.size() == 13 );
554  static const int XDIVS = 10;
555  static const int XMIN = 11;
556  static const int XMAX = 12;
557  if ( parms[XDIVS] < 1 ) return;
558  unsigned int xdivs = static_cast< unsigned int >( parms[XDIVS] );
559 
560  A_.resize( xdivs + 1 );
561  B_.resize( xdivs + 1 );
562  xmin_ = parms[XMIN];
563  xmax_ = parms[XMAX];
564  assert( xmax_ > xmin_ );
565  invDx_ = xdivs / (xmax_ - xmin_ );
566  double dx = ( xmax_ - xmin_ ) / xdivs;
567 
568  double x = xmin_;
569  double prevAentry = 0.0;
570  double prevBentry = 0.0;
571  double temp;
572  double temp2 = 0.0;
573  unsigned int i;
574 
575  for( i = 0; i <= xdivs; i++ ) {
576  if ( fabs( parms[4] ) < SINGULARITY ) {
577  temp = 0.0;
578  A_[i] = temp;
579  } else {
580  temp2 = parms[2] + exp( ( x + parms[3] ) / parms[4] );
581  if ( fabs( temp2 ) < SINGULARITY ) {
582  temp2 = parms[2] + exp( ( x + dx/10.0 + parms[3] ) / parms[4] );
583  temp = ( parms[0] + parms[1] * (x + dx/10 ) ) / temp2;
584 
585  temp2 = parms[2] + exp( ( x - dx/10.0 + parms[3] ) / parms[4] );
586  temp += ( parms[0] + parms[1] * (x - dx/10 ) ) / temp2;
587  temp /= 2.0;
588  // cout << "interpolated temp = " << temp << ", prev = " << prevAentry << endl;
589 
590  // temp = prevAentry;
591  A_[i] = temp;
592  } else {
593  temp = ( parms[0] + parms[1] * x) / temp2;
594  A_[i] = temp;
595  }
596  }
597  if ( fabs( parms[9] ) < SINGULARITY ) {
598  B_[i] = 0.0;
599  } else {
600  temp2 = parms[7] + exp( ( x + parms[8] ) / parms[9] );
601  if ( fabs( temp2 ) < SINGULARITY ) {
602  temp2 = parms[7] + exp( ( x + dx/10.0 + parms[8] ) / parms[9] );
603  temp = (parms[5] + parms[6] * (x + dx/10) ) / temp2;
604  temp2 = parms[7] + exp( ( x - dx/10.0 + parms[8] ) / parms[9] );
605  temp += (parms[5] + parms[6] * (x - dx/10) ) / temp2;
606  temp /= 2.0;
607  B_[i] = temp;
608  // B_[i] = prevBentry;
609  } else {
610  B_[i] = (parms[5] + parms[6] * x ) / temp2;
611  // B_.table_[i] = ( parms[5] + parms[6] * x ) / temp2;
612  }
613  }
614  // There are cleaner ways to do this, but this keeps
615  // the relation to the GENESIS version clearer.
616  // Note the additional SINGULARITY check, to fix a bug
617  // in the earlier code.
618  if ( doTau == 0 && fabs( temp2 ) > SINGULARITY )
619  B_[i] += temp;
620 
621  prevAentry = A_[i];
622  prevBentry = B_[i];
623  x += dx;
624  }
625 
626  prevAentry = 0.0;
627  prevBentry = 0.0;
628  if ( doTau ) {
629  for( i = 0; i <= xdivs; i++ ) {
630  temp = A_[i];
631  temp2 = B_[i];
632  if ( fabs( temp ) < SINGULARITY ) {
633  A_[i] = prevAentry;
634  B_[i] = prevBentry;
635  } else {
636  A_[i] = temp2 / temp;
637  B_[i] = 1.0 / temp;
638  }
639  prevAentry = A_[i];
640  prevBentry = B_[i];
641  }
642  }
643 }
static const double SINGULARITY
Definition: HHGate.cpp:14
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
double invDx_
increment of the range.
Definition: HHGate.h:211

+ Here is the caller graph for this function:

void HHGate::setupTau ( const Eref e,
vector< double >  parms 
)

Definition at line 524 of file HHGate.cpp.

References checkOriginal(), Eref::id(), and setupTables().

Referenced by initCinfo().

526 {
527  if ( checkOriginal( e.id(), "setupTau" ) ) {
528  if ( parms.size() != 13 ) {
529  cout << "HHGate::setupTau: Error: parms.size() != 13\n";
530  return;
531  }
532  setupTables( parms, true );
533  }
534 }
Id id() const
Definition: Eref.cpp:62
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
void setupTables(const vector< double > &parms, bool doTau)
Definition: HHGate.cpp:551

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::setUseInterpolation ( const Eref e,
bool  val 
)

Definition at line 485 of file HHGate.cpp.

References checkOriginal(), Eref::id(), and lookupByInterpolation_.

Referenced by initCinfo(), and HSolveUtils::rates().

486 {
487  if ( checkOriginal( e.id(), "useInterpolation" ) )
489 }
Id id() const
Definition: Eref.cpp:62
bool checkOriginal(Id id, const string &field) const
Definition: HHGate.cpp:776
bool lookupByInterpolation_
Definition: HHGate.h:230

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::tabFill ( vector< double > &  table,
unsigned int  newXdivs,
double  newXmin,
double  newXmax 
)

tabFill does interpolation and range resizing for a table representing a lookup function. newXdivs is one less than the size of the table; it is the number of subdivisions that the table represents. Does NOT alter the existing xmin and xmax, but it does resize the table.

This utility function does interpolation and range resizing for a table representing a lookup function. newXdivs is one less than the size of the table; it is the number of subdivisions that the table represents.

Definition at line 755 of file HHGate.cpp.

References lookupByInterpolation_, and lookupTable().

Referenced by setDivs(), setMax(), setMin(), and setupGate().

757 {
758  if ( newXdivs < 3 ) {
759  cout << "Error: tabFill: # divs must be >= 3. Not filling table.\n";
760  return;
761  }
762 
763  vector< double > old = table;
764  double newDx = ( newXmax - newXmin ) / newXdivs;
765  table.resize( newXdivs + 1 );
766  bool origLookupMode = lookupByInterpolation_;
768 
769  for( unsigned int i = 0; i <= newXdivs; ++i ) {
770  table[i] = lookupTable( table, newXmin + i * newDx );
771  }
772 
773  lookupByInterpolation_ = origLookupMode;
774 }
double lookupTable(const vector< double > &tab, double v) const
Definition: HHGate.cpp:250
bool lookupByInterpolation_
Definition: HHGate.h:230

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::tweakAlpha ( )

Definition at line 536 of file HHGate.cpp.

Referenced by initCinfo().

537 {
538  ; // Dummy
539 }

+ Here is the caller graph for this function:

void HHGate::tweakTables ( bool  doTau)

Tweaks the A and B entries in the tables from the original alpha/beta or minf/tau values. See code in GENESIS/src/olf/new_interp.c, function tweak_tab_values

Definition at line 650 of file HHGate.cpp.

References A_, B_, and SINGULARITY.

Referenced by setupGate().

651 {
652  unsigned int i;
653  unsigned int size = A_.size();
654  assert( size == B_.size() );
655  if ( doTau ) {
656  for ( i = 0; i < size; i++ ) {
657  double temp = A_[ i ];
658  double temp2 = B_[ i ];
659  if ( fabs( temp ) < SINGULARITY ) {
660  if ( temp < 0.0 )
661  temp = -SINGULARITY;
662  else
663  temp = SINGULARITY;
664  }
665  A_[ i ] = temp2 / temp;
666  B_[ i ] = 1.0 / temp;
667  }
668  } else {
669  for ( i = 0; i < size; i++ )
670  B_[i] = A_[i] + B_[i];
671  }
672 }
static const double SINGULARITY
Definition: HHGate.cpp:14
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
vector< double > B_
The lookup table for calculations. Holds alpha(V) + beta(V).
Definition: HHGate.h:202

+ Here is the caller graph for this function:

void HHGate::tweakTau ( )

Definition at line 541 of file HHGate.cpp.

Referenced by initCinfo().

542 {
543  ; // Dummy
544 }

+ Here is the caller graph for this function:

void HHGate::updateAlphaBeta ( )

Update the alpha and beta parameters because the tau or minfinity tables have changed.

Definition at line 806 of file HHGate.cpp.

Referenced by setMinfinity(), and setTau().

807 {
808 }

+ Here is the caller graph for this function:

void HHGate::updateTables ( )

Take the current alpha/beta parameters, and xdivs, xmin, xmax; and rebuild the tables.

Definition at line 814 of file HHGate.cpp.

References A_, alpha_, beta_, setupTables(), xmax_, and xmin_.

Referenced by setAlpha(), setBeta(), setDivs(), setMax(), setMin(), setMinfinity(), and setTau().

815 {
816  if ( alpha_.size() == 0 || beta_.size() == 0 )
817  return;
818  vector< double > parms = alpha_;
819  parms.insert( parms.end(), beta_.begin(), beta_.end() );
820  parms.push_back( A_.size() );
821  parms.push_back( xmin_ );
822  parms.push_back( xmax_ );
823 
824  setupTables( parms, 0 );
825 }
vector< double > beta_
5 parameters for beta
Definition: HHGate.h:190
vector< double > A_
The actual lookup table for calculations. Holds alpha(V).
Definition: HHGate.h:199
double xmax_
Max of the voltage (or conc) range.
Definition: HHGate.h:208
double xmin_
Minimum of the voltage (or conc) range.
Definition: HHGate.h:205
vector< double > alpha_
5 parameters for alpha
Definition: HHGate.h:187
void setupTables(const vector< double > &parms, bool doTau)
Definition: HHGate.cpp:551

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HHGate::updateTauMinf ( )

Update the Tau and Minfinity parameters because the alpha or beta tables have changed.

Definition at line 810 of file HHGate.cpp.

Referenced by setAlpha(), and setBeta().

811 {
812 }

+ Here is the caller graph for this function:

Friends And Related Function Documentation

void testHHGateLookup ( )
friend
void testHHGateSetup ( )
friend

Member Data Documentation

vector< double > HHGate::A_
private

The actual lookup table for calculations. Holds alpha(V).

Definition at line 199 of file HHGate.h.

Referenced by getAlphaParms(), getDivs(), getTableA(), lookupA(), lookupBoth(), setDivs(), setMax(), setMin(), setTableA(), setTableB(), setupGate(), setupTables(), tweakTables(), and updateTables().

vector< double > HHGate::alpha_
private

5 parameters for alpha

Definition at line 187 of file HHGate.h.

Referenced by getAlpha(), getAlphaParms(), setAlpha(), setupAlpha(), and updateTables().

vector< double > HHGate::B_
private

The lookup table for calculations. Holds alpha(V) + beta(V).

Definition at line 202 of file HHGate.h.

Referenced by getTableB(), lookupB(), lookupBoth(), setDivs(), setMax(), setMin(), setTableB(), setupGate(), setupTables(), and tweakTables().

vector< double > HHGate::beta_
private

5 parameters for beta

Definition at line 190 of file HHGate.h.

Referenced by getAlphaParms(), getBeta(), setBeta(), setupAlpha(), and updateTables().

double HHGate::invDx_
private

increment of the range.

Definition at line 211 of file HHGate.h.

Referenced by lookupBoth(), lookupTable(), setDivs(), setMax(), setMin(), setTableA(), and setupTables().

bool HHGate::isDirectTable_
private

Flag to indicate if table entries have been assigned directly (as direct experimental data, or an externally defined V-dep function). When zero it means that the curve-fit forms from setupAlpha etc. have been used.

Definition at line 238 of file HHGate.h.

Referenced by setDivs(), setMax(), setMin(), setTableA(), and setTableB().

bool HHGate::lookupByInterpolation_
private

Flag: Use linear interpolation for lookup if true, use direct table lookup if false.

Definition at line 230 of file HHGate.h.

Referenced by getUseInterpolation(), lookupBoth(), lookupTable(), setUseInterpolation(), and tabFill().

vector< double > HHGate::mInfinity_
private

5 parameters for mInfinity

Definition at line 196 of file HHGate.h.

Referenced by getMinfinity(), and setMinfinity().

Id HHGate::originalChanId_
private

Id of original channel, the one which has actually allocated it, All other Elements have to treat the values as readonly.

Definition at line 217 of file HHGate.h.

Referenced by isOriginalChannel(), and originalChannelId().

Id HHGate::originalGateId_
private

Id of original Gate, the one which was created with the original channel. All other Elements have to treat the values as readonly.

Definition at line 224 of file HHGate.h.

Referenced by checkOriginal(), isOriginalGate(), and originalGateId().

vector< double > HHGate::tau_
private

5 parameters for tau

Definition at line 193 of file HHGate.h.

Referenced by getTau(), and setTau().

double HHGate::xmax_
private

Max of the voltage (or conc) range.

Definition at line 208 of file HHGate.h.

Referenced by getAlphaParms(), getMax(), lookupBoth(), lookupTable(), setDivs(), setMax(), setMin(), setTableA(), setupGate(), setupTables(), and updateTables().

double HHGate::xmin_
private

Minimum of the voltage (or conc) range.

Definition at line 205 of file HHGate.h.

Referenced by getAlphaParms(), getMin(), lookupBoth(), lookupTable(), setDivs(), setMax(), setMin(), setTableA(), setupGate(), setupTables(), and updateTables().


The documentation for this class was generated from the following files: