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  //- Construct from GAMG interface and Istream
123  (
124  const GAMGInterface& GAMGCp,
125  Istream& is
126  );
127 
128  //- Construct by assembling and return a clone.
130  (
131  const GAMGInterface& GAMGCp,
132  const UPtrList<lduInterfaceField>& other
133  ) const
134  {
136  return autoPtr<GAMGInterfaceField>(nullptr);
137  }
138 
139 
140  //- Destructor
141  virtual ~calculatedProcessorGAMGInterfaceField() = default;
142 
143 
144  // Member Functions
145 
146  // Access
147 
148  //- Return size
149  label size() const
150  {
151  return procInterface_.size();
152  }
154 
155  // Interface matrix update
156 
157  //- Initialise neighbour matrix update
158  virtual void initInterfaceMatrixUpdate
159  (
160  solveScalarField& result,
161  const bool add,
162  const lduAddressing& lduAddr,
163  const label patchId,
164  const solveScalarField& psiInternal,
165  const scalarField& coeffs,
166  const direction cmpt,
167  const Pstream::commsTypes commsType
168  ) const;
169 
170  //- Update result field based on interface functionality
171  virtual void updateInterfaceMatrix
172  (
173  solveScalarField& result,
174  const bool add,
175  const lduAddressing& lduAddr,
176  const label patchId,
177  const solveScalarField& psiInternal,
178  const scalarField& coeffs,
179  const direction cmpt,
180  const Pstream::commsTypes commsType
181  ) const;
182 
183 
184  //- Processor interface functions
185 
186  //- Return communicator used for comms
187  virtual label comm() const
188  {
189  return procInterface_.comm();
190  }
191 
192  //- Return processor number
193  virtual int myProcNo() const
194  {
195  return procInterface_.myProcNo();
196  }
197 
198  //- Return neighbour processor number
199  virtual int neighbProcNo() const
200  {
201  return procInterface_.neighbProcNo();
202  }
203 
204  //- Does the interface field perform the transformation
205  virtual bool doTransform() const
206  {
207  return doTransform_;
208  }
209 
210  //- Return face transformation tensor
211  virtual const tensorField& forwardT() const
212  {
213  return procInterface_.forwardT();
214  }
215 
216  //- Return rank of component for transform
217  virtual int rank() const
218  {
219  return rank_;
220  }
221 
223  // I/O
224 
225  //- Write to stream
226  virtual void write(Ostream&) const;
227 };
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 } // End namespace Foam
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
virtual label size() const
Return size.
virtual const tensorField & forwardT() const
Return face transformation tensor.
label patchId(-1)
virtual autoPtr< GAMGInterfaceField > clone(const GAMGInterface &GAMGCp, const UPtrList< lduInterfaceField > &other) const
Construct by assembling and return a clone.
uint8_t direction
Definition: direction.H:46
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator)
commsTypes
Communications types.
Definition: UPstream.H:72
TypeName("calculatedProcessor")
Runtime type information.
virtual label comm() const
Processor interface functions.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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.
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)
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.
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.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
virtual void write(Ostream &) const
Write to stream.
virtual int myProcNo() const
Return processor number (rank in communicator)
Namespace for OpenFOAM.