MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ apply()

void MayaFlux::Kinesis::Acoustics::DuctLoss::apply ( std::span< double > velocity) const
noexcept

Apply the loss to the velocities of a sample, in place.

Parameters
velocityN volume velocities just after the wave update

Does nothing when both rates are zero, or when the size does not match the grid. Allocates nothing.

Definition at line 101 of file DuctLoss.cpp.

102{
103 const size_t n = m_mass.size();
104 if (!m_active || n == 0 || velocity.size() != n) {
105 return;
106 }
107
108 velocity[0] = m_mass[0] * velocity[0] * m_inverse_pivot[0];
109 for (size_t l = 1; l < n; ++l) {
110 velocity[l] = (m_mass[l] * velocity[l] + m_edge[l - 1] * velocity[l - 1]) * m_inverse_pivot[l];
111 }
112 for (size_t l = n - 1; l > 0; --l) {
113 velocity[l - 1] += m_upper[l - 1] * velocity[l];
114 }
115}
std::vector< double > m_inverse_pivot
Definition DuctLoss.hpp:98
T velocity(const Memory::HistoryBuffer< T > &history, double dt) noexcept
First difference: rate of change of position.

References m_active, m_edge, m_inverse_pivot, m_mass, m_upper, and MayaFlux::Kinesis::velocity().

Here is the call graph for this function: