Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
Polynomial Class Reference

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

Inheritance diagram for Polynomial:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

 Polynomial ()
 Construct null, with all coefficients = 0.0. More...
 
 Polynomial (const Polynomial &)
 Copy constructor. 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 &)
 Construct from Istream. More...
 
 Polynomial (const word &name, Istream &)
 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...
 

Private Member Functions

 StaticAssert (PolySize > 0)
 Size must be positive (non-zero) More...
 

Private Attributes

bool logActive_
 Include the log term? - only activated using integralMinus1() More...
 
scalar logCoeff_
 Log coefficient - only activated using integralMinus1() More...
 

Friends

Ostreamoperator (Ostream &, const Polynomial &)
 Ostream Operator. More...
 

Detailed Description

Polynomial templated on size (order):

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

where 0 <= i <= N

Source files

Definition at line 63 of file Polynomial.H.

Member Typedef Documentation

◆ polyType

Definition at line 97 of file Polynomial.H.

◆ intPolyType

Definition at line 99 of file Polynomial.H.

Constructor & Destructor Documentation

◆ Polynomial() [1/6]

Construct null, with all coefficients = 0.0.

Definition at line 31 of file Polynomial.C.

◆ Polynomial() [2/6]

Polynomial ( const Polynomial )

Copy constructor.

◆ Polynomial() [3/6]

Polynomial ( const scalar  coeffs[PolySize])
explicit

Construct from C-array of coefficients.

Definition at line 57 of file Polynomial.C.

◆ Polynomial() [4/6]

Polynomial ( const UList< scalar > &  coeffs)
explicit

Construct from a list of coefficients.

Definition at line 71 of file Polynomial.C.

◆ Polynomial() [5/6]

Construct from Istream.

◆ Polynomial() [6/6]

Polynomial ( const word name,
Istream  
)

Construct from name and Istream.

Member Function Documentation

◆ StaticAssert()

StaticAssert ( PolySize  ,
 
)
private

Size must be positive (non-zero)

◆ logActive()

bool logActive ( ) const

Return true if the log term is active.

Definition at line 132 of file Polynomial.C.

◆ logCoeff()

Foam::scalar logCoeff ( ) const

Return the log coefficient.

Definition at line 139 of file Polynomial.C.

◆ value()

Foam::scalar value ( const scalar  x) const

Return polynomial value.

Definition at line 146 of file Polynomial.C.

Referenced by main().

Here is the caller graph for this function:

◆ derivative()

Foam::scalar derivative ( const scalar  x) const

Return derivative of the polynomial at the given x.

Definition at line 168 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 196 of file Polynomial.C.

◆ integral() [2/2]

intPolyType integral ( const scalar  intConstant = 0.0) const

Return integral coefficients.

Argument becomes zero'th element (constant of integration)

◆ 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 240 of file Polynomial.C.

Friends And Related Function Documentation

◆ operator

Ostream& operator ( Ostream ,
const Polynomial  
)
friend

Ostream Operator.

Field Documentation

◆ logActive_

bool logActive_
private

Include the log term? - only activated using integralMinus1()

Definition at line 89 of file Polynomial.H.

Referenced by Polynomial< 8 >::integralMinus1().

◆ logCoeff_

scalar logCoeff_
private

Log coefficient - only activated using integralMinus1()

Definition at line 92 of file Polynomial.H.

Referenced by Polynomial< 8 >::integralMinus1().


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