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 | Copyright (C) 2015 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::cyclicPeriodicAMIPolyPatch
26 
27 Description
28  Cyclic patch for periodic Arbitrary Mesh Interface (AMI)
29 
30 SourceFiles
31  cyclicPeriodicAMIPolyPatch.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cyclicPeriodicAMIPolyPatch_H
36 #define cyclicPeriodicAMIPolyPatch_H
37 
38 #include "cyclicAMIPolyPatch.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 class OBJstream;
46 
47 /*---------------------------------------------------------------------------*\
48  Class cyclicPeriodicAMIPolyPatch Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public cyclicAMIPolyPatch
54 {
55 private:
56 
57  // Private data
58 
59  //- Periodic patch name
60  mutable word periodicPatchName_;
61 
62  //- Periodic patch ID
63  mutable label periodicPatchID_;
64 
65  //- Current number of transformations (+ve forward, -ve backward)
66  mutable label nTransforms_;
67 
68  //- Number of sectors in a rotationally periodic geometry (optional)
69  const label nSectors_;
70 
71  //- Maximum number of attempts to match the AMI geometry
72  const label maxIter_;
73 
74 
75  // Private Member Functions
76 
77  //- Synchronise the periodic transformations
78  void syncTransforms() const;
79 
80  //- Debug: write obj files of patch (collected on master)
81  void writeOBJ(const primitivePatch& p, OBJstream& str) const;
82 
83  //- Reset the AMI interpolator
84  virtual void resetAMI
85  (
88  ) const;
89 
90 
91 public:
92 
93  //- Runtime type information
94  TypeName("cyclicPeriodicAMI");
95 
96 
97  // Constructors
98 
99  //- Construct from (base couped patch) components
101  (
102  const word& name,
103  const label size,
104  const label start,
105  const label index,
106  const polyBoundaryMesh& bm,
107  const word& patchType,
109  );
110 
111  //- Construct from dictionary
113  (
114  const word& name,
115  const dictionary& dict,
116  const label index,
117  const polyBoundaryMesh& bm,
118  const word& patchType
119  );
120 
121  //- Construct as copy, resetting the boundary mesh
123  (
125  const polyBoundaryMesh&
126  );
127 
128  //- Construct given the original patch and resetting the
129  // face list and boundary mesh information
131  (
132  const cyclicPeriodicAMIPolyPatch& pp,
133  const polyBoundaryMesh& bm,
134  const label index,
135  const label newSize,
136  const label newStart,
137  const word& nbrPatchName
138  );
139 
140  //- Construct given the original patch and a map
142  (
143  const cyclicPeriodicAMIPolyPatch& pp,
144  const polyBoundaryMesh& bm,
145  const label index,
146  const labelUList& mapAddressing,
147  const label newStart
148  );
149 
150 
151  //- Construct and return a clone, resetting the boundary mesh
152  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
153  {
154  return autoPtr<polyPatch>
155  (
156  new cyclicPeriodicAMIPolyPatch(*this, bm)
157  );
158  }
159 
160  //- Construct and return a clone, resetting the face list
161  // and boundary mesh
163  (
164  const polyBoundaryMesh& bm,
165  const label index,
166  const label newSize,
167  const label newStart
168  ) const
169  {
170  return autoPtr<polyPatch>
171  (
173  (
174  *this,
175  bm,
176  index,
177  newSize,
178  newStart,
180  )
181  );
182  }
183 
184  //- Construct and return a clone, resetting the face list
185  // and boundary mesh
187  (
188  const polyBoundaryMesh& bm,
189  const label index,
190  const labelUList& mapAddressing,
191  const label newStart
192  ) const
193  {
194  return autoPtr<polyPatch>
195  (
197  (
198  *this,
199  bm,
200  index,
201  mapAddressing,
202  newStart
203  )
204  );
205  }
206 
207 
208  //- Destructor
209  virtual ~cyclicPeriodicAMIPolyPatch();
210 
211 
212  // Member Functions
213 
214  //- Periodic patch ID
215  virtual label periodicPatchID() const;
216 
217  //- Write the polyPatch data as a dictionary
218  virtual void write(Ostream&) const;
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #endif
232 
233 // ************************************************************************* //
Foam::AMIInterpolation::interpolationMethod
interpolationMethod
Enumeration specifying interpolation method.
Definition: AMIInterpolation.H:86
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::OBJstream
OFstream which keeps track of vertices.
Definition: OBJstream.H:53
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::cyclicAMIPolyPatch::nbrPatchName_
word nbrPatchName_
Name of other half.
Definition: cyclicAMIPolyPatch.H:78
Foam::AMIInterpolation::imFaceAreaWeight
@ imFaceAreaWeight
Definition: AMIInterpolation.H:90
Foam::cyclicPeriodicAMIPolyPatch::syncTransforms
void syncTransforms() const
Synchronise the periodic transformations.
Definition: cyclicPeriodicAMIPolyPatch.C:54
Foam::cyclicPeriodicAMIPolyPatch::maxIter_
const label maxIter_
Maximum number of attempts to match the AMI geometry.
Definition: cyclicPeriodicAMIPolyPatch.H:71
Foam::cyclicPeriodicAMIPolyPatch::~cyclicPeriodicAMIPolyPatch
virtual ~cyclicPeriodicAMIPolyPatch()
Destructor.
Definition: cyclicPeriodicAMIPolyPatch.C:666
Foam::cyclicPeriodicAMIPolyPatch::periodicPatchName_
word periodicPatchName_
Periodic patch name.
Definition: cyclicPeriodicAMIPolyPatch.H:59
Foam::AMIMethod
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:55
Foam::cyclicPeriodicAMIPolyPatch::writeOBJ
void writeOBJ(const primitivePatch &p, OBJstream &str) const
Debug: write obj files of patch (collected on master)
Definition: cyclicPeriodicAMIPolyPatch.C:201
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::cyclicPeriodicAMIPolyPatch::periodicPatchID_
label periodicPatchID_
Periodic patch ID.
Definition: cyclicPeriodicAMIPolyPatch.H:62
Foam::coupledPolyPatch::UNKNOWN
@ UNKNOWN
Definition: coupledPolyPatch.H:59
Foam::cyclicPeriodicAMIPolyPatch::resetAMI
virtual void resetAMI(const AMIPatchToPatchInterpolation::interpolationMethod &AMIMethod=AMIPatchToPatchInterpolation::imFaceAreaWeight) const
Reset the AMI interpolator.
Definition: cyclicPeriodicAMIPolyPatch.C:228
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::cyclicPeriodicAMIPolyPatch::nSectors_
const label nSectors_
Number of sectors in a rotationally periodic geometry (optional)
Definition: cyclicPeriodicAMIPolyPatch.H:68
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::cyclicPeriodicAMIPolyPatch::periodicPatchID
virtual label periodicPatchID() const
Periodic patch ID.
Definition: cyclicPeriodicAMIPolyPatch.C:672
Foam::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:312
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:256
cyclicAMIPolyPatch.H
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::cyclicPeriodicAMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicPeriodicAMIPolyPatch.H:151
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 couped patch) components.
Definition: cyclicPeriodicAMIPolyPatch.C:575
Foam::cyclicPeriodicAMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicPeriodicAMIPolyPatch.C:705
Foam::cyclicPeriodicAMIPolyPatch::nTransforms_
label nTransforms_
Current number of transformations (+ve forward, -ve backward)
Definition: cyclicPeriodicAMIPolyPatch.H:65
Foam::UList
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Definition: HashTable.H:60
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::cyclicPeriodicAMIPolyPatch::TypeName
TypeName("cyclicPeriodicAMI")
Runtime type information.
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:57
Foam::cyclicPeriodicAMIPolyPatch
Cyclic patch for periodic Arbitrary Mesh Interface (AMI)
Definition: cyclicPeriodicAMIPolyPatch.H:50
Foam::patchIdentifier::name
const word & name() const
Return name.
Definition: patchIdentifier.H:109
Foam::patchIdentifier::index
label index() const
Return the index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:133
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:51