62 static_assert(std::is_same_v<FloatType, float> or
63 std::is_same_v<FloatType, double>,
64 "FFTW only implements float and double");
65 using fftw_plan = std::conditional_t<std::is_same_v<FloatType, double>,
66 fftw_plan_s *, fftwf_plan_s *>;
75 void (*
pack_function)(FloatType
const *
const, FloatType *
const,
int const *,
76 int const *,
int const *, int);
81template <
typename FloatType>
115template <
typename FloatType>
133 std::shared_ptr<boost::mpi::environment> m_mpi_env;
136 std::array<fft_forw_plan<FloatType>, 4u> forw;
138 std::array<fft_back_plan<FloatType>, 4u> back;
141 bool init_tag =
false;
144 int max_comm_size = 0;
147 int max_mesh_size = 0;
150 std::vector<FloatType> send_buf;
152 std::vector<FloatType> recv_buf;
158 : m_mpi_env{std::move(mpi_env)} {}
178 int const *ca_mesh_margin,
188 void forward_fft(boost::mpi::communicator
const &comm, FloatType *data);
197 void backward_fft(boost::mpi::communicator
const &comm, FloatType *data,
205 void forw_grid_comm(boost::mpi::communicator
const &comm,
208 void back_grid_comm(boost::mpi::communicator
const &comm,
211 FloatType
const *in, FloatType *out);
218 std::span<int const>,
219 std::span<int>, std::span<int>,
220 std::span<int>,
int);
Vector implementation and trait types for boost qvm interoperability.
Communicator communicator
std::optional< std::vector< int > > find_comm_groups(Utils::Vector3i const &grid1, Utils::Vector3i const &grid2, std::span< int const > node_list1, std::span< int > node_list2, std::span< int > pos, std::span< int > my_pos, int rank)
This ugly function does the bookkeeping: which nodes have to communicate to each other,...
std::vector< T, allocator< T > > vector
int map_3don2d_grid(int const g3d[3], int g2d[3])
Calculate 'best' mapping between a 2D and 3D grid.
Plan for a backward 1D FFT of a flattened 3D array.
Information about the three one dimensional FFTs and how the nodes have to communicate inbetween.
void forward_fft(boost::mpi::communicator const &comm, FloatType *data)
Perform an in-place forward 3D FFT.
fft_data_struct & operator=(fft_data_struct< FloatType > const &)=delete
fft_data_struct(decltype(m_mpi_env) mpi_env)
auto const & get_mesh_size() const
fft_data_struct(fft_data_struct< FloatType > const &)=delete
auto const & get_mesh_start() const
void backward_fft(boost::mpi::communicator const &comm, FloatType *data, bool check_complex)
Perform an in-place backward 3D FFT.
int initialize_fft(boost::mpi::communicator const &comm, Utils::Vector3i const &ca_mesh_dim, int const *ca_mesh_margin, Utils::Vector3i const &global_mesh_dim, Utils::Vector3d const &global_mesh_off, int &ks_pnum, Utils::Vector3i const &grid)
Initialize everything connected to the 3D-FFT.
Plan for a forward 1D FFT of a flattened 3D array.
std::array< int, 3u > new_mesh
size of local mesh after communication, also used for actual FFT.
int n_ffts
number of 1D FFTs.
std::array< int, 3u > old_mesh
size of local mesh before communication.
std::vector< int > recv_block
Recv block specification.
std::vector< int > group
group of nodes which have to communicate with each other.
int new_size
size of new mesh (number of mesh points).
std::array< int, 3u > start
lower left point of local FFT mesh in global FFT mesh coordinates.
std::vector< int > send_size
Send block communication sizes.
std::vector< int > send_block
Send block specification.
int row_dir
row direction of that FFT.
int n_permute
permutations from normal coordinate system.
std::vector< int > recv_size
Recv block communication sizes.
int element
size of send block elements, i.e.
int dir
plan direction: forward or backward FFT (enum value from FFTW).
std::conditional_t< std::is_same_v< FloatType, double >, fftw_plan_s *, fftwf_plan_s * > fftw_plan
fftw_plan plan_handle
plan for the FFT.
void(* pack_function)(FloatType const *const, FloatType *const, int const *, int const *, int const *, int)
packing function for send blocks.