processorFaPatch.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) 2016-2017 Wikki Ltd
9 Copyright (C) 2019-2022 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::processorFaPatch
29
30Description
31 Processor patch.
32
33Author
34 Zeljko Tukovic, FMENA
35 Hrvoje Jasak, Wikki Ltd.
36
37SourceFiles
38 processorFaPatch.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_processorFaPatch_H
43#define Foam_processorFaPatch_H
44
45#include "coupledFaPatch.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class processorFaPatch Declaration
55\*---------------------------------------------------------------------------*/
58:
59 public coupledFaPatch,
61{
62 // Private Data
63
64 //- My processor number
65 int myProcNo_;
66
67 //- Neighbour processor number
68 int neighbProcNo_;
69
70 //- Processor-neighbour patch edge centres
71 vectorField neighbEdgeCentres_;
72
73 //- Processor-neighbour patch edge lengths
74 vectorField neighbEdgeLengths_;
75
76 //- Processor-neighbour patch neighbour face centres
77 vectorField neighbEdgeFaceCentres_;
78
79 //- Corresponding neighbouring local point label for every local point
80 // (so localPoints()[i] == neighb.localPoints()[neighbPoints_[i]])
81 mutable autoPtr<labelList> neighbPointsPtr_;
82
83 //- The set of labels of the processor patch points which are
84 // non-global, i.e. present in this processor patch
85 mutable autoPtr<labelList> nonGlobalPatchPointsPtr_;
86
87
88protected:
89
90 // Protected Member functions
91
92 //- Construct from components with specified name
94 (
95 const word& name,
97 const label index,
98 const faBoundaryMesh& bm,
99 const label nbrPolyPatchi,
100 const label myProcNo,
101 const label neighbProcNo,
102 const word& patchType = typeName
103 );
104
105 //- Make patch weighting factors
106 void makeWeights(scalarField&) const;
107
108 //- Make patch face - neighbour cell distances
109 void makeDeltaCoeffs(scalarField&) const;
110
111 //- Find non-globa patch points
112 void makeNonGlobalPatchPoints() const;
113
114
115 // Geometry Functions
116
117 //- Initialise the calculation of the patch geometry
119
120 //- Calculate the patch geometry
122
123 //- Initialise the patches for moving points
125
126 //- Correct patches after moving points
127 void movePoints(PstreamBuffers&, const pointField&);
128
129 //- Initialise the update of the patch topology
130 virtual void initUpdateMesh(PstreamBuffers&);
131
132 //- Update of the patch topology
133 virtual void updateMesh(PstreamBuffers&);
134
135
136public:
137
138 //- Runtime type information
139 TypeName("processor");
140
141
142 // Constructors
143
144 //- Construct from components with automatically generated standard name
146 (
147 const labelUList& edgeLabels,
148 const label index,
149 const faBoundaryMesh& bm,
150 const label nbrPolyPatchi,
151 const label myProcNo,
152 const label neighbProcNo,
153 const word& patchType = typeName
154 );
155
156 //- Construct from dictionary
158 (
159 const word& name,
160 const dictionary& dict,
161 const label index,
162 const faBoundaryMesh& bm,
163 const word& patchType = typeName
164 );
165
166
167 //- Destructor
168 virtual ~processorFaPatch();
169
170
171 // Member Functions
172
173 //- Return interface size
174 virtual label interfaceSize() const noexcept
175 {
176 return size();
177 }
178
179 //- Return processor number
180 int myProcNo() const noexcept
181 {
182 return myProcNo_;
183 }
184
185 //- Return neighbour processor number
186 int neighbProcNo() const noexcept
187 {
188 return neighbProcNo_;
189 }
190
191 //- Return true if running parallel
192 virtual bool coupled() const
193 {
194 return Pstream::parRun();
195 }
196
197 //- Does this side own the patch ?
198 virtual bool owner() const noexcept
199 {
200 return (myProcNo_ < neighbProcNo_);
201 }
202
203
204 //- The message tag to use for communication
205 virtual int tag() const
206 {
207 return UPstream::msgType();
208 }
209
210 //- Return communicator used for communication
211 virtual label comm() const;
212
213
214 //- Return face transformation tensor
215 virtual const tensorField& forwardT() const
216 {
218 }
219
220 //- Return delta (P to N) vectors across coupled patch
221 virtual tmp<vectorField> delta() const;
222
223
224 //- Return processor-neighbour patch edge centres
225 const vectorField& neighbEdgeCentres() const
226 {
227 return neighbEdgeCentres_;
228 }
229
230 //- Return processor-neighbour patch edge lengths
231 const vectorField& neighbEdgeLengths() const
232 {
233 return neighbEdgeLengths_;
234 }
235
236 //- Return processor-neighbour patch neighbour face centres
238 {
239 return neighbEdgeFaceCentres_;
240 }
241
242 //- Return neighbour point labels. This is for my local point the
243 // corresponding local point on the other side. Call
244 // faBoundaryMesh::updateMesh() on all processors
245 // before using this.
246 const labelList& neighbPoints() const;
247
248 //- Return the set of labels of the processor patch points which are
249 // non-global, i.e. present in this processorFaPatch
250 const labelList& nonGlobalPatchPoints() const;
251
252
253 // Interface transfer functions
254
255 //- Return the values of the given internal data adjacent to
256 //- the interface as a field
258 (
259 const labelUList& internalData
260 ) const;
261
262 //- Return the values of the given internal data adjacent to
263 //- the interface as a field using edgeFaces
265 (
266 const labelUList& internalData,
267 const labelUList& edgeFaces
268 ) const;
269
270 //- Initialise interface data transfer
271 virtual void initTransfer
272 (
273 const Pstream::commsTypes commsType,
274 const labelUList& interfaceData
275 ) const;
276
277 //- Transfer and return neighbour field
279 (
280 const Pstream::commsTypes commsType,
281 const labelUList& interfaceData
282 ) const;
283
284 //- Initialise neighbour field transfer
285 virtual void initInternalFieldTransfer
286 (
287 const Pstream::commsTypes commsType,
288 const labelUList& internalData
289 ) const;
290
291 //- Return neighbour field
293 (
294 const Pstream::commsTypes commsType,
295 const labelUList& internalData
296 ) const;
297
298 //- Return neighbour field using mapping
300 (
301 const Pstream::commsTypes commsType,
302 const labelUList& internalData,
303 const labelUList& edgeCells
304 ) const;
305
306 //- Write the patch data as a dictionary
307 virtual void write(Ostream& os) const;
308};
309
310
311// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312
313} // End namespace Foam
314
315// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316
317#endif
318
319// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Buffers for inter-processor communications streams (UOPstream, UIPstream).
commsTypes
Types of communications.
Definition: UPstream.H:67
static int & msgType() noexcept
Message tag of standard messages.
Definition: UPstream.H:556
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
coupledFaPatch is an abstract base class for patches that couple regions of the computational domain ...
const tensorField & forwardT() const
Return face transformation tensor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Finite area boundary mesh.
virtual label size() const
Patch size is the number of edge labels.
Definition: faPatch.H:311
const labelList & edgeLabels() const noexcept
Return the list of edges.
Definition: faPatch.H:275
const labelUList & edgeFaces() const
Return edge-face addressing.
Definition: faPatch.C:429
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual void initTransfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Initialise interface data transfer.
virtual ~processorFaPatch()
Destructor.
virtual tmp< labelField > internalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Return neighbour field.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
const vectorField & neighbEdgeFaceCentres() const
Return processor-neighbour patch neighbour face centres.
virtual bool coupled() const
Return true if running parallel.
void makeWeights(scalarField &) const
Make patch weighting factors.
const vectorField & neighbEdgeLengths() const
Return processor-neighbour patch edge lengths.
virtual label interfaceSize() const noexcept
Return interface size.
virtual bool owner() const noexcept
Does this side own the patch ?
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const labelList & neighbPoints() const
Return neighbour point labels. This is for my local point the.
void makeNonGlobalPatchPoints() const
Find non-globa patch points.
void makeDeltaCoeffs(scalarField &) const
Make patch face - neighbour cell distances.
int neighbProcNo() const noexcept
Return neighbour processor number.
virtual tmp< labelField > transfer(const Pstream::commsTypes commsType, const labelUList &interfaceData) const
Transfer and return neighbour field.
void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual label comm() const
Return communicator used for communication.
virtual tmp< vectorField > delta() const
Return delta (P to N) vectors across coupled patch.
virtual void initInternalFieldTransfer(const Pstream::commsTypes commsType, const labelUList &internalData) const
Initialise neighbour field transfer.
int myProcNo() const noexcept
Return processor number.
virtual tmp< labelField > interfaceInternalField(const labelUList &internalData) const
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
const labelList & nonGlobalPatchPoints() const
Return the set of labels of the processor patch points which are.
virtual int tag() const
The message tag to use for communication.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
TypeName("processor")
Runtime type information.
const vectorField & neighbEdgeCentres() const
Return processor-neighbour patch edge centres.
virtual const tensorField & forwardT() const
Return face transformation tensor.
An abstract base class for processor coupled interfaces.
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73