#include <QuarticSplineSmoothingKernel.hpp>

Public Member Functions | |
| double | columnDensity (double q) const override |
| double | density (double u) const override |
| double | generateRadius () const override |
| virtual double | columnDensity (double q) const =0 |
| virtual double | density (double u) const =0 |
| virtual double | generateRadius () const =0 |
Public Member Functions inherited from SimulationItem | |
| template<class T > | |
| T * | find (bool setup=true) const |
| template<class T > | |
| T * | interface (int levels=-999999, bool setup=true) const |
| virtual string | itemName () const |
| void | setup () |
| string | typeAndName () const |
Public Member Functions inherited from Item | |
| Item (const Item &)=delete | |
| virtual | ~Item () |
| void | addChild (Item *child) |
| const vector< Item * > & | children () const |
| virtual void | clearItemListProperty (const PropertyDef *property) |
| void | destroyChild (Item *child) |
| virtual bool | getBoolProperty (const PropertyDef *property) const |
| virtual vector< double > | getDoubleListProperty (const PropertyDef *property) const |
| virtual double | getDoubleProperty (const PropertyDef *property) const |
| virtual string | getEnumProperty (const PropertyDef *property) const |
| virtual int | getIntProperty (const PropertyDef *property) const |
| virtual vector< Item * > | getItemListProperty (const PropertyDef *property) const |
| virtual Item * | getItemProperty (const PropertyDef *property) const |
| virtual string | getStringProperty (const PropertyDef *property) const |
| int | getUtilityProperty (string name) const |
| virtual void | insertIntoItemListProperty (const PropertyDef *property, int index, Item *item) |
| Item & | operator= (const Item &)=delete |
| Item * | parent () const |
| virtual void | removeFromItemListProperty (const PropertyDef *property, int index) |
| virtual void | setBoolProperty (const PropertyDef *property, bool value) |
| virtual void | setDoubleListProperty (const PropertyDef *property, vector< double > value) |
| virtual void | setDoubleProperty (const PropertyDef *property, double value) |
| virtual void | setEnumProperty (const PropertyDef *property, string value) |
| virtual void | setIntProperty (const PropertyDef *property, int value) |
| virtual void | setItemProperty (const PropertyDef *property, Item *item) |
| virtual void | setStringProperty (const PropertyDef *property, string value) |
| void | setUtilityProperty (string name, int value) |
| virtual string | type () const |
Protected Member Functions | |
| QuarticSplineSmoothingKernel () | |
| void | setupSelfBefore () override |
Protected Member Functions inherited from SmoothingKernel | |
| SmoothingKernel () | |
| Random * | random () const |
| void | setupSelfBefore () override |
Protected Member Functions inherited from SimulationItem | |
| SimulationItem () | |
| virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
| virtual void | setupSelfAfter () |
| virtual void | setupSelfBefore () |
Protected Member Functions inherited from Item | |
| Item () | |
Private Types | |
| using | BaseType = SmoothingKernel |
| using | ItemType = QuarticSplineSmoothingKernel |
Private Attributes | |
| Array | _Xv |
Friends | |
| class | ItemRegistry |
The QuarticSplineSmoothingKernel class is a subclass of the abstract SmoothingKernel class, and describes a smoothing kernel defined by the quartic spline density,
\[ W(u) = \dfrac{15625}{512\pi} \begin{cases} \; 6 u^{4}-\dfrac{12}{5} u^{2}+\dfrac{46}{125} &\quad 0\le u \le\dfrac{1}{5} \\ \; -4 u^{4}+8 u^{3}-\dfrac{24}{5} u^{2}+\dfrac{8}{25} u +\dfrac{44}{125} &\quad \dfrac{1}{5}\le u \le\dfrac{3}{5} \\ \; u^{4}-4 u^{3}+6 u^{2}-4 u +1 &\quad \dfrac{3}{5}\le u \le 1 \\ \; 0 &\quad \text{else}. \end{cases} \]
It can be verified that this function is continuous at the break points and that it satisfies the required normalization
\[ 4\pi \int_0^\infty W(u)\, u^2\, {\text{d}}u = 1. \]
|
inlineprotected |
Default constructor for concrete Item subclass QuarticSplineSmoothingKernel : "a quartic spline smoothing kernel" .
|
overridevirtual |
This function returns the column density \(\Sigma(q) = 2 \int_{q}^1 \frac{W(u)\,u \,{\text{d}}u} {\sqrt{u^2-q^2}}\) of the smoothing kernel as a function of the normalized impact radius \(q=r_\text{i}/h\). For the quartic spline smoothing kernel, this integral can be calculated analytically, but the resulting formula is very complicated and becomes numerically unstable near some interval borders. Rather than attempting to implement this formula, we implement power series approximations over 8 distinct intervals covering the complete domain. These series and the corresponding floating point coefficients were obtained through a symbolic software package. The approximation has a maximum absolute error of \(10^{-7}\), compared to a maximum column density value of \(\Sigma(q=0) \approx 2.3873\).
Implements SmoothingKernel.
|
overridevirtual |
This function returns the density \(W(u)\) of the smoothing kernel as a function of the normalized radius \(u\). It implements the formula given in the class header, but using floating point coefficients that were precomputed at high precision.
Implements SmoothingKernel.
|
overridevirtual |
This function generates a random normalized radius \(u\) from the smoothing kernel. This is accomplished by generating a uniform deviate \({\cal{X}}\), and solving the equation
\[ {\cal{X}} = \int_0^u 4\pi\,W(u')\,u'^2\, {\text{d}}u' \]
for \(u\). For the quartic spline smoothing kernel, this cumulative distribution function can be readily obtained through a symbolic software package. We use this result, with precomputed high-precision floating point coefficients, to precompute a tabulation of the cumulative distribution function on which we interpolate to solve the above equation.
Implements SmoothingKernel.
|
overrideprotectedvirtual |
This function sets up a grid that will be used to sample random radii from the smoothing kernel.
Reimplemented from SimulationItem.