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 SourceFiles
33  cyclicPeriodicAMIPolyPatch.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef cyclicPeriodicAMIPolyPatch_H
38 #define cyclicPeriodicAMIPolyPatch_H
39 
40 #include "cyclicAMIPolyPatch.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 class OBJstream;
49 
50 /*---------------------------------------------------------------------------*\
51  Class cyclicPeriodicAMIPolyPatch Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public cyclicAMIPolyPatch
57 {
58 private:
59 
60  // Private data
61 
62  //- Current number of transformations (+ve forward, -ve backward)
63  mutable label nTransforms_;
64 
65  //- Number of sectors in a rotationally periodic geometry (optional)
66  const label nSectors_;
67 
68  //- Maximum number of attempts to match the AMI geometry
69  const label maxIter_;
70 
71 
72  // Private Member Functions
73 
74  //- Synchronise the periodic transformations
75  void syncTransforms() const;
76 
77  //- Debug: write obj files of patch (collected on master)
78  void writeOBJ(const primitivePatch& p, OBJstream& str) const;
79 
80  //- Reset the AMI interpolator
81  virtual void resetAMI() const;
82 
83 
84 public:
85 
86  //- Runtime type information
87  TypeName("cyclicPeriodicAMI");
88 
89 
90  // Constructors
91 
92  //- Construct from (base coupled patch) components
94  (
95  const word& name,
96  const label size,
97  const label start,
98  const label index,
99  const polyBoundaryMesh& bm,
100  const word& patchType,
102  );
103 
104  //- Construct from dictionary
106  (
107  const word& name,
108  const dictionary& dict,
109  const label index,
110  const polyBoundaryMesh& bm,
111  const word& patchType
112  );
113 
114  //- Construct as copy, resetting the boundary mesh
116  (
118  const polyBoundaryMesh&
119  );
120 
121  //- Construct given the original patch and resetting the
122  // face list and boundary mesh information
124  (
126  const polyBoundaryMesh& bm,
127  const label index,
128  const label newSize,
129  const label newStart,
130  const word& nbrPatchName
131  );
132 
133  //- Construct given the original patch and a map
135  (
137  const polyBoundaryMesh& bm,
138  const label index,
139  const labelUList& mapAddressing,
140  const label newStart
141  );
142 
143 
144  //- Construct and return a clone, resetting the boundary mesh
145  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
146  {
147  return autoPtr<polyPatch>
148  (
149  new cyclicPeriodicAMIPolyPatch(*this, bm)
150  );
151  }
152 
153  //- Construct and return a clone, resetting the face list
154  // and boundary mesh
155  virtual autoPtr<polyPatch> clone
156  (
157  const polyBoundaryMesh& bm,
158  const label index,
159  const label newSize,
160  const label newStart
161  ) const
162  {
163  return autoPtr<polyPatch>
164  (
166  (
167  *this,
168  bm,
169  index,
170  newSize,
171  newStart,
173  )
174  );
175  }
176 
177  //- Construct and return a clone, resetting the face list
178  // and boundary mesh
179  virtual autoPtr<polyPatch> clone
180  (
181  const polyBoundaryMesh& bm,
182  const label index,
183  const labelUList& mapAddressing,
184  const label newStart
185  ) const
186  {
187  return autoPtr<polyPatch>
188  (
190  (
191  *this,
192  bm,
193  index,
194  mapAddressing,
195  newStart
196  )
197  );
198  }
199 
200 
201  //- Destructor
202  virtual ~cyclicPeriodicAMIPolyPatch();
203 
204 
205  // Member Functions
206 
207  //- Write the polyPatch data as a dictionary
208  virtual void write(Ostream&) const;
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
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:441
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.