srmainwaring / asv_wave_sim

This package contains plugins that support the simulation of waves and surface vessels in Gazebo.
GNU General Public License v3.0
110 stars 29 forks source link

Lazy evaluate the FFT wave simulation #94

Closed srmainwaring closed 1 year ago

srmainwaring commented 1 year ago

The FFT simulation currently executes the FFT plan each time functions such as ElevationAt are called, and updates the amplitudes when the time is updated.

This causes an issue with the new varieties of the function that allow access to individual elements because the optimised version of the FFT using Hermitian symmetry destroys the input storage during the calculation. Calling fftw_execute twice will give erroneous results the second time. The previous complex to complex plan does not have this problem.

The proposal is to implement lazy evaluation, so the FFT for each plan is only executed once after a time update.