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

#include <RotateVectorFieldDecorator.hpp>

Inheritance diagram for RotateVectorFieldDecorator:
Inheritance graph
[legend]

Public Member Functions

int dimension () const override
 
double eulerAlpha () const
 
double eulerBeta () const
 
double eulerGamma () const
 
void setupSelfBefore () override
 
Vec vector (Position bfr) const override
 
VectorFieldvectorField () const
 
virtual int dimension () const =0
 
virtual Vec vector (Position bfr) 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

 RotateVectorFieldDecorator ()
 
- Protected Member Functions inherited from VectorField
 VectorField ()
 
- 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 = VectorField
 
using ItemType = RotateVectorFieldDecorator
 

Private Member Functions

Position derotate (Position bfr) const
 
Vec rotate (Vec bfrorig) const
 

Private Attributes

double _eulerAlpha
 
double _eulerBeta
 
double _eulerGamma
 
double _R11
 
double _R12
 
double _R13
 
double _R21
 
double _R22
 
double _R23
 
double _R31
 
double _R32
 
double _R33
 
VectorField_vectorField
 

Friends

class ItemRegistry
 

Detailed Description

The RotateVectorFieldDecorator class is a decorator that applies an arbitrary rotation to any vector field. For the rotation, we use the general framework of the three Euler angles that can be used to decompose any rotation into a sequence of three individual rotations over the principle axes. We apply the following set of rotations (the so-called X-convention):

If the original position of a vector is denoted as \({\bf{r}}_{\text{orig}}\), the new position can be found as \({\bf{r}} = {\bf{R}}\,{\bf{r}}_{\text{orig}}\), where the rotation matrix \({\bf{R}}\) is given by

\[ {\bf{R}} = \begin{pmatrix} \cos\gamma & \sin\gamma & 0 \\ -\sin\gamma & \cos\gamma & 0 \\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos\beta & \sin\beta \\ 0 & -\sin\beta & \cos\beta \end{pmatrix} \begin{pmatrix} \cos\alpha & \sin\alpha & 0 \\ -\sin\alpha & \cos\alpha & 0 \\ 0 & 0 & 1 \end{pmatrix} \]

or explicitly

\[ {\bf{R}} = \begin{pmatrix} \cos\alpha\cos\gamma-\sin\alpha\cos\beta\sin\gamma & \cos\gamma\sin\alpha+\cos\alpha\cos\beta\sin\gamma & \sin\beta\sin\gamma \\ -\cos\alpha\sin\gamma-\sin\alpha\cos\beta\cos\gamma & -\sin\alpha\sin\gamma+\cos\alpha\cos\beta\cos\gamma & \sin\beta\cos\gamma \\ \sin\alpha\sin\beta & -\cos\alpha\sin\beta & \cos\beta \end{pmatrix} \]

The properties of a RotateVectorFieldDecorator object are a reference to the vector field object being decorated, and the three Euler angles \((\alpha,\beta,\gamma)\) that describe the rotation. The resulting vector field is identical to the vector field being decorated, except that it is rotated over the three Euler angles.

When an item of this type is used, the names provided by the conditional value expression "Dimension3" are inserted into the name sets used for evaluating Boolean expressions.

Constructor & Destructor Documentation

◆ RotateVectorFieldDecorator()

RotateVectorFieldDecorator::RotateVectorFieldDecorator ( )
inlineprotected

Default constructor for concrete Item subclass RotateVectorFieldDecorator : "a decorator that adds a rotation to any vector field" .

Member Function Documentation

◆ derotate()

Position RotateVectorFieldDecorator::derotate ( Position  bfr) const
private

This function derotates a position \({\bf{r}}\), i.e. it returns the derotated position \({\bf{r}}_{\text{orig}} = {\bf{R}}^{\text{T}}\,{\bf{r}}\).

◆ dimension()

int RotateVectorFieldDecorator::dimension ( ) const
overridevirtual

This function returns the dimension of the vector field, which is 3 for this class because there are no guaranteed symmetries.

Implements VectorField.

◆ eulerAlpha()

RotateVectorFieldDecorator::eulerAlpha ( ) const
inline

This function returns the value of the discoverable double property eulerAlpha : "the first Euler angle α" .

This property represents a physical quantity of type "posangle" .

The minimum value for this property is "0 deg" .

The maximum value for this property is "360 deg" .

The default value for this property is given by the conditional value expression "0 deg" .

◆ eulerBeta()

RotateVectorFieldDecorator::eulerBeta ( ) const
inline

This function returns the value of the discoverable double property eulerBeta : "the second Euler angle β" .

This property represents a physical quantity of type "posangle" .

The minimum value for this property is "0 deg" .

The maximum value for this property is "180 deg" .

The default value for this property is given by the conditional value expression "0 deg" .

◆ eulerGamma()

RotateVectorFieldDecorator::eulerGamma ( ) const
inline

This function returns the value of the discoverable double property eulerGamma : "the third Euler angle γ" .

This property represents a physical quantity of type "posangle" .

The minimum value for this property is "0 deg" .

The maximum value for this property is "360 deg" .

The default value for this property is given by the conditional value expression "0 deg" .

◆ rotate()

Vec RotateVectorFieldDecorator::rotate ( Vec  bfrorig) const
private

This function rotates a vector \({\bf{r}}_{\text{orig}}\), i.e. it returns the rotated vector \({\bf{r}} = {\bf{R}}\,{\bf{r}}_{\text{orig}}\).

◆ setupSelfBefore()

void RotateVectorFieldDecorator::setupSelfBefore ( )
overridevirtual

This function calculates and stores some auxiliary values.

Reimplemented from SimulationItem.

◆ vector()

Vec RotateVectorFieldDecorator::vector ( Position  bfr) const
overridevirtual

This function returns the value of the vector field at the position \({\bf{r}}\). It calls the vector() function for the vector field being decorated with the derotated position \({\bf{r}}_{\text{orig}} = {\bf{R}}^{\text{T}}\,{\bf{r}}\) as the argument.

Implements VectorField.

◆ vectorField()

VectorField * RotateVectorFieldDecorator::vectorField ( ) const
inline

This function returns the value of the discoverable item property vectorField : "the vector field to be rotated" .


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