cyclicGAMGInterface.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-2013 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::cyclicGAMGInterface
29 
30 Description
31  GAMG agglomerated cyclic interface.
32 
33 SourceFiles
34  cyclicGAMGInterface.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cyclicGAMGInterface_H
39 #define cyclicGAMGInterface_H
40 
41 #include "GAMGInterface.H"
42 #include "cyclicLduInterface.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class cyclicGAMGInterface Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public GAMGInterface,
56  virtual public cyclicLduInterface
57 {
58  // Private data
59 
60  //- Neighbour patch number
61  label neighbPatchID_;
62 
63  //- Am I owner?
64  bool owner_;
65 
66  //- Transformation tensor
67  tensorField forwardT_;
68 
69  //- Transformation tensor
70  tensorField reverseT_;
71 
72 
73  // Private Member Functions
74 
75  //- No copy construct
77 
78  //- No copy assignment
79  void operator=(const cyclicGAMGInterface&) = delete;
80 
81 
82 public:
83 
84  //- Runtime type information
85  TypeName("cyclic");
86 
87 
88  // Constructors
89 
90  //- Construct from fine level interface,
91  // local and neighbour restrict addressing
93  (
94  const label index,
96  const lduInterface& fineInterface,
97  const labelField& restrictAddressing,
98  const labelField& neighbourRestrictAddressing,
99  const label fineLevelIndex,
100  const label coarseComm
101  );
102 
103  //- Construct from Istream
105  (
106  const label index,
108  Istream& is
109  );
110 
111  //- Construct from fine level interface,
112  //- local and neighbour restrict addressing
114  (
115  const label index,
117  const lduInterface& fineInterface,
118  const labelList& interfaceMap,
119  const labelUList& faceCells,
120  const labelUList& faceRestrictAddresssing,
121  const labelUList& faceOffsets,
122  const lduInterfacePtrsList& allInterfaces
123  );
124 
125  //- Construct by assembling and returning a clone.
127  (
128  const label index,
130  const labelList& interfaceMap,
131  const labelUList& faceCells,
132  const labelUList& faceRestrictAddresssing,
133  const labelUList& faceOffsets,
134  const lduInterfacePtrsList& allInterfaces,
135  const label coarseComm,
136  const label myProcNo,
137  const labelList& procAgglomMap
138  ) const
139  {
141  (
143  (
144  index,
146  *this,
147  interfaceMap,
148  faceCells,
149  faceRestrictAddresssing,
150  faceOffsets,
151  allInterfaces
152  )
153  );
154  }
155 
156 
157  //- Destructor
158  virtual ~cyclicGAMGInterface() = default;
159 
160 
161  // Member Functions
162 
163  // Interface transfer functions
164 
165  //- Transfer and return internal field adjacent to the interface
167  (
168  const Pstream::commsTypes commsType,
169  const labelUList& iF
170  ) const;
171 
172 
173  //- Cyclic interface functions
174 
175  //- Return neighbour processor number
176  virtual label neighbPatchID() const
177  {
178  return neighbPatchID_;
179  }
180 
181  virtual bool owner() const
182  {
183  return owner_;
184  }
185 
186  virtual const cyclicGAMGInterface& neighbPatch() const
187  {
188  return dynamic_cast<const cyclicGAMGInterface&>
189  (
191  );
192  }
193 
194  //- Return face transformation tensor
195  virtual const tensorField& forwardT() const
196  {
197  return forwardT_;
198  }
199 
200  //- Return neighbour-cell transformation tensor
201  virtual const tensorField& reverseT() const
202  {
203  return reverseT_;
204  }
205 
206 
207  // I/O
208 
209  //- Write to stream
210  virtual void write(Ostream& os) const;
211 };
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
commsTypes
Communications types.
Definition: UPstream.H:72
virtual label index() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
An abstract base class for cyclic coupled interfaces.
virtual const cyclicGAMGInterface & neighbPatch() const
Return processor number.
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
virtual ~cyclicGAMGInterface()=default
Destructor.
virtual label neighbPatchID() const
Cyclic interface functions.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual void write(Ostream &os) const
Write to stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
virtual const lduInterfacePtrsList & coarseInterfaces() const
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
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 returning a clone.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
TypeName("cyclic")
Runtime type information.
virtual bool owner() const
virtual const tensorField & forwardT() const
Return face transformation tensor.
Namespace for OpenFOAM.
GAMG agglomerated cyclic interface.