diff --git a/src/interp_to_mfab.cpp b/src/interp_to_mfab.cpp index 85430be..8a39b74 100644 --- a/src/interp_to_mfab.cpp +++ b/src/interp_to_mfab.cpp @@ -97,9 +97,9 @@ int interp_to_mfab::create_height_vector( // current process int interp_to_mfab::get_local_height_indices( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::Vector field_fabs, - amrex::Vector geom) + const amrex::Vector& hvec, + const amrex::Vector& field_fabs, + const amrex::Vector& geom) { // Bounds of local AMR mesh @@ -122,10 +122,11 @@ int interp_to_mfab::get_local_height_indices( // current process int interp_to_mfab::get_local_height_indices( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> dx_vec) + const amrex::Vector& hvec, + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& dx_vec) { // Bounds of local AMR mesh @@ -147,10 +148,10 @@ int interp_to_mfab::get_local_height_indices( // current process int interp_to_mfab::get_local_height_indices( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::MultiFab& mfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::Vector& hvec, + const amrex::MultiFab& mfab, + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { // Bounds of local AMR mesh @@ -165,9 +166,9 @@ int interp_to_mfab::get_local_height_indices( // !! -- This assumes cell-centered locations are what matters -- !! // void interp_to_mfab::get_mfab_mesh_bounds( - amrex::MultiFab& mfab, - amrex::GpuArray problo, - amrex::GpuArray dx, + const amrex::MultiFab& mfab, + const amrex::GpuArray& problo, + const amrex::GpuArray& dx, amrex::Real& mesh_zlo, amrex::Real& mesh_zhi, int idim) @@ -185,9 +186,9 @@ void interp_to_mfab::get_mfab_mesh_bounds( int interp_to_mfab::local_height_vec_ops( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::Real& mesh_zlo, - amrex::Real& mesh_zhi) + const amrex::Vector& hvec, + const amrex::Real& mesh_zlo, + const amrex::Real& mesh_zhi) { // Loop through height vector and get first and last indices int itop = -1; // top index is lowest ind, highest height @@ -236,8 +237,8 @@ int interp_to_mfab::local_height_vec_ops( int interp_to_mfab::check_lateral_overlap( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector geom, + const amrex::Vector& field_fabs, + const amrex::Vector& geom, bool is_hi) { @@ -279,8 +280,8 @@ int interp_to_mfab::check_lateral_overlap( int interp_to_mfab::check_lateral_overlap_lo( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector geom) + const amrex::Vector& field_fabs, + const amrex::Vector& geom) { return check_lateral_overlap(dist, idim, field_fabs, geom, false); } @@ -288,8 +289,8 @@ int interp_to_mfab::check_lateral_overlap_lo( int interp_to_mfab::check_lateral_overlap_hi( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector geom) + const amrex::Vector& field_fabs, + const amrex::Vector& geom) { return check_lateral_overlap(dist, idim, field_fabs, geom, true); } @@ -297,10 +298,12 @@ int interp_to_mfab::check_lateral_overlap_hi( int interp_to_mfab::check_lateral_overlap( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> probhi_vec, - amrex::Vector> dx_vec, + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& + probhi_vec, + const amrex::Vector>& dx_vec, bool is_hi) { @@ -342,10 +345,12 @@ int interp_to_mfab::check_lateral_overlap( int interp_to_mfab::check_lateral_overlap_lo( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> probhi_vec, - amrex::Vector> dx_vec) + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& + probhi_vec, + const amrex::Vector>& dx_vec) { return check_lateral_overlap( dist, idim, field_fabs, problo_vec, probhi_vec, dx_vec, false); @@ -354,10 +359,12 @@ int interp_to_mfab::check_lateral_overlap_lo( int interp_to_mfab::check_lateral_overlap_hi( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> probhi_vec, - amrex::Vector> dx_vec) + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& + probhi_vec, + const amrex::Vector>& dx_vec) { return check_lateral_overlap( dist, idim, field_fabs, problo_vec, probhi_vec, dx_vec, true); @@ -374,9 +381,9 @@ void interp_to_mfab::interp_eta_to_levelset_field( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, - amrex::Vector lsfield, - amrex::Vector geom) + const amrex::Gpu::DeviceVector& etavec, + const amrex::Vector& lsfield, + const amrex::Vector& geom) { // Number of levels @@ -405,10 +412,11 @@ void interp_to_mfab::interp_eta_to_levelset_field( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, - amrex::Vector lsfield, - amrex::Vector> problo_vec, - amrex::Vector> dx_vec) + const amrex::Gpu::DeviceVector& etavec, + const amrex::Vector& lsfield, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& dx_vec) { // Number of levels @@ -435,13 +443,13 @@ void interp_to_mfab::interp_velocity_to_field( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, - amrex::Vector vfield, - amrex::Vector geom) + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, + const amrex::Vector& vfield, + const amrex::Vector& geom) { // Number of levels @@ -485,14 +493,15 @@ void interp_to_mfab::interp_velocity_to_field( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, - amrex::Vector vfield, - amrex::Vector> problo_vec, - amrex::Vector> dx_vec) + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, + const amrex::Vector& vfield, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& dx_vec) { // Number of levels @@ -537,10 +546,10 @@ void interp_to_mfab::interp_eta_to_levelset_multifab( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, + const amrex::Gpu::DeviceVector& etavec, amrex::MultiFab& lsfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { if (spd_ny == 1) { @@ -563,14 +572,14 @@ void interp_to_mfab::interp_velocity_to_multifab( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, amrex::MultiFab& vfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { if (spd_ny == 1) { @@ -594,10 +603,10 @@ void interp_to_mfab::interp_eta_to_levelset_multifab3D( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, + const amrex::Gpu::DeviceVector& etavec, amrex::MultiFab& lsfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { // Get pointer to device vector @@ -689,14 +698,14 @@ void interp_to_mfab::interp_velocity_to_multifab3D( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, + const amrex::Vector& indvec, + const const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, amrex::MultiFab& vfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { // Number of heights relevant to this processor const int nhts = indvec.size(); @@ -861,10 +870,10 @@ void interp_to_mfab::interp_eta_to_levelset_multifab2D( const amrex::Real spd_xlo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, + const amrex::Gpu::DeviceVector& etavec, amrex::MultiFab& lsfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { // Get pointer to device vector @@ -922,13 +931,13 @@ void interp_to_mfab::interp_velocity_to_multifab2D( const amrex::Real spd_dx, const amrex::Real spd_xlo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector wvec, + const amrex::Vector& indvec, + const const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& wvec, amrex::MultiFab& vfab, - amrex::GpuArray problo, - amrex::GpuArray dx) + const amrex::GpuArray& problo, + const amrex::GpuArray& dx) { // Number of heights relevant to this processor const int nhts = indvec.size(); @@ -1114,4 +1123,4 @@ AMREX_GPU_HOST_DEVICE amrex::Real interp_to_mfab::linear_interp1D( const amrex::Real wx_lo = 1.0 - wx_hi; return (wx_lo * a0 + wx_hi * a1); -} \ No newline at end of file +} diff --git a/src/interp_to_mfab.h b/src/interp_to_mfab.h index 207b4e7..d4ebec5 100644 --- a/src/interp_to_mfab.h +++ b/src/interp_to_mfab.h @@ -14,82 +14,89 @@ int create_height_vector( int get_local_height_indices( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::Vector field_fabs, - amrex::Vector geom); + const amrex::Vector& hvec, + const amrex::Vector& field_fabs, + const amrex::Vector& geom); int get_local_height_indices( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> dx_vec); + const amrex::Vector& hvec, + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& dx_vec); int get_local_height_indices( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::MultiFab& mfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::Vector& hvec, + const amrex::MultiFab& mfab, + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); // This library assumes height is in z (index of 2) void get_mfab_mesh_bounds( - amrex::MultiFab& mfab, - amrex::GpuArray problo, - amrex::GpuArray dx, + const amrex::MultiFab& mfab, + const amrex::GpuArray& problo, + const amrex::GpuArray& dx, amrex::Real& mesh_zlo, amrex::Real& mesh_zhi, int idim = 2); int local_height_vec_ops( amrex::Vector& indvec, - amrex::Vector hvec, - amrex::Real& mesh_zlo, - amrex::Real& mesh_zhi); + const amrex::Vector& hvec, + const amrex::Real& mesh_zlo, + const amrex::Real& mesh_zhi); int check_lateral_overlap( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector geom, + const amrex::Vector& field_fabs, + const amrex::Vector& geom, bool is_hi); int check_lateral_overlap_lo( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector geom); + const amrex::Vector& field_fabs, + const amrex::Vector& geom); int check_lateral_overlap_hi( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector geom); + const amrex::Vector& field_fabs, + const amrex::Vector& geom); int check_lateral_overlap( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> probhi_vec, - amrex::Vector> dx_vec, + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& + probhi_vec, + const amrex::Vector>& dx_vec, bool is_hi); int check_lateral_overlap_lo( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> probhi_vec, - amrex::Vector> dx_vec); + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& + probhi_vec, + const amrex::Vector>& dx_vec); int check_lateral_overlap_hi( amrex::Real dist, int idim, - amrex::Vector field_fabs, - amrex::Vector> problo_vec, - amrex::Vector> probhi_vec, - amrex::Vector> dx_vec); + const amrex::Vector& field_fabs, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& + probhi_vec, + const amrex::Vector>& dx_vec); void interp_eta_to_levelset_field( const int spd_nx, @@ -100,9 +107,9 @@ void interp_eta_to_levelset_field( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, - amrex::Vector lsfield, - amrex::Vector geom); + const amrex::Gpu::DeviceVector& etavec, + const amrex::Vector& lsfield, + const amrex::Vector& geom); void interp_eta_to_levelset_field( const int spd_nx, @@ -113,10 +120,11 @@ void interp_eta_to_levelset_field( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, - amrex::Vector lsfield, - amrex::Vector> problo_vec, - amrex::Vector> dx_vec); + const amrex::Gpu::DeviceVector& etavec, + const amrex::Vector& lsfield, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& dx_vec); void interp_velocity_to_field( const int spd_nx, @@ -126,13 +134,13 @@ void interp_velocity_to_field( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, - amrex::Vector vfield, - amrex::Vector geom); + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, + const amrex::Vector& vfield, + const amrex::Vector& geom); void interp_velocity_to_field( const int spd_nx, @@ -142,14 +150,15 @@ void interp_velocity_to_field( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, - amrex::Vector vfield, - amrex::Vector> problo_vec, - amrex::Vector> dx_vec); + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, + const amrex::Vector& vfield, + const amrex::Vector>& + problo_vec, + const amrex::Vector>& dx_vec); void interp_eta_to_levelset_multifab( const int spd_nx, @@ -160,10 +169,10 @@ void interp_eta_to_levelset_multifab( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, + const amrex::Gpu::DeviceVector& etavec, amrex::MultiFab& lsfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); void interp_velocity_to_multifab( const int spd_nx, @@ -173,14 +182,14 @@ void interp_velocity_to_multifab( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, amrex::MultiFab& vfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); void interp_eta_to_levelset_multifab3D( const int spd_nx, @@ -191,10 +200,10 @@ void interp_eta_to_levelset_multifab3D( const amrex::Real spd_ylo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, + const amrex::Gpu::DeviceVector& etavec, amrex::MultiFab& lsfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); void interp_velocity_to_multifab3D( const int spd_nx, @@ -204,14 +213,14 @@ void interp_velocity_to_multifab3D( const amrex::Real spd_xlo, const amrex::Real spd_ylo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector vvec, - amrex::Gpu::DeviceVector wvec, + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& vvec, + const amrex::Gpu::DeviceVector& wvec, amrex::MultiFab& vfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); void interp_eta_to_levelset_multifab2D( const int spd_nx, @@ -219,23 +228,23 @@ void interp_eta_to_levelset_multifab2D( const amrex::Real spd_xlo, const amrex::Real zsl, const bool is_periodic, - amrex::Gpu::DeviceVector etavec, + const amrex::Gpu::DeviceVector& etavec, amrex::MultiFab& lsfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); void interp_velocity_to_multifab2D( const int spd_nx, const amrex::Real spd_dx, const amrex::Real spd_xlo, const bool is_periodic, - amrex::Vector indvec, - amrex::Vector hvec, - amrex::Gpu::DeviceVector uvec, - amrex::Gpu::DeviceVector wvec, + const amrex::Vector& indvec, + const amrex::Vector& hvec, + const amrex::Gpu::DeviceVector& uvec, + const amrex::Gpu::DeviceVector& wvec, amrex::MultiFab& vfab, - amrex::GpuArray problo, - amrex::GpuArray dx); + const amrex::GpuArray& problo, + const amrex::GpuArray& dx); AMREX_GPU_HOST_DEVICE amrex::Real linear_interp( const amrex::Real a000, @@ -277,4 +286,4 @@ AMREX_GPU_HOST_DEVICE amrex::Real linear_interp1D( } // namespace interp_to_mfab -#endif \ No newline at end of file +#endif diff --git a/src/modes_hosgrid.cpp b/src/modes_hosgrid.cpp index e00c430..470add5 100644 --- a/src/modes_hosgrid.cpp +++ b/src/modes_hosgrid.cpp @@ -5,7 +5,7 @@ void modes_hosgrid::copy_complex( const int n0, const int n1, - std::vector> complex_vector, + const std::vector>& complex_vector, fftw_complex* ptr) { for (int i = 0; i < n0; ++i) { @@ -26,7 +26,10 @@ fftw_complex* modes_hosgrid::allocate_complex(const int n0, const int n1) } void modes_hosgrid::copy_real( - const int n0, const int n1, std::vector real_vector, double* ptr) + const int n0, + const int n1, + const std::vector& real_vector, + double* ptr) { for (int i = 0; i < n0; ++i) { for (int j = 0; j < n1; ++j) { @@ -137,7 +140,7 @@ void modes_hosgrid::plan_ifftw_nwt( fftw_complex* modes_hosgrid::allocate_copy( const int n0, const int n1, - std::vector> complex_vector) + const std::vector>& complex_vector) { // Allocate and get pointer auto a_ptr = allocate_complex(n0, n1); @@ -151,7 +154,7 @@ void modes_hosgrid::populate_hos_eta( const int n0, const int n1, const double dimL, - std::vector p_vector, + const std::vector& p_vector, fftw_complex* eta_modes, amrex::Gpu::DeviceVector& HOS_eta) { @@ -188,7 +191,7 @@ void modes_hosgrid::populate_hos_eta( const int n0, const int n1, const double dimL, - std::vector p_vector, + const std::vector& p_vector, double* eta_modes, amrex::Gpu::DeviceVector& HOS_eta) { @@ -205,7 +208,7 @@ void modes_hosgrid::populate_hos_eta( void modes_hosgrid::populate_hos_nwt_eta_nondim( const int n0, const int n1, - std::vector p_vector, + const std::vector& p_vector, double* eta_modes, amrex::Gpu::DeviceVector& HOS_eta) { @@ -252,7 +255,7 @@ void modes_hosgrid::populate_hos_vel( std::vector> mX_vector, std::vector> mY_vector, std::vector> mZ_vector, - std::vector p_vector, + const std::vector& p_vector, fftw_complex* x_modes, fftw_complex* y_modes, fftw_complex* z_modes, @@ -394,11 +397,11 @@ void modes_hosgrid::populate_hos_vel( double zsl, const double dimL, const double dimT, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector mAdd_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& mAdd_vector, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -450,10 +453,10 @@ void modes_hosgrid::populate_hos_nwt_vel_nondim( const double nd_xlen, const double nd_ylen, const double nd_z, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -559,8 +562,8 @@ void modes_hosgrid::populate_additional_hos_nwt_vel_nondim( const double nd_xlen, const double nd_ylen, const double nd_z, - std::vector add_modes_vec, - std::vector p_vector, + const std::vector& add_modes_vec, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -754,7 +757,7 @@ void modes_hosgrid::do_ifftw( const int n1, const bool cos_y, const bool cos_x, - std::vector p_vector, + const std::vector& p_vector, double* f_in, double* sp_out, double* f_work, @@ -846,7 +849,7 @@ void modes_hosgrid::do_ifftw( void modes_hosgrid::do_ifftw( const int n0, const bool cos_y, - std::vector p_vector, + const std::vector& p_vector, double* f_in, double* sp_out, double* f_work, diff --git a/src/modes_hosgrid.h b/src/modes_hosgrid.h index 149cfdd..641d008 100644 --- a/src/modes_hosgrid.h +++ b/src/modes_hosgrid.h @@ -11,12 +11,15 @@ enum struct planner_flags { estimate, patient, exhaustive, measure }; void copy_complex( const int n0, const int n1, - std::vector> complex_vector, + const std::vector>& complex_vector, fftw_complex* ptr); fftw_complex* allocate_complex(const int n0, const int n1); void copy_real( - const int n0, const int n1, std::vector real_vector, double* ptr); + const int n0, + const int n1, + const std::vector& real_vector, + double* ptr); double* allocate_real(const int n0, const int n1); fftw_plan plan_ifftw( @@ -29,7 +32,7 @@ fftw_plan plan_ifftw( fftw_complex* allocate_copy( const int n0, const int n1, - std::vector> complex_vector); + const std::vector>& complex_vector); void plan_ifftw_nwt( const int n0, @@ -42,7 +45,7 @@ void plan_ifftw_nwt( template void populate_hos_eta( ReadModes rm_obj, - std::vector p_vector, + const std::vector& p_vector, PT* eta_modes, amrex::Gpu::DeviceVector& HOS_eta); @@ -50,7 +53,7 @@ void populate_hos_eta( const int n0, const int n1, const double dimL, - std::vector p_vector, + const std::vector& p_vector, fftw_complex* eta_modes, amrex::Gpu::DeviceVector& HOS_eta); @@ -65,14 +68,14 @@ void populate_hos_eta( const int n0, const int n1, const double dimL, - std::vector p_vector, + const std::vector& p_vector, double* eta_modes, amrex::Gpu::DeviceVector& HOS_eta); void populate_hos_nwt_eta_nondim( const int n0, const int n1, - std::vector p_vector, + const std::vector& p_vector, double* eta_modes, amrex::Gpu::DeviceVector& HOS_eta); @@ -84,10 +87,10 @@ void populate_hos_vel( ReadModes rm_obj, const double z, const double zsl, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& p_vector, fftw_complex* x_modes, fftw_complex* y_modes, fftw_complex* z_modes, @@ -101,11 +104,11 @@ void populate_hos_vel( ReadModes rm_obj, const double z, const double zsl, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector mAdd_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& mAdd_vector, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -130,7 +133,7 @@ void populate_hos_vel( std::vector> mX_vector, std::vector> mY_vector, std::vector> mZ_vector, - std::vector p_vector, + const std::vector& p_vector, fftw_complex* x_modes, fftw_complex* y_modes, fftw_complex* z_modes, @@ -168,11 +171,11 @@ void populate_hos_vel( const double zsl, const double dimL, const double dimT, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector mAdd_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& mAdd_vector, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -190,10 +193,10 @@ void populate_hos_nwt_vel_nondim( const double nd_xlen, const double nd_ylen, const double nd_z, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -208,8 +211,8 @@ void populate_additional_hos_nwt_vel_nondim( const double nd_xlen, const double nd_ylen, const double nd_z, - std::vector add_modes_vec, - std::vector p_vector, + const std::vector& add_modes_vec, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -248,7 +251,7 @@ void do_ifftw( const int n1, const bool cos_y, const bool cos_x, - std::vector p_vector, + const std::vector& p_vector, double* f_in, double* sp_out, double* f_work, @@ -257,7 +260,7 @@ void do_ifftw( void do_ifftw( const int n0, const bool cos_y, - std::vector p_vector, + const std::vector& p_vector, double* f_in, double* sp_out, double* f_work, diff --git a/src/modes_hosgrid.tpp b/src/modes_hosgrid.tpp index e6d70bb..f2751c4 100644 --- a/src/modes_hosgrid.tpp +++ b/src/modes_hosgrid.tpp @@ -6,10 +6,10 @@ void modes_hosgrid::populate_hos_vel( ReadModes rm_obj, const double z, const double zsl, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& p_vector, fftw_complex* x_modes, fftw_complex* y_modes, fftw_complex* z_modes, @@ -32,11 +32,11 @@ void modes_hosgrid::populate_hos_vel( ReadModes rm_obj, const double z, const double zsl, - std::vector mX_vector, - std::vector mY_vector, - std::vector mZ_vector, - std::vector mAdd_vector, - std::vector p_vector, + const std::vector& mX_vector, + const std::vector& mY_vector, + const std::vector& mZ_vector, + const std::vector& mAdd_vector, + const std::vector& p_vector, double* x_modes, double* y_modes, double* z_modes, @@ -62,7 +62,7 @@ void modes_hosgrid::populate_hos_vel( template void modes_hosgrid::populate_hos_eta( ReadModes rm_obj, - std::vector p_vector, + const std::vector& p_vector, PT* eta_modes, amrex::Gpu::DeviceVector& HOS_eta) { @@ -83,4 +83,4 @@ void modes_hosgrid::populate_hos_eta( populate_hos_eta( rm_obj.get_first_fft_dimension(), rm_obj.get_second_fft_dimension(), rm_obj.get_L(), p_vector, eta_modes, HOS_eta); -} \ No newline at end of file +}