processorLduInterface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::processorLduInterface
26 
27 Description
28  An abstract base class for processor coupled interfaces.
29 
30 SourceFiles
31  processorLduInterface.C
32  processorLduInterfaceTemplates.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef processorLduInterface_H
37 #define processorLduInterface_H
38 
39 #include "lduInterface.H"
40 #include "transformer.H"
41 #include "primitiveFieldsFwd.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class processorLduInterface Declaration
50 \*---------------------------------------------------------------------------*/
51 
53 {
54  // Private Data
55 
56  //- Send buffer.
57  // Only sized and used when compressed or non-blocking comms used.
58  mutable List<char> sendBuf_;
59 
60  //- Receive buffer.
61  // Only sized and used when compressed or non-blocking comms used.
62  mutable List<char> receiveBuf_;
63 
64  //- Resize the buffer if required
65  void resizeBuf(List<char>& buf, const label size) const;
66 
67 
68 public:
69 
70  //- Runtime type information
71  TypeName("processorLduInterface");
72 
73 
74  // Constructors
75 
76  //- Construct null
78 
79 
80  //- Destructor
81  virtual ~processorLduInterface();
82 
83 
84  // Member Functions
85 
86  // Access
87 
88  //- Return communicator used for parallel communication
89  virtual label comm() const = 0;
90 
91  //- Return processor number (rank in communicator)
92  virtual int myProcNo() const = 0;
93 
94  //- Return neighbour processor number (rank in communicator)
95  virtual int neighbProcNo() const = 0;
96 
97  //- Return transformation between the coupled patches
98  virtual const transformer& transform() const = 0;
99 
100  //- Return message tag used for sending
101  virtual int tag() const = 0;
102 
103 
104  // Transfer functions
105 
106  //- Raw send function
107  template<class Type>
108  void send
109  (
110  const Pstream::commsTypes commsType,
111  const UList<Type>&
112  ) const;
113 
114  //- Raw field receive function
115  template<class Type>
116  void receive
117  (
118  const Pstream::commsTypes commsType,
119  UList<Type>&
120  ) const;
121 
122  //- Raw field receive function returning field
123  template<class Type>
125  (
126  const Pstream::commsTypes commsType,
127  const label size
128  ) const;
129 
130 
131  //- Raw field send function with data compression
132  template<class Type>
133  void compressedSend
134  (
135  const Pstream::commsTypes commsType,
136  const UList<Type>&
137  ) const;
138 
139  //- Raw field receive function with data compression
140  template<class Type>
141  void compressedReceive
142  (
143  const Pstream::commsTypes commsType,
144  UList<Type>&
145  ) const;
146 
147  //- Raw field receive function with data compression returning field
148  template<class Type>
150  (
151  const Pstream::commsTypes commsType,
152  const label size
153  ) const;
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #ifdef NoRepository
165 #endif
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
commsTypes
Types of communications.
Definition: UPstream.H:65
An abstract base class for processor coupled interfaces.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual ~processorLduInterface()
Destructor.
void send(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw send function.
void receive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
virtual int myProcNo() const =0
Return processor number (rank in communicator)
TypeName("processorLduInterface")
Runtime type information.
virtual const transformer & transform() const =0
Return transformation between the coupled patches.
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw field send function with data compression.
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function with data compression.
virtual int tag() const =0
Return message tag used for sending.
A class for managing temporary objects.
Definition: tmp.H:55
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.