Loading...
Searching...
No Matches
processorLduInterface.H
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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2019-2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::processorLduInterface
29
30Description
31 An abstract base class for processor coupled interfaces.
32
33SourceFiles
34 processorLduInterface.C
35 processorLduInterfaceTemplates.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Foam_processorLduInterface_H
40#define Foam_processorLduInterface_H
41
42#include "lduInterface.H"
43#include "primitiveFieldsFwd.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
50/*---------------------------------------------------------------------------*\
51 Class processorLduInterface Declaration
52\*---------------------------------------------------------------------------*/
53
55{
56 // Private Data
57
58 //- Send buffer.
59 // Only sized and used when compressed or non-blocking comms used.
60 mutable List<char> byteSendBuf_;
61
62 //- Receive buffer.
63 // Only sized and used when compressed or non-blocking comms used.
64 mutable List<char> byteRecvBuf_;
65
66
67 // Private Member Functions
68
69 //- Increase buffer size if required
70 // Uses the nocopy variant since it will be overwritten
71 static void resizeBuf(List<char>& buf, const label len)
72 {
73 if (buf.size() < len)
74 {
75 buf.resize_nocopy(len);
76 }
77 }
78
79
80public:
81
82 //- Runtime type information
83 TypeNameNoDebug("processorLduInterface");
84
85
86 // Constructors
87
88 //- Default construct
90
91
92 //- Destructor
93 virtual ~processorLduInterface() = default;
94
95
96 // Member Functions
98 // Access
99
100 //- Return communicator used for parallel communication
101 virtual label comm() const = 0;
102
103 //- Return processor number (rank in communicator)
104 virtual int myProcNo() const = 0;
105
106 //- Return neighbour processor number (rank in communicator)
107 virtual int neighbProcNo() const = 0;
108
109 //- Return face transformation tensor
110 virtual const tensorField& forwardT() const = 0;
111
112 //- Return message tag used for sending
113 virtual int tag() const = 0;
114
115
116 // Transfer Functions
117
118 //- Raw send function
119 template<class Type>
120 void send
121 (
122 const UPstream::commsTypes commsType,
123 const UList<Type>& f
124 ) const;
125
126 //- Raw receive function
127 template<class Type>
129 (
130 const UPstream::commsTypes commsType,
131 UList<Type>& f
132 ) const;
134 //- Raw receive function returning field
135 template<class Type>
136 tmp<Field<Type>> receive
137 (
138 const UPstream::commsTypes commsType,
139 const label size
140 ) const;
141
142
143 //- Raw send function with data compression
144 template<class Type>
145 void compressedSend
146 (
147 const UPstream::commsTypes commsType,
148 const UList<Type>& f
149 ) const;
150
151 //- Raw receive function with data compression
152 template<class Type>
154 (
155 const UPstream::commsTypes commsType,
156 UList<Type>& f
157 ) const;
158
159 //- Raw receive function with data compression returning field
160 template<class Type>
163 const UPstream::commsTypes commsType,
164 const label size
165 ) const;
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace Foam
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175#ifdef NoRepository
177#endif
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181#endif
182
183// ************************************************************************* //
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
Definition ListI.H:171
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
Inter-processor communications stream.
Definition UPstream.H:69
virtual label comm() const =0
Return communicator used for parallel communication.
processorLduInterface() noexcept=default
Default construct.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator).
void compressedReceive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
virtual int myProcNo() const =0
Return processor number (rank in communicator).
void receive(const UPstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
virtual const tensorField & forwardT() const =0
Return face transformation tensor.
void compressedSend(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function with data compression.
virtual int tag() const =0
Return message tag used for sending.
void send(const UPstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
TypeNameNoDebug("processorLduInterface")
Runtime type information.
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
labelList f(nPoints)
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61