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 class OBJstream;
48 
49 /*---------------------------------------------------------------------------*\
50  Class cyclicPeriodicAMIPolyPatch Declaration
51 \*---------------------------------------------------------------------------*/
52 
54 :
55  public cyclicAMIPolyPatch
56 {
57 private:
58 
59  // Private data
60 
61  //- Current number of transformations (+ve forward, -ve backward)
62  mutable label nTransforms_;
63 
64  //- Number of sectors in a rotationally periodic geometry (optional)
65  const label nSectors_;
66 
67  //- Maximum number of attempts to match the AMI geometry
68  const label maxIter_;
69 
70 
71  // Private Member Functions
72 
73  //- Synchronise the periodic transformations
74  void syncTransforms() const;
75 
76  //- Debug: write obj files of patch (collected on master)
77  void writeOBJ(const primitivePatch& p, OBJstream& str) const;
78 
79  //- Reset the AMI interpolator
80  virtual void resetAMI() const;
81 
82 
83 public:
84 
85  //- Runtime type information
86  TypeName("cyclicPeriodicAMI");
87 
88 
89  // Constructors
90 
91  //- Construct from (base coupled patch) components
93  (
94  const word& name,
95  const label size,
96  const label start,
97  const label index,
98  const polyBoundaryMesh& bm,
99  const word& patchType,
101  );
102 
103  //- Construct from dictionary
105  (
106  const word& name,
107  const dictionary& dict,
108  const label index,
109  const polyBoundaryMesh& bm,
110  const word& patchType
111  );
112 
113  //- Construct as copy, resetting the boundary mesh
115  (
117  const polyBoundaryMesh&
118  );
119 
120  //- Construct given the original patch and resetting the
121  // face list and boundary mesh information
123  (
124  const cyclicPeriodicAMIPolyPatch& pp,
125  const polyBoundaryMesh& bm,
126  const label index,
127  const label newSize,
128  const label newStart,
129  const word& nbrPatchName
130  );
131 
132  //- Construct given the original patch and a map
134  (
135  const cyclicPeriodicAMIPolyPatch& pp,
136  const polyBoundaryMesh& bm,
137  const label index,
138  const labelUList& mapAddressing,
139  const label newStart
140  );
141 
142 
143  //- Construct and return a clone, resetting the boundary mesh
144  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
145  {
146  return autoPtr<polyPatch>
147  (
148  new cyclicPeriodicAMIPolyPatch(*this, bm)
149  );
150  }
151 
152  //- Construct and return a clone, resetting the face list
153  // and boundary mesh
155  (
156  const polyBoundaryMesh& bm,
157  const label index,
158  const label newSize,
159  const label newStart
160  ) const
161  {
162  return autoPtr<polyPatch>
163  (
165  (
166  *this,
167  bm,
168  index,
169  newSize,
170  newStart,
172  )
173  );
174  }
175 
176  //- Construct and return a clone, resetting the face list
177  // and boundary mesh
179  (
180  const polyBoundaryMesh& bm,
181  const label index,
182  const labelUList& mapAddressing,
183  const label newStart
184  ) const
185  {
186  return autoPtr<polyPatch>
187  (
189  (
190  *this,
191  bm,
192  index,
193  mapAddressing,
194  newStart
195  )
196  );
197  }
198 
199 
200  //- Destructor
201  virtual ~cyclicPeriodicAMIPolyPatch();
202 
203 
204  // Member Functions
205 
206  //- Write the polyPatch data as a dictionary
207  virtual void write(Ostream&) const;
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::OBJstream
OFstream that keeps track of vertices.
Definition: OBJstream.H:58
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:63
Foam::cyclicAMIPolyPatch::nbrPatchName_
word nbrPatchName_
Name of other half.
Definition: cyclicAMIPolyPatch.H:92
Foam::cyclicPeriodicAMIPolyPatch::~cyclicPeriodicAMIPolyPatch
virtual ~cyclicPeriodicAMIPolyPatch()
Destructor.
Definition: cyclicPeriodicAMIPolyPatch.C:652
Foam::coupledPolyPatch::UNKNOWN
Definition: coupledPolyPatch.H:62
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::patchIdentifier::index
label index() const noexcept
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:147
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:361
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:263
cyclicAMIPolyPatch.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cyclicPeriodicAMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicPeriodicAMIPolyPatch.H:143
Foam::cyclicPeriodicAMIPolyPatch::cyclicPeriodicAMIPolyPatch
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.
Definition: cyclicPeriodicAMIPolyPatch.C:543
Foam::cyclicPeriodicAMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicPeriodicAMIPolyPatch.C:658
Foam::UList< label >
Foam::patchIdentifier::name
const word & name() const noexcept
The patch name.
Definition: patchIdentifier.H:135
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cyclicPeriodicAMIPolyPatch::TypeName
TypeName("cyclicPeriodicAMI")
Runtime type information.
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:60
Foam::cyclicPeriodicAMIPolyPatch
Cyclic patch for periodic Arbitrary Mesh Interface (AMI)
Definition: cyclicPeriodicAMIPolyPatch.H:52
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:68