| 54 | } // namespace wave_detail |
| 55 | |
| 56 | WaveSimulation1D_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 | |
| 72 | void WaveSimulation1D_Real::setSpeed(float something) { |
| 73 | // See constructor for clamp rationale. |
nothing calls this directly
no test coverage detected