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-2018 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 private:
75 
76  // Private Member Functions
77 
78  //- Disallow default bitwise copy construct
80 
81  //- Disallow default bitwise assignment
82  void operator=(const GAMGInterface&);
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,
100  const lduInterfacePtrsList& coarseInterfaces,
101  const lduInterface& fineInterface,
102  const labelField& localRestrictAddressing,
103  const labelField& neighbourRestrictAddressing,
104  const label fineLevelIndex,
105  const label coarseComm
106  ),
107  (
108  index,
109  coarseInterfaces,
110  fineInterface,
111  localRestrictAddressing,
112  neighbourRestrictAddressing,
113  fineLevelIndex,
114  coarseComm
115  )
116  );
117 
119  (
120  autoPtr,
122  Istream,
123  (
124  const label index,
125  const lduInterfacePtrsList& coarseInterfaces,
126  Istream& is
127  ),
128  (
129  index,
130  coarseInterfaces,
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,
143  const lduInterfacePtrsList& coarseInterfaces,
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,
157  const lduInterfacePtrsList& coarseInterfaces,
158  Istream& is
159  );
160 
161 
162  // Constructors
163 
164  //- Construct from interfaces, restrict addressing set later on
166  (
167  const label index,
168  const lduInterfacePtrsList& coarseInterfaces
169  )
170  :
171  index_(index),
172  coarseInterfaces_(coarseInterfaces)
173  {}
174 
175 
176  //- Construct from interfaces and restrict addressing
178  (
179  const label index,
180  const lduInterfacePtrsList& coarseInterfaces,
181  const labelUList& faceCells,
183  )
184  :
185  index_(index),
186  coarseInterfaces_(coarseInterfaces),
187  faceCells_(faceCells),
188  faceRestrictAddressing_(faceRestrictAddressing)
189  {}
190 
191 
192  //- Construct from Istream
194  (
195  const label index,
196  const lduInterfacePtrsList& coarseInterfaces,
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  }
211  virtual label index() const
212  {
213  return index_;
214  }
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  //- Get the interface internal field of the given field
247  template<class Type>
249  (
250  const UList<Type>& internalData,
251  List<Type>&
252  ) const;
253 
254  //- Return the values of the given internal data adjacent to
255  // the interface as a field
257  (
258  const labelUList& internalData
259  ) const;
260 
261 
262  // Agglomeration
263 
264  //- Merge the next level with this level
265  // combining the face-restrict addressing
266  // and copying the face-cell addressing
267  void combine(const GAMGInterface&);
268 
269  //- Agglomerating the given fine-level coefficients and return
271  (
272  const scalarField& fineCoeffs
273  ) const;
274 
275 
276  // I/O
277 
278  //- Write to stream
279  virtual void write(Ostream&) const = 0;
280 };
281 
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 } // End namespace Foam
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #ifdef NoRepository
290  #include "GAMGInterfaceTemplates.C"
291 #endif
292 
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 
295 #endif
296 
297 // ************************************************************************* //
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
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:163
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:61
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
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))
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
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.