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-2018 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 "primitiveFieldsFwd.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class processorLduInterface Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 {
53  // Private data
54 
55  //- Send buffer.
56  // Only sized and used when compressed or non-blocking comms used.
57  mutable List<char> sendBuf_;
58 
59  //- Receive buffer.
60  // Only sized and used when compressed or non-blocking comms used.
61  mutable List<char> receiveBuf_;
62 
63  //- Resize the buffer if required
64  void resizeBuf(List<char>& buf, const label size) const;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("processorLduInterface");
71 
72 
73  // Constructors
74 
75  //- Construct null
77 
78 
79  //- Destructor
80  virtual ~processorLduInterface();
81 
82 
83  // Member Functions
84 
85  // Access
86 
87  //- Return communicator used for parallel communication
88  virtual label comm() const = 0;
89 
90  //- Return processor number (rank in communicator)
91  virtual int myProcNo() const = 0;
92 
93  //- Return neighbour processor number (rank in communicator)
94  virtual int neighbProcNo() const = 0;
95 
96  //- Return face transformation tensor
97  virtual const tensorField& forwardT() const = 0;
98 
99  //- Return message tag used for sending
100  virtual int tag() const = 0;
101 
102  // Transfer functions
103 
104  //- Raw send function
105  template<class Type>
106  void send
107  (
108  const Pstream::commsTypes commsType,
109  const UList<Type>&
110  ) const;
111 
112  //- Raw field receive function
113  template<class Type>
114  void receive
115  (
116  const Pstream::commsTypes commsType,
117  UList<Type>&
118  ) const;
119 
120  //- Raw field receive function returning field
121  template<class Type>
123  (
124  const Pstream::commsTypes commsType,
125  const label size
126  ) const;
127 
128 
129  //- Raw field send function with data compression
130  template<class Type>
131  void compressedSend
132  (
133  const Pstream::commsTypes commsType,
134  const UList<Type>&
135  ) const;
136 
137  //- Raw field receive function with data compression
138  template<class Type>
139  void compressedReceive
140  (
141  const Pstream::commsTypes commsType,
142  UList<Type>&
143  ) const;
144 
145  //- Raw field receive function with data compression returning field
146  template<class Type>
148  (
149  const Pstream::commsTypes commsType,
150  const label size
151  ) const;
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #ifdef NoRepository
163 #endif
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #endif
168 
169 // ************************************************************************* //
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
commsTypes
Types of communications.
Definition: UPstream.H:64
void compressedSend(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw field send function with data compression.
TypeName("processorLduInterface")
Runtime type information.
Forward declarations of the specialisations of Field<T> for scalar, vector and tensor.
virtual ~processorLduInterface()
Destructor.
void receive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function.
virtual label comm() const =0
Return communicator used for parallel communication.
virtual int tag() const =0
Return message tag used for sending.
void send(const Pstream::commsTypes commsType, const UList< Type > &) const
Raw send function.
virtual const tensorField & forwardT() const =0
Return face transformation tensor.
An abstract base class for processor coupled interfaces.
virtual int neighbProcNo() const =0
Return neighbour processor number (rank in communicator)
processorLduInterface()
Construct null.
virtual int myProcNo() const =0
Return processor number (rank in communicator)
A class for managing temporary objects.
Definition: PtrList.H:53
void compressedReceive(const Pstream::commsTypes commsType, UList< Type > &) const
Raw field receive function with data compression.
Namespace for OpenFOAM.