@@ -40,7 +40,8 @@ struct KGrid{T <: KGridType, D}
4040 cache1:: Array{ComplexF64,D}
4141 cache2:: Array{ComplexF64,D}
4242 fftw_plan:: FFTW.cFFTWPlan
43- function KGrid (GT:: Type{T} , D:: Int , Ns:: Int , t:: Float64 , tp:: Float64 , tpp:: Float64 ; full:: Bool = false , fftw_plan= nothing ) where T<: KGridType
43+ ifftw_plan:: AbstractFFTs.ScaledPlan
44+ function KGrid (GT:: Type{T} , D:: Int , Ns:: Int , t:: Float64 , tp:: Float64 , tpp:: Float64 ; full:: Bool = false , fftw_plan= nothing , ifftw_plan= nothing ) where T<: KGridType
4445 sampling = gen_sampling (GT, D, Ns)
4546 kGrid_f = map (v -> basis_transform (GT, v), sampling)
4647 kInd, kInd_conv, kInd_crossc, kMult, expand_perms, kGrid = full ? reduce_KGrid_ident (GT, D, Ns, kGrid_f) : reduce_KGrid (GT, D, Ns, kGrid_f)
@@ -51,9 +52,13 @@ struct KGrid{T <: KGridType, D}
5152 # println("WARNING!!! k-grid sampling must contain zero-vector in order for convolutions to work!")
5253 k0 = first (CartesianIndices ([1 2 ; 3 4 ]))
5354 end
54- fftw_plan = fftw_plan === nothing ? plan_fft! (FFTW. FakeArray {ComplexF64} (gs... ), flags= FFTW. ESTIMATE, timelimit= Inf ) : fftw_plan
55+ cache1 = Array {ComplexF64,D} (undef, gs... )
56+ cache2 = Array {ComplexF64,D} (undef, gs... )
57+ FFTW. set_num_threads (1 );
58+ fftw_plan = fftw_plan === nothing ? plan_fft! (cache1, flags= FFTW. PATIENT, timelimit= Inf , num_threads= 1 ) : fftw_plan
59+ ifftw_plan = ifftw_plan === nothing ? plan_ifft! (cache1, flags= FFTW. PATIENT, timelimit= Inf , num_threads= 1 ) : ifftw_plan
5560 new {GT,D} (Ns^ D, Ns, t, tp, tpp, k0, kGrid, ϵkGrid, kInd, kInd_conv, kInd_crossc, kMult, expand_perms,
56- Array {ComplexF64,D} (undef, gs ... ), Array {ComplexF64,D} (undef, gs ... ), fftw_plan )
61+ cache1, cache2, fftw_plan, ifftw_plan )
5762 end
5863end
5964
0 commit comments