cyclicACMIGAMGInterface.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) 2013-2015 OpenFOAM Foundation
9  Copyright (C) 2023 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::cyclicACMIGAMGInterface
29 
30 Description
31  GAMG agglomerated cyclic ACMI interface.
32 
33 SourceFiles
34  cyclicACMIGAMGInterface.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_cyclicACMIGAMGInterface_H
39 #define Foam_cyclicACMIGAMGInterface_H
40 
41 #include "GAMGInterface.H"
42 #include "cyclicACMILduInterface.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class cyclicACMIGAMGInterface Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public GAMGInterface,
56  virtual public cyclicACMILduInterface
57 {
58  // Private data
59 
60  label neighbPatchID_;
61 
62  bool owner_;
63 
64  tensorField forwardT_;
65 
66  tensorField reverseT_;
67 
68  //- AMI interface
70 
71  //- rank in AMI with respect to parent communicator.
72  //- Used for combining contributions from different processors if the
73  //- destination processor was not in the original set.
74  label myProcNo_;
75 
76 
77  // Private Member Functions
78 
79  //- No copy construct
81 
82  //- No copy assignment
83  void operator=(const cyclicACMIGAMGInterface&) = delete;
84 
85 
86 public:
87 
88  //- Runtime type information
89  TypeName("cyclicACMI");
90 
91 
92  // Constructors
93 
94  //- Construct from fine level interface,
95  //- local and neighbour restrict addressing
97  (
98  const label index,
100  const lduInterface& fineInterface,
101  const labelField& restrictAddressing,
102  const labelField& neighbourRestrictAddressing,
103  const label fineLevelIndex,
104  const label coarseComm
105  );
106 
107  //- Construct from Istream
109  (
110  const label index,
112  Istream& is
113  );
114 
115  //- Construct from fine level interface,
116  //- local and neighbour restrict addressing
118  (
119  const label index,
121  const lduInterface& fineInterface,
122  const labelList& interfaceMap,
123  const labelUList& faceCells,
124  const labelUList& faceRestrictAddresssing,
125  const labelUList& faceOffsets,
126  const lduInterfacePtrsList& allInterfaces,
127  const label coarseComm,
128  const label myProcNo,
129  const labelList& procAgglomMap
130  );
131 
132  //- Construct by assembling and returning a clone.
134  (
135  const label index,
137  const labelList& interfaceMap,
138  const labelUList& faceCells,
139  const labelUList& faceRestrictAddresssing,
140  const labelUList& faceOffsets,
141  const lduInterfacePtrsList& allInterfaces,
142  const label coarseComm,
143  const label myProcNo,
144  const labelList& procAgglomMap
145  ) const
146  {
148  (
150  (
151  index,
153  *this,
154  interfaceMap,
155  faceCells,
156  faceRestrictAddresssing,
157  faceOffsets,
158  allInterfaces,
159  coarseComm,
160  myProcNo,
161  procAgglomMap
162  )
163  );
164  }
165 
166 
167  //- Destructor
168  virtual ~cyclicACMIGAMGInterface() = default;
169 
170 
171  // Member Functions
172 
173  // Interface transfer functions
174 
175  //- Transfer and return internal field adjacent to the interface
177  (
178  const Pstream::commsTypes commsType,
179  const labelUList& iF
180  ) const;
181 
182 
183  //- Cyclic interface functions
184 
185  //- Return neighbour processor number
186  virtual label neighbPatchID() const
187  {
188  return neighbPatchID_;
189  }
190 
191  virtual bool owner() const
192  {
193  return owner_;
194  }
195 
196  virtual const cyclicACMIGAMGInterface& neighbPatch() const
197  {
198  return dynamic_cast<const cyclicACMIGAMGInterface&>
199  (
201  );
202  }
203 
204  virtual const AMIPatchToPatchInterpolation& AMI() const
205  {
206  return *amiPtr_;
207  }
208 
209  //- Return face transformation tensor
210  virtual const tensorField& forwardT() const
211  {
212  return forwardT_;
213  }
214 
215  //- Return neighbour-cell transformation tensor
216  virtual const tensorField& reverseT() const
217  {
218  return reverseT_;
219  }
220 
221  //- -1 or old local rank
222  virtual label myProcNo() const
223  {
224  return myProcNo_;
225  }
226 
227 
228  // I/O
229 
230  //- Write to stream
231  virtual void write(Ostream&) const;
232 };
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
virtual const tensorField & forwardT() const
Return face transformation tensor.
GAMG agglomerated cyclic ACMI interface.
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.
virtual label neighbPatchID() const
Cyclic interface functions.
commsTypes
Communications types.
Definition: UPstream.H:77
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
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 void write(Ostream &) const
Write to stream.
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
TypeName("cyclicACMI")
Runtime type information.
An abstract base class for cyclic ACMI coupled interfaces.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
virtual const cyclicACMIGAMGInterface & neighbPatch() const
Return processor number.
Abstract base class for GAMG agglomerated interfaces.
Definition: GAMGInterface.H:50
virtual const lduInterfacePtrsList & coarseInterfaces() const
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches...
Definition: lduInterface.H:53
virtual const AMIPatchToPatchInterpolation & AMI() const
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual ~cyclicACMIGAMGInterface()=default
Destructor.
Namespace for OpenFOAM.
virtual label myProcNo() const
-1 or old local rank