Polynomial< PolySize > Class Template Reference

Polynomial templated on size (order): More...

Inheritance diagram for Polynomial< PolySize >:
[legend]

Public Types

typedef Polynomial< PolySize > polyType
 
typedef Polynomial< PolySize+1 > intPolyType
 

Public Member Functions

 Polynomial ()
 Default construct, with all coefficients = 0. More...
 
 Polynomial (std::initializer_list< scalar > coeffs)
 Construct from an initializer list of coefficients. More...
 
 Polynomial (const scalar coeffs[PolySize])
 Construct from C-array of coefficients. More...
 
 Polynomial (const UList< scalar > &coeffs)
 Construct from a list of coefficients. More...
 
 Polynomial (Istream &is)
 Construct from Istream. More...
 
 Polynomial (const word &name, Istream &is)
 Construct from name and Istream. More...
 
bool logActive () const
 Return true if the log term is active. More...
 
scalar logCoeff () const
 Return the log coefficient. More...
 
scalar value (const scalar x) const
 Return polynomial value. More...
 
scalar derivative (const scalar x) const
 Return derivative of the polynomial at the given x. More...
 
scalar integral (const scalar x1, const scalar x2) const
 Return integral between two values. More...
 
intPolyType integral (const scalar intConstant=0.0) const
 Return integral coefficients. More...
 
polyType integralMinus1 (const scalar intConstant=0.0) const
 Return integral coefficients when lowest order is -1. More...
 

Detailed Description

template<int PolySize>
class Foam::Polynomial< PolySize >

Polynomial templated on size (order):

    poly = sum(coeffs[i]*x^i) + logCoeff*log(x)

where 0 <= i <= N

  • integer powers, starting at zero
  • value(x) to evaluate the poly for a given value
  • derivative(x) returns derivative at value
  • integral(x1, x2) returns integral between two scalar values
  • integral() to return a new, integral coeff polynomial
    • increases the size (order)
  • integralMinus1() to return a new, integral coeff polynomial where the base poly starts at order -1
Source files

Definition at line 68 of file Polynomial.H.

Member Typedef Documentation

◆ polyType

typedef Polynomial<PolySize> polyType

Definition at line 94 of file Polynomial.H.

◆ intPolyType

typedef Polynomial<PolySize+1> intPolyType

Definition at line 95 of file Polynomial.H.

Constructor & Destructor Documentation

◆ Polynomial() [1/6]

Default construct, with all coefficients = 0.

Definition at line 34 of file Polynomial.C.

◆ Polynomial() [2/6]

Polynomial ( std::initializer_list< scalar >  coeffs)

Construct from an initializer list of coefficients.

Definition at line 43 of file Polynomial.C.

◆ Polynomial() [3/6]

Polynomial ( const scalar  coeffs[PolySize])
explicit

Construct from C-array of coefficients.

Definition at line 67 of file Polynomial.C.

◆ Polynomial() [4/6]

Polynomial ( const UList< scalar > &  coeffs)
explicit

Construct from a list of coefficients.

Definition at line 81 of file Polynomial.C.

◆ Polynomial() [5/6]

Polynomial ( Istream is)
explicit

Construct from Istream.

Definition at line 103 of file Polynomial.C.

◆ Polynomial() [6/6]

Polynomial ( const word name,
Istream is 
)

Construct from name and Istream.

Definition at line 112 of file Polynomial.C.

Member Function Documentation

◆ logActive()

bool logActive ( ) const

Return true if the log term is active.

Definition at line 138 of file Polynomial.C.

◆ logCoeff()

Foam::scalar logCoeff ( ) const

Return the log coefficient.

Definition at line 145 of file Polynomial.C.

◆ value()

Foam::scalar value ( const scalar  x) const

Return polynomial value.

Definition at line 152 of file Polynomial.C.

◆ derivative()

Foam::scalar derivative ( const scalar  x) const

Return derivative of the polynomial at the given x.

Definition at line 174 of file Polynomial.C.

◆ integral() [1/2]

Foam::scalar integral ( const scalar  x1,
const scalar  x2 
) const

Return integral between two values.

Definition at line 202 of file Polynomial.C.

◆ integral() [2/2]

Foam::Polynomial< PolySize >::intPolyType integral ( const scalar  intConstant = 0.0) const

Return integral coefficients.

Argument becomes zero'th element (constant of integration)

Definition at line 230 of file Polynomial.C.

◆ integralMinus1()

Foam::Polynomial< PolySize >::polyType integralMinus1 ( const scalar  intConstant = 0.0) const

Return integral coefficients when lowest order is -1.

Argument becomes zero'th element (constant of integration)

Definition at line 246 of file Polynomial.C.


The documentation for this class was generated from the following files: