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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::processorCyclicPolyPatch
28 
29 Description
30  Neighbour processor patch.
31 
32  Note: morph patch face ordering is geometric.
33 
34 SourceFiles
35  processorCyclicPolyPatch.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef processorCyclicPolyPatch_H
40 #define processorCyclicPolyPatch_H
41 
42 #include "processorPolyPatch.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class processorCyclicPolyPatch Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public processorPolyPatch
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 
69 protected:
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
99  void movePoints(PstreamBuffers&, const pointField&);
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 
108 public:
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
260  virtual ~processorCyclicPolyPatch();
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  }
308 
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 // ************************************************************************* //
Foam::processorCyclicPolyPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: processorCyclicPolyPatch.H:374
Foam::processorCyclicPolyPatch::tag
virtual int tag() const
Return message tag to use for communication.
Definition: processorCyclicPolyPatch.C:193
Foam::coupledPolyPatch::separation
virtual const vectorField & separation() const
If the planes are separated the separation vector.
Definition: coupledPolyPatch.H:289
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.C:94
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:63
Foam::processorCyclicPolyPatch
Neighbour processor patch.
Definition: processorCyclicPolyPatch.H:52
Foam::processorCyclicPolyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: processorCyclicPolyPatch.C:307
Foam::coupledPolyPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: coupledPolyPatch.H:301
Foam::processorCyclicPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: processorCyclicPolyPatch.C:321
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:88
Foam::coupledPolyPatch::reverseT
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
Definition: coupledPolyPatch.H:307
Foam::processorCyclicPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: processorCyclicPolyPatch.C:336
Foam::processorPolyPatch::neighbProcNo
int neighbProcNo() const
Return neighbour processor number.
Definition: processorPolyPatch.H:274
Foam::processorCyclicPolyPatch::collocated
virtual const boolList & collocated() const
Are faces collocated. Either size 0,1 or length of patch.
Definition: processorCyclicPolyPatch.H:380
Foam::processorCyclicPolyPatch::separation
virtual const vectorField & separation() const
If the planes are separated the separation vector.
Definition: processorCyclicPolyPatch.H:356
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::coupledPolyPatch
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
Definition: coupledPolyPatch.H:54
Foam::processorCyclicPolyPatch::transformPosition
virtual void transformPosition(point &l, const label facei) const
Transform a patch-based position from other side to this side.
Definition: processorCyclicPolyPatch.H:344
Foam::coupledPolyPatch::owner
virtual bool owner() const =0
Does this side own the patch ?
Foam::polyBoundaryMesh::names
wordList names() const
Return a list of patch names.
Definition: polyBoundaryMesh.C:555
Foam::processorCyclicPolyPatch::initMovePoints
void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
Definition: processorCyclicPolyPatch.C:287
Foam::coupledPolyPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: coupledPolyPatch.H:295
Foam::processorCyclicPolyPatch::movePoints
void movePoints(PstreamBuffers &, const pointField &)
Correct patches after moving points.
Definition: processorCyclicPolyPatch.C:298
Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
processorCyclicPolyPatch(const label size, const label start, const label index, const polyBoundaryMesh &bm, const int myProcNo, const int neighbProcNo, const word &referPatchName, const transformType transform=UNKNOWN, const word &patchType=typeName)
Construct from components.
Definition: processorCyclicPolyPatch.C:46
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::coupledPolyPatch::separated
virtual bool separated() const
Are the planes separated.
Definition: coupledPolyPatch.H:283
Foam::Field< vector >
Foam::polyPatch::boundaryMesh
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
Definition: polyPatch.C:315
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::processorCyclicPolyPatch::referPatchID
label referPatchID() const
Referring patchID.
Definition: processorCyclicPolyPatch.H:288
Foam::coupledPolyPatch::UNKNOWN
Definition: coupledPolyPatch.H:62
Foam::processorPolyPatch
Neighbour processor patch.
Definition: processorPolyPatch.H:58
Foam::polyBoundaryMesh::findPatchID
label findPatchID(const word &patchName, const bool allowNotFound=true) const
Find patch index given a name, return -1 if not found.
Definition: polyBoundaryMesh.C:765
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::processorCyclicPolyPatch::referPatch
const coupledPolyPatch & referPatch() const
Definition: processorCyclicPolyPatch.H:308
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
processorPolyPatch.H
Foam::processorCyclicPolyPatch::owner
virtual bool owner() const
Does this side own the patch ?
Definition: processorCyclicPolyPatch.H:318
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchIdentifier::index
label index() const noexcept
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:147
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:361
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:263
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::processorCyclicPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: processorCyclicPolyPatch.C:366
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::processorCyclicPolyPatch::patchIDs
static labelList patchIDs(const word &cyclicPolyPatchName, const polyBoundaryMesh &bm)
Return the indices of a processorCyclicPolyPatchs.
Definition: processorCyclicPolyPatch.C:177
Foam::processorCyclicPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: processorCyclicPolyPatch.H:324
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::processorCyclicPolyPatch::separated
virtual bool separated() const
Are the planes separated.
Definition: processorCyclicPolyPatch.H:350
Foam::processorCyclicPolyPatch::referPatchName
const word & referPatchName() const
Return name of originating cyclicPolyPatch patch.
Definition: processorCyclicPolyPatch.H:265
Foam::coupledPolyPatch::transformPosition
virtual void transformPosition(pointField &) const =0
Transform a patch-based position from other side to this side.
Foam::Vector< scalar >
Foam::processorCyclicPolyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: processorCyclicPolyPatch.C:313
Foam::List< label >
Foam::UList< label >
Foam::processorCyclicPolyPatch::calcGeometry
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: processorCyclicPolyPatch.C:240
Foam::processorCyclicPolyPatch::transformPosition
virtual void transformPosition(pointField &l) const
Transform a patch-based position from other side to this side.
Definition: processorCyclicPolyPatch.H:338
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch
virtual ~processorCyclicPolyPatch()
Definition: processorCyclicPolyPatch.C:156
Foam::processorCyclicPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: processorCyclicPolyPatch.H:181
Foam::processorCyclicPolyPatch::forwardT
virtual const tensorField & forwardT() const
Return face transformation tensor.
Definition: processorCyclicPolyPatch.H:368
Foam::processorCyclicPolyPatch::parallel
virtual bool parallel() const
Are the cyclic planes parallel.
Definition: processorCyclicPolyPatch.H:362
Foam::patchIdentifier::name
const word & name() const noexcept
The patch name.
Definition: patchIdentifier.H:135
Foam::processorPolyPatch::myProcNo
int myProcNo() const
Return processor number.
Definition: processorPolyPatch.H:268
Foam::coupledPolyPatch::collocated
virtual const boolList & collocated() const
Are faces collocated. Either size 0,1 or length of patch.
Definition: coupledPolyPatch.H:313
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:60
Foam::processorCyclicPolyPatch::newName
static word newName(const word &cyclicPolyPatchName, const label myProcNo, const label neighbProcNo)
Return the name of a processorCyclicPolyPatch.
Definition: processorCyclicPolyPatch.C:163
Foam::processorCyclicPolyPatch::initGeometry
void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: processorCyclicPolyPatch.C:233
Foam::processorCyclicPolyPatch::TypeName
TypeName("processorCyclic")
Runtime type information.
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79