ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
fft.cpp File Reference

Routines, row decomposition, data structures and communication for the 3D-FFT. More...

#include "fft.hpp"
#include "vector.hpp"
#include "p3m/packing.hpp"
#include <utils/Vector.hpp>
#include <utils/index.hpp>
#include <utils/math/permute_ifield.hpp>
#include <utils/mpi/cart_comm.hpp>
#include <boost/mpi/communicator.hpp>
#include <boost/serialization/vector.hpp>
#include <fftw3.h>
#include <omp.h>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstddef>
#include <limits>
#include <optional>
#include <span>
#include <stdexcept>
#include <utility>
#include <vector>
Include dependency graph for fft.cpp:

Go to the source code of this file.

Classes

struct  fft::fftw< FloatType >
struct  fft::fftw< float >

Namespaces

namespace  fft
namespace  fft::anonymous_namespace{fft.cpp}

Macros

MPI tags for FFT communication
#define REQ_FFT_FORW   301
 Tag for communication in forw_grid_comm().
#define REQ_FFT_BACK   302
 Tag for communication in back_grid_comm().

Functions

template<typename T>
static void fft_sendrecv (T const *const sendbuf, int scount, int dest, T *const recvbuf, int rcount, int source, boost::mpi::communicator const &comm, int tag)
std::optional< std::vector< int > > fft::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, when you change the node grid.
int fft::anonymous_namespace{fft.cpp}::calc_local_mesh (const int *n_pos, const int *n_grid, const int *mesh, const double *mesh_off, int *loc_mesh, int *start)
 Calculate the local fft mesh.
int fft::anonymous_namespace{fft.cpp}::calc_send_block (const int *pos1, const int *grid1, const int *pos2, const int *grid2, const int *mesh, const double *mesh_off, int *block)
 Calculate a send (or recv.) block for grid communication during a decomposition change.
template<typename FloatType>
void fft::anonymous_namespace{fft.cpp}::pack_block_permute1 (FloatType const *const in, FloatType *const out, const int *start, const int *size, const int *dim, int element)
 Pack a block with dimensions size[0] * size[1] * size[2] starting at start of an input 3D-grid with dimension dim into an output 3D-grid with dimensions size[2] * size[0] * size[1] with a simultaneous one-fold permutation of the indices.
template<typename FloatType>
void fft::anonymous_namespace{fft.cpp}::pack_block_permute2 (FloatType const *const in, FloatType *const out, const int *start, const int *size, const int *dim, int element)
 Pack a block with dimensions size[0] * size[1] * size[2] starting at start of an input 3D-grid with dimension dim into an output 3D-grid with dimensions size[2] * size[0] * size[1] with a simultaneous two-fold permutation of the indices.
int fft::map_3don2d_grid (int const g3d[3], int g2d[3])
 Calculate 'best' mapping between a 2D and 3D grid.
void fft::calc_2d_grid (int n, int grid[3])
 Calculate most square 2D grid.
void permute_ifield (int *field, int size, int permute)
 permute an integer array field of size size about permute positions.

Detailed Description

Routines, row decomposition, data structures and communication for the 3D-FFT.

Definition in file fft.cpp.

Macro Definition Documentation

◆ REQ_FFT_BACK

#define REQ_FFT_BACK   302

Tag for communication in back_grid_comm().

Definition at line 64 of file fft.cpp.

◆ REQ_FFT_FORW

#define REQ_FFT_FORW   301

Tag for communication in forw_grid_comm().

Definition at line 62 of file fft.cpp.

Function Documentation

◆ fft_sendrecv()

template<typename T>
void fft_sendrecv ( T const *const sendbuf,
int scount,
int dest,
T *const recvbuf,
int rcount,
int source,
boost::mpi::communicator const & comm,
int tag )
static

Definition at line 68 of file fft.cpp.

◆ permute_ifield()

void Utils::permute_ifield ( int * field,
int size,
int permute )
inline

permute an integer array field of size size about permute positions.

Definition at line 24 of file permute_ifield.hpp.

Referenced by fft::fft_data_struct< FloatType >::initialize_fft().