Efficient preallocation of computation arrays in WaveSimul
This PR changes where and how arrays used for computations are allocated.
Instead of reallocating new arrays for every shot, computation arrays are stored into WaveSimul
and reused by future shot computations.
Where creating a new WaveSimul
, arrays are allocated (either on CPU or GPU depending on the specified backend to be used) and are updated at every call of swforward!
, swgradient!
or swmisfit!
based on the new material properties.
WaveSimul
objects can now be build with build_wavesim
before calling swforward!
, swgradient!
or swmisfit!
for more efficient pre-allocation and memory re-usage.