18 const int FourierFuncType = 1;
19 const int PolyFuncType = 2;
20 const int ArrheniusFuncType = 3;
21 const int GaussianFuncType = 4;
22 const int SumFuncType = 20;
23 const int DiffFuncType = 25;
24 const int ProdFuncType = 30;
25 const int RatioFuncType = 40;
26 const int PeriodicFuncType = 50;
27 const int CompositeFuncType = 60;
28 const int TimesConstantFuncType = 70;
29 const int PlusConstantFuncType = 80;
30 const int SinFuncType = 100;
31 const int CosFuncType = 102;
32 const int ExpFuncType = 104;
33 const int PowFuncType = 106;
34 const int ConstFuncType = 110;
59 virtual int ID()
const;
65 virtual doublereal
eval(doublereal t)
const;
83 virtual doublereal isProportional(
Func1& other);
85 virtual std::string write(
const std::string& arg)
const;
91 void setC(doublereal
c);
100 virtual int order()
const;
102 Func1& func1_dup()
const;
104 Func1& func2_dup()
const;
106 Func1* parent()
const;
108 void setParent(
Func1* p);
123 Func1& newTimesConstFunction(
Func1& f1, doublereal c);
124 Func1& newPlusConstFunction(
Func1& f1, doublereal c);
133 Sin1(doublereal omega = 1.0) :
142 Sin1& operator=(
const Sin1& right) {
143 if (&right ==
this) {
146 Func1::operator=(right);
152 return (
Func1&) *nfunc;
155 virtual std::string write(
const std::string& arg)
const;
157 virtual int ID()
const {
161 virtual doublereal
eval(doublereal t)
const {
172 Cos1(doublereal omega = 1.0) :
181 Cos1& operator=(
const Cos1& right) {
182 if (&right ==
this) {
185 Func1::operator=(right);
191 return (
Func1&) *nfunc;
193 virtual std::string write(
const std::string& arg)
const;
194 virtual int ID()
const {
197 virtual doublereal
eval(doublereal t)
const {
207 Exp1(doublereal A = 1.0) :
215 Exp1& operator=(
const Exp1& right) {
216 if (&right ==
this) {
219 Func1::operator=(right);
222 virtual std::string write(
const std::string& arg)
const;
223 virtual int ID()
const {
227 return *(
new Exp1(m_c));
229 virtual doublereal
eval(doublereal t)
const {
248 Pow1& operator=(
const Pow1& right) {
249 if (&right ==
this) {
252 Func1::operator=(right);
255 virtual std::string write(
const std::string& arg)
const;
256 virtual int ID()
const {
260 return *(
new Pow1(m_c));
262 virtual doublereal
eval(doublereal t)
const {
284 if (&right ==
this) {
287 Func1::operator=(right);
291 virtual std::string write(
const std::string& arg)
const;
292 virtual int ID()
const {
293 return ConstFuncType;
295 virtual doublereal
eval(doublereal t)
const {
299 return *(
new Const1(m_c));
319 m_f1->setParent(
this);
320 m_f2->setParent(
this);
330 *
this = Sum1::operator=(b);
333 Sum1& operator=(
const Sum1& right) {
334 if (&right ==
this) {
337 Func1::operator=(right);
340 m_f1->setParent(
this);
341 m_f2->setParent(
this);
346 virtual int ID()
const {
350 virtual doublereal
eval(doublereal t)
const {
351 return m_f1->
eval(t) + m_f2->
eval(t);
357 return newSumFunction(f1d, f2d);
363 return newSumFunction(d1, d2);
369 virtual std::string write(
const std::string& arg)
const;
382 m_f1->setParent(
this);
383 m_f2->setParent(
this);
393 *
this = Diff1::operator=(b);
397 if (&right ==
this) {
400 Func1::operator=(right);
403 m_f1->setParent(
this);
404 m_f2->setParent(
this);
409 virtual int ID()
const {
413 virtual doublereal
eval(doublereal t)
const {
414 return m_f1->
eval(t) - m_f2->
eval(t);
420 return newDiffFunction(f1d, f2d);
429 virtual std::string write(
const std::string& arg)
const;
443 m_f1->setParent(
this);
444 m_f2->setParent(
this);
454 *
this = Product1::operator=(b);
458 if (&right ==
this) {
461 Func1::operator=(right);
464 m_f1->setParent(
this);
465 m_f2->setParent(
this);
470 virtual int ID()
const {
477 return newProdFunction(f1d, f2d);
480 virtual std::string write(
const std::string& arg)
const;
482 virtual doublereal
eval(doublereal t)
const {
483 return m_f1->
eval(t) * m_f2->
eval(t);
489 return newSumFunction(a1, a2);
506 m_f1->setParent(
this);
515 *
this = TimesConstant1::operator=(b);
519 if (&right ==
this) {
522 Func1::operator=(right);
524 m_f1->setParent(
this);
528 virtual int ID()
const {
529 return TimesConstantFuncType;
540 return (other.
c()/
c());
546 virtual doublereal isProportional(Func1& other) {
554 virtual doublereal
eval(doublereal t)
const {
555 return m_f1->
eval(t) * m_c;
560 Func1* d = &newTimesConstFunction(f1d, m_c);
564 virtual std::string write(
const std::string& arg)
const;
581 m_f1->setParent(
this);
590 *
this = PlusConstant1::operator=(b);
594 if (&right ==
this) {
597 Func1::operator=(right);
599 m_f1->setParent(
this);
604 virtual int ID()
const {
605 return PlusConstantFuncType;
614 virtual doublereal
eval(doublereal t)
const {
615 return m_f1->
eval(t) + m_c;
620 virtual std::string write(
const std::string& arg)
const;
638 m_f1->setParent(
this);
639 m_f2->setParent(
this);
649 *
this = Ratio1::operator=(b);
653 if (&right ==
this) {
656 Func1::operator=(right);
659 m_f1->setParent(
this);
660 m_f2->setParent(
this);
665 virtual int ID()
const {
666 return RatioFuncType;
669 virtual doublereal
eval(doublereal t)
const {
670 return m_f1->
eval(t) / m_f2->
eval(t);
676 return newRatioFunction(f1d, f2d);
682 Func1& s = newDiffFunction(a1, a2);
684 return newRatioFunction(s, p);
687 virtual std::string write(
const std::string& arg)
const;
704 m_f1->setParent(
this);
705 m_f2->setParent(
this);
715 *
this = Composite1::operator=(b);
719 if (&right ==
this) {
722 Func1::operator=(right);
725 m_f1->setParent(
this);
726 m_f2->setParent(
this);
731 virtual int ID()
const {
732 return CompositeFuncType;
735 virtual doublereal
eval(doublereal t)
const {
742 return newCompositeFunction(f1d, f2d);
750 Func1* p = &newProdFunction(*d3, *d2);
754 virtual std::string write(
const std::string& arg)
const;
777 Gaussian(
double A,
double t0,
double fwhm) :
781 m_tau = fwhm/(2.0*std::sqrt(std::log(2.0)));
786 *
this = Gaussian::operator=(b);
790 if (&right ==
this) {
793 Func1::operator=(right);
803 return *((
Func1*)np);
806 virtual doublereal
eval(doublereal t)
const {
807 doublereal x = (t - m_t0)/m_tau;
808 return m_A * std::exp(-x*x);
812 doublereal m_A, m_t0, m_tau;
822 Poly1(
size_t n,
const double*
c) :
825 std::copy(
c,
c+m_cpoly.size(), m_cpoly.begin());
830 *
this = Poly1::operator=(b);
834 if (&right ==
this) {
837 Func1::operator=(right);
838 m_cpoly = right.m_cpoly;
845 return *((
Func1*)np);
848 virtual doublereal
eval(doublereal t)
const {
849 doublereal r = m_cpoly[m_cpoly.size()-1];
850 for (
size_t n = 1; n < m_cpoly.size(); n++) {
852 r += m_cpoly[m_cpoly.size() - n - 1];
873 Fourier1(
size_t n,
double omega,
double a0,
874 const double* a,
const double* b) :
880 std::copy(a, a+n, m_ccos.begin());
881 std::copy(b, b+n, m_csin.begin());
886 *
this = Fourier1::operator=(b);
890 if (&right ==
this) {
893 Func1::operator=(right);
894 m_omega = right.m_omega;
895 m_a0_2 = right.m_a0_2;
896 m_ccos = right.m_ccos;
897 m_csin = right.m_csin;
904 return *((
Func1*)np);
907 virtual doublereal
eval(doublereal t)
const {
909 doublereal sum = m_a0_2;
910 for (n = 0; n < m_ccos.size(); n++) {
912 sum += m_ccos[n]*std::cos(m_omega*nn*t)
913 + m_csin[n]*std::sin(m_omega*nn*t);
919 doublereal m_omega, m_a0_2;
938 for (
size_t i = 0; i < n; i++) {
948 *
this = Arrhenius1::operator=(b);
952 if (&right ==
this) {
955 Func1::operator=(right);
965 return *((
Func1*)np);
968 virtual doublereal
eval(doublereal t)
const {
969 doublereal sum = 0.0;
970 for (
size_t n = 0; n < m_A.size(); n++) {
971 sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t);
994 *
this = Periodic1::operator=(b);
998 if (&right ==
this) {
1001 Func1::operator=(right);
1008 return *((
Func1*)np);
1015 virtual doublereal
eval(doublereal t)
const {
1016 int np = int(t/m_c);
1017 doublereal time = t - np*m_c;
1018 return m_func->
eval(time);
A function plus a constant.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual doublereal eval(doublereal t) const
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.
Product of two functions.
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 doublereal eval(doublereal t) const
Evaluate the function.
bool isIdentical(Func1 &other) const
Routine to determine if two functions are the same.
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.
doublereal operator()(doublereal t) const
Calls method eval to 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.
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.
This file contains definitions of terms that are used in internal routines and are unlikely to need m...
doublereal c() const
accessor function for the stored constant
virtual doublereal eval(doublereal t) const
Evaluate the function.
virtual int order() const
Return the order of the function, if it makes sense.
virtual doublereal eval(doublereal t) const
Evaluate the function.
implements the sin() function
virtual Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual doublereal eval(doublereal t) const
Evaluate the function.
Difference of two functions.
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.
virtual doublereal eval(doublereal t) const
Evaluate the function.
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 & 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.
void setC(doublereal c)
Function to set the stored constant.
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 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 Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
Func1 & func1() const
accessor function for m_f1
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 Func1 & duplicate() const
Duplicate the current function.
Func1 & func2() const
accessor function for m_f2
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 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.
Product of two functions.
virtual doublereal eval(doublereal t) const
Evaluate the function.
Namespace for the Cantera kernel.
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 Func1 & duplicate() const
Duplicate the current function.
virtual Func1 & derivative() const
Creates a derivative to the current function.
virtual Func1 & duplicate() const
Duplicate the current function.
virtual int order() const
Return the order of the function, if it makes sense.