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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::GAMGInterface
28 
29 Description
30  Abstract base class for GAMG agglomerated interfaces.
31 
32 SourceFiles
33  GAMGInterface.C
34  newAmgInterface.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef GAMGInterface_H
39 #define GAMGInterface_H
40 
41 #include "autoPtr.H"
42 #include "lduInterfacePtrsList.H"
43 #include "GAMGAgglomeration.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class GAMGInterface Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class GAMGInterface
55 :
56  public lduInterface
57 {
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 private:
77 
78  // Private Member Functions
79 
80  //- No copy construct
81  GAMGInterface(const GAMGInterface&) = delete;
82 
83  //- No copy assignment
84  void operator=(const GAMGInterface&) = delete;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("GAMGInterface");
91 
92 
93  // Declare run-time constructor selection tables
94 
96  (
97  autoPtr,
100  (
101  const label index,
103  const lduInterface& fineInterface,
104  const labelField& localRestrictAddressing,
105  const labelField& neighbourRestrictAddressing,
106  const label fineLevelIndex,
107  const label coarseComm
108  ),
109  (
110  index,
112  fineInterface,
113  localRestrictAddressing,
114  neighbourRestrictAddressing,
115  fineLevelIndex,
116  coarseComm
117  )
118  );
119 
121  (
122  autoPtr,
124  Istream,
125  (
126  const label index,
128  Istream& is
129  ),
130  (
131  index,
133  is
134  )
135  );
136 
137 
138  // Selectors
139 
140  //- Return a pointer to a new interface created on freestore given
141  // the fine interface
143  (
144  const label index,
146  const lduInterface& fineInterface,
147  const labelField& localRestrictAddressing,
148  const labelField& neighbourRestrictAddressing,
149  const label fineLevelIndex,
150  const label coarseComm
151  );
152 
153  //- Return a pointer to a new interface created on freestore given
154  // the fine interface
156  (
157  const word& coupleType,
158  const label index,
160  Istream& is
161  );
162 
163 
164  // Constructors
165 
166  //- Construct from interfaces, restrict addressing set later on
168  (
169  const label index,
171  )
172  :
173  index_(index),
175  {}
176 
177 
178  //- Construct from interfaces and restrict addressing
180  (
181  const label index,
183  const labelUList& faceCells,
185  )
186  :
187  index_(index),
191  {}
192 
193 
194  //- Construct from Istream
196  (
197  const label index,
199  Istream& is
200  );
201 
202 
203  // Member Functions
204 
205  // Access
206 
207  //- Return size
208  virtual label size() const
209  {
210  return faceCells_.size();
211  }
212 
213  virtual label index() const
214  {
215  return index_;
216  }
217 
218  virtual const lduInterfacePtrsList& coarseInterfaces() const
219  {
220  return coarseInterfaces_;
221  }
222 
223  //- Return faceCell addressing
224  virtual const labelUList& faceCells() const
225  {
226  return faceCells_;
227  }
228 
229  //- Return (local)face restrict addressing
230  virtual const labelList& faceRestrictAddressing() const
231  {
233  }
234 
235  //- Return non-const access to face restrict addressing
237  {
239  }
240 
241  //- Return the interface internal field of the given field
242  template<class Type>
244  (
245  const UList<Type>& internalData
246  ) const;
247 
248  //- Get the interface internal field of the given field
249  template<class Type>
251  (
252  const UList<Type>& internalData,
253  List<Type>&
254  ) const;
255 
256  //- Return the values of the given internal data adjacent to
257  // the interface as a field
259  (
260  const labelUList& internalData
261  ) const;
262 
263 
264  // Agglomeration
265 
266  //- Merge the next level with this level
267  // combining the face-restrict addressing
268  // and copying the face-cell addressing
269  void combine(const GAMGInterface&);
270 
271  //- Agglomerating the given fine-level coefficients and return
273  (
274  const scalarField& fineCoeffs
275  ) const;
276 
277 
278  // I/O
279 
280  //- Write to stream
281  virtual void write(Ostream&) const = 0;
282 };
283 
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 } // End namespace Foam
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 #ifdef NoRepository
292  #include "GAMGInterfaceTemplates.C"
293 #endif
294 
295 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
296 
297 #endif
298 
299 // ************************************************************************* //
Foam::GAMGInterface::write
virtual void write(Ostream &) const =0
Write to stream.
Definition: GAMGInterface.C:114
Foam::GAMGInterface::size
virtual label size() const
Return size.
Definition: GAMGInterface.H:207
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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:229
GAMGAgglomeration.H
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:223
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:53
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:81
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:235
Foam::GAMGInterface::TypeName
TypeName("GAMGInterface")
Runtime type information.
Foam::GAMGInterface::index
virtual label index() const
Definition: GAMGInterface.H:212
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:217
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:58
autoPtr.H