ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
FFTBuffersLegacy.cpp
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#include <config/config.hpp>
23
24#if defined(ESPRESSO_DP3M)
25
26#include "FFTBuffersLegacy.hpp"
27
28#include "communication.hpp"
29#include "p3m/common.hpp"
30
31#include <array>
32#include <span>
33
34template <typename FloatType>
36
37template <typename FloatType>
40 out.rs_scalar = std::span(rs_mesh);
41 for (auto i = 0u; i < 3u; ++i) {
42 out.rs_fields[i] = std::span(rs_mesh_fields[i]);
43 }
44}
45
46template <typename FloatType> void FFTBuffersLegacy<FloatType>::init_halo() {
47 mesh_comm.resize(::comm_cart, local_mesh);
48}
49
50template <typename FloatType>
52 rs_mesh.resize(ca_mesh_size);
53 for (auto &rs_mesh_field : rs_mesh_fields) {
54 rs_mesh_field.resize(ca_mesh_size);
55 }
56}
57
58template <typename FloatType>
60 std::array<FloatType *, 3u> meshes = get_vector_mesh();
61 mesh_comm.spread_grid(::comm_cart, meshes, local_mesh.dim);
62}
63
64template <typename FloatType>
66 std::array<FloatType *, 3u> meshes = get_vector_mesh();
67 mesh_comm.gather_grid(::comm_cart, meshes, local_mesh.dim);
68}
69
70template <typename FloatType>
72 mesh_comm.spread_grid(::comm_cart, rs_mesh.data(), local_mesh.dim);
73}
74
75template <typename FloatType>
77 return rs_mesh.data();
78}
79
80template <typename FloatType>
81std::array<FloatType *, 3u> FFTBuffersLegacy<FloatType>::get_vector_mesh() {
82 return {{rs_mesh_fields[0u].data(), rs_mesh_fields[1u].data(),
83 rs_mesh_fields[2u].data()}};
84}
85
86template class FFTBuffersLegacy<float>;
87template class FFTBuffersLegacy<double>;
88
89#endif // defined(ESPRESSO_DP3M)
Buffers for FFTBackendLegacy.
void update_mesh_views(P3MFFTMesh< FloatType > &out) override
void perform_scalar_halo_spread() override
void perform_vector_halo_spread() override
void perform_vector_halo_gather() override
~FFTBuffersLegacy() override
void init_halo() override
void init_meshes(int ca_mesh_size) override
FloatType * get_scalar_mesh() override
std::array< FloatType *, 3u > get_vector_mesh() override
cudaStream_t stream[1]
CUDA streams for parallel computing on CPU and GPU.
boost::mpi::communicator comm_cart
The communicator.
Common functions for dipolar and charge P3M.
Local mesh FFT buffers.