79 Func1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) : m_f1(f1), m_f2(f2) {}
81 Func1(shared_ptr<Func1> f1,
double A) : m_c(A), m_f1(f1) {}
83 virtual ~Func1() =
default;
90 virtual string type()
const {
102 virtual double eval(
double t)
const;
120 virtual bool isIdentical(shared_ptr<Func1> other)
const;
142 virtual string write(
const string& arg)
const;
160 virtual int order()
const;
164 shared_ptr<Func1> m_f1;
165 shared_ptr<Func1> m_f2;
170shared_ptr<Func1>
newSumFunction(shared_ptr<Func1> f1, shared_ptr<Func1> f2);
174shared_ptr<Func1>
newDiffFunction(shared_ptr<Func1> f1, shared_ptr<Func1> f2);
178shared_ptr<Func1>
newProdFunction(shared_ptr<Func1> f1, shared_ptr<Func1> f2);
182shared_ptr<Func1>
newRatioFunction(shared_ptr<Func1> f1, shared_ptr<Func1> f2);
206 Sin1(
double omega=1.0) {
211 Sin1(
const vector<double>& params);
213 string write(
const string& arg)
const override;
219 double eval(
double t)
const override{
223 shared_ptr<Func1>
derivative()
const override;
237 Cos1(
double omega=1.0) {
242 Cos1(
const vector<double>& params);
244 string write(
const string& arg)
const override;
250 double eval(
double t)
const override {
253 shared_ptr<Func1>
derivative()
const override;
271 Exp1(
const vector<double>& params);
273 string write(
const string& arg)
const override;
279 double eval(
double t)
const override {
283 shared_ptr<Func1>
derivative()
const override;
302 Log1(
const vector<double>& params);
308 double eval(
double t)
const override {
312 shared_ptr<Func1>
derivative()
const override;
314 string write(
const string& arg)
const override;
331 Pow1(
const vector<double>& params);
333 string write(
const string& arg)
const override;
339 double eval(
double t)
const override {
342 shared_ptr<Func1>
derivative()
const override;
365 Tabulated1(
size_t n,
const double* tvals,
const double* fvals,
366 const string& method=
"linear");
383 string write(
const string& arg)
const override;
387 return "tabulated-linear";
389 return "tabulated-previous";
392 double eval(
double t)
const override;
393 shared_ptr<Func1>
derivative()
const override;
415 Const1(
const vector<double>& params);
417 string write(
const string& arg)
const override;
423 double eval(
double t)
const override {
427 return make_shared<Const1>(0.0);
442 Sum1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) :
Func1(f1, f2) {}
448 double eval(
double t)
const override {
449 return m_f1->eval(t) + m_f2->eval(t);
460 string write(
const string& arg)
const override;
473 Diff1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) :
Func1(f1, f2) {}
479 double eval(
double t)
const override {
480 return m_f1->eval(t) - m_f2->eval(t);
491 string write(
const string& arg)
const override;
505 Product1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) :
Func1(f1, f2) {}
511 string write(
const string& arg)
const override;
513 double eval(
double t)
const override {
514 return m_f1->eval(t) * m_f2->eval(t);
517 shared_ptr<Func1>
derivative()
const override;
537 return "times-constant";
542 return (other.
c()/
c());
556 double eval(
double t)
const override {
557 return m_f1->eval(t) * m_c;
564 string write(
const string& arg)
const override;
584 return "plus-constant";
587 double eval(
double t)
const override {
588 return m_f1->eval(t) + m_c;
592 return m_f1->derivative();
595 string write(
const string& arg)
const override;
613 Ratio1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) :
Func1(f1, f2) {}
619 double eval(
double t)
const override {
620 return m_f1->eval(t) / m_f2->eval(t);
623 shared_ptr<Func1>
derivative()
const override;
625 string write(
const string& arg)
const override;
642 Composite1(shared_ptr<Func1> f1, shared_ptr<Func1> f2) :
Func1(f1, f2) {}
648 double eval(
double t)
const override {
649 return m_f1->eval(m_f2->eval(t));
652 shared_ptr<Func1>
derivative()
const override;
654 string write(
const string& arg)
const override;
680 Gaussian1(
double A,
double t0,
double fwhm) {
683 m_tau = fwhm/(2.0*std::sqrt(std::log(2.0)));
698 double eval(
double t)
const override {
699 double x = (t - m_t0)/m_tau;
700 return m_A * std::exp(-x*x);
704 double m_A, m_t0, m_tau;
727 Poly13(
size_t n,
const double*
c) {
729 std::copy(
c,
c+m_cpoly.size(), m_cpoly.begin());
734 Poly13(
const vector<double>& params);
737 return "polynomial3";
744 double eval(
double t)
const override {
745 double r = m_cpoly[0];
746 for (
size_t n = 1; n < m_cpoly.size(); n++) {
753 string write(
const string& arg)
const override;
756 vector<double> m_cpoly;
771 Fourier1(
size_t n,
double omega,
double a0,
const double* a,
const double* b) {
776 std::copy(a, a+n, m_ccos.begin());
777 std::copy(b, b+n, m_csin.begin());
782 Fourier1(
const vector<double>& params);
792 double eval(
double t)
const override {
795 for (n = 0; n < m_ccos.size(); n++) {
797 sum += m_ccos[n]*std::cos(m_omega*nn*t)
798 + m_csin[n]*std::sin(m_omega*nn*t);
804 double m_omega, m_a0_2;
805 vector<double> m_ccos, m_csin;
824 for (
size_t i = 0; i < n; i++) {
844 double eval(
double t)
const override {
846 for (
size_t n = 0; n < m_A.size(); n++) {
847 sum += m_A[n]*std::pow(t,m_b[n])*std::exp(-m_E[n]/t);
853 vector<double> m_A, m_b, m_E;
872 double eval(
double t)
const override {
874 double time = t - np*m_c;
875 return m_f1->eval(time);
Implements a sum of Arrhenius terms.
double eval(double t) const override
Evaluate the function.
string type() const override
Returns a string describing the type of the function.
bool isIdentical(shared_ptr< Func1 > other) const override
Routine to determine if two functions are the same.
Implements a composite function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
string write(const string &arg) const override
Write LaTeX string describing function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the cos() function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the difference of two functions.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the exp() (exponential) function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements a Fourier cosine/sine series.
double eval(double t) const override
Evaluate the function.
string type() const override
Returns a string describing the type of the function.
bool isIdentical(shared_ptr< Func1 > other) const override
Routine to determine if two functions are the same.
Base class for 'functor' classes that evaluate a function of one variable.
string typeName() const
Returns a string with the class name of the functor.
virtual shared_ptr< Func1 > derivative() const
Creates a derivative to the current function.
virtual string type() const
Returns a string describing the type of the function.
virtual double eval(double t) const
Evaluate the function.
shared_ptr< Func1 > func1_shared() const
Accessor function for m_f1.
virtual double isProportional(TimesConstant1 &other)
virtual string write(const string &arg) const
Write LaTeX string describing function.
double operator()(double t) const
Calls method eval to evaluate the function.
virtual bool isIdentical(shared_ptr< Func1 > other) const
Routine to determine if two functions are the same.
virtual int order() const
Return the order of the function, if it makes sense.
shared_ptr< Func1 > func2_shared() const
Accessor function for m_f2.
double c() const
Accessor function for the stored constant m_c.
Implements a Gaussian function.
double eval(double t) const override
Evaluate the function.
string type() const override
Returns a string describing the type of the function.
bool isIdentical(shared_ptr< Func1 > other) const override
Routine to determine if two functions are the same.
Implements the log() (natural logarithm) function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements a periodic function.
double eval(double t) const override
Evaluate the function.
string type() const override
Returns a string describing the type of the function.
Implements the sum of a function and a constant.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements a polynomial of degree n.
double eval(double t) const override
Evaluate the function.
string type() const override
Returns a string describing the type of the function.
bool isIdentical(shared_ptr< Func1 > other) const override
Routine to determine if two functions are the same.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the pow() (power) function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the product of two functions.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the ratio of two functions.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the sin() function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements the sum of two functions.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
string write(const string &arg) const override
Write LaTeX string describing function.
Implements a tabulated function.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
bool isIdentical(shared_ptr< Func1 > other) const override
Routine to determine if two functions are the same.
string write(const string &arg) const override
Write LaTeX string describing function.
void setMethod(const string &method)
Set the interpolation method.
vector< double > m_tvec
Vector of time values.
bool m_isLinear
Boolean indicating interpolation method.
vector< double > m_fvec
Vector of function values.
Implements the product of a function and a constant.
double eval(double t) const override
Evaluate the function.
shared_ptr< Func1 > derivative() const override
Creates a derivative to the current function.
string type() const override
Returns a string describing the type of the function.
int order() const override
Return the order of the function, if it makes sense.
double isProportional(Func1 &other) override
string write(const string &arg) const override
Write LaTeX string describing function.
double isProportional(TimesConstant1 &other) override
This file contains definitions of constants, types and terms that are used in internal routines and a...
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
shared_ptr< Func1 > newCompositeFunction(shared_ptr< Func1 > f1, shared_ptr< Func1 > f2)
Composite of two functions.
shared_ptr< Func1 > newProdFunction(shared_ptr< Func1 > f1, shared_ptr< Func1 > f2)
Product of two functions.
shared_ptr< Func1 > newDiffFunction(shared_ptr< Func1 > f1, shared_ptr< Func1 > f2)
Difference of two functions.
shared_ptr< Func1 > newTimesConstFunction(shared_ptr< Func1 > f, double c)
Product of function and constant.
shared_ptr< Func1 > newSumFunction(shared_ptr< Func1 > f1, shared_ptr< Func1 > f2)
Sum of two functions.
shared_ptr< Func1 > newRatioFunction(shared_ptr< Func1 > f1, shared_ptr< Func1 > f2)
Ratio of two functions.
shared_ptr< Func1 > newPlusConstFunction(shared_ptr< Func1 > f, double c)
Sum of function and constant.
Namespace for the Cantera kernel.