oldCyclicPolyPatch.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-2015 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::oldCyclicPolyPatch
28
29Description
30 'old' style cyclic polyPatch with all faces in single patch. Does ordering
31 but cannot be used to run. Writes 'type cyclic' so foamUpgradeCyclics
32 can be run afterwards.
33 Used to get cyclics from mesh converters that assume cyclics in single
34 patch (e.g. fluent3DMeshToFoam)
35
36SourceFiles
37 oldCyclicPolyPatch.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef oldCyclicPolyPatch_H
42#define oldCyclicPolyPatch_H
43
44#include "coupledPolyPatch.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51/*---------------------------------------------------------------------------*\
52 Class oldCyclicPolyPatch Declaration
53\*---------------------------------------------------------------------------*/
56:
57 public coupledPolyPatch
58{
59 // Private data
60
61 //- Morph:angle between normals of neighbouring faces.
62 // Used to split cyclic into halves.
63 scalar featureCos_;
64
65
66 // For rotation
67
68 //- Axis of rotation for rotational cyclics
69 vector rotationAxis_;
70
71 //- Point on axis of rotation for rotational cyclics
72 point rotationCentre_;
73
74 // For translation
75
76 //- Translation vector
77 vector separationVector_;
78
79
80 // Private member functions
81
82 //- Find amongst selected faces the one with the largest area
83 static label findMaxArea(const pointField&, const faceList&);
84
85 void calcTransforms();
86
87 //- Calculate face centres
88 static pointField calcFaceCentres
89 (
90 const UList<face>&,
91 const pointField&
92 );
93
94 //- Get f[0] for all faces
95 static pointField getAnchorPoints
96 (
97 const UList<face>&,
98 const pointField&
99 );
100
101 // Face ordering
102
103 //- Find the two parts of the faces of pp using feature edges.
104 // Returns true if successful.
105 bool getGeometricHalves
106 (
107 const primitivePatch&,
108 labelList&,
109 labelList&
110 ) const;
111
112 //- Calculate geometric factors of the two halves.
113 void getCentresAndAnchors
114 (
115 const primitivePatch&,
116 const faceList& half0Faces,
117 const faceList& half1Faces,
118
119 pointField& ppPoints,
120 pointField& half0Ctrs,
121 pointField& half1Ctrs,
122 pointField& anchors0,
123 scalarField& tols
124 ) const;
125
126 //- Given matched faces matches the anchor point. Sets faceMap,
127 // rotation. Returns true if all matched.
128 bool matchAnchors
129 (
130 const bool report,
131 const primitivePatch&,
132 const labelList&,
133 const pointField&,
134 const labelList&,
135 const faceList&,
136 const labelList&,
137 const scalarField&,
138
140 labelList& rotation
141 ) const;
142
143 //- For rotational cases, try to find a unique face on each side
144 // of the cyclic.
145 label getConsistentRotationFace
146 (
148 ) const;
149
150
151protected:
152
153 // Protected Member functions
154
155 //- Initialise the calculation of the patch geometry
156 virtual void initGeometry(PstreamBuffers&);
157
158 //- Calculate the patch geometry
159 virtual void calcGeometry(PstreamBuffers&);
160
161 //- Initialise the patches for moving points
162 virtual void initMovePoints(PstreamBuffers&, const pointField&);
163
164 //- Correct patches after moving points
165 virtual void movePoints(PstreamBuffers&, const pointField&);
166
167 //- Initialise the update of the patch topology
168 virtual void initUpdateMesh(PstreamBuffers&);
169
170 //- Update of the patch topology
171 virtual void updateMesh(PstreamBuffers&);
172
173public:
174
175 //- Runtime type information
176 TypeName("oldCyclic");
177
178
179 // Constructors
180
181 //- Construct from components
183 (
184 const word& name,
185 const label size,
186 const label start,
187 const label index,
188 const polyBoundaryMesh& bm,
189 const word& patchType,
191 );
192
193 //- Construct from dictionary
195 (
196 const word& name,
197 const dictionary& dict,
198 const label index,
199 const polyBoundaryMesh& bm,
200 const word& patchType
201 );
202
203 //- Construct as copy, resetting the boundary mesh
205
206 //- Construct given the original patch and resetting the
207 // face list and boundary mesh information
209 (
210 const oldCyclicPolyPatch& pp,
211 const polyBoundaryMesh& bm,
212 const label index,
213 const label newSize,
214 const label newStart
215 );
216
217 //- Construct and return a clone, resetting the boundary mesh
218 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
219 {
220 return autoPtr<polyPatch>(new oldCyclicPolyPatch(*this, bm));
221 }
222
223 //- Construct and return a clone, resetting the face list
224 // and boundary mesh
226 (
227 const polyBoundaryMesh& bm,
228 const label index,
229 const label newSize,
230 const label newStart
231 ) const
232 {
233 return autoPtr<polyPatch>
234 (
235 new oldCyclicPolyPatch(*this, bm, index, newSize, newStart)
236 );
237 }
238
239
240 // Destructor
241
242 virtual ~oldCyclicPolyPatch();
243
244
245 // Member Functions
246
247 // Access
248
249 //- Does this side own the patch ?
250 virtual bool owner() const
251 {
253 return true;
254 }
255
256 //- Transform a patch-based position from other side to this side
257 virtual void transformPosition(pointField& l) const
258 {
260 }
261
262 //- Transform a patch-based position from other side to this side
263 virtual void transformPosition(point&, const label facei) const
264 {
266 }
267
268 //- Calculate the patch geometry
269 virtual void calcGeometry
270 (
271 const primitivePatch& referPatch,
272 const pointField& thisCtrs,
273 const vectorField& thisAreas,
274 const pointField& thisCc,
275 const pointField& nbrCtrs,
276 const vectorField& nbrAreas,
277 const pointField& nbrCc
278 );
279
280 //- Initialize ordering for primitivePatch. Does not
281 // refer to *this (except for name() and type() etc.)
282 virtual void initOrder
283 (
285 const primitivePatch&
286 ) const;
287
288 //- Return new ordering for primitivePatch.
289 // Ordering is -faceMap: for every face
290 // index of the new face -rotation:for every new face the clockwise
291 // shift of the original face. Return false if nothing changes
292 // (faceMap is identity, rotation is 0), true otherwise.
293 virtual bool order
294 (
296 const primitivePatch&,
298 labelList& rotation
299 ) const;
300
301 //- Write the polyPatch data as a dictionary
302 virtual void write(Ostream&) const;
303};
304
305
306// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
307
308} // End namespace Foam
309
310// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311
312#endif
313
314// ************************************************************************* //
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).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: UList.H:94
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
virtual transformType transform() const
Type of transform.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
'old' style cyclic polyPatch with all faces in single patch. Does ordering but cannot be used to run....
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 void initMovePoints(PstreamBuffers &, const pointField &)
Initialise the patches for moving points.
virtual bool owner() const
Does this side own the patch ?
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual 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 order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
virtual 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.
TypeName("oldCyclic")
Runtime type information.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void transformPosition(point &, const label facei) const
Transform a patch-based position from other side to this side.
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.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:364
const vectorField::subField faceCentres() const
Return face centres.
Definition: polyPatch.C:321
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
Namespace for OpenFOAM.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
runTime write()
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73