Loading...
Searching...
No Matches
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{
51/*---------------------------------------------------------------------------*\
52 Class GAMGInterface Declaration
53\*---------------------------------------------------------------------------*/
54
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
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
85public:
86
87 //- Runtime type information
88 TypeName("GAMGInterface");
90
91 // Declare run-time constructor selection tables
92
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 );
117
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,
191
192 //- Construct from Istream
194 (
195 const label index,
197 Istream& is
198 );
199
200 //- Construct by assembling and return a clone.
202 (
203 const label index,
205 const labelList& interfaceMap, // current to fine interface
206 const labelUList& faceCells,
207 const labelUList& faceRestrictAddresssing,
208 const labelUList& faceOffsets,
209 const lduInterfacePtrsList& allInterfaces,
210 const label coarseComm,
211 const label myProcNo,
212 const labelList& procAgglomMap
213 ) const
214 {
216 return nullptr;
217 }
218
219
220
221 // Member Functions
222
223 // Access
225 //- Return size
226 virtual label size() const
227 {
228 return faceCells_.size();
229 }
230
231 virtual label index() const
232 {
233 return index_;
234 }
235
236 virtual const lduInterfacePtrsList& coarseInterfaces() const
237 {
238 return coarseInterfaces_;
239 }
240
241 //- Return faceCell addressing
242 virtual const labelUList& faceCells() const
243 {
244 return faceCells_;
245 }
246
247 //- Return (local)face restrict addressing
248 virtual const labelList& faceRestrictAddressing() const
249 {
252
253 //- Return non-const access to face restrict addressing
255 {
257 }
258
259 //- Return the interface internal field of the given field
260 template<class Type>
262 (
263 const UList<Type>& internalData
264 ) const;
265
266 //- Return the interface internal field of the given field
267 //- using faceCell mapping
268 template<class Type>
270 (
271 const UList<Type>& internalData,
272 const labelUList& faceCells
273 ) const;
274
275 //- Get the interface internal field of the given field
276 template<class Type>
278 (
279 const UList<Type>& internalData,
281 ) const;
282
283 //- Return the values of the given internal data adjacent to
284 // the interface as a field
286 (
287 const labelUList& internalData
288 ) const;
289
290 //- Return the values of the given internal data adjacent to
291 //- the interface as a field using faceCell mapping
293 (
294 const labelUList& internalData,
295 const labelUList& faceCells
296 ) const;
297
298
299 // Agglomeration
300
301 //- Merge the next level with this level
302 // combining the face-restrict addressing
303 // and copying the face-cell addressing
304 void combine(const GAMGInterface&);
305
306 //- Agglomerating the given fine-level coefficients and return
308 (
309 const scalarField& fineCoeffs
310 ) const;
311
312
313 // I/O
314
315 //- Write to stream
316 virtual void write(Ostream&) const = 0;
317};
318
319
320// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321
322} // End namespace Foam
323
324// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325
326#ifdef NoRepository
327 #include "GAMGInterfaceTemplates.C"
328#endif
329
330// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
331
332#endif
333
334// ************************************************************************* //
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.
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
Return the interface internal field of the given field using faceCell mapping.
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.
const lduInterfacePtrsList & coarseInterfaces_
All interfaces.
void combine(const GAMGInterface &)
Merge the next level with this level.
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData) const
Return the interface internal field of the given field.
virtual autoPtr< GAMGInterface > clone(const label index, const lduInterfacePtrsList &coarseInterfaces, const labelList &interfaceMap, const labelUList &faceCells, const labelUList &faceRestrictAddresssing, const labelUList &faceOffsets, const lduInterfacePtrsList &allInterfaces, const label coarseComm, const label myProcNo, const labelList &procAgglomMap) const
Construct by assembling and return a clone.
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.
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.
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:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition UList.H:89
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Smooth ATC in cells next to a set of patches supplied by type.
Definition faceCells.H:55
lduInterface() noexcept=default
Default construct.
A class for managing temporary objects.
Definition tmp.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Field< label > labelField
Specialisation of Field<T> for label.
Definition labelField.H:48
UList< label > labelUList
A UList of labels.
Definition UList.H:75
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:68