GAMGInterface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::GAMGInterface
26 
27 Description
28  Abstract base class for GAMG agglomerated interfaces.
29 
30 SourceFiles
31  GAMGInterface.C
32  newAmgInterface.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef GAMGInterface_H
37 #define GAMGInterface_H
38 
39 #include "autoPtr.H"
40 #include "lduInterfacePtrsList.H"
41 #include "GAMGAgglomeration.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class GAMGInterface Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class GAMGInterface
53 :
54  public lduInterface
55 {
56 
57 protected:
58 
59  // Protected data
60 
61  //- My index in coarseInterfaces
62  const label index_;
63 
64  //- All interfaces
66 
67  //- Face-cell addressing
69 
70  //- Face restrict addressing
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("GAMGInterface");
78 
79 
80  // Declare run-time constructor selection tables
81 
83  (
84  autoPtr,
87  (
88  const label index,
89  const lduInterfacePtrsList& coarseInterfaces,
90  const lduInterface& fineInterface,
91  const labelField& localRestrictAddressing,
92  const labelField& neighbourRestrictAddressing,
93  const label fineLevelIndex,
94  const label coarseComm
95  ),
96  (
97  index,
98  coarseInterfaces,
99  fineInterface,
100  localRestrictAddressing,
101  neighbourRestrictAddressing,
102  fineLevelIndex,
103  coarseComm
104  )
105  );
106 
108  (
109  autoPtr,
111  Istream,
112  (
113  const label index,
114  const lduInterfacePtrsList& coarseInterfaces,
115  Istream& is
116  ),
117  (
118  index,
119  coarseInterfaces,
120  is
121  )
122  );
123 
124 
125  // Selectors
126 
127  //- Return a pointer to a new interface created on freestore given
128  // the fine interface
130  (
131  const label index,
132  const lduInterfacePtrsList& coarseInterfaces,
133  const lduInterface& fineInterface,
134  const labelField& localRestrictAddressing,
135  const labelField& neighbourRestrictAddressing,
136  const label fineLevelIndex,
137  const label coarseComm
138  );
139 
140  //- Return a pointer to a new interface created on freestore given
141  // the fine interface
143  (
144  const word& coupleType,
145  const label index,
146  const lduInterfacePtrsList& coarseInterfaces,
147  Istream& is
148  );
149 
150 
151  // Constructors
152 
153  //- Construct from interfaces, restrict addressing set later on
155  (
156  const label index,
157  const lduInterfacePtrsList& coarseInterfaces
158  )
159  :
160  index_(index),
161  coarseInterfaces_(coarseInterfaces)
162  {}
163 
164 
165  //- Construct from interfaces and restrict addressing
167  (
168  const label index,
169  const lduInterfacePtrsList& coarseInterfaces,
170  const labelUList& faceCells,
172  )
173  :
174  index_(index),
175  coarseInterfaces_(coarseInterfaces),
176  faceCells_(faceCells),
177  faceRestrictAddressing_(faceRestrictAddressing)
178  {}
179 
180 
181  //- Construct from Istream
183  (
184  const label index,
185  const lduInterfacePtrsList& coarseInterfaces,
186  Istream& is
187  );
188 
189  //- Disallow default bitwise copy construction
190  GAMGInterface(const GAMGInterface&) = delete;
191 
192 
193  // Member Functions
194 
195  // Access
196 
197  //- Return size
198  virtual label size() const
199  {
200  return faceCells_.size();
201  }
203  virtual label index() const
204  {
205  return index_;
206  }
208  virtual const lduInterfacePtrsList& coarseInterfaces() const
209  {
210  return coarseInterfaces_;
211  }
212 
213  //- Return faceCell addressing
214  virtual const labelUList& faceCells() const
215  {
216  return faceCells_;
217  }
218 
219  //- Return (local)face restrict addressing
220  virtual const labelList& faceRestrictAddressing() const
221  {
223  }
224 
225  //- Return non-const access to face restrict addressing
227  {
229  }
230 
231  //- Return the interface internal field of the given field
232  template<class Type>
234  (
235  const UList<Type>& internalData
236  ) const;
237 
238  //- Get the interface internal field of the given field
239  template<class Type>
241  (
242  const UList<Type>& internalData,
243  List<Type>&
244  ) const;
245 
246  //- Return the values of the given internal data adjacent to
247  // the interface as a field
249  (
250  const labelUList& internalData
251  ) const;
252 
253 
254  // Agglomeration
255 
256  //- Merge the next level with this level
257  // combining the face-restrict addressing
258  // and copying the face-cell addressing
259  void combine(const GAMGInterface&);
260 
261  //- Agglomerating the given fine-level coefficients and return
263  (
264  const scalarField& fineCoeffs
265  ) const;
266 
267 
268  // I/O
269 
270  //- Write to stream
271  virtual void write(Ostream&) const = 0;
272 
273 
274  // Member Operators
275 
276  //- Disallow default bitwise assignment
277  void operator=(const GAMGInterface&) = delete;
278 };
279 
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 } // End namespace Foam
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 #ifdef NoRepository
288  #include "GAMGInterfaceTemplates.C"
289 #endif
290 
291 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
292 
293 #endif
294 
295 // ************************************************************************* //
virtual label size() const
Return size.
tmp< Field< Type > > interfaceInternalField(const UList< Type > &internalData) const
Return the interface internal field of the given field.
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
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
labelList faceRestrictAddressing_
Face restrict addressing.
Definition: GAMGInterface.H:70
const lduInterfacePtrsList & coarseInterfaces_
All interfaces.
Definition: GAMGInterface.H:64
A class for handling words, derived from string.
Definition: word.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: HashTable.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
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
Disallow default bitwise 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:79
GAMGInterface(const label index, const lduInterfacePtrsList &coarseInterfaces)
Construct from interfaces, restrict addressing set later on.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:51
void combine(const GAMGInterface &)
Merge the next level with this level.
Definition: GAMGInterface.C:56
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
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
virtual const labelList & faceRestrictAddressing() const
Return (local)face restrict addressing.
labelList faceCells_
Face-cell addressing.
Definition: GAMGInterface.H:67
A class for managing temporary objects.
Definition: PtrList.H:53
Namespace for OpenFOAM.