Loading...
Searching...
No Matches
cyclicPeriodicAMIPolyPatch.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) 2015-2021 OpenCFD Ltd.
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::cyclicPeriodicAMIPolyPatch
28
29Description
30 Cyclic patch for periodic Arbitrary Mesh Interface (AMI)
31
32 Uses automated matching to fill all of the faces on owner and neighbour.
33 Can be used for translational periodic matching as well. Uses the
34 transforms from a specified periodic patch to transform the geometry.
35
36SourceFiles
37 cyclicPeriodicAMIPolyPatch.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef cyclicPeriodicAMIPolyPatch_H
42#define cyclicPeriodicAMIPolyPatch_H
43
44#include "cyclicAMIPolyPatch.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52class OBJstream;
54/*---------------------------------------------------------------------------*\
55 Class cyclicPeriodicAMIPolyPatch Declaration
56\*---------------------------------------------------------------------------*/
57
59:
61{
62private:
63
64 // Private data
65
66 //- Current number of transformations (+ve forward, -ve backward).
67 //- Used internally to stores the last state that gave a starting
68 //- match. Speeds up the automatic matching.
69 mutable label nTransforms_;
70
71 //- Number of sectors in a rotationally periodic geometry (optional)
72 const label nSectors_;
73
74 //- Maximum number of attempts to match the AMI geometry
75 const label maxIter_;
76
77
78 // Private Member Functions
79
80 //- Synchronise the periodic transformations
81 void syncTransforms() const;
82
83 //- Debug: write obj files of patch (collected on master)
84 void writeOBJ(const primitivePatch& p, OBJstream& str) const;
85
86 //- Reset the AMI interpolator
87 virtual void resetAMI() const;
88
89
90public:
91
92 //- Runtime type information
93 TypeName("cyclicPeriodicAMI");
94
95
96 // Constructors
97
98 //- Construct from (base coupled patch) components
100 (
101 const word& name,
102 const label size,
103 const label start,
104 const label index,
105 const polyBoundaryMesh& bm,
106 const word& patchType,
108 );
109
110 //- Construct from dictionary
112 (
113 const word& name,
114 const dictionary& dict,
115 const label index,
116 const polyBoundaryMesh& bm,
117 const word& patchType
118 );
119
120 //- Construct as copy, resetting the boundary mesh
122 (
124 const polyBoundaryMesh&
125 );
126
127 //- Construct given the original patch and resetting the
128 // face list and boundary mesh information
130 (
132 const polyBoundaryMesh& bm,
133 const label index,
134 const label newSize,
135 const label newStart,
136 const word& nbrPatchName
137 );
138
139 //- Construct given the original patch and a map
141 (
143 const polyBoundaryMesh& bm,
144 const label index,
145 const labelUList& mapAddressing,
146 const label newStart
147 );
148
149
150 //- Construct and return a clone, resetting the boundary mesh
151 virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
152 {
153 return autoPtr<polyPatch>
154 (
155 new cyclicPeriodicAMIPolyPatch(*this, bm)
156 );
157 }
158
159 //- Construct and return a clone, resetting the face list
160 // and boundary mesh
162 (
163 const polyBoundaryMesh& bm,
164 const label index,
165 const label newSize,
166 const label newStart
167 ) const
168 {
169 return autoPtr<polyPatch>
170 (
172 (
173 *this,
174 bm,
175 index,
176 newSize,
177 newStart,
179 )
180 );
181 }
182
183 //- Construct and return a clone, resetting the face list
184 // and boundary mesh
187 const polyBoundaryMesh& bm,
188 const label index,
189 const labelUList& mapAddressing,
190 const label newStart
191 ) const
192 {
193 return autoPtr<polyPatch>
194 (
196 (
197 *this,
198 bm,
199 index,
200 mapAddressing,
201 newStart
202 )
203 );
204 }
205
206
207 //- Destructor
209
210
211 // Member Functions
212
213 //- Write the polyPatch data as a dictionary
214 virtual void write(Ostream&) const;
215};
216
217
218// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219
220} // End namespace Foam
221
222// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223
224
225// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226
227#endif
228
229// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files.
Definition OBJstream.H:58
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
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
word nbrPatchName_
Name of other half.
virtual void resetAMI() const
Reset the AMI interpolator, use current patch points.
cyclicAMIPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform=UNKNOWN, const word &defaultAMIMethod=faceAreaWeightAMI::typeName)
Construct from (base coupled patch) components.
Cyclic patch for periodic Arbitrary Mesh Interface (AMI).
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
cyclicPeriodicAMIPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType, const transformType transform=UNKNOWN)
Construct from (base coupled patch) components.
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.
TypeName("cyclicPeriodicAMI")
Runtime type information.
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.
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,...
label start() const noexcept
Return start label of this patch in the polyMesh face list.
Definition polyPatch.H:446
A class for handling words, derived from Foam::string.
Definition word.H:66
volScalarField & p
Namespace for OpenFOAM.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
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