Loading...
Searching...
No Matches
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 Foam_processorCyclicPolyPatch_H
40#define Foam_processorCyclicPolyPatch_H
41
42#include "processorPolyPatch.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
49/*---------------------------------------------------------------------------*\
50 Class processorCyclicPolyPatch Declaration
51\*---------------------------------------------------------------------------*/
52
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 );
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 (
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 (
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 (
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
212 virtual autoPtr<polyPatch> clone
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() = default;
261
262
263 // Static Functions
264
265 //- Return the name of a processorCyclicPolyPatch constructed from
266 //- the cyclicPolyPatch name and the pair of processor IDs.
267 static word newName
268 (
269 const word& cyclicPolyPatchName,
270 const label myProcNo,
271 const label neighbProcNo
272 );
273
274 //- Return the indices of a processorCyclicPolyPatchs
275 // constructed from the given cyclicPolyPatch
276 static labelList patchIDs
277 (
278 const word& cyclicPolyPatchName,
279 const polyBoundaryMesh& bm
280 );
281
282
283 // Member Functions
284
285 //- Return name of originating cyclicPolyPatch patch
286 const word& referPatchName() const
287 {
288 return referPatchName_;
289 }
290
291 //- The referring patchID.
292 //- Searches for referPatchName() on the first call.
293 virtual label referPatchID() const;
294
295 //- The referred coupled patch
296 const coupledPolyPatch& referPatch() const
297 {
298 const polyPatch& pp = this->boundaryMesh()[referPatchID()];
300 }
301
302 //- Return message tag to use for communication
303 virtual int tag() const;
304
305 //- Does this side own the patch ?
306 virtual bool owner() const
307 {
308 return referPatch().owner();
309 }
310
311 //- Type of transform
312 virtual transformType transform() const
313 {
314 return referPatch().transform();
315 }
316
317 //- Type of transform
318 // This is currently only for use when collapsing generated
319 // meshes that can have zero area faces.
320 virtual transformType& transform()
321 {
322 return const_cast<coupledPolyPatch&>(referPatch()).transform();
323 }
324
325 //- Transform a patch-based position from other side to this side
326 virtual void transformPosition(pointField& l) const
327 {
329 }
330
331 //- Transform a patch-based position from other side to this side
332 virtual void transformPosition(point& l, const label facei) const
333 {
334 referPatch().transformPosition(l, facei);
335 }
337 //- Are the planes separated.
338 virtual bool separated() const
339 {
340 return referPatch().separated();
341 }
342
343 //- If the planes are separated the separation vector.
344 virtual const vectorField& separation() const
345 {
346 return referPatch().separation();
347 }
348
349 //- Are the cyclic planes parallel.
350 virtual bool parallel() const
351 {
352 return referPatch().parallel();
353 }
354
355 //- Return face transformation tensor.
356 virtual const tensorField& forwardT() const
357 {
358 return referPatch().forwardT();
359 }
360
361 //- Return neighbour-cell transformation tensor.
362 virtual const tensorField& reverseT() const
363 {
365 }
366
367 //- Are faces collocated. Either size 0,1 or length of patch
368 virtual const boolList& collocated() const
369 {
370 return referPatch().collocated();
371 }
373
374 //- Initialize ordering for primitivePatch. Does not
375 // refer to *this (except for name() and type() etc.)
376 virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
377
378 //- Return new ordering for primitivePatch.
379 // Ordering is -faceMap: for every face
380 // index of the new face -rotation:for every new face the clockwise
381 // shift of the original face. Return false if nothing changes
382 // (faceMap is identity, rotation is 0), true otherwise.
383 virtual bool order
384 (
386 const primitivePatch&,
388 labelList& rotation
389 ) const;
390
392 //- Write the polyPatch data as a dictionary
393 virtual void write(Ostream&) const;
394};
395
396
397// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
398
399} // End namespace Foam
400
401// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
402
403#endif
404
405// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
labelList patchIDs
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label size() const noexcept
Definition UList.H:706
void size(const label n)
Definition UList.H:118
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
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.
coupledPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform)
Construct from components.
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:133
label index() const noexcept
The index of this patch in the boundaryMesh.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
friend class polyBoundaryMesh
Definition polyPatch.H:112
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundaryMesh reference.
Definition polyPatch.C:295
label start() const noexcept
Return start label of this patch in the polyMesh face list.
Definition polyPatch.H:446
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.
virtual ~processorCyclicPolyPatch()=default
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 constructed from the cyclicPolyPatch name and the pair ...
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.
virtual bool owner() const
Does this side own the patch ?
virtual const tensorField & reverseT() const
Return neighbour-cell transformation tensor.
const coupledPolyPatch & referPatch() const
The referred coupled patch.
void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual label referPatchID() const
The referring patchID. Searches for referPatchName() on the first call.
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.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm, const label index, const label newSize, const label newStart) const
Construct and return a clone, resetting the face list.
virtual int tag() const
Return message tag to use for communication.
virtual void calcGeometry(const primitivePatch &referPatch, const pointField &thisCtrs, const vectorField &thisAreas, const pointField &thisCc, const pointField &nbrCtrs, const vectorField &nbrAreas, const pointField &nbrCc)
Calculate the patch geometry with externally.
virtual const boolList & collocated() const
Are faces collocated. Either size 0,1 or length of patch.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm, const label index, const labelUList &mapAddressing, const label newStart) const
Construct and return a clone, resetting the face list.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm, const label index, const label newSize, const label newStart, const word &referPatchName) const
Construct and return a clone, resetting the face list.
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 transformType & transform()
Type of transform.
virtual const tensorField & forwardT() const
Return face transformation tensor.
int neighbProcNo() const noexcept
Return neighbour processor number.
processorPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const int myProcNo, const int neighbProcNo, const transformType transform=UNKNOWN, const word &patchType=typeName)
Construct from components with specified name.
int myProcNo() const noexcept
Return processor number.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Namespace for OpenFOAM.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
Definition typeInfo.H:172
List< label > labelList
A List of labels.
Definition List.H:62
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
Definition point.H:37
List< bool > boolList
A List of bools.
Definition List.H:60
Field< tensor > tensorField
Specialisation of Field<T> for tensor.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
vectorField pointField
pointField is a vectorField.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68