@@ -59,6 +59,7 @@ SpectralExecutionerBase::execute()
59
59
// back and forth test
60
60
auto & c_buffer = getFFTBuffer < Real > ("c" );
61
61
auto c = c_buffer .realSpace ();
62
+ auto c_tilde = c_buffer .reciprocalSpace ();
62
63
c_buffer .forward ();
63
64
64
65
auto & R_buffer = getFFTBuffer < RealVectorValue > ("R" );
@@ -114,24 +115,25 @@ SpectralExecutionerBase::kVectorMultiply(const FFTBufferBase<Real> & in_buffer,
114
115
{
115
116
case 1 :
116
117
{
118
+ const auto & ivec = in_buffer .kTable (0 );
117
119
const int ni = grid [0 ];
118
- for (int i = 0 ; i < ni ; ++ i )
119
- {
120
- out [i ](0 ) = in [i ] * i ;
121
- }
120
+ for (int i = 0 ; i * 2 <= ni ; ++ i )
121
+ out [i ](0 ) = in [i ] * ivec [i ];
122
122
return ;
123
123
}
124
124
125
125
case 2 :
126
126
{
127
127
std ::size_t index = 0 ;
128
+ const auto & ivec = in_buffer .kTable (0 );
129
+ const auto & jvec = in_buffer .kTable (1 );
128
130
const int ni = grid [0 ];
129
131
const int nj = grid [1 ];
130
132
for (int i = 0 ; i < ni ; ++ i )
131
- for (int j = 0 ; j < nj ; ++ j )
133
+ for (int j = 0 ; j * 2 <= nj ; ++ j )
132
134
{
133
- out [index ](0 ) = in [index ] * i ;
134
- out [index ](1 ) = in [index ] * j ;
135
+ out [index ](0 ) = in [index ] * ivec [ i ] ;
136
+ out [index ](1 ) = in [index ] * jvec [ j ] ;
135
137
index ++ ;
136
138
}
137
139
return ;
@@ -140,16 +142,19 @@ SpectralExecutionerBase::kVectorMultiply(const FFTBufferBase<Real> & in_buffer,
140
142
case 3 :
141
143
{
142
144
std ::size_t index = 0 ;
145
+ const auto & ivec = in_buffer .kTable (0 );
146
+ const auto & jvec = in_buffer .kTable (1 );
147
+ const auto & kvec = in_buffer .kTable (2 );
143
148
const int ni = grid [0 ];
144
149
const int nj = grid [1 ];
145
150
const int nk = grid [2 ];
146
151
for (int i = 0 ; i < ni ; ++ i )
147
152
for (int j = 0 ; j < nj ; ++ j )
148
- for (int k = 0 ; k < nk ; ++ k )
153
+ for (int k = 0 ; k * 2 <= nk ; ++ k )
149
154
{
150
- out [index ](0 ) = in [index ] * i ;
151
- out [index ](1 ) = in [index ] * j ;
152
- out [index ](2 ) = in [index ] * k ;
155
+ out [index ](0 ) = in [index ] * ivec [ i ] ;
156
+ out [index ](1 ) = in [index ] * jvec [ j ] ;
157
+ out [index ](2 ) = in [index ] * kvec [ k ] ;
153
158
index ++ ;
154
159
}
155
160
return ;
0 commit comments