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