GAMGInterface.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-2016 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::GAMGInterface
29
30Description
31 Abstract base class for GAMG agglomerated interfaces.
32
33SourceFiles
34 GAMGInterface.C
35 newAmgInterface.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef GAMGInterface_H
40#define GAMGInterface_H
41
42#include "autoPtr.H"
44#include "GAMGAgglomeration.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class GAMGInterface Declaration
53\*---------------------------------------------------------------------------*/
55class GAMGInterface
56:
57 public lduInterface
58{
59protected:
60
61 // Protected data
62
63 //- My index in coarseInterfaces
64 const label index_;
65
66 //- All interfaces
68
69 //- Face-cell addressing
71
72 //- Face restrict addressing
74
75
76 // Protected Member Functions
77
78 //- No copy construct
79 GAMGInterface(const GAMGInterface&) = delete;
80
81 //- No copy assignment
82 void operator=(const GAMGInterface&) = delete;
83
84
85public:
86
87 //- Runtime type information
88 TypeName("GAMGInterface");
89
90
91 // Declare run-time constructor selection tables
94 (
95 autoPtr,
98 (
99 const label index,
101 const lduInterface& fineInterface,
102 const labelField& localRestrictAddressing,
103 const labelField& neighbourRestrictAddressing,
104 const label fineLevelIndex,
105 const label coarseComm
106 ),
107 (
108 index,
110 fineInterface,
111 localRestrictAddressing,
112 neighbourRestrictAddressing,
113 fineLevelIndex,
114 coarseComm
115 )
116 );
119 (
120 autoPtr,
122 Istream,
123 (
124 const label index,
126 Istream& is
127 ),
128 (
129 index,
131 is
132 )
133 );
134
135
136 // Selectors
137
138 //- Return a pointer to a new interface created on freestore given
139 // the fine interface
141 (
142 const label index,
144 const lduInterface& fineInterface,
145 const labelField& localRestrictAddressing,
146 const labelField& neighbourRestrictAddressing,
147 const label fineLevelIndex,
148 const label coarseComm
149 );
150
151 //- Return a pointer to a new interface created on freestore given
152 // the fine interface
154 (
155 const word& coupleType,
156 const label index,
158 Istream& is
159 );
160
161
162 // Constructors
163
164 //- Construct from interfaces, restrict addressing set later on
166 (
167 const label index,
169 )
170 :
171 index_(index),
173 {}
174
175
176 //- Construct from interfaces and restrict addressing
178 (
179 const label index,
181 const labelUList& faceCells,
183 )
184 :
185 index_(index),
189 {}
190
191
192 //- Construct from Istream
194 (
195 const label index,
197 Istream& is
198 );
199
200
201 // Member Functions
202
203 // Access
204
205 //- Return size
206 virtual label size() const
207 {
208 return faceCells_.size();
209 }
211 virtual label index() const
212 {
213 return index_;
214 }
216 virtual const lduInterfacePtrsList& coarseInterfaces() const
217 {
218 return coarseInterfaces_;
219 }
220
221 //- Return faceCell addressing
222 virtual const labelUList& faceCells() const
223 {
224 return faceCells_;
225 }
226
227 //- Return (local)face restrict addressing
228 virtual const labelList& faceRestrictAddressing() const
229 {
231 }
232
233 //- Return non-const access to face restrict addressing
235 {
237 }
238
239 //- Return the interface internal field of the given field
240 template<class Type>
242 (
243 const UList<Type>& internalData
244 ) const;
245
246 //- Return the interface internal field of the given field
247 //- using faceCell mapping
248 template<class Type>
250 (
251 const UList<Type>& internalData,
252 const labelUList& faceCells
253 ) const;
254
255 //- Get the interface internal field of the given field
256 template<class Type>
258 (
259 const UList<Type>& internalData,
261 ) const;
262
263 //- Return the values of the given internal data adjacent to
264 // the interface as a field
266 (
267 const labelUList& internalData
268 ) const;
269
270 //- Return the values of the given internal data adjacent to
271 //- the interface as a field using faceCell mapping
273 (
274 const labelUList& internalData,
275 const labelUList& faceCells
276 ) const;
277
278
279 // Agglomeration
280
281 //- Merge the next level with this level
282 // combining the face-restrict addressing
283 // and copying the face-cell addressing
284 void combine(const GAMGInterface&);
285
286 //- Agglomerating the given fine-level coefficients and return
288 (
289 const scalarField& fineCoeffs
290 ) const;
291
292
293 // I/O
294
295 //- Write to stream
296 virtual void write(Ostream&) const = 0;
297};
298
299
300// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301
302} // End namespace Foam
303
304// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
305
306#ifdef NoRepository
307 #include "GAMGInterfaceTemplates.C"
308#endif
309
310// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311
312#endif
313
314// ************************************************************************* //
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:57
virtual label size() const
Return size.
GAMGInterface(const label index, const lduInterfacePtrsList &coarseInterfaces)
Construct from interfaces, restrict addressing set later on.
virtual const labelList & faceRestrictAddressing() const
Return (local)face restrict addressing.
virtual labelList & faceRestrictAddressing()
Return non-const access to face restrict addressing.
labelList faceRestrictAddressing_
Face restrict addressing.
Definition: GAMGInterface.H:72
GAMGInterface(const label index, const lduInterfacePtrsList &coarseInterfaces, const labelUList &faceCells, const labelUList &faceRestrictAddressing)
Construct from interfaces and restrict addressing.
virtual label index() const
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData, const labelUList &faceCells) const
virtual const lduInterfacePtrsList & coarseInterfaces() const
void operator=(const GAMGInterface &)=delete
No copy assignment.
virtual const labelUList & faceCells() const
Return faceCell addressing.
virtual tmp< scalarField > agglomerateCoeffs(const scalarField &fineCoeffs) const
Agglomerating the given fine-level coefficients and return.
Definition: GAMGInterface.C:92
const lduInterfacePtrsList & coarseInterfaces_
All interfaces.
Definition: GAMGInterface.H:66
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData) const
Return the interface internal field of the given field.
TypeName("GAMGInterface")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, GAMGInterface, Istream,(const label index, const lduInterfacePtrsList &coarseInterfaces, Istream &is),(index, coarseInterfaces, is))
labelList faceCells_
Face-cell addressing.
Definition: GAMGInterface.H:69
static autoPtr< GAMGInterface > New(const label index, const lduInterfacePtrsList &coarseInterfaces, const lduInterface &fineInterface, const labelField &localRestrictAddressing, const labelField &neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm)
Return a pointer to a new interface created on freestore given.
const label index_
My index in coarseInterfaces.
Definition: GAMGInterface.H:63
declareRunTimeSelectionTable(autoPtr, GAMGInterface, lduInterface,(const label index, const lduInterfacePtrsList &coarseInterfaces, const lduInterface &fineInterface, const labelField &localRestrictAddressing, const labelField &neighbourRestrictAddressing, const label fineLevelIndex, const label coarseComm),(index, coarseInterfaces, fineInterface, localRestrictAddressing, neighbourRestrictAddressing, fineLevelIndex, coarseComm))
GAMGInterface(const GAMGInterface &)=delete
No copy construct.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:59
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:58
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
runTime write()
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73