The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | Friends | List of all members
QuarticSplineSmoothingKernel Class Reference

#include <QuarticSplineSmoothingKernel.hpp>

Inheritance diagram for QuarticSplineSmoothingKernel:
Inheritance graph
[legend]

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 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

 QuarticSplineSmoothingKernel ()
 
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 ()
 
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
 

Detailed Description

The QuarticSplineSmoothingKernel class is a subclass of the abstract SmoothingKernel class, and describes a smoothing kernel defined by the quartic spline density,

W(u)=15625512π{6u4125u2+461250u154u4+8u3245u2+825u+4412515u35u44u3+6u24u+135u10else.

It can be verified that this function is continuous at the break points and that it satisfies the required normalization

4π0W(u)u2du=1.

Constructor & Destructor Documentation

◆ QuarticSplineSmoothingKernel()

QuarticSplineSmoothingKernel::QuarticSplineSmoothingKernel ( )
inlineprotected

Default constructor for concrete Item subclass QuarticSplineSmoothingKernel : "a quartic spline smoothing kernel" .

Member Function Documentation

◆ columnDensity()

double QuarticSplineSmoothingKernel::columnDensity ( double  q) const
overridevirtual

This function returns the column density Σ(q)=2q1W(u)uduu2q2 of the smoothing kernel as a function of the normalized impact radius q=ri/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 107, compared to a maximum column density value of Σ(q=0)2.3873.

Implements SmoothingKernel.

◆ density()

double QuarticSplineSmoothingKernel::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 implements the formula given in the class header, but using floating point coefficients that were precomputed at high precision.

Implements SmoothingKernel.

◆ generateRadius()

double QuarticSplineSmoothingKernel::generateRadius ( ) const
overridevirtual

This function generates a random normalized radius u from the smoothing kernel. This is accomplished by generating a uniform deviate X, and solving the equation

X=0u4πW(u)u2du

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.

◆ setupSelfBefore()

void QuarticSplineSmoothingKernel::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: