The SKIRT project
advanced radiative transfer for astrophysics
CubicSplineSmoothingKernel Class Reference

#include <CubicSplineSmoothingKernel.hpp>

Inheritance diagram for CubicSplineSmoothingKernel:

Public Member Functions

double columnDensity (double q) const override
double density (double u) const override
double generateRadius () const override
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 ItemgetItemProperty (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)
Itemoperator= (const Item &)=delete
Itemparent () 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

 CubicSplineSmoothingKernel ()
void setupSelfBefore () override
Protected Member Functions inherited from SmoothingKernel
 SmoothingKernel ()
Randomrandom () const
void setupSelfBefore () override
Protected Member Functions inherited from SimulationItem
 SimulationItem ()
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
virtual void setupSelfAfter ()
Protected Member Functions inherited from Item
 Item ()

Private Types

using BaseType
using ItemType

Private Attributes

Array _Xv

Friends

class ItemRegistry

Detailed Description

The CubicSpineSmoothingKernel class is a subclass of the abstract SmoothingKernel class, and describes smoothing kernels defined by the standard cubic spline density,

\[ W(u) = \begin{cases}\; \dfrac{8\,(1-6\,u^2+6\,u^3)}{\pi} & \quad\text{if }0\leq u \leq \tfrac12, \\ \; \dfrac{16\,(1-u)^3}{\pi} & \quad \text{if }\tfrac12 \leq u \leq 1, \\ \; 0 & \quad \text{else}. \end{cases} \]

It can be checked that this function is continuous at \(u=\tfrac12\) and that it satisfies the required normalization

\[ 4\pi \int_0^\infty W(u)\, u^2\, {\text{d}}u = 1. \]

Constructor & Destructor Documentation

◆ CubicSplineSmoothingKernel()

CubicSplineSmoothingKernel::CubicSplineSmoothingKernel ( )
inlineprotected

Default constructor for concrete Item subclass CubicSplineSmoothingKernel: "a cubic spline smoothing kernel".

Member Function Documentation

◆ columnDensity()

double CubicSplineSmoothingKernel::columnDensity ( double q) const
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 cubic spline smoothing kernel, we obtain

\[\Sigma(q) = \begin{cases} \; \dfrac{2}{\pi}\left[(4+26\,q^2)\sqrt{1-q^2} - (1+26\,q^2)\sqrt{1-4\,q^2} \right. \\ \left. \qquad\quad-18\,q^4\ln \left(\dfrac{2\,q} {1+\sqrt{1-4\,q^2}}\right) -6\,q^2(4+q^2) \ln\left(\dfrac{2+2\sqrt{1-q^2}} {1+\sqrt{1-4\,q^2}}\right) \right] & \quad{\text{if }}0\leq q\leq \tfrac12, \\[1em] \; \dfrac{4}{\pi}\left[(2+13\,q^2)\sqrt{1-q^2} + 3\,q^2(4+q^2)\ln\left(\dfrac{q} {1+\sqrt{1-q^2}}\right)\right] & \quad{\text{if }}\tfrac12\leq q\leq 1, \\ \; 0 & \quad{\text{else}}. \end{cases} \]

Implements SmoothingKernel.

◆ density()

double CubicSplineSmoothingKernel::density ( double u) const
overridevirtual

This function returns the density \(W(u)\) of the smoothing kernel as a function of the normalized radius \(u\). It just implements the analytical formula given in the class header.

Implements SmoothingKernel.

◆ generateRadius()

double CubicSplineSmoothingKernel::generateRadius ( ) const
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 cubic spline smoothing kernel, we obtain

\[ \int_0^u 4\pi\,W(u')\,u'^2\, {\text{d}}u' = \begin{cases} \; 32 u^{6}-\dfrac{192}{5} u^{5}+\dfrac{32}{3} u^{3} & \quad\text{if }0\leq u \leq \tfrac12, \\ \; -\dfrac{32}{3} u^{6}+\dfrac{192}{5} u^{5}-48 u^{4}+\dfrac{64}{3} u^{3}-\dfrac{1}{15} & \quad \text{if }\tfrac12 \leq u \leq 1. \end{cases} \]

We precompute a tabulation of this cumulative distribution function on which we interpolate to solve this equation.

Implements SmoothingKernel.

◆ setupSelfBefore()

void CubicSplineSmoothingKernel::setupSelfBefore ( )
overrideprotectedvirtual

This function sets up a grid that will be used to sample random radii from the smoothing kernel.

Reimplemented from SimulationItem.


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