calculatedProcessorGAMGInterfaceField.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) 2019-2023 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::calculatedProcessorGAMGInterfaceField
28 
29 Description
30  GAMG agglomerated processor interface field.
31 
32 SourceFiles
33  calculatedProcessorGAMGInterfaceField.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Foam_calculatedProcessorGAMGInterfaceField_H
38 #define Foam_calculatedProcessorGAMGInterfaceField_H
39 
40 #include "GAMGInterfaceField.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class calculatedProcessorGAMGInterfaceField Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public GAMGInterfaceField,
57 {
58  // Private Data
59 
60  //- Local reference cast into the processor interface
61  const calculatedProcessorGAMGInterface& procInterface_;
62 
63  //- Is the transform required
64  bool doTransform_;
65 
66  //- Rank of component for transformation
67  int rank_;
68 
69 
70  // Sending and receiving
71 
72  //- Current (non-blocking) send request
73  mutable label sendRequest_;
74 
75  //- Current (non-blocking) recv request
76  mutable label recvRequest_;
77 
78  //- Scalar send buffer
79  mutable solveScalarField scalarSendBuf_;
80 
81  //- Scalar recv buffer
82  mutable solveScalarField scalarRecvBuf_;
83 
84 
85 
86  // Private Member Functions
87 
88  //- No copy construct
90  (
92  ) = delete;
93 
94  //- No copy assignment
95  void operator=(const calculatedProcessorGAMGInterfaceField&) = delete;
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("calculatedProcessor");
102 
103 
104  // Constructors
105 
106  //- Construct from GAMG interface and fine level interface field
108  (
109  const GAMGInterface& GAMGCp,
110  const lduInterfaceField& fineInterface
111  );
112 
113  //- Construct from GAMG interface and fine level interface field
115  (
116  const GAMGInterface& GAMGCp,
117  const bool doTransform,
118  const int rank
119  );
120 
121 
122  //- Destructor
123  virtual ~calculatedProcessorGAMGInterfaceField() = default;
124 
125 
126  // Member Functions
127 
128  // Access
129 
130  //- Return size
131  label size() const
132  {
133  return procInterface_.size();
134  }
135 
136 
137  // Interface matrix update
138 
139  //- Initialise neighbour matrix update
140  virtual void initInterfaceMatrixUpdate
141  (
142  solveScalarField& result,
143  const bool add,
144  const lduAddressing& lduAddr,
145  const label patchId,
146  const solveScalarField& psiInternal,
147  const scalarField& coeffs,
148  const direction cmpt,
149  const Pstream::commsTypes commsType
150  ) const;
151 
152  //- Update result field based on interface functionality
153  virtual void updateInterfaceMatrix
154  (
155  solveScalarField& result,
156  const bool add,
157  const lduAddressing& lduAddr,
158  const label patchId,
159  const solveScalarField& psiInternal,
160  const scalarField& coeffs,
161  const direction cmpt,
162  const Pstream::commsTypes commsType
163  ) const;
164 
165 
166  //- Processor interface functions
167 
168  //- Return communicator used for comms
169  virtual label comm() const
170  {
171  return procInterface_.comm();
172  }
173 
174  //- Return processor number
175  virtual int myProcNo() const
176  {
177  return procInterface_.myProcNo();
178  }
179 
180  //- Return neighbour processor number
181  virtual int neighbProcNo() const
182  {
183  return procInterface_.neighbProcNo();
184  }
185 
186  //- Does the interface field perform the transformation
187  virtual bool doTransform() const
188  {
189  return doTransform_;
190  }
191 
192  //- Return face transformation tensor
193  virtual const tensorField& forwardT() const
194  {
195  return procInterface_.forwardT();
196  }
197 
198  //- Return rank of component for transform
199  virtual int rank() const
200  {
201  return rank_;
202  }
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
virtual label size() const
Return size.
virtual const tensorField & forwardT() const
Return face transformation tensor.
label patchId(-1)
uint8_t direction
Definition: direction.H:48
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
commsTypes
Communications types.
Definition: UPstream.H:74
TypeName("calculatedProcessor")
Runtime type information.
virtual label comm() const
Processor interface functions.
virtual bool doTransform() const
Does the interface field perform the transformation.
virtual ~calculatedProcessorGAMGInterfaceField()=default
Destructor.
virtual int myProcNo() const
Return processor number.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
Abstract base class for processor coupled interfaces.
virtual label comm() const
Return communicator used for sending.
GAMG agglomerated processor interface.
GAMG agglomerated processor interface field.
virtual int rank() const
Return rank of component for transform.
void add(FieldField< Field1, typename typeOfSum< Type1, Type2 >::type > &f, const FieldField< Field1, Type1 > &f1, const FieldField< Field2, Type2 > &f2)
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.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
virtual const tensorField & forwardT() const
Return face transformation tensor.
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 int neighbProcNo() const
Return neighbour processor number.
Abstract base class for GAMG agglomerated interface fields.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
virtual int myProcNo() const
Return processor number (rank in communicator)
Namespace for OpenFOAM.