MCPcopy Create free account
hub / github.com/FastLED/FastLED / WaveSimulation1D_Real

Method WaveSimulation1D_Real

src/fl/math/wave/wave_simulation_real.cpp.hpp:56–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54} // namespace wave_detail
55
56WaveSimulation1D_Real::WaveSimulation1D_Real(u32 len, float courantSq,
57 int dampening) FL_NOEXCEPT
58 : length(len),
59 grid1(length + 2), // Initialize vector with correct size
60 grid2(length + 2), // Initialize vector with correct size
61 whichGrid(0),
62 // CFL stability bound for the explicit leapfrog 5-point stencil in 1D
63 // is C^2 <= 1. Negative speed has no physical meaning. Clamp at the
64 // boundary to keep the Q15 fixed-point kernel both stable and within
65 // i32 overflow margins (paired with the i64 promote in update()).
66 mCourantSq(wave_detail::float_to_fixed(fl::clamp(courantSq, 0.0f, 1.0f))),
67 mDampenening(dampening),
68 mDampDecayQ15(wave_detail::compute_damp_decay_q15(dampening)) {
69 // Additional initialization can be added here if needed.
70}
71
72void WaveSimulation1D_Real::setSpeed(float something) {
73 // See constructor for clamp rationale.

Callers

nothing calls this directly

Calls 3

float_to_fixedFunction · 0.85
clampFunction · 0.85
compute_damp_decay_q15Function · 0.85

Tested by

no test coverage detected