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 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{
49
50/*---------------------------------------------------------------------------*\
51 Class processorLduInterface Declaration
52\*---------------------------------------------------------------------------*/
55{
56 // Private Data
57
58 //- Send buffer.
59 // Only sized and used when compressed or non-blocking comms used.
60 mutable List<char> sendBuf_;
61
62 //- Receive buffer.
63 // Only sized and used when compressed or non-blocking comms used.
64 mutable List<char> receiveBuf_;
65
66
67 // Private Member Functions
68
69 //- Increase buffer size if required
70 static void resizeBuf(List<char>& buf, const label len);
71
72
73public:
74
75 //- Runtime type information
76 TypeName("processorLduInterface");
77
78
79 // Constructors
80
81 //- Default construct
82 processorLduInterface() = default;
83
84
85 //- Destructor
86 virtual ~processorLduInterface() = default;
87
88
89 // Member Functions
90
91 // Access
92
93 //- Return communicator used for parallel communication
94 virtual label comm() const = 0;
95
96 //- Return processor number (rank in communicator)
97 virtual int myProcNo() const = 0;
98
99 //- Return neighbour processor number (rank in communicator)
100 virtual int neighbProcNo() const = 0;
101
102 //- Return face transformation tensor
103 virtual const tensorField& forwardT() const = 0;
104
105 //- Return message tag used for sending
106 virtual int tag() const = 0;
107
108
109 // Transfer Functions
110
111 //- Raw send function
112 template<class Type>
113 void send
114 (
115 const Pstream::commsTypes commsType,
116 const UList<Type>& f
117 ) const;
118
119 //- Raw receive function
120 template<class Type>
121 void receive
122 (
123 const Pstream::commsTypes commsType,
125 ) const;
126
127 //- Raw receive function returning field
128 template<class Type>
130 (
131 const Pstream::commsTypes commsType,
132 const label size
133 ) const;
134
135
136 //- Raw send function with data compression
137 template<class Type>
138 void compressedSend
139 (
140 const Pstream::commsTypes commsType,
141 const UList<Type>& f
142 ) const;
143
144 //- Raw receive function with data compression
145 template<class Type>
147 (
148 const Pstream::commsTypes commsType,
150 ) const;
151
152 //- Raw receive function with data compression returning field
153 template<class Type>
155 (
156 const Pstream::commsTypes commsType,
157 const label size
158 ) const;
159};
160
161
162// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163
164} // End namespace Foam
165
166// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167
168#ifdef NoRepository
170#endif
171
172// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173
174#endif
175
176// ************************************************************************* //
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
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:94
commsTypes
Types of communications.
Definition: UPstream.H:67
An abstract base class for processor coupled interfaces.
virtual label comm() const =0
Return communicator used for parallel communication.
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &f) const
Raw send function with data compression.
tmp< Field< Type > > receive(const Pstream::commsTypes commsType, const label size) const
Raw receive function returning field.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
virtual int myProcNo() const =0
Return processor number (rank in communicator)
void receive(const Pstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
tmp< Field< Type > > compressedReceive(const Pstream::commsTypes commsType, const label size) const
Raw receive function with data compression returning field.
TypeName("processorLduInterface")
Runtime type information.
processorLduInterface()=default
Default construct.
virtual const tensorField & forwardT() const =0
Return face transformation tensor.
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
virtual int tag() const =0
Return message tag used for sending.
virtual ~processorLduInterface()=default
Destructor.
void send(const Pstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
A class for managing temporary objects.
Definition: tmp.H:65
Namespace for OpenFOAM.
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
labelList f(nPoints)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73