OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Public Member Functions | Private Attributes | List of all members
polynomial::DifferentialOperatorTwo Class Reference

#include <DifferentialOperatorTwo.h>

Public Member Functions

 DifferentialOperatorTwo ()
 
 DifferentialOperatorTwo (const std::size_t &xDerivatives, const std::size_t &sDerivatives)
 
 DifferentialOperatorTwo (const DifferentialOperatorTwo &doperator)
 
 ~DifferentialOperatorTwo ()
 
DifferentialOperatorTwooperator= (const DifferentialOperatorTwo &doperator)
 
void resizeX (const std::size_t &xDerivatives)
 
void resizeS (const std::size_t &sDerivatives)
 
void differentiateX ()
 
void differentiateS ()
 
void multiplyPolynomial (const TwoPolynomial &poly)
 
void setPolynomial (const TwoPolynomial &poly, const std::size_t &x, const std::size_t &s)
 
void printOperator () const
 
void addOperator (const DifferentialOperatorTwo &doperator)
 
std::size_t getXDerivatives () const
 
std::size_t getSDerivatives () const
 
bool isPolynomialZero (const std::size_t &x, const std::size_t &s, const std::size_t &term) const
 
void truncate (const std::size_t &truncateOrder)
 
double evaluatePolynomial (const double &x, const double &s, const std::size_t &xDerivative, const std::size_t &sDerivative, const std::vector< double > &dSvalues) const
 
std::size_t numberOfTerms (const std::size_t &xDerivatives, const std::size_t &sDerivatives) const
 
std::vector< std::size_t > getdSFactors (const std::size_t &xDerivatives, const std::size_t &sDerivatives, const std::size_t &p) const
 
void sortTerms ()
 

Private Attributes

std::vector< std::vector< PolynomialSum > > polynomials_m
 
std::size_t xDerivatives_m
 
std::size_t sDerivatives_m
 

Detailed Description

Definition at line 54 of file DifferentialOperatorTwo.h.

Constructor & Destructor Documentation

◆ DifferentialOperatorTwo() [1/3]

polynomial::DifferentialOperatorTwo::DifferentialOperatorTwo ( )

Default constructor, initialises identity operator

Definition at line 36 of file DifferentialOperatorTwo.cpp.

References polynomials_m.

◆ DifferentialOperatorTwo() [2/3]

polynomial::DifferentialOperatorTwo::DifferentialOperatorTwo ( const std::size_t &  xDerivatives,
const std::size_t &  sDerivatives 
)

Constructor, initialises operator with zero polynomials and derivatives up to xDerivatives in x and sDerivatives in s

Parameters
xDerivatives-> Highest x-derivative
sDerivatives-> Highest s-derivative

Definition at line 46 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

◆ DifferentialOperatorTwo() [3/3]

polynomial::DifferentialOperatorTwo::DifferentialOperatorTwo ( const DifferentialOperatorTwo doperator)

Copy constructor

Definition at line 56 of file DifferentialOperatorTwo.cpp.

◆ ~DifferentialOperatorTwo()

polynomial::DifferentialOperatorTwo::~DifferentialOperatorTwo ( )

Destructor

Definition at line 63 of file DifferentialOperatorTwo.cpp.

Member Function Documentation

◆ addOperator()

void polynomial::DifferentialOperatorTwo::addOperator ( const DifferentialOperatorTwo doperator)

Add the doperator to operator, term by term

Parameters
doperator-> Differential operator to be added

Definition at line 154 of file DifferentialOperatorTwo.cpp.

References polynomials_m, resizeS(), resizeX(), sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::applyOperator().

Here is the call graph for this function:

◆ differentiateS()

void polynomial::DifferentialOperatorTwo::differentiateS ( )

Differentiate wrt s using product rule

Definition at line 104 of file DifferentialOperatorTwo.cpp.

References polynomials_m, resizeS(), sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::applyOperator(), and polynomial::RecursionRelationTwo::differentiateS().

Here is the call graph for this function:

◆ differentiateX()

void polynomial::DifferentialOperatorTwo::differentiateX ( )

Differentiate wrt x using product rule

Definition at line 92 of file DifferentialOperatorTwo.cpp.

References polynomials_m, resizeX(), sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::applyOperator(), and polynomial::RecursionRelationTwo::differentiateX().

Here is the call graph for this function:

◆ evaluatePolynomial()

double polynomial::DifferentialOperatorTwo::evaluatePolynomial ( const double &  x,
const double &  s,
const std::size_t &  xDerivative,
const std::size_t &  sDerivative,
const std::vector< double > &  dSvalues 
) const

Evaluate polynomial specified

Parameters
x-> Point x where polynomial is evaluated
s-> Point s where polynomial is evaluated
xDerivative-> Number of x-derivatives
sDerivative-> Number of s-derivatives
term-> Term index

Definition at line 187 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::evaluatePolynomial().

◆ getdSFactors()

std::vector< std::size_t > polynomial::DifferentialOperatorTwo::getdSFactors ( const std::size_t &  xDerivatives,
const std::size_t &  sDerivatives,
const std::size_t &  p 
) const

Returns list of S(s)-derivatives from term p in polynomial with xDerivatives x-derivatives and sDerivatives s-derivatives
If xDerivatives or sDerivatives are out of range an empty vector is returned

Parameters
xDerivatives-> Number of x-derivatives
sDerivatives-> Number of s-derivatives
p-> Term index, starting with term 0

Definition at line 209 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::getdSfactors().

◆ getSDerivatives()

std::size_t polynomial::DifferentialOperatorTwo::getSDerivatives ( ) const
inline

Returns highest derivative in s

Definition at line 167 of file DifferentialOperatorTwo.h.

References sDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::getMaxSDerivatives().

◆ getXDerivatives()

std::size_t polynomial::DifferentialOperatorTwo::getXDerivatives ( ) const
inline

Returns highest derivative in x

Definition at line 163 of file DifferentialOperatorTwo.h.

References xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::getMaxXDerivatives().

◆ isPolynomialZero()

bool polynomial::DifferentialOperatorTwo::isPolynomialZero ( const std::size_t &  x,
const std::size_t &  s,
const std::size_t &  term 
) const

Check if polynomial with x x-derivaties and s s-derivatives is a zero polynomial
If x or s are out of range, true is returned

Parameters
x-> Number of x-derivatives
s-> Number of s-derivatives
term-> Term index

Definition at line 169 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::isPolynomialZero(), and printOperator().

◆ multiplyPolynomial()

void polynomial::DifferentialOperatorTwo::multiplyPolynomial ( const TwoPolynomial &  poly)

Multiplies each term with given polynomial

Parameters
poly-> Polynomial that is multiplied with this polynomial

Definition at line 116 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::applyOperator().

◆ numberOfTerms()

std::size_t polynomial::DifferentialOperatorTwo::numberOfTerms ( const std::size_t &  xDerivatives,
const std::size_t &  sDerivatives 
) const

Returns number of terms in the sum with xDerivatives x-derivatives and sDerivatives s-derivatives
If xDerivative or sDerivative are out of range zero is returned

Parameters
xDerivatives-> Number of x-derivatives
sDerivatives-> Number of s-derivatives

Definition at line 200 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::numberOfTerms(), and printOperator().

◆ operator=()

DifferentialOperatorTwo & polynomial::DifferentialOperatorTwo::operator= ( const DifferentialOperatorTwo doperator)

Assigment operator

Definition at line 66 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

◆ printOperator()

void polynomial::DifferentialOperatorTwo::printOperator ( ) const

Print operator, for internal debugging

Definition at line 136 of file DifferentialOperatorTwo.cpp.

References endl(), isPolynomialZero(), numberOfTerms(), polynomials_m, sDerivatives_m, and xDerivatives_m.

Here is the call graph for this function:

◆ resizeS()

void polynomial::DifferentialOperatorTwo::resizeS ( const std::size_t &  sDerivatives)

Set highest derivative in s to xDerivatives

Parameters
sDerivatives-> Highest s-derivative

Definition at line 85 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by addOperator(), differentiateS(), polynomial::RecursionRelationTwo::resizeS(), and setPolynomial().

◆ resizeX()

void polynomial::DifferentialOperatorTwo::resizeX ( const std::size_t &  xDerivatives)

Set highest derivative in x to xDerivatives111

Parameters
xDerivatives-> Highest x-derivative

Definition at line 74 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by addOperator(), differentiateX(), polynomial::RecursionRelationTwo::resizeX(), and setPolynomial().

◆ setPolynomial()

void polynomial::DifferentialOperatorTwo::setPolynomial ( const TwoPolynomial &  poly,
const std::size_t &  x,
const std::size_t &  s 
)

Assign the polynomial poly to the operator

Parameters
poly-> Polynomial to be assigned
x-> Number of x-derivatives
s-> Numbe of s-derivatives

Definition at line 124 of file DifferentialOperatorTwo.cpp.

References polynomials_m, resizeS(), resizeX(), sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::RecursionRelationTwo().

Here is the call graph for this function:

◆ sortTerms()

void polynomial::DifferentialOperatorTwo::sortTerms ( )

Sort the terms in each sum, with fewest S(s)-derivatives first, then in increasing powers

Definition at line 220 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::sortTerms().

◆ truncate()

void polynomial::DifferentialOperatorTwo::truncate ( const std::size_t &  truncateOrder)

Truncate all polynomials to truncateOrder

Parameters
truncateOrder-> Highest order of x after truncation

Definition at line 178 of file DifferentialOperatorTwo.cpp.

References polynomials_m, sDerivatives_m, and xDerivatives_m.

Referenced by polynomial::RecursionRelationTwo::truncate().

Member Data Documentation

◆ polynomials_m

std::vector<std::vector<PolynomialSum> > polynomial::DifferentialOperatorTwo::polynomials_m
private

◆ sDerivatives_m

std::size_t polynomial::DifferentialOperatorTwo::sDerivatives_m
private

◆ xDerivatives_m

std::size_t polynomial::DifferentialOperatorTwo::xDerivatives_m
private

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