OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
#include <DifferentialOperator.h>
Public Member Functions | |
DifferentialOperator () | |
DifferentialOperator (const std::size_t &xDerivatives, const std::size_t &sDerivatives) | |
DifferentialOperator (const DifferentialOperator &doperator) | |
DifferentialOperator & | operator= (const DifferentialOperator &doperator) |
~DifferentialOperator () | |
void | resizeX (const std::size_t &xDerivatives) |
void | resizeS (const std::size_t &sDerivatives) |
void | differentiateX () |
void | doubleDifferentiateS () |
void | multiplyPolynomial (const Polynomial &poly) |
void | setPolynomial (const std::vector< int > &poly, const std::size_t &x, const std::size_t &s) |
void | printOperator () const |
void | addOperator (const DifferentialOperator &doperator) |
std::size_t | getXDerivatives () const |
std::size_t | getSDerivatives () const |
bool | isPolynomialZero (const std::size_t &x, const std::size_t &s) const |
void | truncate (const std::size_t &truncateOrder) |
double | evaluatePolynomial (const double &x, const std::size_t &xDerivative, const std::size_t &sDerivative) const |
Private Attributes | |
std::vector< std::vector< Polynomial > > | polynomials_m |
std::size_t | xDerivatives_m |
std::size_t | sDerivatives_m |
Definition at line 52 of file DifferentialOperator.h.
polynomial::DifferentialOperator::DifferentialOperator | ( | ) |
Default constructor, initialises identity operator (constant 1)
Definition at line 34 of file DifferentialOperator.cpp.
References polynomials_m.
polynomial::DifferentialOperator::DifferentialOperator | ( | 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 derivative of x |
sDerivatives | -> Highest serivative in s |
Definition at line 42 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
polynomial::DifferentialOperator::DifferentialOperator | ( | const DifferentialOperator & | doperator | ) |
Copy constructor
Definition at line 51 of file DifferentialOperator.cpp.
polynomial::DifferentialOperator::~DifferentialOperator | ( | ) |
Destructor, does nothing
Definition at line 58 of file DifferentialOperator.cpp.
void polynomial::DifferentialOperator::addOperator | ( | const DifferentialOperator & | doperator | ) |
Add the operator to Operator, term by term
doperator | -> DifferentialOperator object to be added with this DifferentialOperator object |
Definition at line 147 of file DifferentialOperator.cpp.
References polynomials_m, resizeS(), resizeX(), sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::applyOperator().
void polynomial::DifferentialOperator::differentiateX | ( | ) |
Differentiate wrt x using product rule
Definition at line 87 of file DifferentialOperator.cpp.
References polynomials_m, resizeX(), sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::applyOperator(), and polynomial::RecursionRelation::differentiateX().
void polynomial::DifferentialOperator::doubleDifferentiateS | ( | ) |
Differentiate wrt s twice
Definition at line 99 of file DifferentialOperator.cpp.
References polynomials_m, resizeS(), sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::applyOperator().
double polynomial::DifferentialOperator::evaluatePolynomial | ( | const double & | x, |
const std::size_t & | xDerivative, | ||
const std::size_t & | sDerivative | ||
) | const |
Evaluate polynomial with xDerivative x-derivatives and sDerivative s-derivatives
If xDerivative or sDerivative is greater than xDerivative_m or sDerivative then zero is returned
x | -> Point at which polynomial is evaluated |
xDerivative | -> Number of x-derivatives |
sDerivative | -> Number of s-derivatives |
Definition at line 178 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::evaluatePolynomial().
|
inline |
Returns highest derivative in s
Definition at line 141 of file DifferentialOperator.h.
References sDerivatives_m.
Referenced by polynomial::RecursionRelation::getMaxSDerivatives().
|
inline |
Returns highest derivative in x
Definition at line 137 of file DifferentialOperator.h.
References xDerivatives_m.
Referenced by polynomial::RecursionRelation::getMaxXDerivatives().
bool polynomial::DifferentialOperator::isPolynomialZero | ( | const std::size_t & | x, |
const std::size_t & | s | ||
) | const |
Check if polynomial with x x-derivaties and s s-derivatives is a zero polynomial
If x or s is larger than xDerivatives or sDerivatives true is returned
x | -> Number of x-derivatives |
s | -> Number of s-derivatives |
Definition at line 161 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::isPolynomialZero().
void polynomial::DifferentialOperator::multiplyPolynomial | ( | const Polynomial & | poly | ) |
Multiplies each term with given polynomial
poly | -> Polynomial that multiplies each term |
Definition at line 111 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::applyOperator().
DifferentialOperator & polynomial::DifferentialOperator::operator= | ( | const DifferentialOperator & | doperator | ) |
Assigment operator
Definition at line 61 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
void polynomial::DifferentialOperator::printOperator | ( | ) | const |
Print operator, for internal debugging
Definition at line 131 of file DifferentialOperator.cpp.
References endl(), polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::printOperator().
void polynomial::DifferentialOperator::resizeS | ( | const std::size_t & | sDerivatives | ) |
Set highest derivative in s to sDerivatives
sDerivatives | -> Highest derivative in s |
Definition at line 80 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by addOperator(), doubleDifferentiateS(), polynomial::RecursionRelation::resizeS(), and setPolynomial().
void polynomial::DifferentialOperator::resizeX | ( | const std::size_t & | xDerivatives | ) |
Set highest derivative in x to xDerivatives
xDerivatives | -> Highest derivative in x |
Definition at line 69 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by addOperator(), differentiateX(), polynomial::RecursionRelation::resizeX(), and setPolynomial().
void polynomial::DifferentialOperator::setPolynomial | ( | const std::vector< int > & | poly, |
const std::size_t & | x, | ||
const std::size_t & | s | ||
) |
Assign the input polynomial
If x or s is greater than xDerivatives_m or sDerivatives_m, they are adjusted accordingly and polynomials_m is resized
poly | -> Polynomial to be assigned to the operator |
x | -> Number of x-derivatives |
s | -> Number of s-derivatives |
Definition at line 119 of file DifferentialOperator.cpp.
References polynomials_m, resizeS(), resizeX(), sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::RecursionRelation().
void polynomial::DifferentialOperator::truncate | ( | const std::size_t & | truncateOrder | ) |
Truncate all polynomials to truncateOrder
If truncateOrder is greater than the highest power of x then zeroes are appended to the end
truncateOrder | -> Highest order of x after truncation |
Definition at line 170 of file DifferentialOperator.cpp.
References polynomials_m, sDerivatives_m, and xDerivatives_m.
Referenced by polynomial::RecursionRelation::truncate().
|
private |
Definition at line 131 of file DifferentialOperator.h.
Referenced by addOperator(), DifferentialOperator(), differentiateX(), doubleDifferentiateS(), evaluatePolynomial(), isPolynomialZero(), multiplyPolynomial(), operator=(), printOperator(), resizeS(), resizeX(), setPolynomial(), and truncate().
|
private |
Definition at line 133 of file DifferentialOperator.h.
Referenced by addOperator(), DifferentialOperator(), differentiateX(), doubleDifferentiateS(), evaluatePolynomial(), getSDerivatives(), isPolynomialZero(), multiplyPolynomial(), operator=(), printOperator(), resizeS(), resizeX(), setPolynomial(), and truncate().
|
private |
Definition at line 132 of file DifferentialOperator.h.
Referenced by addOperator(), DifferentialOperator(), differentiateX(), doubleDifferentiateS(), evaluatePolynomial(), getXDerivatives(), isPolynomialZero(), multiplyPolynomial(), operator=(), printOperator(), resizeS(), resizeX(), setPolynomial(), and truncate().