| 180 | } |
| 181 | |
| 182 | WaveSimulation2D_Real::WaveSimulation2D_Real(u32 W, u32 H, |
| 183 | float speed, float dampening) FL_NOEXCEPT |
| 184 | : width(W), height(H), stride(W + 2), |
| 185 | grid1((W + 2) * (H + 2)), |
| 186 | grid2((W + 2) * (H + 2)), whichGrid(0), |
| 187 | // CFL stability bound for the explicit leapfrog 5-point stencil in 2D |
| 188 | // is C^2 <= 1/2. Negative speed has no physical meaning. Clamp at the |
| 189 | // boundary to keep the Q15 fixed-point kernel both stable and within |
| 190 | // i32 overflow margins (paired with the i64 promote in update()). |
| 191 | mCourantSq(wave_detail::float_to_fixed(fl::clamp(speed, 0.0f, 0.5f))), |
| 192 | // Dampening exponent; e.g., 6 means a factor of 2^6 = 64. |
| 193 | mDampening(static_cast<int>(dampening)), |
| 194 | mDampDecayQ15(wave_detail::compute_damp_decay_q15(static_cast<int>(dampening))) {} |
| 195 | |
| 196 | void WaveSimulation2D_Real::setSpeed(float something) { |
| 197 | // See constructor for clamp rationale. |
nothing calls this directly
no test coverage detected