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 -------------------------------------------------------------------------------
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::cyclicPeriodicAMIPolyPatch
28 
29 Description
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 
36 SourceFiles
37  cyclicPeriodicAMIPolyPatch.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef cyclicPeriodicAMIPolyPatch_H
42 #define cyclicPeriodicAMIPolyPatch_H
43 
44 #include "cyclicAMIPolyPatch.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class OBJstream;
53 
54 /*---------------------------------------------------------------------------*\
55  Class cyclicPeriodicAMIPolyPatch Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public cyclicAMIPolyPatch
61 {
62 private:
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 
90 public:
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
161  virtual autoPtr<polyPatch> clone
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
185  virtual autoPtr<polyPatch> clone
186  (
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
208  virtual ~cyclicPeriodicAMIPolyPatch();
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 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
label start() const noexcept
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:446
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.
A list of faces which address into the list of points.
A class for handling words, derived from Foam::string.
Definition: word.H:63
Cyclic patch for Arbitrary Mesh Interface (AMI)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
const word & name() const noexcept
The patch name.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
An OFstream that keeps track of vertices and provides convenience output methods for OBJ files...
Definition: OBJstream.H:55
TypeName("cyclicPeriodicAMI")
Runtime type information.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
virtual transformType transform() const
Type of transform.
Cyclic patch for periodic Arbitrary Mesh Interface (AMI)
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
label index() const noexcept
The index of this patch in the boundaryMesh.
volScalarField & p
word nbrPatchName_
Name of other half.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
Namespace for OpenFOAM.