Loading...
Searching...
No Matches
cyclicACMIGAMGInterfaceField.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) 2013 OpenFOAM Foundation
9 Copyright (C) 2019 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::cyclicACMIGAMGInterfaceField
29
30Description
31 GAMG agglomerated cyclic interface for Arbitrarily Coupled Mesh Interface
32 (ACMI) fields.
33
34SourceFiles
35 cyclicACMIGAMGInterfaceField.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef cyclicACMIGAMGInterfaceField_H
40#define cyclicACMIGAMGInterfaceField_H
41
42#include "GAMGInterfaceField.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
51/*---------------------------------------------------------------------------*\
52 Class cyclicACMIGAMGInterfaceField Declaration
53\*---------------------------------------------------------------------------*/
54
55class cyclicACMIGAMGInterfaceField
56:
57 public GAMGInterfaceField,
58 virtual public cyclicACMILduInterfaceField
59{
60 // Private data
61
62 //- Local reference cast into the cyclic interface
63 const cyclicACMIGAMGInterface& cyclicACMIInterface_;
64
65 //- Is the transform required
66 bool doTransform_;
67
68 //- Rank of component for transformation
69 int rank_;
70
71
72 // Sending and receiving (distributed AMI)
73
74 //- Current range of send requests (non-blocking)
75 mutable labelRange sendRequests_;
76
77 //- Current range of recv requests (non-blocking)
78 mutable labelRange recvRequests_;
79
80 //- Scalar send buffers
81 mutable PtrList<List<solveScalar>> scalarSendBufs_;
82
83 //- Scalar receive buffers
84 mutable PtrList<List<solveScalar>> scalarRecvBufs_;
85
86 // Only used for AMI caching
87
88 //- Current range of send requests (non-blocking)
89 mutable labelRange sendRequests1_;
90
91 //- Current range of recv requests (non-blocking)
92 mutable labelRange recvRequests1_;
93
94 //- Scalar send buffers
95 mutable PtrList<List<solveScalar>> scalarSendBufs1_;
96
97 //- Scalar receive buffers
98 mutable PtrList<List<solveScalar>> scalarRecvBufs1_;
99
100
101 // Private Member Functions
102
103 //- No copy construct
104 cyclicACMIGAMGInterfaceField
105 (
106 const cyclicACMIGAMGInterfaceField&
107 ) = delete;
108
109 //- No copy assignment
110 void operator=(const cyclicACMIGAMGInterfaceField&) = delete;
111
112
113public:
114
115 //- Runtime type information
116 TypeName("cyclicACMI");
117
118
119 // Constructors
120
121 //- Construct from GAMG interface and fine level interface field
122 cyclicACMIGAMGInterfaceField
123 (
124 const GAMGInterface& GAMGCp,
125 const lduInterfaceField& fineInterfaceField
126 );
127
128 //- Construct from GAMG interface and fine level interface field
129 cyclicACMIGAMGInterfaceField
130 (
131 const GAMGInterface& GAMGCp,
132 const bool doTransform,
133 const int rank
134 );
135
136 //- Construct from GAMG interface and Istream
137 cyclicACMIGAMGInterfaceField
138 (
139 const GAMGInterface& GAMGCp,
140 Istream& is
141 );
142
143 //- Construct from GAMG interface and local and remote fields
144 cyclicACMIGAMGInterfaceField
145 (
146 const GAMGInterface& GAMGCp,
148 const UPtrList<lduInterfaceField>& other
149 );
150
151 //- Construct by assembling and return a clone.
153 (
154 const GAMGInterface& GAMGCp,
155 const UPtrList<lduInterfaceField>& other
156 ) const
157 {
159 (
160 new cyclicACMIGAMGInterfaceField
161 (
162 GAMGCp,
163 *this, // local field
164 other // other fields
165 )
166 );
167 }
168
169
170 //- Destructor
171 virtual ~cyclicACMIGAMGInterfaceField() = default;
172
173
174 // Member Functions
175
176 // Access
177
178 //- Return size
179 label size() const
180 {
181 return cyclicACMIInterface_.size();
182 }
183
184
185 // Interface matrix update
186
187 //- Are all (receive) data available?
188 virtual bool ready() const;
189
190 //- Initialise neighbour matrix update
191 virtual void initInterfaceMatrixUpdate
192 (
193 solveScalarField& result,
194 const bool add,
195 const lduAddressing& lduAddr,
196 const label patchId,
197 const solveScalarField& psiInternal,
198 const scalarField& coeffs,
199 const direction cmpt,
200 const Pstream::commsTypes commsType
201 ) const;
202
203 //- Update result field based on interface functionality
204 virtual void updateInterfaceMatrix
205 (
207 const bool add,
208 const lduAddressing& lduAddr,
209 const label patchId,
210 const solveScalarField& psiInternal,
211 const scalarField& coeffs,
212 const direction cmpt,
213 const Pstream::commsTypes commsType
214 ) const;
215
217 //- Cyclic interface functions
218
219 //- Does the interface field perform the transformation
220 virtual bool doTransform() const
221 {
222 return doTransform_;
223 }
224
225 //- Return face transformation tensor
226 virtual const tensorField& forwardT() const
227 {
228 return cyclicACMIInterface_.forwardT();
229 }
230
231 //- Return neighbour-cell transformation tensor
232 virtual const tensorField& reverseT() const
233 {
234 return cyclicACMIInterface_.reverseT();
235 }
236
237 //- Return rank of component for transform
238 virtual int rank() const
239 {
240 return rank_;
241 }
242
243
244 // I/O
245
246 //- Write to stream
247 virtual void write(Ostream&) const;
248};
249
250
251// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252
253} // End namespace Foam
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257#endif
258
259// ************************************************************************* //
Abstract base class for GAMG agglomerated interfaces.
virtual label size() const
Return size.
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
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
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
virtual bool doTransform() const
Cyclic interface functions.
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 int rank() const
Return rank of component for transform.
virtual autoPtr< GAMGInterfaceField > clone(const GAMGInterface &GAMGCp, const UPtrList< lduInterfaceField > &other) const
Construct by assembling and return a clone.
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 const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
TypeName("cyclicACMI")
Runtime type information.
virtual ~cyclicACMIGAMGInterfaceField()=default
Destructor.
virtual bool ready() const
Are all (receive) data available?
virtual const tensorField & forwardT() const
Return face transformation tensor.
GAMG agglomerated cyclic ACMI interface.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual const tensorField & forwardT() const
Return face transformation tensor.
A range or interval of labels defined by a start and a size.
Definition labelRange.H:66
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...
bool local
Definition EEqn.H:20
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