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;
59 virtual int ID()
const;
65 virtual doublereal
eval(doublereal t)
const;
84 virtual doublereal isProportional(
Func1& other);
86 virtual std::string write(
const std::string& arg)
const;
93 void setC(doublereal c);
102 virtual int order()
const;
105 Func1& func1_dup()
const;
108 Func1& func2_dup()
const;
110 Func1* parent()
const;
113 void setParent(
Func1* p);
128 Func1& newTimesConstFunction(
Func1& f1, doublereal c);
129 Func1& newPlusConstFunction(
Func1& f1, doublereal c);
139 Sin1(doublereal omega = 1.0) :
148 Sin1& operator=(
const Sin1& right) {
149 if (&right ==
this) {
152 Func1::operator=(right);
158 return (
Func1&) *nfunc;
161 virtual std::string write(
const std::string& arg)
const;
163 virtual int ID()
const {
167 virtual doublereal
eval(doublereal t)
const {
178 Cos1(doublereal omega = 1.0) :
187 Cos1& operator=(
const Cos1& right) {
188 if (&right ==
this) {
191 Func1::operator=(right);
197 return (
Func1&) *nfunc;
199 virtual std::string write(
const std::string& arg)
const;
200 virtual int ID()
const {
203 virtual doublereal
eval(doublereal t)
const {
215 Exp1(doublereal A = 1.0) :
223 Exp1& operator=(
const Exp1& right) {
224 if (&right ==
this) {
227 Func1::operator=(right);
230 virtual std::string write(
const std::string& arg)
const;
231 virtual int ID()
const {
235 return *(
new Exp1(m_c));
237 virtual doublereal
eval(doublereal t)
const {
259 Pow1& operator=(
const Pow1& right) {
260 if (&right ==
this) {
263 Func1::operator=(right);
266 virtual std::string write(
const std::string& arg)
const;
267 virtual int ID()
const {
271 return *(
new Pow1(m_c));
273 virtual doublereal
eval(doublereal t)
const {
298 if (&right ==
this) {
301 Func1::operator=(right);
305 virtual std::string write(
const std::string& arg)
const;
306 virtual int ID()
const {
307 return ConstFuncType;
309 virtual doublereal
eval(doublereal t)
const {
313 return *(
new Const1(m_c));
334 m_f1->setParent(
this);
335 m_f2->setParent(
this);
345 *
this = Sum1::operator=(b);
348 Sum1& operator=(
const Sum1& right) {
349 if (&right ==
this) {
352 Func1::operator=(right);
355 m_f1->setParent(
this);
356 m_f2->setParent(
this);
361 virtual int ID()
const {
365 virtual doublereal
eval(doublereal t)
const {
366 return m_f1->
eval(t) + m_f2->
eval(t);
372 return newSumFunction(f1d, f2d);
378 return newSumFunction(d1, d2);
384 virtual std::string write(
const std::string& arg)
const;
397 m_f1->setParent(
this);
398 m_f2->setParent(
this);
408 *
this = Diff1::operator=(b);
412 if (&right ==
this) {
415 Func1::operator=(right);
418 m_f1->setParent(
this);
419 m_f2->setParent(
this);
424 virtual int ID()
const {
428 virtual doublereal
eval(doublereal t)
const {
429 return m_f1->
eval(t) - m_f2->
eval(t);
435 return newDiffFunction(f1d, f2d);
444 virtual std::string write(
const std::string& arg)
const;
459 m_f1->setParent(
this);
460 m_f2->setParent(
this);
470 *
this = Product1::operator=(b);
474 if (&right ==
this) {
477 Func1::operator=(right);
480 m_f1->setParent(
this);
481 m_f2->setParent(
this);
486 virtual int ID()
const {
493 return newProdFunction(f1d, f2d);
496 virtual std::string write(
const std::string& arg)
const;
498 virtual doublereal
eval(doublereal t)
const {
499 return m_f1->
eval(t) * m_f2->
eval(t);
505 return newSumFunction(a1, a2);
524 m_f1->setParent(
this);
533 *
this = TimesConstant1::operator=(b);
537 if (&right ==
this) {
540 Func1::operator=(right);
542 m_f1->setParent(
this);
546 virtual int ID()
const {
547 return TimesConstantFuncType;
558 return (other.
c()/
c());
564 virtual doublereal isProportional(Func1& other) {
572 virtual doublereal
eval(doublereal t)
const {
573 return m_f1->
eval(t) * m_c;
578 Func1* d = &newTimesConstFunction(f1d, m_c);
582 virtual std::string write(
const std::string& arg)
const;
600 m_f1->setParent(
this);
609 *
this = PlusConstant1::operator=(b);
613 if (&right ==
this) {
616 Func1::operator=(right);
618 m_f1->setParent(
this);
623 virtual int ID()
const {
624 return PlusConstantFuncType;
633 virtual doublereal
eval(doublereal t)
const {
634 return m_f1->
eval(t) + m_c;
639 virtual std::string write(
const std::string& arg)
const;
659 m_f1->setParent(
this);
660 m_f2->setParent(
this);
670 *
this = Ratio1::operator=(b);
674 if (&right ==
this) {
677 Func1::operator=(right);
680 m_f1->setParent(
this);
681 m_f2->setParent(
this);
686 virtual int ID()
const {
687 return RatioFuncType;
690 virtual doublereal
eval(doublereal t)
const {
691 return m_f1->
eval(t) / m_f2->
eval(t);
697 return newRatioFunction(f1d, f2d);
703 Func1& s = newDiffFunction(a1, a2);
705 return newRatioFunction(s, p);
708 virtual std::string write(
const std::string& arg)
const;
727 m_f1->setParent(
this);
728 m_f2->setParent(
this);
738 *
this = Composite1::operator=(b);
742 if (&right ==
this) {
745 Func1::operator=(right);
748 m_f1->setParent(
this);
749 m_f2->setParent(
this);
754 virtual int ID()
const {
755 return CompositeFuncType;
758 virtual doublereal
eval(doublereal t)
const {
765 return newCompositeFunction(f1d, f2d);
773 Func1* p = &newProdFunction(*d3, *d2);
777 virtual std::string write(
const std::string& arg)
const;
804 Gaussian(
double A,
double t0,
double fwhm) :
808 m_tau = fwhm/(2.0*std::sqrt(std::log(2.0)));
813 *
this = Gaussian::operator=(b);
817 if (&right ==
this) {
820 Func1::operator=(right);
830 return *((
Func1*)np);
833 virtual doublereal
eval(doublereal t)
const {
834 doublereal x = (t - m_t0)/m_tau;
835 return m_A * std::exp(-x*x);
839 doublereal m_A, m_t0, m_tau;
850 Poly1(
size_t n, doublereal*
c) :
854 std::copy(c, c+m_n, m_cpoly.begin());
859 *
this = Poly1::operator=(b);
863 if (&right ==
this) {
866 Func1::operator=(right);
867 m_cpoly = right.m_cpoly;
876 return *((
Func1*)np);
879 virtual doublereal
eval(doublereal t)
const {
880 doublereal r = m_cpoly[m_n-1];
881 for (
size_t n = 1; n < m_n; n++) {
883 r += m_cpoly[m_n - n - 1];
905 Fourier1(
size_t n, doublereal omega, doublereal a0,
906 doublereal* a, doublereal* b) :
913 std::copy(a, a+n, m_ccos.begin());
914 std::copy(b, b+n, m_csin.begin());
919 *
this = Fourier1::operator=(b);
923 if (&right ==
this) {
926 Func1::operator=(right);
927 m_omega = right.m_omega;
928 m_a0_2 = right.m_a0_2;
929 m_ccos = right.m_ccos;
930 m_csin = right.m_csin;
938 return *((
Func1*)np);
941 virtual doublereal
eval(doublereal t)
const {
943 doublereal sum = m_a0_2;
944 for (n = 0; n < m_n; n++) {
946 sum += m_ccos[n]*std::cos(m_omega*nn*t)
947 + m_csin[n]*std::sin(m_omega*nn*t);
954 doublereal m_omega, m_a0_2;
974 for (
size_t i = 0; i < n; i++) {
984 *
this = Arrhenius1::operator=(b);
988 if (&right ==
this) {
991 Func1::operator=(right);
1002 return *((
Func1*)np);
1005 virtual doublereal
eval(doublereal t)
const {
1006 doublereal sum = 0.0;
1007 for (
size_t n = 0; n < m_n; n++) {
1008 sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t);
1033 *
this = Periodic1::operator=(b);
1037 if (&right ==
this) {
1040 Func1::operator=(right);
1047 return *((
Func1*)np);
1054 virtual doublereal
eval(doublereal t)
const {
1055 int np = int(t/m_c);
1056 doublereal time = t - np*m_c;
1057 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.