OpenLB 1.7
Loading...
Searching...
No Matches
particleCommunicator.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2022 Jan E. Marquardt
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program 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
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef PARTICLE_COMMUNICATOR_HH
25#define PARTICLE_COMMUNICATOR_HH
26
28
29namespace olb {
30namespace particles {
31namespace communication {
32
34{
35#ifdef PARALLEL_MODE_MPI
36 if (MPI_Comm_dup(MPI_COMM_WORLD, &particleDistribution) != MPI_SUCCESS) {
37 throw std::runtime_error("Unable to duplicate MPI communicator");
38 }
39 if (MPI_Comm_dup(MPI_COMM_WORLD, &surfaceForceComm) != MPI_SUCCESS) {
40 throw std::runtime_error("Unable to duplicate MPI communicator");
41 }
42 if (MPI_Comm_dup(MPI_COMM_WORLD, &wallContactDetectionComm) != MPI_SUCCESS) {
43 throw std::runtime_error("Unable to duplicate MPI communicator");
44 }
45 if (MPI_Comm_dup(MPI_COMM_WORLD, &particleContactDetectionComm) !=
46 MPI_SUCCESS) {
47 throw std::runtime_error("Unable to duplicate MPI communicator");
48 }
49 if (MPI_Comm_dup(MPI_COMM_WORLD, &contactTreatmentComm) != MPI_SUCCESS) {
50 throw std::runtime_error("Unable to duplicate MPI communicator");
51 }
52 if (MPI_Comm_dup(MPI_COMM_WORLD, &equationsOfMotionComm) != MPI_SUCCESS) {
53 throw std::runtime_error("Unable to duplicate MPI communicator");
54 }
55#endif
56}
57
59{
60#ifdef PARALLEL_MODE_MPI
61 MPI_Comm_free(&particleDistribution);
62 MPI_Comm_free(&surfaceForceComm);
63 MPI_Comm_free(&wallContactDetectionComm);
64 MPI_Comm_free(&particleContactDetectionComm);
65 MPI_Comm_free(&contactTreatmentComm);
66 MPI_Comm_free(&equationsOfMotionComm);
67#endif
68}
69
70} // namespace communication
71} // namespace particles
72} // namespace olb
73
74#endif
Top level namespace for all of OpenLB.
MPI_Comm contactTreatmentComm
Communicator for particle contact detection communication.
MPI_Comm equationsOfMotionComm
Communicator for contact treatment results communication.
MPI_Comm surfaceForceComm
Communicator for particle distribution communication.
MPI_Comm particleContactDetectionComm
Communicator for wall contact detection communication.
MPI_Comm wallContactDetectionComm
Communicator for surface force communication.