Loading...
Searching...
No Matches
Polynomial< PolySize > Class Template Reference

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

#include <Polynomial.H>

Inheritance diagram for Polynomial< PolySize >:
Collaboration diagram for Polynomial< PolySize >:

Public Types

typedef Polynomial< PolySize > polyType
typedef Polynomial< PolySize+1 > intPolyType
Public Types inherited from VectorSpace< Polynomial< PolySize >, scalar, PolySize >
typedef VectorSpace< Polynomial< PolySize >, scalar, Ncmpts > vsType
 VectorSpace type.
typedef scalar cmptType
 Component type.
typedef scalar magType
 Magnitude type.
typedef direction size_type
 The type to represent the size of a VectorSpace.
typedef scalar * iterator
 Random access iterator for traversing VectorSpace.
typedef const scalar * const_iterator
 Random access iterator for traversing VectorSpace.

Public Member Functions

 Polynomial ()
 Default construct, with all coefficients = 0.
 Polynomial (std::initializer_list< scalar > coeffs)
 Construct from an initializer list of coefficients.
 Polynomial (const scalar coeffs[PolySize])
 Construct from C-array of coefficients.
 Polynomial (const UList< scalar > &coeffs)
 Construct from a list of coefficients.
 Polynomial (Istream &is)
 Construct from Istream.
 Polynomial (const word &name, Istream &is)
 Construct from name and Istream.
bool logActive () const noexcept
 Return true if the log term is active.
scalar logCoeff () const noexcept
 Return the log coefficient.
scalar value (const scalar x) const
 Return polynomial value.
scalar derivative (const scalar x) const
 Return derivative of the polynomial at the given x.
scalar integral (const scalar x1, const scalar x2) const
 Return integral between two values.
intPolyType integral (const scalar intConstant=0.0) const
 Return integral coefficients.
polyType integralMinus1 (const scalar intConstant=0.0) const
 Return integral coefficients when lowest order is -1.
Public Member Functions inherited from VectorSpace< Polynomial< PolySize >, scalar, PolySize >
const Foam::VectorSpace< Polynomial< PolySize >, scalar, Ncmpts >::template ConstBlock< SubVector, BStart > block () const
 VectorSpace ()=default
 Default construct.
const scalar & component (const direction) const
void replace (const direction, const scalar &)
const scalar * cdata () const noexcept
 Return const pointer to the first data element.
scalar * data () noexcept
 Return pointer to the first data element.
void fill (const scalar &s)
 Assign all components to given value.
const scalar & operator[] (const direction) const
void operator= (const VectorSpace< Polynomial< PolySize >, scalar, Ncmpts > &)
void operator+= (const VectorSpace< Polynomial< PolySize >, scalar, Ncmpts > &)
void operator-= (const VectorSpace< Polynomial< PolySize >, scalar, Ncmpts > &)
void operator*= (const scalar)
void operator/= (const scalar)
iterator begin () noexcept
 Return an iterator (pointer) to begin of VectorSpace.
const_iterator cbegin () const noexcept
 Return const_iterator (const pointer) to begin of VectorSpace.
iterator end () noexcept
 Return an iterator (pointer) to end of VectorSpace.
const_iterator cend () const noexcept
 Return const_iterator (const pointer) to end of VectorSpace.

Additional Inherited Members

Static Public Member Functions inherited from VectorSpace< Polynomial< PolySize >, scalar, PolySize >
static constexpr direction size () noexcept
 The number of elements in the VectorSpace = Ncmpts.
static Polynomial< PolySize > uniform (const scalar &s)
 Return a VectorSpace with all elements = s.
Public Attributes inherited from VectorSpace< Polynomial< PolySize >, scalar, PolySize >
scalar v_ [Ncmpts]
 The components of this vector space.
Static Public Attributes inherited from VectorSpace< Polynomial< PolySize >, scalar, PolySize >
static constexpr direction dim
 Dimensionality of space.
static constexpr direction nComponents
 Number of components in this vector space.
static constexpr direction mRows
static constexpr direction nCols
static const char *const typeName
static const char *const componentNames []
static const Polynomial< PolySize > zero
static const Polynomial< PolySize > one
static const Polynomial< PolySize > max
static const Polynomial< PolySize > min
static const Polynomial< PolySize > rootMax
static const Polynomial< PolySize > rootMin

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 71 of file Polynomial.H.

Member Typedef Documentation

◆ polyType

template<int PolySize>
typedef Polynomial<PolySize> polyType

Definition at line 94 of file Polynomial.H.

◆ intPolyType

template<int PolySize>
typedef Polynomial<PolySize+1> intPolyType

Definition at line 95 of file Polynomial.H.

Constructor & Destructor Documentation

◆ Polynomial() [1/6]

template<int PolySize>
Polynomial ( )

Default construct, with all coefficients = 0.

Definition at line 27 of file Polynomial.C.

References Polynomial(), VectorSpace< Polynomial< PolySize >, scalar, PolySize >::VectorSpace(), and Foam::Zero.

Referenced by Polynomial(), Polynomial(), Polynomial(), Polynomial(), and Polynomial().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Polynomial() [2/6]

template<int PolySize>
Polynomial ( std::initializer_list< scalar > coeffs)

Construct from an initializer list of coefficients.

Definition at line 36 of file Polynomial.C.

References for(), Polynomial(), VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_, and VectorSpace< Polynomial< PolySize >, scalar, PolySize >::VectorSpace().

Here is the call graph for this function:

◆ Polynomial() [3/6]

template<int PolySize>
Polynomial ( const scalar coeffs[PolySize])
explicit

Construct from C-array of coefficients.

Definition at line 60 of file Polynomial.C.

References Polynomial(), VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_, and VectorSpace< Polynomial< PolySize >, scalar, PolySize >::VectorSpace().

Here is the call graph for this function:

◆ Polynomial() [4/6]

template<int PolySize>
Polynomial ( const UList< scalar > & coeffs)
explicit

Construct from a list of coefficients.

Definition at line 74 of file Polynomial.C.

References for(), Polynomial(), UList< T >::size(), VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_, and VectorSpace< Polynomial< PolySize >, scalar, PolySize >::VectorSpace().

Here is the call graph for this function:

◆ Polynomial() [5/6]

template<int PolySize>
Polynomial ( Istream & is)
explicit

Construct from Istream.

Definition at line 96 of file Polynomial.C.

References Polynomial(), and VectorSpace< Polynomial< PolySize >, scalar, PolySize >::VectorSpace().

Here is the call graph for this function:

◆ Polynomial() [6/6]

template<int PolySize>
Polynomial ( const word & name,
Istream & is )

Construct from name and Istream.

Definition at line 105 of file Polynomial.C.

References Foam::name().

Here is the call graph for this function:

Member Function Documentation

◆ logActive()

template<int PolySize>
bool logActive ( ) const
noexcept

Return true if the log term is active.

Definition at line 131 of file Polynomial.C.

References Foam::noexcept.

◆ logCoeff()

template<int PolySize>
Foam::scalar logCoeff ( ) const
noexcept

Return the log coefficient.

Definition at line 138 of file Polynomial.C.

References Foam::noexcept.

◆ value()

template<int PolySize>
Foam::scalar value ( const scalar x) const

Return polynomial value.

Definition at line 145 of file Polynomial.C.

References x.

◆ derivative()

template<int PolySize>
Foam::scalar derivative ( const scalar x) const

Return derivative of the polynomial at the given x.

Definition at line 167 of file Polynomial.C.

References VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_, and x.

◆ integral() [1/2]

template<int PolySize>
Foam::scalar integral ( const scalar x1,
const scalar x2 ) const

Return integral between two values.

Definition at line 194 of file Polynomial.C.

References Foam::log(), and VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_.

Here is the call graph for this function:

◆ integral() [2/2]

template<int PolySize>
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 223 of file Polynomial.C.

References forAll, and VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_.

◆ integralMinus1()

template<int PolySize>
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 239 of file Polynomial.C.

References VectorSpace< Polynomial< PolySize >, scalar, PolySize >::v_.


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