MercuryDPM
0.11
|
This class is used to define polynomial axisymmetric coarse-graining functions. More...
#include <NormalisedPolynomial.h>
Public Member Functions | |
NORMALIZED_POLYNOMIAL () | |
Basic constructor; note that this does not determine the particular polynomial; one needs to call set_polynomial to define the coefficients. More... | |
void | set_polynomial (std::vector< Mdouble > new_coefficients, unsigned int new_dim) |
Use this function to set the polynomial coefficients ![]() | |
void | set_polynomial (Mdouble *new_coefficients, unsigned int num_coeff, unsigned int new_dim) |
Some as set_polynomial, but avoids the use of a vector. More... | |
void | setName (const char *new_name) |
Use this function to change the name of the polynomial. More... | |
std::string | getName () |
Returns name of the polynomial. More... | |
Mdouble | evaluate (Mdouble r) |
Returns the value of the polynomial, ![]() | |
Mdouble | evaluateGradient (Mdouble r) |
Returns the gradient of the polynomial, ![]() | |
Mdouble | evaluateIntegral (Mdouble a, Mdouble b, Mdouble t) |
Returns the value of the line integral along the normal P1P2 "from a to b" over the axisymmetric function. More... | |
int | getOrder (void) |
Returns the order of the polynomial. More... | |
template<> | |
double | evaluate (double r) |
template<> | |
double | evaluate (double r) |
template<> | |
double | evaluate (double r) |
template<> | |
double | evaluate (double r) |
template<> | |
double | evaluate (double r) |
template<> | |
double | evaluate (double r) |
template<> | |
double | evaluateGradient (double r) |
template<> | |
double | evaluateGradient (double r) |
template<> | |
double | evaluateGradient (double r) |
template<> | |
double | evaluateGradient (double r) |
template<> | |
double | evaluateGradient (double r) |
template<> | |
double | evaluateGradient (double r) |
template<> | |
double | evaluateIntegral (double a, double b, double t) |
template<> | |
double | evaluateIntegral (double a, double b, double t) |
template<> | |
double | evaluateIntegral (double a, double b, double t) |
template<> | |
double | evaluateIntegral (double a, double b, double t) |
template<> | |
double | evaluateIntegral (double a, double b, double t) |
template<> | |
double | evaluateIntegral (double a, double b, double t) |
Private Member Functions | |
void | finish_set_polynomial () |
Normalizes the polynomial coefficients ![]() ![]() | |
Mdouble | get_volume () |
Returns the integral over the unit sphere of the axisymmetric function ![]() | |
Mdouble | evaluate_1D (Mdouble r) |
Returns the value of the polynomial averaged over 2 dimensions. For StatType=X, ![]() | |
Mdouble | evaluate_2D (Mdouble r) |
Returns the value of the polynomial averaged over 1 dimension. For StatType=XY, ![]() | |
void | set_average () |
Sets averaged_coefficients. More... | |
void | set_average_1D () |
Sets averaged_coefficients ![]() ![]() | |
void | set_average_2D () |
For StatType=XY,XZ,XZ, averaged_coefficients is not used since ![]() ![]() | |
Mdouble | evaluateGradient_1D (Mdouble r) |
Returns the value of the gradient averaged over 2 dimensions. More... | |
Mdouble | evaluateGradient_2D (Mdouble r) |
Returns the value of the gradient averaged over 1 dimensions. More... | |
Mdouble | evaluateIntegral_1D (Mdouble a, Mdouble b, Mdouble t) |
Returns the value of the line integral along the normal P1P2 "from a to b" over the axisymmetric function averaged over 2 dimensions. More... | |
Mdouble | evaluateIntegral_2D (Mdouble a, Mdouble b, Mdouble t) |
Returns the value of the line integral along the normal P1P2 "from a to b" over the axisymmetric function averaged over 1 dimensions. More... | |
Mdouble | operator[] (int i) const |
Access to the coefficients. More... | |
template<> | |
void | set_average () |
template<> | |
void | set_average () |
template<> | |
void | set_average () |
template<> | |
void | set_average () |
template<> | |
void | set_average () |
template<> | |
void | set_average () |
Private Attributes | |
std::string | name |
Contains the name of the polynomial which will be displayed as CGtype by the statistical code. More... | |
unsigned int | dim |
The system dimension. More... | |
std::vector< Mdouble > | coefficients |
Stores the coefficients ![]() | |
std::vector< Mdouble > | averaged_coefficients |
Stores some coefficients used in evaluate and evaluateIntegral for StatTypes different from XYZ. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const NORMALIZED_POLYNOMIAL &P) |
Returns a text description of the polynomial. More... | |
This class is used to define polynomial axisymmetric coarse-graining functions.
This class stores a polynomial, , which is normalized such that the integral over the unit sphere of the axisymmetric function
is unity.
Use set_polynomial to define the polynomial. Use evaluate to evaluate the polynomial. Use evaluateGradient to evaluate the polynomial's gradient.
Calculations can be found in src/docs/Polynomials.nb
This is used to define polynomial axisymmetric coarse-graining functions (see StatisticsVector).
Note: not everything is implemented yet: only dim=3 is working, no gradients are computed.
Definition at line 51 of file NormalisedPolynomial.h.
|
inline |
Basic constructor; note that this does not determine the particular polynomial; one needs to call set_polynomial to define the coefficients.
Definition at line 85 of file NormalisedPolynomial.h.
References NORMALIZED_POLYNOMIAL< T >::coefficients, NORMALIZED_POLYNOMIAL< T >::dim, and NORMALIZED_POLYNOMIAL< T >::setName().
double NORMALIZED_POLYNOMIAL< T >::evaluate | ( | Mdouble | r | ) |
Returns the value of the polynomial, .
For averaged StatType this function is templated. If averaging statistics are used, then an averaged function is stored as well; for averaging a over certain dimensions is stored as well.
For averaging over two dimensions, .
For averaging over one dimensions, .
Definition at line 130 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients.
double NORMALIZED_POLYNOMIAL< X >::evaluate | ( | double | r | ) |
Definition at line 365 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< Y >::evaluate | ( | double | r | ) |
Definition at line 369 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< Z >::evaluate | ( | double | r | ) |
Definition at line 373 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< XY >::evaluate | ( | double | r | ) |
Definition at line 377 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< XZ >::evaluate | ( | double | r | ) |
Definition at line 381 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< YZ >::evaluate | ( | double | r | ) |
Definition at line 385 of file NormalisedPolynomial.hcc.
|
private |
Returns the value of the polynomial averaged over 2 dimensions. For StatType=X, . See also set_average_1D.
Definition at line 152 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::averaged_coefficients.
|
private |
Returns the value of the polynomial averaged over 1 dimension. For StatType=XY, .
Definition at line 183 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients.
double NORMALIZED_POLYNOMIAL< T >::evaluateGradient | ( | Mdouble | r | ) |
Returns the gradient of the polynomial, .
Definition at line 142 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients.
double NORMALIZED_POLYNOMIAL< X >::evaluateGradient | ( | double | r | ) |
Definition at line 390 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< Y >::evaluateGradient | ( | double | r | ) |
Definition at line 394 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< Z >::evaluateGradient | ( | double | r | ) |
Definition at line 398 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< XY >::evaluateGradient | ( | double | r | ) |
Definition at line 402 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< XZ >::evaluateGradient | ( | double | r | ) |
Definition at line 406 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< YZ >::evaluateGradient | ( | double | r | ) |
Definition at line 410 of file NormalisedPolynomial.hcc.
|
private |
Returns the value of the gradient averaged over 2 dimensions.
Definition at line 162 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients, and constants::pi.
|
private |
Returns the value of the gradient averaged over 1 dimensions.
Definition at line 176 of file NormalisedPolynomial.hcc.
double NORMALIZED_POLYNOMIAL< T >::evaluateIntegral | ( | Mdouble | a, |
Mdouble | b, | ||
Mdouble | t | ||
) |
Returns the value of the line integral along the normal P1P2 "from a to b" over the axisymmetric function.
For averaged StatType this function is templated.
Definition at line 226 of file NormalisedPolynomial.hcc.
References A, and NORMALIZED_POLYNOMIAL< T >::coefficients.
Definition at line 415 of file NormalisedPolynomial.hcc.
Definition at line 419 of file NormalisedPolynomial.hcc.
Definition at line 423 of file NormalisedPolynomial.hcc.
Definition at line 427 of file NormalisedPolynomial.hcc.
Definition at line 431 of file NormalisedPolynomial.hcc.
Definition at line 435 of file NormalisedPolynomial.hcc.
|
private |
Returns the value of the line integral along the normal P1P2 "from a to b" over the axisymmetric function averaged over 2 dimensions.
Definition at line 287 of file NormalisedPolynomial.hcc.
References A, and NORMALIZED_POLYNOMIAL< T >::averaged_coefficients.
|
private |
Returns the value of the line integral along the normal P1P2 "from a to b" over the axisymmetric function averaged over 1 dimensions.
Definition at line 280 of file NormalisedPolynomial.hcc.
|
private |
Normalizes the polynomial coefficients such that the integral over the unit sphere of the axisymmetric function
is unity.
, with
for 3D,
for 2D,
for 1D systems.
Also sets averaged_coefficients
Assumes that dim and coefficients are already set.
Definition at line 45 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients, NORMALIZED_POLYNOMIAL< T >::get_volume(), NORMALIZED_POLYNOMIAL< T >::set_average(), and NORMALIZED_POLYNOMIAL< T >::setName().
Referenced by NORMALIZED_POLYNOMIAL< T >::set_polynomial().
|
private |
Returns the integral over the unit sphere of the axisymmetric function .
, with
for 3D,
for 2D,
for 1D systems.
For , we obtain
for 3D,
for 2D,
for 1D systems.
Definition at line 65 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients, NORMALIZED_POLYNOMIAL< T >::dim, and constants::pi.
Referenced by NORMALIZED_POLYNOMIAL< T >::finish_set_polynomial().
|
inline |
Returns name of the polynomial.
Definition at line 113 of file NormalisedPolynomial.h.
References NORMALIZED_POLYNOMIAL< T >::name.
|
inline |
Returns the order of the polynomial.
Definition at line 148 of file NormalisedPolynomial.h.
References NORMALIZED_POLYNOMIAL< T >::coefficients.
|
inlineprivate |
Access to the coefficients.
Definition at line 247 of file NormalisedPolynomial.h.
References NORMALIZED_POLYNOMIAL< T >::coefficients.
|
private |
Sets averaged_coefficients.
This function is templated, with the default used only for StatType=XYZ, so it does nothing.
Definition at line 100 of file NormalisedPolynomial.hcc.
Referenced by NORMALIZED_POLYNOMIAL< T >::finish_set_polynomial().
|
private |
Definition at line 340 of file NormalisedPolynomial.hcc.
|
private |
Definition at line 344 of file NormalisedPolynomial.hcc.
|
private |
Definition at line 348 of file NormalisedPolynomial.hcc.
|
private |
Definition at line 352 of file NormalisedPolynomial.hcc.
|
private |
Definition at line 356 of file NormalisedPolynomial.hcc.
|
private |
Definition at line 360 of file NormalisedPolynomial.hcc.
|
private |
Sets averaged_coefficients for StatType=X,Y,Z such that
. See evaluate_1D.
Definition at line 106 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::averaged_coefficients, NORMALIZED_POLYNOMIAL< T >::coefficients, and constants::pi.
|
private |
For StatType=XY,XZ,XZ, averaged_coefficients is not used since can be evaluated as a function of
. See evaluate_2D.
Definition at line 124 of file NormalisedPolynomial.hcc.
void NORMALIZED_POLYNOMIAL< T >::set_polynomial | ( | std::vector< Mdouble > | new_coefficients, |
unsigned int | new_dim | ||
) |
Use this function to set the polynomial coefficients . This function calls finish_set_polynomial to normalize the coefficients.
Definition at line 27 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients, NORMALIZED_POLYNOMIAL< T >::dim, and NORMALIZED_POLYNOMIAL< T >::finish_set_polynomial().
void NORMALIZED_POLYNOMIAL< T >::set_polynomial | ( | Mdouble * | new_coefficients, |
unsigned int | num_coeff, | ||
unsigned int | new_dim | ||
) |
Some as set_polynomial, but avoids the use of a vector.
Definition at line 35 of file NormalisedPolynomial.hcc.
References NORMALIZED_POLYNOMIAL< T >::coefficients, NORMALIZED_POLYNOMIAL< T >::dim, and NORMALIZED_POLYNOMIAL< T >::finish_set_polynomial().
|
inline |
Use this function to change the name of the polynomial.
Definition at line 105 of file NormalisedPolynomial.h.
References NORMALIZED_POLYNOMIAL< T >::name.
Referenced by NORMALIZED_POLYNOMIAL< T >::finish_set_polynomial(), and NORMALIZED_POLYNOMIAL< T >::NORMALIZED_POLYNOMIAL().
|
friend |
Returns a text description of the polynomial.
Definition at line 156 of file NormalisedPolynomial.h.
|
private |
Stores some coefficients used in evaluate and evaluateIntegral for StatTypes different from XYZ.
Definition at line 76 of file NormalisedPolynomial.h.
Referenced by NORMALIZED_POLYNOMIAL< T >::evaluate_1D(), NORMALIZED_POLYNOMIAL< T >::evaluateIntegral_1D(), and NORMALIZED_POLYNOMIAL< T >::set_average_1D().
|
private |
Stores the coefficients .
Definition at line 71 of file NormalisedPolynomial.h.
Referenced by NORMALIZED_POLYNOMIAL< T >::evaluate(), NORMALIZED_POLYNOMIAL< T >::evaluate_2D(), NORMALIZED_POLYNOMIAL< T >::evaluateGradient(), NORMALIZED_POLYNOMIAL< T >::evaluateGradient_1D(), NORMALIZED_POLYNOMIAL< T >::evaluateIntegral(), NORMALIZED_POLYNOMIAL< T >::finish_set_polynomial(), NORMALIZED_POLYNOMIAL< T >::get_volume(), NORMALIZED_POLYNOMIAL< T >::getOrder(), NORMALIZED_POLYNOMIAL< T >::NORMALIZED_POLYNOMIAL(), NORMALIZED_POLYNOMIAL< T >::operator[](), NORMALIZED_POLYNOMIAL< T >::set_average_1D(), and NORMALIZED_POLYNOMIAL< T >::set_polynomial().
|
private |
The system dimension.
Definition at line 66 of file NormalisedPolynomial.h.
Referenced by NORMALIZED_POLYNOMIAL< T >::get_volume(), NORMALIZED_POLYNOMIAL< T >::NORMALIZED_POLYNOMIAL(), and NORMALIZED_POLYNOMIAL< T >::set_polynomial().
|
private |
Contains the name of the polynomial which will be displayed as CGtype by the statistical code.
Definition at line 61 of file NormalisedPolynomial.h.
Referenced by NORMALIZED_POLYNOMIAL< T >::getName(), and NORMALIZED_POLYNOMIAL< T >::setName().