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 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  //- Periodic patch name
62  mutable word periodicPatchName_;
63 
64  //- Periodic patch ID
65  mutable label periodicPatchID_;
66 
67  //- Current number of transformations (+ve forward, -ve backward)
68  mutable label nTransforms_;
69 
70  //- Number of sectors in a rotationally periodic geometry (optional)
71  const label nSectors_;
72 
73  //- Maximum number of attempts to match the AMI geometry
74  const label maxIter_;
75 
76 
77  // Private Member Functions
78 
79  //- Synchronise the periodic transformations
80  void syncTransforms() const;
81 
82  //- Debug: write obj files of patch (collected on master)
83  void writeOBJ(const primitivePatch& p, OBJstream& str) const;
84 
85  //- Reset the AMI interpolator
86  virtual void resetAMI() const;
87 
88 
89 public:
90 
91  //- Runtime type information
92  TypeName("cyclicPeriodicAMI");
93 
94 
95  // Constructors
96 
97  //- Construct from (base coupled patch) components
99  (
100  const word& name,
101  const label size,
102  const label start,
103  const label index,
104  const polyBoundaryMesh& bm,
105  const word& patchType,
107  );
108 
109  //- Construct from dictionary
111  (
112  const word& name,
113  const dictionary& dict,
114  const label index,
115  const polyBoundaryMesh& bm,
116  const word& patchType
117  );
118 
119  //- Construct as copy, resetting the boundary mesh
121  (
123  const polyBoundaryMesh&
124  );
125 
126  //- Construct given the original patch and resetting the
127  // face list and boundary mesh information
129  (
130  const cyclicPeriodicAMIPolyPatch& pp,
131  const polyBoundaryMesh& bm,
132  const label index,
133  const label newSize,
134  const label newStart,
135  const word& nbrPatchName
136  );
137 
138  //- Construct given the original patch and a map
140  (
141  const cyclicPeriodicAMIPolyPatch& pp,
142  const polyBoundaryMesh& bm,
143  const label index,
144  const labelUList& mapAddressing,
145  const label newStart
146  );
147 
148 
149  //- Construct and return a clone, resetting the boundary mesh
150  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
151  {
152  return autoPtr<polyPatch>
153  (
154  new cyclicPeriodicAMIPolyPatch(*this, bm)
155  );
156  }
157 
158  //- Construct and return a clone, resetting the face list
159  // and boundary mesh
161  (
162  const polyBoundaryMesh& bm,
163  const label index,
164  const label newSize,
165  const label newStart
166  ) const
167  {
168  return autoPtr<polyPatch>
169  (
171  (
172  *this,
173  bm,
174  index,
175  newSize,
176  newStart,
178  )
179  );
180  }
181 
182  //- Construct and return a clone, resetting the face list
183  // and boundary mesh
185  (
186  const polyBoundaryMesh& bm,
187  const label index,
188  const labelUList& mapAddressing,
189  const label newStart
190  ) const
191  {
192  return autoPtr<polyPatch>
193  (
195  (
196  *this,
197  bm,
198  index,
199  mapAddressing,
200  newStart
201  )
202  );
203  }
204 
205 
206  //- Destructor
207  virtual ~cyclicPeriodicAMIPolyPatch();
208 
209 
210  // Member Functions
211 
212  //- Periodic patch ID
213  virtual label periodicPatchID() const;
214 
215  //- Write the polyPatch data as a dictionary
216  virtual void write(Ostream&) const;
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
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:62
Foam::cyclicAMIPolyPatch::nbrPatchName_
word nbrPatchName_
Name of other half.
Definition: cyclicAMIPolyPatch.H:91
Foam::cyclicPeriodicAMIPolyPatch::~cyclicPeriodicAMIPolyPatch
virtual ~cyclicPeriodicAMIPolyPatch()
Destructor.
Definition: cyclicPeriodicAMIPolyPatch.C:653
Foam::coupledPolyPatch::UNKNOWN
Definition: coupledPolyPatch.H:61
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:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cyclicPeriodicAMIPolyPatch::periodicPatchID
virtual label periodicPatchID() const
Periodic patch ID.
Definition: cyclicPeriodicAMIPolyPatch.C:659
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:313
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:258
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:149
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:544
Foam::cyclicPeriodicAMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicPeriodicAMIPolyPatch.C:692
Foam::UList< label >
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:59
Foam::cyclicPeriodicAMIPolyPatch
Cyclic patch for periodic Arbitrary Mesh Interface (AMI)
Definition: cyclicPeriodicAMIPolyPatch.H:52
Foam::patchIdentifier::name
const word & name() const
The patch name.
Definition: patchIdentifier.H:134
Foam::patchIdentifier::index
label index() const
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:158
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:67