ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
send_mesh.hpp
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#pragma once
23
24#include "config/config.hpp"
25
26#if defined(P3M) or defined(DP3M)
27
28#include "p3m/common.hpp"
29
30#include <utils/Vector.hpp>
31
32#include <boost/mpi/communicator.hpp>
33
34#include <span>
35#include <vector>
36
37/** @brief P3M halo communicator. */
38template <typename FloatType> class p3m_send_mesh {
39 enum Requests {
40 REQ_P3M_INIT = 200,
41 REQ_P3M_GATHER = 201,
42 REQ_P3M_SPREAD = 202
43 };
44 /** dimension of sub meshes to send. */
45 int s_dim[6][3];
46 /** lower left corners of sub meshes to send. */
47 int s_ld[6][3];
48 /** upper right corners of sub meshes to send. */
49 int s_ur[6][3];
50 /** sizes for send buffers. */
51 int s_size[6];
52 /** dimension of sub meshes to recv. */
53 int r_dim[6][3];
54 /** lower left corners of sub meshes to recv. */
55 int r_ld[6][3];
56 /** upper right corners of sub meshes to recv. */
57 int r_ur[6][3];
58 /** sizes for recv buffers. */
59 int r_size[6];
60 /** maximal size for send/recv buffers. */
61 int max;
62
63 /** vector to store grid points to send. */
64 std::vector<FloatType> send_grid;
65 /** vector to store grid points to recv */
66 std::vector<FloatType> recv_grid;
67
68public:
69 void resize(boost::mpi::communicator const &comm,
70 P3MLocalMesh const &local_mesh);
71 void gather_grid(boost::mpi::communicator const &comm,
72 std::span<FloatType *> meshes, Utils::Vector3i const &dim);
73 void gather_grid(boost::mpi::communicator const &comm, FloatType *mesh,
74 Utils::Vector3i const &dim) {
75 gather_grid(comm, std::span(&mesh, 1u), dim);
76 }
77 void spread_grid(boost::mpi::communicator const &comm,
78 std::span<FloatType *> meshes, Utils::Vector3i const &dim);
79 void spread_grid(boost::mpi::communicator const &comm, FloatType *mesh,
80 Utils::Vector3i const &dim) {
81 spread_grid(comm, std::span(&mesh, 1u), dim);
82 }
83};
84
85#endif // defined(P3M) or defined(DP3M)
Vector implementation and trait types for boost qvm interoperability.
P3M halo communicator.
Definition send_mesh.hpp:38
void gather_grid(boost::mpi::communicator const &comm, std::span< FloatType * > meshes, Utils::Vector3i const &dim)
void spread_grid(boost::mpi::communicator const &comm, FloatType *mesh, Utils::Vector3i const &dim)
Definition send_mesh.hpp:79
void gather_grid(boost::mpi::communicator const &comm, FloatType *mesh, Utils::Vector3i const &dim)
Definition send_mesh.hpp:73
void spread_grid(boost::mpi::communicator const &comm, std::span< FloatType * > meshes, Utils::Vector3i const &dim)
void resize(boost::mpi::communicator const &comm, P3MLocalMesh const &local_mesh)
Definition send_mesh.cpp:90
This file contains the defaults for ESPResSo.
Common functions for dipolar and charge P3M.
Properties of the local mesh.