17 const int FourierFuncType = 1;
18 const int PolyFuncType = 2;
19 const int ArrheniusFuncType = 3;
20 const int GaussianFuncType = 4;
21 const int SumFuncType = 20;
22 const int DiffFuncType = 25;
23 const int ProdFuncType = 30;
24 const int RatioFuncType = 40;
25 const int PeriodicFuncType = 50;
26 const int CompositeFuncType = 60;
27 const int TimesConstantFuncType = 70;
28 const int PlusConstantFuncType = 80;
29 const int SinFuncType = 100;
30 const int CosFuncType = 102;
31 const int ExpFuncType = 104;
32 const int PowFuncType = 106;
33 const int ConstFuncType = 110;
64 virtual int ID()
const;
70 virtual doublereal
eval(doublereal t)
const;
89 virtual doublereal isProportional(
Func1& other);
91 virtual std::string write(
const std::string& arg)
const;
98 void setC(doublereal c);
107 virtual int order()
const;
110 Func1& func1_dup()
const;
113 Func1& func2_dup()
const;
115 Func1* parent()
const;
118 void setParent(
Func1* p);
133 Func1& newTimesConstFunction(
Func1& f1, doublereal c);
134 Func1& newPlusConstFunction(
Func1& f1, doublereal c);
144 Sin1(doublereal omega = 1.0) :
153 Sin1& operator=(
const Sin1& right) {
154 if (&right ==
this) {
157 Func1::operator=(right);
163 return (
Func1&) *nfunc;
166 virtual std::string write(
const std::string& arg)
const;
168 virtual int ID()
const {
172 virtual doublereal
eval(doublereal t)
const {
183 Cos1(doublereal omega = 1.0) :
192 Cos1& operator=(
const Cos1& right) {
193 if (&right ==
this) {
196 Func1::operator=(right);
202 return (
Func1&) *nfunc;
204 virtual std::string write(
const std::string& arg)
const;
205 virtual int ID()
const {
208 virtual doublereal
eval(doublereal t)
const {
220 Exp1(doublereal A = 1.0) :
228 Exp1& operator=(
const Exp1& right) {
229 if (&right ==
this) {
232 Func1::operator=(right);
235 virtual std::string write(
const std::string& arg)
const;
236 virtual int ID()
const {
240 return *(
new Exp1(m_c));
242 virtual doublereal
eval(doublereal t)
const {
264 Pow1& operator=(
const Pow1& right) {
265 if (&right ==
this) {
268 Func1::operator=(right);
271 virtual std::string write(
const std::string& arg)
const;
272 virtual int ID()
const {
276 return *(
new Pow1(m_c));
278 virtual doublereal
eval(doublereal t)
const {
303 if (&right ==
this) {
306 Func1::operator=(right);
310 virtual std::string write(
const std::string& arg)
const;
311 virtual int ID()
const {
312 return ConstFuncType;
314 virtual doublereal
eval(doublereal t)
const {
318 return *(
new Const1(m_c));
339 m_f1->setParent(
this);
340 m_f2->setParent(
this);
350 *
this = Sum1::operator=(b);
353 Sum1& operator=(
const Sum1& right) {
354 if (&right ==
this) {
357 Func1::operator=(right);
360 m_f1->setParent(
this);
361 m_f2->setParent(
this);
366 virtual int ID()
const {
370 virtual doublereal
eval(doublereal t)
const {
371 return m_f1->
eval(t) + m_f2->
eval(t);
377 return newSumFunction(f1d, f2d);
383 return newSumFunction(d1, d2);
389 virtual std::string write(
const std::string& arg)
const;
402 m_f1->setParent(
this);
403 m_f2->setParent(
this);
413 *
this = Diff1::operator=(b);
417 if (&right ==
this) {
420 Func1::operator=(right);
423 m_f1->setParent(
this);
424 m_f2->setParent(
this);
429 virtual int ID()
const {
433 virtual doublereal
eval(doublereal t)
const {
434 return m_f1->
eval(t) - m_f2->
eval(t);
440 return newDiffFunction(f1d, f2d);
449 virtual std::string write(
const std::string& arg)
const;
464 m_f1->setParent(
this);
465 m_f2->setParent(
this);
475 *
this = Product1::operator=(b);
479 if (&right ==
this) {
482 Func1::operator=(right);
485 m_f1->setParent(
this);
486 m_f2->setParent(
this);
491 virtual int ID()
const {
498 return newProdFunction(f1d, f2d);
501 virtual std::string write(
const std::string& arg)
const;
503 virtual doublereal
eval(doublereal t)
const {
504 return m_f1->
eval(t) * m_f2->
eval(t);
510 return newSumFunction(a1, a2);
529 m_f1->setParent(
this);
538 *
this = TimesConstant1::operator=(b);
542 if (&right ==
this) {
545 Func1::operator=(right);
547 m_f1->setParent(
this);
551 virtual int ID()
const {
552 return TimesConstantFuncType;
563 return (other.
c()/
c());
569 virtual doublereal isProportional(Func1& other) {
577 virtual doublereal
eval(doublereal t)
const {
578 return m_f1->
eval(t) * m_c;
583 Func1* d = &newTimesConstFunction(f1d, m_c);
587 virtual std::string write(
const std::string& arg)
const;
605 m_f1->setParent(
this);
614 *
this = PlusConstant1::operator=(b);
618 if (&right ==
this) {
621 Func1::operator=(right);
623 m_f1->setParent(
this);
628 virtual int ID()
const {
629 return PlusConstantFuncType;
638 virtual doublereal
eval(doublereal t)
const {
639 return m_f1->
eval(t) + m_c;
644 virtual std::string write(
const std::string& arg)
const;
664 m_f1->setParent(
this);
665 m_f2->setParent(
this);
675 *
this = Ratio1::operator=(b);
679 if (&right ==
this) {
682 Func1::operator=(right);
685 m_f1->setParent(
this);
686 m_f2->setParent(
this);
691 virtual int ID()
const {
692 return RatioFuncType;
695 virtual doublereal
eval(doublereal t)
const {
696 return m_f1->
eval(t) / m_f2->
eval(t);
702 return newRatioFunction(f1d, f2d);
708 Func1& s = newDiffFunction(a1, a2);
710 return newRatioFunction(s, p);
713 virtual std::string write(
const std::string& arg)
const;
732 m_f1->setParent(
this);
733 m_f2->setParent(
this);
743 *
this = Composite1::operator=(b);
747 if (&right ==
this) {
750 Func1::operator=(right);
753 m_f1->setParent(
this);
754 m_f2->setParent(
this);
759 virtual int ID()
const {
760 return CompositeFuncType;
763 virtual doublereal
eval(doublereal t)
const {
770 return newCompositeFunction(f1d, f2d);
778 Func1* p = &newProdFunction(*d3, *d2);
782 virtual std::string write(
const std::string& arg)
const;
809 Gaussian(
double A,
double t0,
double fwhm) :
813 m_tau = fwhm/(2.0*std::sqrt(std::log(2.0)));
818 *
this = Gaussian::operator=(b);
822 if (&right ==
this) {
825 Func1::operator=(right);
835 return *((
Func1*)np);
838 virtual doublereal
eval(doublereal t)
const {
839 doublereal x = (t - m_t0)/m_tau;
840 return m_A * std::exp(-x*x);
844 doublereal m_A, m_t0, m_tau;
855 Poly1(
size_t n, doublereal*
c) :
859 std::copy(c, c+m_n, m_cpoly.begin());
864 *
this = Poly1::operator=(b);
868 if (&right ==
this) {
871 Func1::operator=(right);
872 m_cpoly = right.m_cpoly;
881 return *((
Func1*)np);
884 virtual doublereal
eval(doublereal t)
const {
885 doublereal r = m_cpoly[m_n-1];
886 for (
size_t n = 1; n < m_n; n++) {
888 r += m_cpoly[m_n - n - 1];
910 Fourier1(
size_t n, doublereal omega, doublereal a0,
911 doublereal* a, doublereal* b) :
918 std::copy(a, a+n, m_ccos.begin());
919 std::copy(b, b+n, m_csin.begin());
924 *
this = Fourier1::operator=(b);
928 if (&right ==
this) {
931 Func1::operator=(right);
932 m_omega = right.m_omega;
933 m_a0_2 = right.m_a0_2;
934 m_ccos = right.m_ccos;
935 m_csin = right.m_csin;
943 return *((
Func1*)np);
946 virtual doublereal
eval(doublereal t)
const {
948 doublereal sum = m_a0_2;
949 for (n = 0; n < m_n; n++) {
951 sum += m_ccos[n]*std::cos(m_omega*nn*t)
952 + m_csin[n]*std::sin(m_omega*nn*t);
959 doublereal m_omega, m_a0_2;
979 for (
size_t i = 0; i < n; i++) {
989 *
this = Arrhenius1::operator=(b);
993 if (&right ==
this) {
996 Func1::operator=(right);
1007 return *((
Func1*)np);
1010 virtual doublereal
eval(doublereal t)
const {
1011 doublereal sum = 0.0;
1012 for (
size_t n = 0; n < m_n; n++) {
1013 sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t);
1038 *
this = Periodic1::operator=(b);
1042 if (&right ==
this) {
1045 Func1::operator=(right);
1052 return *((
Func1*)np);
1059 virtual doublereal
eval(doublereal t)
const {
1060 int np = int(t/m_c);
1061 doublereal time = t - np*m_c;
1062 return m_func->
eval(time);
A function plus a constant.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual int order() const
Return the order of the function, if it makes sense.
Product of two functions.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
Fourier cosine/sine series.
Func1 & func2() const
accessor function for m_f2
virtual Func1 & duplicate() const
Duplicate the current function.
bool isIdentical(Func1 &other) const
Routine to determine if two functions are the same.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual int order() const
Return the order of the function, if it makes sense.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
implements the sin() function
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
Difference of two functions.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual int order() const
Return the order of the function, if it makes sense.
virtual doublereal eval(doublereal t) const
Evaluate the function.
doublereal c() const
accessor function for the stored constant
virtual doublereal eval(doublereal t) const
Evaluate the function.
Func1 & func1() const
accessor function for m_f1
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual int order() const
Return the order of the function, if it makes sense.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & duplicate() const
Duplicate the current function.
void setC(doublereal c)
Function to set the stored constant.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual int order() const
Return the order of the function, if it makes sense.
Base class for 'functor' classes that evaluate a function of one variable.
virtual int order() const
Return the order of the function, if it makes sense.
virtual int order() const
Return the order of the function, if it makes sense.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual int order() const
Return the order of the function, if it makes sense.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
Product of two functions.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
doublereal operator()(doublereal t) const
Calls method eval to evaluate the function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.