Loading...
Searching...
No Matches
UPstreamAllToAll.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2022-2023 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
28#include "UPstream.H"
29#include "Map.H"
31#include <cinttypes>
32#include <cstring> // memmove
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36#undef Pstream_CommonRoutines
37#define Pstream_CommonRoutines(Type) \
38void Foam::UPstream::allToAll \
39( \
40 const UList<Type>& sendData, \
41 UList<Type>& recvData, \
42 const int communicator \
43) \
44{ \
45 recvData.deepCopy(sendData); \
46}
47
48
51
52#undef Pstream_CommonRoutines
53
54
55// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56
57#undef Pstream_CommonRoutines
58#define Pstream_CommonRoutines(Type) \
59void Foam::UPstream::allToAllConsensus \
60( \
61 const UList<Type>& sendData, \
62 UList<Type>& recvData, \
63 const int tag, \
64 const int communicator \
65) \
66{ \
67 recvData.deepCopy(sendData); \
68} \
69void Foam::UPstream::allToAllConsensus \
70( \
71 const Map<Type>& sendData, \
72 Map<Type>& recvData, \
73 const int tag, \
74 const int communicator \
75) \
76{ \
77 recvData = sendData; \
78}
79
80
83
84#undef Pstream_CommonRoutines
85
86
87// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88
89#undef Pstream_CommonRoutines
90#define Pstream_CommonRoutines(Type) \
91void Foam::UPstream::allToAllv \
92( \
93 const Type* sendData, \
94 const UList<int>& sendCounts, \
95 const UList<int>& sendOffsets, \
96 Type* recvData, \
97 const UList<int>& recvCounts, \
98 const UList<int>& recvOffsets, \
99 const int communicator \
100) \
101{ \
102 if (recvCounts[0] != sendCounts[0]) \
103 { \
104 FatalErrorInFunction \
105 << "Number to send " << sendCounts[0] \
106 << " does not equal number to receive " << recvCounts[0] \
107 << Foam::abort(FatalError); \
108 } \
109 std::memmove(recvData, sendData, recvCounts[0]*sizeof(Type)); \
110}
111
112
113// Unused: Pstream_CommonRoutines(char);
114
115#undef Pstream_CommonRoutines
116
117// ************************************************************************* //
#define Pstream_CommonRoutines(Type)