processorCyclicPolyPatch.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-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::processorCyclicPolyPatch
28
29Description
30 Neighbour processor patch.
31
32 Note: morph patch face ordering is geometric.
33
34SourceFiles
35 processorCyclicPolyPatch.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef processorCyclicPolyPatch_H
40#define processorCyclicPolyPatch_H
41
42#include "processorPolyPatch.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49/*---------------------------------------------------------------------------*\
50 Class processorCyclicPolyPatch Declaration
51\*---------------------------------------------------------------------------*/
54:
56{
57 // Private data
58
59 //- Name of originating patch
60 const word referPatchName_;
61
62 //- Message tag to use for communication
63 mutable int tag_;
64
65 //- Index of originating patch
66 mutable label referPatchID_;
67
68
69protected:
70
71 // Protected Member functions
72
73 //- Initialise the calculation of the patch geometry
75
76 //- Calculate the patch geometry
78
79 //- Calculate the patch geometry with externally
80 // provided geometry
81 virtual void calcGeometry
82 (
84 const pointField& thisCtrs,
85 const vectorField& thisAreas,
86 const pointField& thisCc,
87 const pointField& nbrCtrs,
88 const vectorField& nbrAreas,
89 const pointField& nbrCc
90 )
91 {
93 }
94
95 //- Initialise the patches for moving points
97
98 //- Correct patches after moving points
100
101 //- Initialise the update of the patch topology
102 virtual void initUpdateMesh(PstreamBuffers&);
103
104 //- Update of the patch topology
105 virtual void updateMesh(PstreamBuffers&);
106
107
108public:
109
110 //- Runtime type information
111 TypeName("processorCyclic");
112
113
114 // Constructors
115
116 //- Construct from components
118 (
119 const label size,
120 const label start,
121 const label index,
122 const polyBoundaryMesh& bm,
123 const int myProcNo,
124 const int neighbProcNo,
125 const word& referPatchName,
127 const word& patchType = typeName
128 );
129
130 //- Construct from dictionary
132 (
133 const word& name,
134 const dictionary& dict,
135 const label index,
136 const polyBoundaryMesh&,
137 const word& patchType
138 );
139
140 //- Construct as copy, resetting the boundary mesh
142 (
144 const polyBoundaryMesh&
145 );
146
147 //- Construct as given the original patch and resetting the
148 // face list and boundary mesh information
150 (
151 const processorCyclicPolyPatch& pp,
152 const polyBoundaryMesh& bm,
153 const label index,
154 const label newSize,
155 const label newStart
156 );
157
158 //- Construct as given the original patch and resetting the
159 // face list, boundary mesh information and referPatch
161 (
162 const processorCyclicPolyPatch& pp,
163 const polyBoundaryMesh& bm,
164 const label index,
165 const label newSize,
166 const label newStart,
167 const word& referPatchName
168 );
169
170 //- Construct given the original patch and a map
172 (
173 const processorCyclicPolyPatch& pp,
174 const polyBoundaryMesh& bm,
175 const label index,
176 const labelUList& mapAddressing,
177 const label newStart
178 );
179
180
181 //- Construct and return a clone, resetting the boundary mesh
182 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
183 {
184 return autoPtr<polyPatch>(new processorCyclicPolyPatch(*this, bm));
185 }
186
187 //- Construct and return a clone, resetting the face list
188 // and boundary mesh
190 (
191 const polyBoundaryMesh& bm,
192 const label index,
193 const label newSize,
194 const label newStart
195 ) const
196 {
197 return autoPtr<polyPatch>
198 (
200 (
201 *this,
202 bm,
203 index,
204 newSize,
205 newStart
206 )
207 );
208 }
209
210 //- Construct and return a clone, resetting the face list
211 // and boundary mesh
213 (
214 const polyBoundaryMesh& bm,
215 const label index,
216 const label newSize,
217 const label newStart,
218 const word& referPatchName
219 ) const
220 {
221 return autoPtr<polyPatch>
222 (
224 (
225 *this,
226 bm,
227 index,
228 newSize,
229 newStart,
231 )
232 );
233 }
234
235 //- Construct and return a clone, resetting the face list
236 // and boundary mesh
238 (
239 const polyBoundaryMesh& bm,
240 const label index,
241 const labelUList& mapAddressing,
242 const label newStart
243 ) const
244 {
245 return autoPtr<polyPatch>
246 (
248 (
249 *this,
250 bm,
251 index,
252 mapAddressing,
253 newStart
254 )
255 );
256 }
257
258
259 // Destructor
261
262
263 // Member functions
264
265 //- Return name of originating cyclicPolyPatch patch
266 const word& referPatchName() const
267 {
268 return referPatchName_;
269 }
270
271 //- Return the name of a processorCyclicPolyPatch
272 // constructed from cyclicPolyPatch name and the processor IDs
273 static word newName
274 (
275 const word& cyclicPolyPatchName,
276 const label myProcNo,
277 const label neighbProcNo
278 );
279
280 //- Return the indices of a processorCyclicPolyPatchs
281 // constructed from the given cyclicPolyPatch
282 static labelList patchIDs
283 (
284 const word& cyclicPolyPatchName,
285 const polyBoundaryMesh& bm
286 );
287
288 //- Referring patchID.
289 label referPatchID() const
290 {
291 if (referPatchID_ == -1)
292 {
293 referPatchID_ = this->boundaryMesh().findPatchID
294 (
295 referPatchName_
296 );
297 if (referPatchID_ == -1)
298 {
300 << "Illegal referPatch name " << referPatchName_
301 << endl << "Valid patch names are "
302 << this->boundaryMesh().names()
303 << exit(FatalError);
304 }
305 }
306 return referPatchID_;
307 }
309 const coupledPolyPatch& referPatch() const
310 {
311 const polyPatch& pp = this->boundaryMesh()[referPatchID()];
312 return refCast<const coupledPolyPatch>(pp);
313 }
314
315 //- Return message tag to use for communication
316 virtual int tag() const;
317
318 //- Does this side own the patch ?
319 virtual bool owner() const
320 {
321 return referPatch().owner();
322 }
323
324 //- Type of transform
325 virtual transformType transform() const
326 {
327 return referPatch().transform();
328 }
329
330 //- Type of transform
331 // This is currently only for use when collapsing generated
332 // meshes that can have zero area faces.
333 virtual transformType& transform()
334 {
335 return const_cast<coupledPolyPatch&>(referPatch()).transform();
336 }
337
338 //- Transform a patch-based position from other side to this side
339 virtual void transformPosition(pointField& l) const
340 {
342 }
343
344 //- Transform a patch-based position from other side to this side
345 virtual void transformPosition(point& l, const label facei) const
346 {
347 referPatch().transformPosition(l, facei);
348 }
349
350 //- Are the planes separated.
351 virtual bool separated() const
352 {
353 return referPatch().separated();
354 }
355
356 //- If the planes are separated the separation vector.
357 virtual const vectorField& separation() const
358 {
359 return referPatch().separation();
360 }
361
362 //- Are the cyclic planes parallel.
363 virtual bool parallel() const
364 {
365 return referPatch().parallel();
366 }
367
368 //- Return face transformation tensor.
369 virtual const tensorField& forwardT() const
370 {
371 return referPatch().forwardT();
372 }
373
374 //- Return neighbour-cell transformation tensor.
375 virtual const tensorField& reverseT() const
376 {
377 return referPatch().reverseT();
378 }
379
380 //- Are faces collocated. Either size 0,1 or length of patch
381 virtual const boolList& collocated() const
382 {
383 return referPatch().collocated();
384 }
385
386
387 //- Initialize ordering for primitivePatch. Does not
388 // refer to *this (except for name() and type() etc.)
389 virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
390
391 //- Return new ordering for primitivePatch.
392 // Ordering is -faceMap: for every face
393 // index of the new face -rotation:for every new face the clockwise
394 // shift of the original face. Return false if nothing changes
395 // (faceMap is identity, rotation is 0), true otherwise.
396 virtual bool order
397 (
399 const primitivePatch&,
401 labelList& rotation
402 ) const;
403
404
405 //- Write the polyPatch data as a dictionary
406 virtual void write(Ostream&) const;
407};
408
409
410// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
411
412} // End namespace Foam
413
414// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
415
416#endif
417
418// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A list of faces which address into the list of points.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
Definition: boundaryMesh.H:63
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual transformType transform() const
Type of transform.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
virtual bool separated() const
Are the planes separated.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual bool owner() const =0
Does this side own the patch ?
virtual const boolList & collocated() const
Are faces collocated. Either size 0,1 or length of patch.
virtual const vectorField & separation() const
If the planes are separated the separation vector.
virtual void transformPosition(pointField &) const =0
Transform a patch-based position from other side to this side.
virtual 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
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:364
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
TypeName("processorCyclic")
Runtime type information.
virtual transformType transform() const
Type of transform.
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
static word newName(const word &cyclicPolyPatchName, const label myProcNo, const label neighbProcNo)
Return the name of a processorCyclicPolyPatch.
virtual bool owner() const
Does this side own the patch ?
static labelList patchIDs(const word &cyclicPolyPatchName, const polyBoundaryMesh &bm)
Return the indices of a processorCyclicPolyPatchs.
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const coupledPolyPatch & referPatch() const
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
virtual bool separated() const
Are the planes separated.
virtual bool parallel() const
Are the cyclic planes parallel.
virtual void transformPosition(point &l, const label facei) const
Transform a patch-based position from other side to this side.
label referPatchID() const
Referring patchID.
virtual int tag() const
Return message tag to use for communication.
virtual const boolList & collocated() const
Are faces collocated. Either size 0,1 or length of patch.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
virtual void transformPosition(pointField &l) const
Transform a patch-based position from other side to this side.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
virtual const vectorField & separation() const
If the planes are separated the separation vector.
const word & referPatchName() const
Return name of originating cyclicPolyPatch patch.
virtual const tensorField & forwardT() const
Return face transformation tensor.
Neighbour processor patch.
int myProcNo() const
Return processor number.
int neighbProcNo() const
Return neighbour processor number.
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Namespace for OpenFOAM.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
UList< label > labelUList
A UList of labels.
Definition: UList.H:85
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73