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-2024 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(P3M) or defined(DP3M)
25
26#include "FFTBuffersLegacy.hpp"
27
28#include "communication.hpp"
29
30#include <array>
31#include <span>
32
33template <typename FloatType>
35
36template <typename FloatType>
39 out.rs_scalar = std::span(rs_mesh);
40 for (auto i = 0u; i < 3u; ++i) {
41 out.rs_fields[i] = std::span(rs_mesh_fields[i]);
42 }
43}
44
45template <typename FloatType> void FFTBuffersLegacy<FloatType>::init_halo() {
46 mesh_comm.resize(::comm_cart, local_mesh);
47}
48
49template <typename FloatType>
51 rs_mesh.resize(ca_mesh_size);
52 for (auto &rs_mesh_field : rs_mesh_fields) {
53 rs_mesh_field.resize(ca_mesh_size);
54 }
55}
56
57template <typename FloatType>
59 std::array<FloatType *, 3u> meshes = {{rs_mesh_fields[0u].data(),
60 rs_mesh_fields[1u].data(),
61 rs_mesh_fields[2u].data()}};
62 mesh_comm.spread_grid(::comm_cart, meshes, local_mesh.dim);
63}
64
65template <typename FloatType>
67 mesh_comm.gather_grid(::comm_cart, rs_mesh.data(), local_mesh.dim);
68}
69
70template <typename FloatType>
72 std::array<FloatType *, 3u> meshes = {{rs_mesh_fields[0u].data(),
73 rs_mesh_fields[1u].data(),
74 rs_mesh_fields[2u].data()}};
75 mesh_comm.gather_grid(::comm_cart, meshes, local_mesh.dim);
76}
77
78template <typename FloatType>
80 mesh_comm.spread_grid(::comm_cart, rs_mesh.data(), local_mesh.dim);
81}
82
83template <typename FloatType>
85 return rs_mesh.data();
86}
87
88template <typename FloatType>
89std::array<FloatType *, 3u> FFTBuffersLegacy<FloatType>::get_vector_mesh() {
90 return {rs_mesh_fields[0u].data(), rs_mesh_fields[1u].data(),
91 rs_mesh_fields[2u].data()};
92}
93
94template class FFTBuffersLegacy<float>;
95template class FFTBuffersLegacy<double>;
96
97#endif // defined(P3M) or defined(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 perform_scalar_halo_gather() 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
boost::mpi::communicator comm_cart
The communicator.
This file contains the defaults for ESPResSo.
Local mesh FFT buffers.
std::array< std::span< FloatType >, 3 > rs_fields
real-space vector meshes for the electric or dipolar field.
std::span< FloatType > rs_scalar
real-space scalar mesh for charge assignment and FFT.