@@ -71,7 +71,7 @@ fftw_plan modes_hosgrid::plan_ifftw(
7171 std::exit (1 );
7272 }
7373 // Output array is used for planning (except for FFTW_ESTIMATE)
74- double out[n0][n1];
74+ double out[n0][n1]; // HERE
7575 // Make and return plan
7676 return fftw_plan_dft_c2r_2d (n0, n1, in, &out[0 ][0 ], flag);
7777}
@@ -104,7 +104,7 @@ void modes_hosgrid::plan_ifftw_nwt(
104104 std::exit (1 );
105105 }
106106 // Output array is used for planning (except for FFTW_ESTIMATE)
107- double out[n0 * n1];
107+ double out[n0 * n1]; // HERE
108108 if (n0 == 1 ) {
109109 // CC
110110 plan_vector.emplace_back (
@@ -204,14 +204,13 @@ void modes_hosgrid::populate_hos_ocean_eta_nondim(
204204 amrex::Gpu::DeviceVector<amrex::Real>& HOS_eta)
205205{
206206 // Local array for output data
207- double out[ n0 * n1] ;
207+ std::vector< double > out ( n0 * n1) ;
208208 // Perform complex-to-real (inverse) FFT
209- do_ifftw (n0, n1, p, eta_modes, & out[ 0 ] );
209+ do_ifftw (n0, n1, p, eta_modes, out. data () );
210210
211211 // Copy data to output vector
212212 amrex::Gpu::copy (
213- amrex::Gpu::hostToDevice, &out[0 ], &out[0 ] + HOS_eta.size (),
214- HOS_eta.begin ());
213+ amrex::Gpu::hostToDevice, out.begin (), out.end (), HOS_eta.begin ());
215214
216215 // !! -- This function MODIFIES the modes -- !! //
217216 // .. they are not intended to be reused .. //
@@ -243,16 +242,18 @@ void modes_hosgrid::populate_hos_nwt_eta_nondim(
243242 amrex::Gpu::DeviceVector<amrex::Real>& HOS_eta)
244243{
245244 // Local array for output data
246- double out[n0 * n1];
247- double f_work[n0 * n1];
248- double sp_work[n0 * n1];
245+ std::vector<double > out (n0 * n1);
246+ std::vector<double > f_work (n0 * n1);
247+ std::vector<double > sp_work (n0 * n1);
248+
249249 // Perform complex-to-real (inverse) FFT (cos, cos)
250- do_ifftw (n0, n1, true , true , p_vector, eta_modes, &out[0 ], f_work, sp_work);
250+ do_ifftw (
251+ n0, n1, true , true , p_vector, eta_modes, out.data (), f_work.data (),
252+ sp_work.data ());
251253
252254 // Copy data to output vector
253255 amrex::Gpu::copy (
254- amrex::Gpu::hostToDevice, &out[0 ], &out[0 ] + HOS_eta.size (),
255- HOS_eta.begin ());
256+ amrex::Gpu::hostToDevice, out.begin (), out.end (), HOS_eta.begin ());
256257
257258 // !! -- This function MODIFIES the modes -- !! //
258259 // .. they are not intended to be reused .. //
0 commit comments