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

#include <Polynomial_LD.h>

A generic monomial with N variables of type Real. A monomial is one term of a polynomial. More...

Detailed Description

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

A generic monomial with N variables of type Real. A monomial is one term of a polynomial.

Todo this first version of polynomial is a linear presentation. This presentation is efficient for arithmetic operator like +,-,*,/ and derivative. But is not optimized for the evaluating (comparing to the recurent presentation).

Public Attributes

Real coef
 
sofa::type::Vec< N, int > powers
 

Protected Attributes

sofa::type::Vec< N, std::string > variables
 

Public Member Functions

 Monomial_LD ()
 
 Monomial_LD (Real,...)
 
 Monomial_LD (const Monomial_LD< Real, N > &a)
 
Monomial_LD< Real, N > & operator= (const Monomial_LD< Real, N > &b)
 
void SetCoef (const Real &m_coef)
 Setting of Monomial_LD. More...
 
void SetPower (int numbervar, int powervalue)
 
int degree ()
 Return the total degree of monomial. More...
 
bool operator== (const Monomial_LD< Real, N > &b) const
 Logical operators. More...
 
bool operator!= (const Monomial_LD< Real, N > &b) const
 
bool isSamePowers (const Monomial_LD< Real, N > &b) const
 
bool isnullptr () const
 
Monomial_LD< Real, N > & operator*= (const Real &alpha)
 Mathematical operators. More...
 
Monomial_LD< Real, N > & operator/= (const Real &alpha)
 
Monomial_LD< Real, N > & operator+= (const Monomial_LD< Real, N > &b)
 
Monomial_LD< Real, N > & operator-= (const Monomial_LD< Real, N > &b)
 
Monomial_LD< Real, N > & operator*= (const Monomial_LD< Real, N > &b)
 
Monomial_LD< Real, N > operator+ () const
 
Monomial_LD< Real, N > operator- () const
 
Monomial_LD< Real, N > operator* (const Real &alpha)
 
Monomial_LD< Real, N > operator/ (const Real &alpha)
 
Monomial_LD< Real, N > operator+ (const Monomial_LD< Real, N > &a)
 
Monomial_LD< Real, N > operator- (const Monomial_LD< Real, N > &a)
 
Monomial_LD< Real, N > operator* (const Monomial_LD< Real, N > &a)
 
Real operator() (const RNpoint &x) const
 Evaluating value. More...
 
Real operator() (const RNpoint &x, unsigned int idvar) const
 Evaluating first partial derivative by idvar-th variable. More...
 
Monomial_LD< Real, N > d (const unsigned int &ideriv) const
 Evaluating partial derivative hight order by idvar-th variable in ideriv-th order. More...
 
void writeToStream (std::ostream &ff) const
 
void readFromStream (std::istream &ff)
 

Friends

template<typename FReal , unsigned int FN>
Monomial_LD< FReal, FN > & operator* (const FReal &alpha, Monomial_LD< FReal, FN > &r)
 

Attribute details

◆ coef

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

◆ powers

template<typename Real , unsigned int N>
sofa::type::Vec<N,int> sofa::helper::Monomial_LD< Real, N >::powers

◆ variables

template<typename Real , unsigned int N>
sofa::type::Vec<N,std::string> sofa::helper::Monomial_LD< Real, N >::variables
protected

Constructor details

◆ Monomial_LD() [1/3]

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

Tools used in FEM computing

◆ Monomial_LD() [2/3]

template<typename Real , unsigned int N>
sofa::helper::Monomial_LD< Real, N >::Monomial_LD ( Real  m_coef,
  ... 
)

◆ Monomial_LD() [3/3]

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

Function details

◆ d()

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

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

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

◆ degree()

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

Return the total degree of monomial.

◆ isnullptr()

template<typename Real , unsigned int N>
bool sofa::helper::Monomial_LD< Real, N >::isnullptr ( ) const
inline

◆ isSamePowers()

template<typename Real , unsigned int N>
bool sofa::helper::Monomial_LD< Real, N >::isSamePowers ( const Monomial_LD< Real, N > &  b) const

◆ operator!=()

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

◆ operator()() [1/2]

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

Evaluating value.

◆ operator()() [2/2]

template<typename Real , unsigned int N>
Real sofa::helper::Monomial_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>
Monomial_LD<Real,N> sofa::helper::Monomial_LD< Real, N >::operator* ( const Monomial_LD< Real, N > &  a)
inline

◆ operator*() [2/2]

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

◆ operator*=() [1/2]

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

◆ operator*=() [2/2]

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

Mathematical operators.

◆ operator+() [1/2]

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

◆ operator+() [2/2]

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

◆ operator+=()

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

◆ operator-() [1/2]

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

◆ operator-() [2/2]

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

◆ operator-=()

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

◆ operator/()

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

◆ operator/=()

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

◆ operator=()

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

◆ operator==()

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

Logical operators.

◆ readFromStream()

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

◆ SetCoef()

template<typename Real , unsigned int N>
void sofa::helper::Monomial_LD< Real, N >::SetCoef ( const Real m_coef)
inline

Setting of Monomial_LD.

◆ SetPower()

template<typename Real , unsigned int N>
void sofa::helper::Monomial_LD< Real, N >::SetPower ( int  numbervar,
int  powervalue 
)
inline

◆ writeToStream()

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

Enum details

◆ anonymous enum

template<typename Real , unsigned int N>
anonymous enum

to define the derivative operator m_mono.d(x), m_mono.d(y)

Enumerator
xy 
yz 
zx 

Related details

◆ operator*

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