SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::helper::Polynomial_LD< Real, N > Class Template Reference

#include <Polynomial_LD.h>

A generic polynomial with N variables of type Real. A polynomial is a list composed of several monomials. More...

Detailed Description

template<typename Real, unsigned int N>
class sofa::helper::Polynomial_LD< Real, N >

A generic polynomial with N variables of type Real. A polynomial is a list composed of several monomials.

Public Attributes

unsigned int nbOfMonomial
 
MonomialsList listOfMonoMial
 

Public Member Functions

 Polynomial_LD ()
 Default constructor. More...
 
 Polynomial_LD (const Polynomial_LD< Real, N > &a)
 Copy constructor. More...
 
 Polynomial_LD (const Monomial_LD< Real, N > &a)
 
Polynomial_LD< Real, N > & operator= (const Polynomial_LD< Real, N > &b)
 Assign operator. More...
 
 Polynomial_LD (const unsigned int nbofTerm,...)
 setting of Polynomial More...
 
void Set (const unsigned int nbofTerm,...)
 
int degree ()
 
bool operator== (const Polynomial_LD< Real, N > &b) const
 Return true if a and b has the same powers. More...
 
bool operator!= (const Polynomial_LD< Real, N > &b) const
 
Polynomial_LD< Real, N > & operator*= (const Real &alpha)
 
Polynomial_LD< Real, N > & operator/= (const Real &alpha)
 
Polynomial_LD< Real, N > & operator+= (const Monomial_LD< Real, N > &b)
 
Polynomial_LD< Real, N > & operator+= (const Polynomial_LD< Real, N > &b)
 
Polynomial_LD< Real, N > & operator-= (const Polynomial_LD< Real, N > &b)
 
Polynomial_LD< Real, N > operator+ () const
 
Polynomial_LD< Real, N > operator- () const
 
Polynomial_LD< Real, N > & operator*= (const Polynomial_LD< Real, N > &b)
 
Polynomial_LD< Real, N > operator* (const Real &alpha)
 
Polynomial_LD< Real, N > operator/ (const Real &alpha)
 
Polynomial_LD< Real, N > operator+ (const Monomial_LD< Real, N > &a)
 
Polynomial_LD< Real, N > operator+ (const Polynomial_LD< Real, N > &a)
 
Polynomial_LD< Real, N > operator- (const Polynomial_LD< Real, N > &a)
 
Polynomial_LD< Real, N > operator* (const Polynomial_LD< Real, N > &a)
 
Real operator() (const RNpoint &x) const
 Evaluating. More...
 
Real operator() (const RNpoint &x, unsigned int idvar) const
 Evaluating first partial derivative by idvar-th variable. More...
 
Polynomial_LD< Real, N > d (const unsigned int &ideriv) const
 Evaluating partial derivative hight order by idvar-th variable in ideriv-th order. More...
 
void setnbOfMonomial (int m_nbofmonomial)
 
void writeToStream (std::ostream &stream) const
 
void readFromStream (std::istream &stream)
 
std::string getString () const
 
void sort ()
 

Protected Member Functions

void exchangeMonomial (unsigned int ithMono, unsigned int jthMono)
 The sort must be done after each constructor and each operation where monomials are inserted. More...
 
void sortByVar (unsigned int idVar)
 

Friends

template<typename FReal , unsigned int FN>
Polynomial_LD< FReal, FN > & operator* (const FReal &alpha, Polynomial_LD< FReal, FN > &r)
 
template<typename FReal , unsigned int FN>
Polynomial_LD< FReal, FN > & operator* (const Monomial_LD< FReal, FN > &a, Polynomial_LD< FReal, FN > &r)
 poly=poly+mono || mono + poly More...
 

Attribute details

◆ listOfMonoMial

template<typename Real , unsigned int N>
MonomialsList sofa::helper::Polynomial_LD< Real, N >::listOfMonoMial

◆ nbOfMonomial

template<typename Real , unsigned int N>
unsigned int sofa::helper::Polynomial_LD< Real, N >::nbOfMonomial

Constructor details

◆ Polynomial_LD() [1/4]

template<typename Real , unsigned int N>
sofa::helper::Polynomial_LD< Real, N >::Polynomial_LD

Default constructor.

◆ Polynomial_LD() [2/4]

template<typename Real , unsigned int N>
sofa::helper::Polynomial_LD< Real, N >::Polynomial_LD ( const Polynomial_LD< Real, N > &  a)

Copy constructor.

◆ Polynomial_LD() [3/4]

template<typename Real , unsigned int N>
sofa::helper::Polynomial_LD< Real, N >::Polynomial_LD ( const Monomial_LD< Real, N > &  a)

◆ Polynomial_LD() [4/4]

template<typename Real , unsigned int N>
sofa::helper::Polynomial_LD< Real, N >::Polynomial_LD ( const unsigned int  nbofTerm,
  ... 
)

setting of Polynomial

Function details

◆ d()

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > sofa::helper::Polynomial_LD< Real, N >::d ( const unsigned int &  ideriv) const

Evaluating partial derivative hight order by idvar-th variable in ideriv-th order.

Derivative operator allowing to write p1=p2.d(x);

◆ degree()

template<typename Real , unsigned int N>
int sofa::helper::Polynomial_LD< Real, N >::degree

◆ exchangeMonomial()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::exchangeMonomial ( unsigned int  ithMono,
unsigned int  jthMono 
)
protected

The sort must be done after each constructor and each operation where monomials are inserted.

◆ getString()

template<typename Real , unsigned int N>
std::string sofa::helper::Polynomial_LD< Real, N >::getString

◆ operator!=()

template<typename Real , unsigned int N>
bool sofa::helper::Polynomial_LD< Real, N >::operator!= ( const Polynomial_LD< Real, N > &  b) const
inline

◆ operator()() [1/2]

template<typename Real , unsigned int N>
Real sofa::helper::Polynomial_LD< Real, N >::operator() ( const RNpoint x) const

Evaluating.

◆ operator()() [2/2]

template<typename Real , unsigned int N>
Real sofa::helper::Polynomial_LD< Real, N >::operator() ( const RNpoint x,
unsigned int  idvar 
) const

Evaluating first partial derivative by idvar-th variable.

◆ operator*() [1/2]

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator* ( const Polynomial_LD< Real, N > &  a)
inline

◆ operator*() [2/2]

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator* ( const Real &  alpha)
inline

◆ operator*=() [1/2]

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > & sofa::helper::Polynomial_LD< Real, N >::operator*= ( const Polynomial_LD< Real, N > &  b)

◆ operator*=() [2/2]

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > & sofa::helper::Polynomial_LD< Real, N >::operator*= ( const Real &  alpha)

◆ operator+() [1/3]

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator+ ( ) const
inline

◆ operator+() [2/3]

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator+ ( const Monomial_LD< Real, N > &  a)
inline

◆ operator+() [3/3]

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator+ ( const Polynomial_LD< Real, N > &  a)
inline

◆ operator+=() [1/2]

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > & sofa::helper::Polynomial_LD< Real, N >::operator+= ( const Monomial_LD< Real, N > &  b)

◆ operator+=() [2/2]

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > & sofa::helper::Polynomial_LD< Real, N >::operator+= ( const Polynomial_LD< Real, N > &  b)

◆ operator-() [1/2]

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > sofa::helper::Polynomial_LD< Real, N >::operator-

◆ operator-() [2/2]

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator- ( const Polynomial_LD< Real, N > &  a)
inline

◆ operator-=()

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > & sofa::helper::Polynomial_LD< Real, N >::operator-= ( const Polynomial_LD< Real, N > &  b)

◆ operator/()

template<typename Real , unsigned int N>
Polynomial_LD<Real,N> sofa::helper::Polynomial_LD< Real, N >::operator/ ( const Real &  alpha)
inline

◆ operator/=()

template<typename Real , unsigned int N>
Polynomial_LD< Real, N > & sofa::helper::Polynomial_LD< Real, N >::operator/= ( const Real &  alpha)

◆ operator=()

template<typename Real , unsigned int N>
Polynomial_LD<Real,N>& sofa::helper::Polynomial_LD< Real, N >::operator= ( const Polynomial_LD< Real, N > &  b)
inline

Assign operator.

◆ operator==()

template<typename Real , unsigned int N>
bool sofa::helper::Polynomial_LD< Real, N >::operator== ( const Polynomial_LD< Real, N > &  b) const

Return true if a and b has the same powers.

◆ readFromStream()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::readFromStream ( std::istream &  stream)

◆ Set()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::Set ( const unsigned int  nbofTerm,
  ... 
)

◆ setnbOfMonomial()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::setnbOfMonomial ( int  m_nbofmonomial)

◆ sort()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::sort

◆ sortByVar()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::sortByVar ( unsigned int  idVar)
protected

◆ writeToStream()

template<typename Real , unsigned int N>
void sofa::helper::Polynomial_LD< Real, N >::writeToStream ( std::ostream &  stream) const

Related details

◆ operator* [1/2]

template<typename Real , unsigned int N>
template<typename FReal , unsigned int FN>
Polynomial_LD<FReal,FN>& operator* ( const FReal &  alpha,
Polynomial_LD< FReal, FN > &  r 
)
friend

Comutativity of operator*(Real): Allowing to write p1=r*p2; or p1=p2*r; Polynomial_LD = Polynomial_LD*Real || Real*Polynomial_LD.

◆ operator* [2/2]

template<typename Real , unsigned int N>
template<typename FReal , unsigned int FN>
Polynomial_LD<FReal,FN>& operator* ( const Monomial_LD< FReal, FN > &  a,
Polynomial_LD< FReal, FN > &  r 
)
friend

poly=poly+mono || mono + poly