Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::processorGAMGInterfaceField
29
30Description
31 GAMG agglomerated processor interface field.
32
33SourceFiles
34 processorGAMGInterfaceField.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_processorGAMGInterfaceField_H
39#define Foam_processorGAMGInterfaceField_H
40
41#include "GAMGInterfaceField.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
50/*---------------------------------------------------------------------------*\
51 Class processorGAMGInterfaceField Declaration
52\*---------------------------------------------------------------------------*/
53
54class processorGAMGInterfaceField
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
90 processorGAMGInterfaceField
91 (
92 const processorGAMGInterfaceField&
93 ) = delete;
94
95 //- No copy assignment
96 void operator=(const processorGAMGInterfaceField&) = delete;
97
98
99public:
100
101 //- Runtime type information
102 TypeName("processor");
103
104
105 // Constructors
106
107 //- Construct from GAMG interface and fine level interface field
108 processorGAMGInterfaceField
109 (
110 const GAMGInterface& GAMGCp,
111 const lduInterfaceField& fineInterface
112 );
113
114 //- Construct from GAMG interface and fine level interface field
115 processorGAMGInterfaceField
116 (
117 const GAMGInterface& GAMGCp,
118 const bool doTransform,
119 const int rank
120 );
121
122 //- Construct from GAMG interface and Istream
123 processorGAMGInterfaceField
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 (
138 new processorGAMGInterfaceField
139 (
140 patch,
141 doTransform_,
142 rank_
143 )
144 );
145 }
146
147
148 //- Destructor
149 virtual ~processorGAMGInterfaceField() = default;
150
151
152 // Member Functions
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// ************************************************************************* //
Abstract base class for GAMG agglomerated interfaces.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
commsTypes
Communications types.
Definition UPstream.H:81
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
The class contains the addressing required by the lduMatrix: upper, lower and losort.
An abstract base class for implicitly-coupled interface fields e.g. processor and cyclic patch fields...
virtual bool doTransform() const
Does the interface field perform the transformation.
virtual autoPtr< GAMGInterfaceField > clone(const GAMGInterface &patch, const UPtrList< lduInterfaceField > &other) const
Construct by assembling and return a clone.
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 ~processorGAMGInterfaceField()=default
Destructor.
virtual int rank() const
Return rank of component for transform.
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 myProcNo() const
Return processor number.
virtual label comm() const
Processor interface functions.
TypeName("processor")
Runtime type information.
virtual bool ready() const
Are all (receive) data available?
virtual int neighbProcNo() const
Return neighbour processor number.
virtual const tensorField & forwardT() const
Return face transformation tensor.
GAMG agglomerated processor interface.
virtual int myProcNo() const
Return processor number (rank in communicator).
virtual int neighbProcNo() const
Return neighbour processor number (rank in communicator).
processorLduInterfaceField()=default
Default construct.
label patchId(-1)
Namespace for OpenFOAM.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
void add(DimensionedField< scalar, GeoMesh > &result, const dimensioned< scalar > &dt1, const DimensionedField< scalar, GeoMesh > &f2)
Field< solveScalar > solveScalarField
uint8_t direction
Definition direction.H:49
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68