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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::GAMGInterface
29 
30 Description
31  Abstract base class for GAMG agglomerated interfaces.
32 
33 SourceFiles
34  GAMGInterface.C
35  newAmgInterface.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef GAMGInterface_H
40 #define GAMGInterface_H
41 
42 #include "autoPtr.H"
43 #include "lduInterfacePtrsList.H"
44 #include "GAMGAgglomeration.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class GAMGInterface Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class GAMGInterface
56 :
57  public lduInterface
58 {
59 protected:
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 
85 public:
86 
87  //- Runtime type information
88  TypeName("GAMGInterface");
89 
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,
183  )
184  :
185  index_(index),
189  {}
190 
191 
192  //- Construct from Istream
194  (
195  const label index,
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
224 
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  {
251  }
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,
280  List<Type>&
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.
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData) const
Return the interface internal field of the given field.
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
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.
virtual label index() const
virtual const labelUList & faceCells() const
Return faceCell addressing.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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.
labelList faceRestrictAddressing_
Face restrict addressing.
Definition: GAMGInterface.H:76
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:52
const lduInterfacePtrsList & coarseInterfaces_
All interfaces.
Definition: GAMGInterface.H:66
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
GAMGInterface(const GAMGInterface &)=delete
No copy construct.
A class for handling words, derived from Foam::string.
Definition: word.H:63
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
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))
void operator=(const GAMGInterface &)=delete
No copy assignment.
const label index_
My index in coarseInterfaces.
Definition: GAMGInterface.H:61
virtual tmp< scalarField > agglomerateCoeffs(const scalarField &fineCoeffs) const
Agglomerating the given fine-level coefficients and return.
Definition: GAMGInterface.C:85
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
void combine(const GAMGInterface &)
Merge the next level with this level.
Definition: GAMGInterface.C:52
virtual const lduInterfacePtrsList & coarseInterfaces() const
virtual void write(Ostream &) const =0
Write to stream.
TypeName("GAMGInterface")
Runtime type information.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual const labelList & faceRestrictAddressing() const
Return (local)face restrict addressing.
labelList faceCells_
Face-cell addressing.
Definition: GAMGInterface.H:71
List< label > labelList
A List of labels.
Definition: List.H:62
A class for managing temporary objects.
Definition: HashPtrTable.H:50
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
Namespace for OpenFOAM.