26#if defined(P3M) or defined(DP3M)
49 :
params{std::move(parameters)} {}
62 std::array<std::vector<int>, 3>
d_op;
77 std::unique_ptr<FFTBackend<FloatType>>
fft;
84 auto const mesh_size_ptr =
fft->get_mesh_size();
85 auto const mesh_start_ptr =
fft->get_mesh_start();
86 for (
auto i = 0u; i < 3u; ++i) {
87 mesh.size[i] = mesh_size_ptr[i];
88 mesh.start[i] = mesh_start_ptr[i];
95 assert(
fft ==
nullptr);
96 fft = std::make_unique<T>(std::as_const(
local_mesh), args...);
API for the FFT backend of the P3M algorithm.
virtual void init(P3MParameters const ¶ms)=0
virtual int get_ca_mesh_size() const noexcept=0
virtual ~FFTBackend()=default
virtual void backward_fft(FloatType *rs_mesh)=0
Carry out the backward FFT of the scalar mesh.
bool check_complex_residuals
virtual std::array< int, 3u > const & get_mesh_size() const =0
P3MLocalMesh const & local_mesh
virtual int get_ks_pnum() const noexcept=0
virtual void forward_fft(FloatType *rs_mesh)=0
Carry out the forward FFT of the scalar mesh.
virtual std::array< int, 3u > const & get_mesh_start() const =0
FFTBackend(P3MLocalMesh const &local_mesh)
virtual std::tuple< int, int, int > get_permutations() const =0
Get indices of the k-space data layout.
API for the FFT mesh buffers.
P3MLocalMesh const & local_mesh
virtual void init_meshes(int ca_mesh_size)=0
Initialize the meshes.
virtual void perform_scalar_halo_gather()=0
Update scalar mesh halo with data from neighbors (accumulation).
virtual void perform_vector_halo_gather()=0
Update vector mesh halo with data from neighbors (accumulation).
virtual std::array< FloatType *, 3u > get_vector_mesh()=0
Get pointer to vector mesh begin.
virtual void perform_vector_halo_spread()=0
Update vector mesh halo of all neighbors.
virtual void init_halo()=0
Initialize the halo buffers.
virtual void update_mesh_views(P3MFFTMesh< FloatType > &out)=0
Update the scalar and vector mesh views in P3MFFTMesh to point to the new underlying data structures.
FFTBuffers(P3MLocalMesh const &local_mesh)
virtual ~FFTBuffers()=default
virtual void perform_scalar_halo_spread()=0
Update scalar mesh halo of all neighbors.
virtual FloatType * get_scalar_mesh()=0
Get pointer to scalar mesh begin.
This file contains the defaults for ESPResSo.
Common functions for dipolar and charge P3M.
std::array< std::vector< int >, 3 > calc_p3m_mesh_shift(Utils::Vector3i const &mesh_size, bool zero_out_midpoint=false)
Calculate indices that shift P3MParameters::mesh by mesh/2.
static SteepestDescentParameters params
Currently active steepest descent instance.
Properties of the local mesh.
Structure to hold P3M parameters and some dependent variables.
Utils::Vector3i mesh
number of mesh points per coordinate direction (>0), in real space.
Base class for the electrostatics and magnetostatics P3M algorithms.
std::unique_ptr< FFTBuffers< FloatType > > fft_buffers
FFT buffers.
void make_fft_instance(Args... args)
P3MLocalMesh local_mesh
Local mesh properties.
P3MParameters params
P3M base parameters.
std::array< std::vector< int >, 3 > d_op
Spatial differential operator in k-space.
std::unique_ptr< FFTBackend< FloatType > > fft
FFT algorithm.
std::vector< FloatType > g_energy
Energy optimised influence function (k-space)
P3MFFTMesh< FloatType > mesh
Local mesh FFT buffers.
p3m_data_struct(P3MParameters &¶meters)
void make_mesh_instance(Args... args)
void calc_differential_operator()
Calculate the Fourier transformed differential operator.
std::vector< FloatType > g_force
Force optimised influence function (k-space)