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,
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  }
210 
211  virtual label index() const
212  {
213  return index_;
214  }
215 
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,
260  List<Type>&
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 // ************************************************************************* //
Foam::GAMGInterface::write
virtual void write(Ostream &) const =0
Write to stream.
Definition: GAMGInterface.C:125
Foam::GAMGInterface::size
virtual label size() const
Return size.
Definition: GAMGInterface.H:205
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::GAMGInterface::index_
const label index_
My index in coarseInterfaces.
Definition: GAMGInterface.H:63
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::GAMGInterface::declareRunTimeSelectionTable
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))
Foam::GAMGInterface::faceRestrictAddressing_
labelList faceRestrictAddressing_
Face restrict addressing.
Definition: GAMGInterface.H:72
Foam::lduInterface
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
Definition: lduInterface.H:54
Foam::GAMGInterface::faceRestrictAddressing
virtual const labelList & faceRestrictAddressing() const
Return (local)face restrict addressing.
Definition: GAMGInterface.H:227
Foam::GAMGInterface::operator=
void operator=(const GAMGInterface &)=delete
No copy assignment.
GAMGAgglomeration.H
Foam::GAMGInterface::GAMGInterface
GAMGInterface(const GAMGInterface &)=delete
No copy construct.
lduInterfacePtrsList.H
Foam::GAMGInterface::faceCells_
labelList faceCells_
Face-cell addressing.
Definition: GAMGInterface.H:69
Foam::Field< label >
Foam::GAMGInterface::faceCells
virtual const labelUList & faceCells() const
Return faceCell addressing.
Definition: GAMGInterface.H:221
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::GAMGInterface::coarseInterfaces_
const lduInterfacePtrsList & coarseInterfaces_
All interfaces.
Definition: GAMGInterface.H:66
Foam::GAMGInterface
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:54
Foam::UPtrList< const lduInterface >
Foam::GAMGInterface::agglomerateCoeffs
virtual tmp< scalarField > agglomerateCoeffs(const scalarField &fineCoeffs) const
Agglomerating the given fine-level coefficients and return.
Definition: GAMGInterface.C:92
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::GAMGInterface::faceRestrictAddressing
virtual labelList & faceRestrictAddressing()
Return non-const access to face restrict addressing.
Definition: GAMGInterface.H:233
Foam::GAMGInterface::TypeName
TypeName("GAMGInterface")
Runtime type information.
Foam::GAMGInterface::index
virtual label index() const
Definition: GAMGInterface.H:210
GAMGInterfaceTemplates.C
Foam::GAMGInterface::interfaceInternalField
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData) const
Return the interface internal field of the given field.
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::UList< label >
Foam::GAMGInterface::New
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.
Definition: GAMGInterfaceNew.C:37
Foam::GAMGInterface::coarseInterfaces
virtual const lduInterfacePtrsList & coarseInterfaces() const
Definition: GAMGInterface.H:215
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::faceCells
Smooth ATC in cells next to a set of patches supplied by type.
Definition: faceCells.H:56
Foam::GAMGInterface::combine
void combine(const GAMGInterface &)
Merge the next level with this level.
Definition: GAMGInterface.C:59
autoPtr.H