RT-WDF
0.0.1
Real-time Wave Digital Filter Framework
|
#include <rt-wdf.h>
Public Member Functions | |
wdfTreeNode (std::vector< wdfTreeNode *> childrenIn) | |
wdfTreeNode (wdfTreeNode *left, wdfTreeNode *right) | |
wdfTreeNode () | |
virtual | ~wdfTreeNode () |
void | setParentInChildren () |
void | createPorts () |
double | adaptPorts (double T) |
virtual double | calculateUpRes (double T)=0 |
virtual void | calculateScatterCoeffs ()=0 |
virtual double | pullWaveUp () |
virtual double | calculateUpB ()=0 |
virtual void | pushWaveDown (double descendingWave) |
virtual void | calculateDownB (double descendingWave)=0 |
virtual std::string | getType () const =0 |
Public Attributes | |
std::unique_ptr< wdfPort > | upPort |
std::unique_ptr< wdfTreeNode > | parentNode |
Protected Attributes | |
std::vector< wdfPort * > | downPorts |
std::vector< wdfTreeNode * > | childrenNodes |
Tree Node class to describe a wave digital filter node in a subtree below the root
wdfTreeNode::wdfTreeNode | ( | std::vector< wdfTreeNode *> | childrenIn | ) |
Base class of a WDF Tree Node.
This is the base class for all adapted WDF elements in subtrees with more than n=2 ports that hang off the root.
*childrenNodes | holds a vector of pointers to all children connected to this element in the tree |
wdfTreeNode::wdfTreeNode | ( | wdfTreeNode * | left, |
wdfTreeNode * | right | ||
) |
Base class of a WDF Tree Node.
This version of the constructor is used as the base class for three port nodes in the tree (series and parallel adaptors)
*left | holds a pointer to the left child of the node |
*right | holds a pointer to the right child of the node |
wdfTreeNode::wdfTreeNode | ( | ) |
Base class of a WDF Tree Node.
This version of the constructor is used as the base class for all adapted WDF leafs.
|
virtual |
Destructor
double wdfTreeNode::adaptPorts | ( | double | T | ) |
Recursively adapts all ports in the tree.
This recursion should be initiated from the base of the tree. It sets port resistances of all upfacing ports according to component values and/or adaptation rules and copies it onto connected downfacing ports in the parent.
T | sample period as specified by setSamplerate() |
|
pure virtual |
Virtual placeholder function that is meant to set the wave components in the downfacing ports.
This function processes the input wave correctly for the downfacing ports and sets them in the port objects.
descendingWave | incoming wave component on the upfacing port |
Implemented in wdfTerminatedResVSource, wdfTerminatedRes, wdfTerminatedInd, wdfTerminatedCap, wdfInverter, wdfTerminatedParallel, wdfTerminatedSeries, and wdfTerminatedRtype.
|
pure virtual |
Virtual placeholder function that is meant to recursively calculate scattering coefficients of adapters.
This recursion should be initiated from the base of the tree. It calculates the scattering coefficients according to the port resistances of an element.
Implemented in wdfTerminatedLeaf, wdfInverter, wdfTerminatedParallel, wdfTerminatedSeries, and wdfTerminatedRtype.
|
pure virtual |
Virtual placeholder function that is meant to return the upfacing wave component towards the root.
This function is called from pullWave() to calculate the wave that travels towards the base according to the element type.
Implemented in wdfTerminatedResVSource, wdfTerminatedRes, wdfTerminatedInd, wdfTerminatedCap, wdfInverter, wdfTerminatedParallel, wdfTerminatedSeries, and wdfTerminatedRtype.
|
pure virtual |
Virtual placeholder function that is meant to return the nodes' upfacing port resistance.
This function is called from adaptPorts(). It returns the upfacing port resistance of a tree node to fulfill adaptation according to the respective adaptation law of this node.
T | sample period T = 1/fs as needed to adapt capacitors/inductors |
Implemented in wdfTerminatedResVSource, wdfTerminatedRes, wdfTerminatedInd, wdfTerminatedCap, wdfInverter, wdfTerminatedParallel, wdfTerminatedSeries, and wdfTerminatedRtype.
void wdfTreeNode::createPorts | ( | ) |
Recursively creates WDF ports in the tree.
This recursion should be initiated from the base of the tree. It creates downfacing ports for all children and an upfacing port in each child while setting the correct pointers to the nodes that these ports are connected to.
|
pure virtual |
Virtual placeholder function that is meant to return a String describing the type of this node.
Implemented in wdfTerminatedResVSource, wdfTerminatedRes, wdfTerminatedInd, wdfTerminatedCap, wdfInverter, wdfTerminatedParallel, wdfTerminatedSeries, and wdfTerminatedRtype.
|
virtual |
Recursively pulls the wave from the leafs towards the root.
This recursion should be initiated from the base of the tree. As all tree nodes are adapted, it basically just pulls up correctly scattered states of reactive elements and input values from adapted sources.
|
virtual |
Recursively pushes the wave from the root towards the leafs.
This recursion should be initiated from the base of the tree. It pushes the respective wave component of a branch from the root to the leafs by scattering them correctly along the way.
descendingWave | descending wave component that shall be scattered to the downfacing ports of the node or processed in a leaf accordingly |
void wdfTreeNode::setParentInChildren | ( | ) |
Recursively sets pointers to parent node in children.
This recursion should be initiated from the base of the tree. It sets a pointer to *this parent node in all connected children.
|
protected |
Vector of pointers to connected children nodes of this node.
|
protected |
Vector of pointers to downfacing port objects of this tree.
std::unique_ptr<wdfTreeNode> wdfTreeNode::parentNode |
Pointer to the connected parent node of this node.
std::unique_ptr<wdfPort> wdfTreeNode::upPort |
Pointer to the upfacing port object of this node.