cyclicACMIPolyPatch.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) 2013-2016 OpenFOAM Foundation
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::cyclicACMIPolyPatch
26 
27 Description
28  Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
29 
30 SourceFiles
31  cyclicACMIPolyPatch.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef cyclicACMIPolyPatch_H
36 #define cyclicACMIPolyPatch_H
37 
38 #include "cyclicAMIPolyPatch.H"
40 #include "polyBoundaryMesh.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class cyclicACMIPolyPatch Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public cyclicAMIPolyPatch
54 {
55 
56 private:
57 
58  // Private data
59 
60  //- Fraction of face area below which face is considered disconnected
61  static const scalar tolerance_;
62 
63  //- Name of non-overlapping patch
64  const word nonOverlapPatchName_;
65 
66  //- Index of non-overlapping patch
67  mutable label nonOverlapPatchID_;
68 
69  //- Mask/weighting for source patch
70  mutable scalarField srcMask_;
71 
72  //- Mask/weighting for target patch
73  mutable scalarField tgtMask_;
74 
75  //- Flag to indicate that AMI has been updated
76  mutable bool updated_;
77 
78 
79 protected:
80 
81  // Protected Member Functions
82 
83  //- Reset the AMI interpolator
84  virtual void resetAMI
85  (
88  ) const;
89 
90  //- Initialise the calculation of the patch geometry
91  virtual void initGeometry(PstreamBuffers&);
92 
93  //- Calculate the patch geometry
94  virtual void calcGeometry(PstreamBuffers&);
95 
96  //- Initialise the patches for moving points
97  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
98 
99  //- Correct patches after moving points
100  virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
101 
102  //- Initialise the update of the patch topology
103  virtual void initUpdateMesh(PstreamBuffers&);
104 
105  //- Update of the patch topology
106  virtual void updateMesh(PstreamBuffers&);
107 
108  //- Clear geometry
109  virtual void clearGeom();
110 
111  //- Return the mask/weighting for the source patch
112  virtual const scalarField& srcMask() const;
113 
114  //- Return the mask/weighting for the target patch
115  virtual const scalarField& tgtMask() const;
116 
117 
118 public:
119 
120  //- Runtime type information
121  TypeName("cyclicACMI");
122 
123 
124  // Constructors
125 
126  //- Construct from (base couped patch) components
128  (
129  const word& name,
130  const label size,
131  const label start,
132  const label index,
133  const polyBoundaryMesh& bm,
134  const word& patchType,
136  );
137 
138  //- Construct from dictionary
140  (
141  const word& name,
142  const dictionary& dict,
143  const label index,
144  const polyBoundaryMesh& bm,
145  const word& patchType
146  );
147 
148  //- Construct as copy, resetting the boundary mesh
150  (
151  const cyclicACMIPolyPatch&,
152  const polyBoundaryMesh&
153  );
154 
155  //- Construct given the original patch and resetting the
156  // face list and boundary mesh information
158  (
159  const cyclicACMIPolyPatch& pp,
160  const polyBoundaryMesh& bm,
161  const label index,
162  const label newSize,
163  const label newStart,
164  const word& nbrPatchName,
165  const word& nonOverlapPatchName
166  );
167 
168  //- Construct given the original patch and a map
170  (
171  const cyclicACMIPolyPatch& pp,
172  const polyBoundaryMesh& bm,
173  const label index,
174  const labelUList& mapAddressing,
175  const label newStart
176  );
177 
178 
179  //- Construct and return a clone, resetting the boundary mesh
180  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
181  {
182  return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
183  }
184 
185  //- Construct and return a clone, resetting the face list
186  // and boundary mesh
188  (
189  const polyBoundaryMesh& bm,
190  const label index,
191  const label newSize,
192  const label newStart
193  ) const
194  {
195  return autoPtr<polyPatch>
196  (
198  (
199  *this,
200  bm,
201  index,
202  newSize,
203  newStart,
204  neighbPatchName(),
205  nonOverlapPatchName_
206  )
207  );
208  }
209 
210  //- Construct and return a clone, resetting the face list
211  // and boundary mesh
213  (
214  const polyBoundaryMesh& bm,
215  const label index,
216  const labelUList& mapAddressing,
217  const label newStart
218  ) const
219  {
220  return autoPtr<polyPatch>
221  (
223  (
224  *this,
225  bm,
226  index,
227  mapAddressing,
228  newStart
229  )
230  );
231  }
232 
233 
234  //- Destructor
235  virtual ~cyclicACMIPolyPatch();
236 
237 
238  // Member Functions
239 
240  // Access
241 
242  //- Reset the updated flag
243  inline void setUpdated(bool flag) const;
244 
245  //- Return access to the updated flag
246  inline bool updated() const;
247 
248  //- Return a reference to the neighbour patch
249  virtual const cyclicACMIPolyPatch& neighbPatch() const;
250 
251  //- Non-overlapping patch name
252  inline const word& nonOverlapPatchName() const;
253 
254  //- Non-overlapping patch ID
255  virtual label nonOverlapPatchID() const;
256 
257  //- Return a const reference to the non-overlapping patch
258  inline const polyPatch& nonOverlapPatch() const;
259 
260  //- Return a reference to the non-overlapping patch
261  inline polyPatch& nonOverlapPatch();
262 
263  //- Mask field where 1 = overlap, 0 = no-overlap
264  inline const scalarField& mask() const;
265 
266  //- Overlap tolerance
267  inline static scalar tolerance();
268 
269 
270  //- Calculate the patch geometry
271  virtual void calcGeometry
272  (
273  const primitivePatch& referPatch,
274  const pointField& thisCtrs,
275  const vectorField& thisAreas,
276  const pointField& thisCc,
277  const pointField& nbrCtrs,
278  const vectorField& nbrAreas,
279  const pointField& nbrCc
280  );
281 
282  //- Initialize ordering for primitivePatch. Does not
283  // refer to *this (except for name() and type() etc.)
284  virtual void initOrder
285  (
287  const primitivePatch&
288  ) const;
289 
290  //- Return new ordering for primitivePatch.
291  // Ordering is -faceMap: for every face
292  // index of the new face -rotation:for every new face the clockwise
293  // shift of the original face. Return false if nothing changes
294  // (faceMap is identity, rotation is 0), true otherwise.
295  virtual bool order
296  (
298  const primitivePatch&,
300  labelList& rotation
301  ) const;
302 
303  //- Write the polyPatch data as a dictionary
304  virtual void write(Ostream&) const;
305 };
306 
307 
308 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
309 
310 } // End namespace Foam
311 
312 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
313 
314 #include "cyclicACMIPolyPatchI.H"
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 #endif
319 
320 // ************************************************************************* //
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
void setUpdated(bool flag) const
Reset the updated flag.
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
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
virtual void resetAMI(const AMIPatchToPatchInterpolation::interpolationMethod &AMIMethod=AMIPatchToPatchInterpolation::imFaceAreaWeight) const
Reset the AMI interpolator.
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
interpolationMethod
Enumeration specifying interpolation method.
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
A list of faces which address into the list of points.
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
const word & neighbPatchName() const
Neighbour patch name.
virtual const scalarField & srcMask() const
Return the mask/weighting for the source patch.
A class for handling words, derived from string.
Definition: word.H:59
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
cyclicACMIPolyPatch(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.
Cyclic patch for Arbitrary Mesh Interface (AMI)
bool updated() const
Return access to the updated flag.
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:61
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:55
Foam::polyBoundaryMesh.
virtual void clearGeom()
Clear geometry.
const word & nonOverlapPatchName() const
Non-overlapping patch name.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
TypeName("cyclicACMI")
Runtime type information.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
virtual ~cyclicACMIPolyPatch()
Destructor.
virtual transformType transform() const
Type of transform.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Namespace for OpenFOAM.
static scalar tolerance()
Overlap tolerance.