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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::processorLduInterface
29 
30 Description
31  An abstract base class for processor coupled interfaces.
32 
33 SourceFiles
34  processorLduInterface.C
35  processorLduInterfaceTemplates.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef processorLduInterface_H
40 #define processorLduInterface_H
41 
42 #include "lduInterface.H"
43 #include "primitiveFieldsFwd.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
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> 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 size);
71 
72 
73 public:
74 
75  //- Runtime type information
76  TypeName("processorLduInterface");
77 
78 
79  // Constructors
80 
81  //- Construct null
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,
124  UList<Type>& f
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>
146  void compressedReceive
147  (
148  const Pstream::commsTypes commsType,
149  UList<Type>& f
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 // ************************************************************************* //
primitiveFieldsFwd.H
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::processorLduInterface
An abstract base class for processor coupled interfaces.
Definition: processorLduInterface.H:53
Foam::processorLduInterface::processorLduInterface
processorLduInterface()=default
Construct null.
Foam::processorLduInterface::compressedSend
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &f) const
Raw send function with data compression.
Definition: processorLduInterfaceTemplates.C:153
Foam::processorLduInterface::compressedReceive
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &f) const
Raw receive function with data compression.
Definition: processorLduInterfaceTemplates.C:234
Foam::processorLduInterface::TypeName
TypeName("processorLduInterface")
Runtime type information.
Foam::processorLduInterface::receive
void receive(const Pstream::commsTypes commsType, UList< Type > &f) const
Raw receive function.
Definition: processorLduInterfaceTemplates.C:101
processorLduInterfaceTemplates.C
Foam::processorLduInterface::tag
virtual int tag() const =0
Return message tag used for sending.
Foam::Field< tensor >
Foam::processorLduInterface::neighbProcNo
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
Foam::processorLduInterface::send
void send(const Pstream::commsTypes commsType, const UList< Type > &f) const
Raw send function.
Definition: processorLduInterfaceTemplates.C:37
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
Foam::processorLduInterface::myProcNo
virtual int myProcNo() const =0
Return processor number (rank in communicator)
f
labelList f(nPoints)
Foam::List< char >
Foam::UList< Type >
Foam::processorLduInterface::comm
virtual label comm() const =0
Return communicator used for parallel communication.
Foam::processorLduInterface::forwardT
virtual const tensorField & forwardT() const =0
Return face transformation tensor.
lduInterface.H
Foam::processorLduInterface::~processorLduInterface
virtual ~processorLduInterface()=default
Destructor.