OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <DifferentialOperatorTwo.h>
Public Member Functions | |
DifferentialOperatorTwo () | |
DifferentialOperatorTwo (const std::size_t &xDerivatives, const std::size_t &sDerivatives) | |
DifferentialOperatorTwo (const DifferentialOperatorTwo &doperator) | |
~DifferentialOperatorTwo () | |
DifferentialOperatorTwo & | operator= (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 |
Definition at line 54 of file DifferentialOperatorTwo.h.
polynomial::DifferentialOperatorTwo::DifferentialOperatorTwo | ( | ) |
Default constructor, initialises identity operator
Definition at line 36 of file DifferentialOperatorTwo.cpp.
References polynomials_m.
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
xDerivatives | -> Highest x-derivative |
sDerivatives | -> Highest s-derivative |
Definition at line 46 of file DifferentialOperatorTwo.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
polynomial::DifferentialOperatorTwo::DifferentialOperatorTwo | ( | const DifferentialOperatorTwo & | doperator | ) |
Copy constructor
Definition at line 56 of file DifferentialOperatorTwo.cpp.
polynomial::DifferentialOperatorTwo::~DifferentialOperatorTwo | ( | ) |
Destructor
Definition at line 63 of file DifferentialOperatorTwo.cpp.
void polynomial::DifferentialOperatorTwo::addOperator | ( | const DifferentialOperatorTwo & | doperator | ) |
Add the doperator to operator, term by term
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().
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().
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().
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
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().
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
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().
|
inline |
Returns highest derivative in s
Definition at line 167 of file DifferentialOperatorTwo.h.
References sDerivatives_m.
Referenced by polynomial::RecursionRelationTwo::getMaxSDerivatives().
|
inline |
Returns highest derivative in x
Definition at line 163 of file DifferentialOperatorTwo.h.
References xDerivatives_m.
Referenced by polynomial::RecursionRelationTwo::getMaxXDerivatives().
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
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().
void polynomial::DifferentialOperatorTwo::multiplyPolynomial | ( | const TwoPolynomial & | poly | ) |
Multiplies each term with given polynomial
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().
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
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().
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.
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.
void polynomial::DifferentialOperatorTwo::resizeS | ( | const std::size_t & | sDerivatives | ) |
Set highest derivative in s to xDerivatives
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().
void polynomial::DifferentialOperatorTwo::resizeX | ( | const std::size_t & | xDerivatives | ) |
Set highest derivative in x to xDerivatives111
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().
void polynomial::DifferentialOperatorTwo::setPolynomial | ( | const TwoPolynomial & | poly, |
const std::size_t & | x, | ||
const std::size_t & | s | ||
) |
Assign the polynomial poly to the operator
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().
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().
void polynomial::DifferentialOperatorTwo::truncate | ( | const std::size_t & | truncateOrder | ) |
Truncate all polynomials to truncateOrder
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().
|
private |
Definition at line 157 of file DifferentialOperatorTwo.h.
Referenced by addOperator(), DifferentialOperatorTwo(), differentiateS(), differentiateX(), evaluatePolynomial(), getdSFactors(), isPolynomialZero(), multiplyPolynomial(), numberOfTerms(), operator=(), printOperator(), resizeS(), resizeX(), setPolynomial(), sortTerms(), and truncate().
|
private |
Definition at line 159 of file DifferentialOperatorTwo.h.
Referenced by addOperator(), DifferentialOperatorTwo(), differentiateS(), differentiateX(), evaluatePolynomial(), getdSFactors(), getSDerivatives(), isPolynomialZero(), multiplyPolynomial(), numberOfTerms(), operator=(), printOperator(), resizeS(), resizeX(), setPolynomial(), sortTerms(), and truncate().
|
private |
Definition at line 158 of file DifferentialOperatorTwo.h.
Referenced by addOperator(), DifferentialOperatorTwo(), differentiateS(), differentiateX(), evaluatePolynomial(), getdSFactors(), getXDerivatives(), isPolynomialZero(), multiplyPolynomial(), numberOfTerms(), operator=(), printOperator(), resizeS(), resizeX(), setPolynomial(), sortTerms(), and truncate().