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-2022 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#ifndef ESPRESSO_CORE_P3M_SEND_MESH_HPP
22#define ESPRESSO_CORE_P3M_SEND_MESH_HPP
23
24#include "config/config.hpp"
25
26#if defined(P3M) || defined(DP3M)
27
28#include "p3m/common.hpp"
29
30#include <utils/Span.hpp>
31#include <utils/Vector.hpp>
32
33#include <boost/mpi/communicator.hpp>
34
35#include <vector>
36
37/** Structure for send/recv meshes. */
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 /** left down corners of sub meshes to send. */
47 int s_ld[6][3];
48 /** up 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 /** left down corners of sub meshes to recv. */
55 int r_ld[6][3];
56 /** up 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<double> send_grid;
65 /** vector to store grid points to recv */
66 std::vector<double> recv_grid;
67
68public:
69 void resize(const boost::mpi::communicator &comm,
70 const P3MLocalMesh &local_mesh);
72 const boost::mpi::communicator &comm,
73 const Utils::Vector3i &dim);
74 void gather_grid(double *mesh, const boost::mpi::communicator &comm,
75 const Utils::Vector3i &dim) {
76 gather_grid(Utils::make_span(&mesh, 1), comm, dim);
77 }
79 const boost::mpi::communicator &comm,
80 const Utils::Vector3i &dim);
81 void spread_grid(double *mesh, const boost::mpi::communicator &comm,
82 const Utils::Vector3i &dim) {
83 spread_grid(Utils::make_span(&mesh, 1), comm, dim);
84 }
85};
86#endif
87#endif
Vector implementation and trait types for boost qvm interoperability.
A stripped-down version of std::span from C++17.
Definition Span.hpp:38
Structure for send/recv meshes.
Definition send_mesh.hpp:38
void spread_grid(Utils::Span< double * > meshes, const boost::mpi::communicator &comm, const Utils::Vector3i &dim)
void resize(const boost::mpi::communicator &comm, const P3MLocalMesh &local_mesh)
Definition send_mesh.cpp:73
void gather_grid(Utils::Span< double * > meshes, const boost::mpi::communicator &comm, const Utils::Vector3i &dim)
void spread_grid(double *mesh, const boost::mpi::communicator &comm, const Utils::Vector3i &dim)
Definition send_mesh.hpp:81
void gather_grid(double *mesh, const boost::mpi::communicator &comm, const Utils::Vector3i &dim)
Definition send_mesh.hpp:74
Common functions for dipolar and charge P3M.
This file contains the defaults for ESPResSo.
DEVICE_QUALIFIER constexpr Span< T > make_span(T *p, std::size_t N)
Definition Span.hpp:112
Structure for local mesh parameters.
Definition common.hpp:183