processorGAMGInterfaceField.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-2014 OpenFOAM Foundation
9  Copyright (C) 2019-2023 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::processorGAMGInterfaceField
29 
30 Description
31  GAMG agglomerated processor interface field.
32 
33 SourceFiles
34  processorGAMGInterfaceField.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_processorGAMGInterfaceField_H
39 #define Foam_processorGAMGInterfaceField_H
40 
41 #include "GAMGInterfaceField.H"
42 #include "processorGAMGInterface.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class processorGAMGInterfaceField Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public GAMGInterfaceField,
58 {
59  // Private data
60 
61  //- Local reference cast into the processor interface
62  const processorGAMGInterface& procInterface_;
63 
64  //- Is the transform required
65  bool doTransform_;
66 
67  //- Rank of component for transformation
68  int rank_;
69 
70 
71  // Sending and receiving
72 
73  //- Current (non-blocking) send request
74  mutable label sendRequest_;
75 
76  //- Current (non-blocking) recv request
77  mutable label recvRequest_;
78 
79  //- Scalar send buffer
80  mutable solveScalarField scalarSendBuf_;
81 
82  //- Scalar recv buffer
83  mutable solveScalarField scalarRecvBuf_;
84 
85 
86 
87  // Private Member Functions
88 
89  //- No copy construct
91  (
93  ) = delete;
94 
95  //- No copy assignment
96  void operator=(const processorGAMGInterfaceField&) = delete;
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("processor");
103 
104 
105  // Constructors
106 
107  //- Construct from GAMG interface and fine level interface field
109  (
110  const GAMGInterface& GAMGCp,
111  const lduInterfaceField& fineInterface
112  );
113 
114  //- Construct from GAMG interface and fine level interface field
116  (
117  const GAMGInterface& GAMGCp,
118  const bool doTransform,
119  const int rank
120  );
121 
122  //- Construct from GAMG interface and Istream
124  (
125  const GAMGInterface& GAMGCp,
126  Istream& is
127  );
128 
129  //- Construct by assembling and return a clone.
131  (
132  const GAMGInterface& patch,
133  const UPtrList<lduInterfaceField>& other
134  ) const
135  {
137  (
139  (
140  patch,
141  doTransform_,
142  rank_
143  )
144  );
145  }
146 
147 
148  //- Destructor
149  virtual ~processorGAMGInterfaceField() = default;
150 
151 
152  // Member Functions
153 
154  // Access
155 
156  //- Return size
157  label size() const
158  {
159  return procInterface_.size();
160  }
161 
162 
163  // Interface matrix update
164 
165  //- Are all (receive) data available?
166  virtual bool ready() const;
167 
168  //- Initialise neighbour matrix update
169  virtual void initInterfaceMatrixUpdate
170  (
171  solveScalarField& result,
172  const bool add,
173  const lduAddressing& lduAddr,
174  const label patchId,
175  const solveScalarField& psiInternal,
176  const scalarField& coeffs,
177  const direction cmpt,
178  const Pstream::commsTypes commsType
179  ) const;
180 
181  //- Update result field based on interface functionality
182  virtual void updateInterfaceMatrix
183  (
185  const bool add,
186  const lduAddressing& lduAddr,
187  const label patchId,
188  const solveScalarField& psiInternal,
189  const scalarField& coeffs,
190  const direction cmpt,
191  const Pstream::commsTypes commsType
192  ) const;
193 
194 
195  //- Processor interface functions
196 
197  //- Return communicator used for comms
198  virtual label comm() const
199  {
200  return procInterface_.comm();
201  }
202 
203  //- Return processor number
204  virtual int myProcNo() const
205  {
206  return procInterface_.myProcNo();
207  }
208 
209  //- Return neighbour processor number
210  virtual int neighbProcNo() const
211  {
212  return procInterface_.neighbProcNo();
213  }
214 
215  //- Does the interface field perform the transformation
216  virtual bool doTransform() const
217  {
218  return doTransform_;
219  }
220 
221  //- Return face transformation tensor
222  virtual const tensorField& forwardT() const
223  {
224  return procInterface_.forwardT();
225  }
226 
227  //- Return rank of component for transform
228  virtual int rank() const
229  {
230  return rank_;
231  }
232 
233 
234  // I/O
236  //- Write to stream
237  virtual void write(Ostream&) const;
238 };
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 } // End namespace Foam
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #endif
248 
249 // ************************************************************************* //
virtual label size() const
Return size.
virtual autoPtr< GAMGInterfaceField > clone(const GAMGInterface &patch, const UPtrList< lduInterfaceField > &other) const
Construct by assembling and return a clone.
label patchId(-1)
virtual const tensorField & forwardT() const
Return face transformation tensor.
uint8_t direction
Definition: direction.H:46
virtual const tensorField & forwardT() const
Return face transformation tensor.
commsTypes
Communications types.
Definition: UPstream.H:72
virtual int rank() const
Return rank of component for transform.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual int myProcNo() const
Return processor number (rank in communicator)
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual int myProcNo() const
Return processor number.
virtual int neighbProcNo() const
Return neighbour processor number.
virtual ~processorGAMGInterfaceField()=default
Destructor.
Abstract base class for processor coupled interfaces.
TypeName("processor")
Runtime type information.
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: HashTable.H:106
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
GAMG agglomerated processor interface.
virtual label comm() const
Processor interface functions.
virtual void write(Ostream &) const
Write to stream.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
const std::string patch
OpenFOAM patch number as a std::string.
Abstract base class for GAMG agglomerated interface fields.
virtual bool ready() const
Are all (receive) data available?
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
The class contains the addressing required by the lduMatrix: upper, lower and losort.
GAMG agglomerated processor interface field.
virtual bool doTransform() const
Does the interface field perform the transformation.
virtual void initInterfaceMatrixUpdate(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Initialise neighbour matrix update.
virtual void updateInterfaceMatrix(solveScalarField &result, const bool add, const lduAddressing &lduAddr, const label patchId, const solveScalarField &psiInternal, const scalarField &coeffs, const direction cmpt, const Pstream::commsTypes commsType) const
Update result field based on interface functionality.
virtual label comm() const
Processor interface functions.
Namespace for OpenFOAM.