 The open source CFD toolbox
polynomialFunction Class Reference

Polynomial function representation. More...

Inheritance diagram for polynomialFunction:
[legend]
Collaboration diagram for polynomialFunction:
[legend]

## Public Member Functions

TypeName ("polynomialFunction")
Runtime type information. More...

polynomialFunction ()
Default construct as size 1 with coefficient == 0. More...

polynomialFunction (const label order)
Construct a particular size, with all coefficients == 0. More...

polynomialFunction (std::initializer_list< scalar > coeffs)
Construct from an initializer list of coefficients. More...

polynomialFunction (const UList< scalar > &coeffs)
Construct from a list of coefficients. More...

polynomialFunction (Istream &is)
Construct from Istream. More...

virtual ~polynomialFunction ()=default
Destructor. More...

bool logActive () const
True if the log term is active. More...

scalar logCoeff () const
The log coefficient. More...

scalar value (const scalar x) const
Return polynomial value. More...

scalar integrate (const scalar x1, const scalar x2) const
Integrate between two values. More...

polynomialFunction integral (const scalar intConstant=0) const
Return integral coefficients. More...

polynomialFunction integralMinus1 (const scalar intConstant=0) const
Return integral coefficients when lowest order is -1. More...

bool operator== (const polynomialFunction &rhs) const
Equality of coefficients, and logCoeff (if active) More...

bool operator!= (const polynomialFunction &rhs) const

polynomialFunctionoperator+= (const polynomialFunction &)

polynomialFunctionoperator-= (const polynomialFunction &)

polynomialFunctionoperator*= (const scalar)

polynomialFunctionoperator/= (const scalar)

## Friends

Istreamoperator>> (Istream &, polynomialFunction &poly)

Ostreamoperator<< (Ostream &, const polynomialFunction &poly)

## Detailed Description

Polynomial function representation.

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


where  0 <= i <= N

• integer powers, starting at zero
• value(x) to evaluate the poly for a given value
• integrate(x1, x2) 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
Foam::Polynomial for a templated implementation
Source files

Definition at line 76 of file polynomialFunction.H.

## ◆ polynomialFunction() [1/5]

 polynomialFunction ( )

Default construct as size 1 with coefficient == 0.

Definition at line 99 of file polynomialFunction.C.

## ◆ polynomialFunction() [2/5]

 polynomialFunction ( const label order )
explicit

Construct a particular size, with all coefficients == 0.

Definition at line 107 of file polynomialFunction.C.

## ◆ polynomialFunction() [3/5]

 polynomialFunction ( std::initializer_list< scalar > coeffs )
explicit

Construct from an initializer list of coefficients.

Definition at line 118 of file polynomialFunction.C.

## ◆ polynomialFunction() [4/5]

 polynomialFunction ( const UList< scalar > & coeffs )
explicit

Construct from a list of coefficients.

Definition at line 130 of file polynomialFunction.C.

## ◆ polynomialFunction() [5/5]

 polynomialFunction ( Istream & is )
explicit

Construct from Istream.

Definition at line 140 of file polynomialFunction.C.

## ◆ ~polynomialFunction()

 virtual ~polynomialFunction ( )
virtualdefault

Destructor.

## ◆ TypeName()

 TypeName ( "polynomialFunction" )

Runtime type information.

## ◆ logActive()

 bool logActive ( ) const

True if the log term is active.

Definition at line 152 of file polynomialFunction.C.

## ◆ logCoeff()

 Foam::scalar logCoeff ( ) const

The log coefficient.

Definition at line 158 of file polynomialFunction.C.

## ◆ value()

 Foam::scalar value ( const scalar x ) const

Return polynomial value.

Definition at line 164 of file polynomialFunction.C.

References Foam::log(), and x.

Here is the call graph for this function:

## ◆ integrate()

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

Integrate between two values.

Definition at line 187 of file polynomialFunction.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Here is the call graph for this function:

## ◆ integral()

 Foam::polynomialFunction integral ( const scalar intConstant = 0 ) const

Return integral coefficients.

Argument becomes zeroth element (constant of integration)

Definition at line 218 of file polynomialFunction.C.

## ◆ integralMinus1()

 Foam::polynomialFunction integralMinus1 ( const scalar intConstant = 0 ) const

Return integral coefficients when lowest order is -1.

Argument becomes zeroth element (constant of integration)

Definition at line 225 of file polynomialFunction.C.

## ◆ operator==()

 bool operator== ( const polynomialFunction & rhs ) const

Equality of coefficients, and logCoeff (if active)

Definition at line 233 of file polynomialFunction.C.

Referenced by polynomialFunction::operator!=().

Here is the caller graph for this function:

## ◆ operator!=()

 bool operator!= ( const polynomialFunction & rhs ) const
inline

Definition at line 192 of file polynomialFunction.H.

References polynomialFunction::operator==().

Here is the call graph for this function:

## ◆ operator+=()

 Foam::polynomialFunction & operator+= ( const polynomialFunction & poly )

Definition at line 245 of file polynomialFunction.C.

References forAll, List< T >::resize(), and Foam::Zero.

Here is the call graph for this function:

## ◆ operator-=()

 Foam::polynomialFunction & operator-= ( const polynomialFunction & poly )

Definition at line 264 of file polynomialFunction.C.

References forAll, List< T >::resize(), and Foam::Zero.

Here is the call graph for this function:

## ◆ operator*=()

 Foam::polynomialFunction & operator*= ( const scalar s )

Definition at line 283 of file polynomialFunction.C.

References forAll, and s.

## ◆ operator/=()

 Foam::polynomialFunction & operator/= ( const scalar s )

Definition at line 296 of file polynomialFunction.C.

References forAll, and s.

## ◆ operator>>

 Istream& operator>> ( Istream & , polynomialFunction & poly )
friend

## ◆ operator<<

 Ostream& operator<< ( Ostream & , const polynomialFunction & poly )
friend

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