@@ -26,8 +26,8 @@ void Naive::hlFilter(View::C_XY &complexArray) {
26
26
});
27
27
}
28
28
29
- void Naive::fft (View::R_XY in, View::C_XY out) {
30
- fft_base (in, out);
29
+ void Naive::fftHL (View::R_XY in, View::C_XY out) {
30
+ tf. fft (in, out);
31
31
hlFilter (out);
32
32
}
33
33
@@ -37,14 +37,13 @@ void Naive::init(std::string_view equilibriumName) {
37
37
auto temp = g.rBufXY ();
38
38
39
39
// Plan FFTs both ways
40
- fft_base = fftw::plan_r2c<2u >::dft (temp.to_mdspan (), phi_K.to_mdspan (), fftw::ESTIMATE);
41
- fftInv = fftw::plan_c2r<2u >::dft (phi_K.to_mdspan (), temp.to_mdspan (), fftw::ESTIMATE);
40
+ tf.init ();
42
41
43
42
// Initialize equilibrium values
44
43
auto [aParEq, phi] = equilibrium (equilibriumName, g);
45
44
46
- fft (phi.to_mdspan (), phi_K.to_mdspan ());
47
- fft (aParEq.to_mdspan (), aParEq_K.to_mdspan ());
45
+ fftHL (phi.to_mdspan (), phi_K.to_mdspan ());
46
+ fftHL (aParEq.to_mdspan (), aParEq_K.to_mdspan ());
48
47
49
48
// Transform moments into phase space
50
49
for (int m = G_MIN; m < g.M ; ++m) {
@@ -475,7 +474,7 @@ Real Naive::updateTimestep(Real dt, Real tempDt, bool noInc, Real relative_error
475
474
mdarray<Real, dextents<Dim, 2u >> Naive::getFinalAPar () {
476
475
Buf::R_XY buf = g.rBufXY ();
477
476
// This actually wrecks A_PAR, but we don't need it anymore
478
- fftInv (Grid::sliceXY (moments_K, A_PAR), buf.to_mdspan ());
477
+ tf. bfft (Grid::sliceXY (moments_K, A_PAR), buf.to_mdspan ());
479
478
480
479
// Write to a layout_right array and normalize
481
480
mdarray<Real, dextents<Dim, 2u >> result{g.X , g.Y };
@@ -490,7 +489,7 @@ Naive::Buf::R_XY Naive::getMoment(Dim m) const {
490
489
g.for_each_kxky ([&](Dim kx, Dim ky) { tmp (kx, ky) = moments_K (kx, ky, m); });
491
490
492
491
Buf::R_XY out = g.rBufXY ();
493
- fftInv (tmp.to_mdspan (), out.to_mdspan ());
492
+ tf. bfft (tmp.to_mdspan (), out.to_mdspan ());
494
493
495
494
return out;
496
495
}
@@ -506,16 +505,16 @@ Naive::Buf::R_XY Naive::getMoment(Dim m) const {
506
505
void Naive::derivatives (const View::C_XY &op, Naive::DxDy<View::R_XY> output) {
507
506
DxDy<Buf::C_XY> Der_K{g.KX , g.KY };
508
507
prepareDXY_PH (op, Der_K.DX , Der_K.DY );
509
- fftInv (Der_K.DX .to_mdspan (), output.DX );
510
- fftInv (Der_K.DY .to_mdspan (), output.DY );
508
+ tf. bfft (Der_K.DX .to_mdspan (), output.DX );
509
+ tf. bfft (Der_K.DY .to_mdspan (), output.DY );
511
510
}
512
511
513
512
Naive::Buf::C_XY Naive::halfBracket (Naive::DxDy<View::R_XY> derOp1,
514
513
Naive::DxDy<View::R_XY> derOp2) {
515
514
Buf::R_XY br = g.rBufXY ();
516
515
Buf::C_XY br_K = g.cBufXY ();
517
516
bracket (derOp1, derOp2, br);
518
- fft (br.to_mdspan (), br_K.to_mdspan ());
517
+ fftHL (br.to_mdspan (), br_K.to_mdspan ());
519
518
br_K (0 , 0 ) = 0 ;
520
519
return br_K;
521
520
}
@@ -532,16 +531,12 @@ void Naive::exportToNpy(std::string path, View::C_XY view) const {
532
531
533
532
g.for_each_kxky ([&](Dim kx, Dim ky) { tempK (kx, ky) = view (kx, ky); });
534
533
535
- fftInv (tempK.to_mdspan (), temp.to_mdspan ());
536
- normalize (temp.to_mdspan (), temp.to_mdspan ());
534
+ tf. bfft (tempK.to_mdspan (), temp.to_mdspan ());
535
+ tf. normalize (temp.to_mdspan (), temp.to_mdspan ());
537
536
538
537
exportToNpy (std::move (path), temp.to_mdspan ());
539
538
}
540
539
541
- void Naive::normalize (View::R_XY view, View::R_XY viewOut) const {
542
- g.for_each_xy ([&](Dim x, Dim y) { viewOut (x, y) = view (x, y) * XYNorm; });
543
- }
544
-
545
540
Naive::Energies Naive::calculateEnergies () const {
546
541
Energies e{};
547
542
g.for_each_kxky ([&](Dim kx, Dim ky) {
0 commit comments