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 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
30#include <cinttypes>
31#include <cstring> // memmove
32
33// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34
35#undef Pstream_CommonRoutines
36#define Pstream_CommonRoutines(Native) \
37void Foam::UPstream::allToAll \
38( \
39 const UList<Native>& sendData, \
40 UList<Native>& recvData, \
41 const label comm \
42) \
43{ \
44 recvData.deepCopy(sendData); \
45} \
46
47
50
51#undef Pstream_CommonRoutines
52
53
54// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55
56#undef Pstream_CommonRoutines
57#define Pstream_CommonRoutines(Native) \
58void Foam::UPstream::allToAll \
59( \
60 const Native* sendData, \
61 const UList<int>& sendCounts, \
62 const UList<int>& sendOffsets, \
63 Native* recvData, \
64 const UList<int>& recvCounts, \
65 const UList<int>& recvOffsets, \
66 const label comm \
67) \
68{ \
69 if (recvCounts[0] != sendCounts[0]) \
70 { \
71 FatalErrorInFunction \
72 << "Number to send " << sendCounts[0] \
73 << " does not equal number to receive " << recvCounts[0] \
74 << Foam::abort(FatalError); \
75 } \
76 std::memmove(recvData, sendData, recvCounts[0]*sizeof(Native)); \
77}
78
79
80// Unused: Pstream_CommonRoutines(char);
81
82#undef Pstream_CommonRoutines
83
84// ************************************************************************* //
#define Pstream_CommonRoutines(Native)