CMS 3D CMS Logo

ThirdOrderDelayODE.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <cassert>
4 
6 
7 void ThirdOrderDelayODE::calculate(const double tau, const double currentIn,
8  double /* dIdt */, double /* d2Id2t */,
9  const double* x, const unsigned lenX,
10  const unsigned firstNode,
11  double* derivative) const
12 {
13  // Check input sanity
14  if (lenX < firstNode + 3U) throw cms::Exception(
15  "In ThirdOrderDelayODE::calculate: insufficient number of variables");
16  if (tau <= 0.0) throw cms::Exception(
17  "In ThirdOrderDelayODE::calculate: delay time is not positive");
18  assert(x);
19  assert(derivative);
20 
21  derivative[firstNode] = x[firstNode+1];
22  derivative[firstNode+1] = x[firstNode+2];
23  derivative[firstNode+2] = 6.0/a_*(currentIn - x[firstNode] -
24  c_*tau*x[firstNode+1] -
25  b_/2.0*tau*tau*x[firstNode+2])/tau/tau/tau;
26 }
27 
28 void ThirdOrderDelayODE::setParameters(const double* pars, const unsigned nPars)
29 {
30  assert(nPars == 3U);
31  assert(pars);
32  a_ = exp(pars[0]);
33  b_ = exp(pars[1]);
34  c_ = exp(pars[2]);
35 }
Derivative< X, A >::type derivative(const A &_)
Definition: Derivative.h:18
void calculate(double tau, double inputCurrent, double dIdt, double d2Id2t, const double *x, unsigned lenX, unsigned firstNode, double *derivative) const
void setParameters(const double *pars, unsigned nPars)