SOFA API  c76874b7
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::defaulttype::Vec< N, intpowers
 

Protected Attributes

sofa::defaulttype::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

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

Constructor details

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

Tools used in FEM computing

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

Function details

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);

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

Return the total degree of monomial.

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

Evaluating value.

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.

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

Mathematical operators.

template<typename Real , unsigned int N>
Monomial_LD< Real, N > & sofa::helper::Monomial_LD< Real, N >::operator*= ( const Monomial_LD< Real, N > &  b)
template<typename Real , unsigned int N>
Monomial_LD<Real,N> sofa::helper::Monomial_LD< Real, N >::operator+ ( ) const
inline
template<typename Real , unsigned int N>
Monomial_LD<Real,N> sofa::helper::Monomial_LD< Real, N >::operator+ ( const Monomial_LD< Real, N > &  a)
inline
template<typename Real , unsigned int N>
Monomial_LD< Real, N > & sofa::helper::Monomial_LD< Real, N >::operator+= ( const Monomial_LD< Real, N > &  b)
template<typename Real , unsigned int N>
Monomial_LD<Real,N> sofa::helper::Monomial_LD< Real, N >::operator- ( ) const
inline
template<typename Real , unsigned int N>
Monomial_LD<Real,N> sofa::helper::Monomial_LD< Real, N >::operator- ( const Monomial_LD< Real, N > &  a)
inline
template<typename Real , unsigned int N>
Monomial_LD< Real, N > & sofa::helper::Monomial_LD< Real, N >::operator-= ( const Monomial_LD< Real, N > &  b)
template<typename Real , unsigned int N>
Monomial_LD<Real,N> sofa::helper::Monomial_LD< Real, N >::operator/ ( const Real alpha)
inline
template<typename Real , unsigned int N>
Monomial_LD<Real,N>& sofa::helper::Monomial_LD< Real, N >::operator/= ( const Real alpha)
inline
template<typename Real , unsigned int N>
Monomial_LD< Real, N > & sofa::helper::Monomial_LD< Real, N >::operator= ( const Monomial_LD< Real, N > &  b)
template<typename Real , unsigned int N>
bool sofa::helper::Monomial_LD< Real, N >::operator== ( const Monomial_LD< Real, N > &  b) const

Logical operators.

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

Setting of Monomial_LD.

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

Enum details

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

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