Loading...
Searching...
No Matches
cyclicAMIGAMGInterface.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-2015 OpenFOAM Foundation
9 Copyright (C) 2023 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::cyclicAMIGAMGInterface
29
30Description
31 GAMG agglomerated cyclic AMI interface.
32
33SourceFiles
34 cyclicAMIGAMGInterface.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_cyclicAMIGAMGInterface_H
39#define Foam_cyclicAMIGAMGInterface_H
40
41#include "GAMGInterface.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
49/*---------------------------------------------------------------------------*\
50 Class cyclicAMIGAMGInterface Declaration
51\*---------------------------------------------------------------------------*/
52
53class cyclicAMIGAMGInterface
54:
55 public GAMGInterface,
56 virtual public cyclicAMILduInterface
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
80 cyclicAMIGAMGInterface(const cyclicAMIGAMGInterface&) = delete;
81
82 //- No copy assignment
83 void operator=(const cyclicAMIGAMGInterface&) = delete;
84
85
86public:
87
88 //- Runtime type information
89 TypeName("cyclicAMI");
90
91
92 // Constructors
93
94 //- Construct from fine level interface,
95 //- local and neighbour restrict addressing
96 cyclicAMIGAMGInterface
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
108 cyclicAMIGAMGInterface
109 (
110 const label index,
112 Istream& is
113 );
114
115 //- Construct from fine level interface,
116 //- local and neighbour restrict addressing
117 cyclicAMIGAMGInterface
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
148 (
149 new cyclicAMIGAMGInterface
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 ~cyclicAMIGAMGInterface() = 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 cyclicAMIGAMGInterface& neighbPatch() const
197 {
198 return dynamic_cast<const cyclicAMIGAMGInterface&>
199 (
201 );
202 }
203
204 virtual const AMIPatchToPatchInterpolation& AMI() const
205 {
206 return *amiPtr_;
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
218 return reverseT_;
219 }
220
221 //- -1 or old local rank
222 virtual label myProcNo() const
223 {
224 return myProcNo_;
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 label index() const
virtual const lduInterfacePtrsList & coarseInterfaces() const
virtual const labelUList & faceCells() const
Return faceCell addressing.
const lduInterfacePtrsList & coarseInterfaces_
All interfaces.
GAMGInterface(const GAMGInterface &)=delete
No copy construct.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
commsTypes
Communications types.
Definition UPstream.H:81
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual label neighbPatchID() const
Cyclic interface functions.
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.
TypeName("cyclicAMI")
Runtime type information.
virtual const AMIPatchToPatchInterpolation & AMI() const
virtual label myProcNo() const
-1 or old local rank
virtual const cyclicAMIGAMGInterface & neighbPatch() const
Return processor number.
virtual ~cyclicAMIGAMGInterface()=default
Destructor.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &iF) const
Transfer and return internal field adjacent to the interface.
virtual const tensorField & forwardT() const
Return face transformation tensor.
cyclicAMILduInterface() noexcept=default
Default construct.
An abstract base class for implicitly-coupled interfaces e.g. processor and cyclic patches.
A class for managing temporary objects.
Definition tmp.H:75
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
AMIInterpolation AMIPatchToPatchInterpolation
Patch-to-patch interpolation == Foam::AMIInterpolation.
Field< label > labelField
Specialisation of Field<T> for label.
Definition labelField.H:48
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
runTime write()
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68