ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
FFTBackendLegacy.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2010-2026 The ESPResSo project
3 * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010
4 * Max-Planck-Institute for Polymer Research, Theory Group
5 *
6 * This file is part of ESPResSo.
7 *
8 * ESPResSo is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * ESPResSo is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#pragma once
23
24#include <config/config.hpp>
25
26#if defined(ESPRESSO_DP3M)
27
28#include "common.hpp"
29#include "data_struct.hpp"
30
31#include <array>
32#include <memory>
33#include <tuple>
34#include <type_traits>
35
36namespace fft {
37template <typename FloatType> struct fft_data_struct;
38} // namespace fft
39
40/**
41 * @brief Historic FFT backend based on FFTW3.
42 * The 3D FFT is split into three 1D FFTs.
43 */
44template <typename FloatType>
45class FFTBackendLegacy : public FFTBackend<FloatType> {
46 static_assert(std::is_same_v<FloatType, float> or
47 std::is_same_v<FloatType, double>,
48 "FFTW only implements float and double");
49 std::unique_ptr<fft::fft_data_struct<FloatType>> fft;
50 using FFTBackend<FloatType>::local_mesh;
51 int ca_mesh_size = -1;
52 int ks_pnum = -1;
53
54public:
57 void init(P3MParameters const &params) override;
58 void forward_fft(FloatType *rs_mesh) override;
59 void backward_fft(FloatType *rs_mesh) override;
60 int get_ca_mesh_size() const noexcept override { return ca_mesh_size; }
61 int get_ks_pnum() const noexcept override { return ks_pnum; }
62 std::array<int, 3u> const &get_mesh_size() const override {
63 return fft->get_mesh_size();
64 }
65 std::array<int, 3u> const &get_mesh_start() const override {
66 return fft->get_mesh_start();
67 }
68};
69
70#endif // defined(ESPRESSO_DP3M)
void backward_fft(FloatType *rs_mesh) override
~FFTBackendLegacy() override
std::array< int, 3u > const & get_mesh_size() const override
FFTBackendLegacy(P3MLocalMesh const &local_mesh)
std::array< int, 3u > const & get_mesh_start() const override
void init(P3MParameters const &params) override
void forward_fft(FloatType *rs_mesh) override
int get_ca_mesh_size() const noexcept override
int get_ks_pnum() const noexcept override
P3MLocalMesh const & local_mesh
FFTBackend(P3MLocalMesh const &local_mesh)
Definition fft.cpp:77
Common functions for dipolar and charge P3M.
Properties of the local mesh and halo region.
Structure to hold P3M parameters and some dependent variables.
Information about the three one dimensional FFTs and how the nodes have to communicate inbetween.
Definition fft.hpp:125