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 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  //- Copy of the original patch face areas
61  mutable vectorField faceAreas0_;
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  static const scalar tolerance_;
82 
83 
84  // Protected Member Functions
85 
86  //- Initialise patch face areas
87  virtual void initPatchFaceAreas() const;
88 
89  //- Reset the AMI interpolator
90  virtual void resetAMI
91  (
94  ) const;
95 
96  //- Set neighbour ACMI patch areas
97  virtual void setNeighbourFaceAreas() const;
98 
99  //- Initialise the calculation of the patch geometry
100  virtual void initGeometry(PstreamBuffers&);
101 
102  //- Calculate the patch geometry
103  virtual void calcGeometry(PstreamBuffers&);
104 
105  //- Initialise the patches for moving points
106  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
107 
108  //- Correct patches after moving points
109  virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
110 
111  //- Initialise the update of the patch topology
112  virtual void initUpdateMesh(PstreamBuffers&);
113 
114  //- Update of the patch topology
115  virtual void updateMesh(PstreamBuffers&);
116 
117  //- Clear geometry
118  virtual void clearGeom();
119 
120  //- Return the mask/weighting for the source patch
121  virtual const scalarField& srcMask() const;
122 
123  //- Return the mask/weighting for the target patch
124  virtual const scalarField& tgtMask() const;
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("cyclicACMI");
131 
132 
133  // Constructors
134 
135  //- Construct from (base couped patch) components
137  (
138  const word& name,
139  const label size,
140  const label start,
141  const label index,
142  const polyBoundaryMesh& bm,
143  const word& patchType,
145  );
146 
147  //- Construct from dictionary
149  (
150  const word& name,
151  const dictionary& dict,
152  const label index,
153  const polyBoundaryMesh& bm,
154  const word& patchType
155  );
156 
157  //- Construct as copy, resetting the boundary mesh
159  (
160  const cyclicACMIPolyPatch&,
161  const polyBoundaryMesh&
162  );
163 
164  //- Construct given the original patch and resetting the
165  // face list and boundary mesh information
167  (
168  const cyclicACMIPolyPatch& pp,
169  const polyBoundaryMesh& bm,
170  const label index,
171  const label newSize,
172  const label newStart,
173  const word& nbrPatchName,
175  );
176 
177  //- Construct given the original patch and a map
179  (
180  const cyclicACMIPolyPatch& pp,
181  const polyBoundaryMesh& bm,
182  const label index,
183  const labelUList& mapAddressing,
184  const label newStart
185  );
186 
187 
188  //- Construct and return a clone, resetting the boundary mesh
189  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
190  {
191  return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
192  }
193 
194  //- Construct and return a clone, resetting the face list
195  // and boundary mesh
197  (
198  const polyBoundaryMesh& bm,
199  const label index,
200  const label newSize,
201  const label newStart
202  ) const
203  {
204  return autoPtr<polyPatch>
205  (
207  (
208  *this,
209  bm,
210  index,
211  newSize,
212  newStart,
213  neighbPatchName(),
214  nonOverlapPatchName_
215  )
216  );
217  }
218 
219  //- Construct and return a clone, resetting the face list
220  // and boundary mesh
222  (
223  const polyBoundaryMesh& bm,
224  const label index,
225  const labelUList& mapAddressing,
226  const label newStart
227  ) const
228  {
229  return autoPtr<polyPatch>
230  (
232  (
233  *this,
234  bm,
235  index,
236  mapAddressing,
237  newStart
238  )
239  );
240  }
241 
242 
243  //- Destructor
244  virtual ~cyclicACMIPolyPatch();
245 
246 
247  // Member Functions
248 
249  // Access
250 
251  //- Reset the updated flag
252  inline void setUpdated(bool flag) const;
253 
254  //- Return access to the updated flag
255  inline bool updated() const;
256 
257  //- Return access to the original patch face areas
258  inline const vectorField& faceAreas0() const;
259 
260  //- Return a reference to the neighbour patch
261  virtual const cyclicACMIPolyPatch& neighbPatch() const;
262 
263  //- Non-overlapping patch name
264  inline const word& nonOverlapPatchName() const;
265 
266  //- Non-overlapping patch ID
267  virtual label nonOverlapPatchID() const;
268 
269  //- Return a const reference to the non-overlapping patch
270  inline const polyPatch& nonOverlapPatch() const;
271 
272  //- Return a reference to the non-overlapping patch
273  inline polyPatch& nonOverlapPatch();
274 
275  //- Mask field where 1 = overlap, 0 = no-overlap
276  inline const scalarField& mask() const;
277 
278 
279  // Interpolations
280 
281  //- Interpolate field
282  template<class Type>
284  (
285  const Field<Type>& fldCouple,
286  const Field<Type>& fldNonOverlap
287  ) const;
288 
289  //- Interpolate tmp field
290  template<class Type>
292  (
293  const tmp<Field<Type> >& tFldCouple,
294  const tmp<Field<Type> >& tFldNonOverlap
295  ) const;
296 
297  //- Low-level interpolate List
298  template<class Type, class CombineOp>
299  void interpolate
300  (
301  const UList<Type>& fldCouple,
302  const UList<Type>& fldNonOverlap,
303  const CombineOp& cop,
304  List<Type>& result
305  ) const;
306 
307 
308  //- Calculate the patch geometry
309  virtual void calcGeometry
310  (
311  const primitivePatch& referPatch,
312  const pointField& thisCtrs,
313  const vectorField& thisAreas,
314  const pointField& thisCc,
315  const pointField& nbrCtrs,
316  const vectorField& nbrAreas,
317  const pointField& nbrCc
318  );
319 
320  //- Initialize ordering for primitivePatch. Does not
321  // refer to *this (except for name() and type() etc.)
322  virtual void initOrder
323  (
325  const primitivePatch&
326  ) const;
327 
328  //- Return new ordering for primitivePatch.
329  // Ordering is -faceMap: for every face
330  // index of the new face -rotation:for every new face the clockwise
331  // shift of the original face. Return false if nothing changes
332  // (faceMap is identity, rotation is 0), true otherwise.
333  virtual bool order
334  (
336  const primitivePatch&,
338  labelList& rotation
339  ) const;
340 
341  //- Write the polyPatch data as a dictionary
342  virtual void write(Ostream&) const;
343 };
344 
345 
346 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
347 
348 } // End namespace Foam
349 
350 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351 
352 #include "cyclicACMIPolyPatchI.H"
353 
354 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
355 
356 #ifdef NoRepository
358 #endif
359 
360 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
361 
362 #endif
363 
364 // ************************************************************************* //
virtual ~cyclicACMIPolyPatch()
Destructor.
virtual void setNeighbourFaceAreas() const
Set neighbour ACMI patch areas.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Cyclic patch for Arbitrary Mesh Interface (AMI)
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
const word & name() const
Return name.
virtual void resetAMI(const AMIPatchToPatchInterpolation::interpolationMethod &AMIMethod=AMIPatchToPatchInterpolation::imFaceAreaWeight) const
Reset the AMI interpolator.
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:55
TypeName("cyclicACMI")
Runtime type information.
label index() const
Return the index of this patch in the boundaryMesh.
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
A class for handling words, derived from string.
Definition: word.H:59
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
bool updated() const
Return access to the updated flag.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
void setUpdated(bool flag) const
Reset the updated flag.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Namespace for OpenFOAM.
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
interpolationMethod
Enumeration specifying interpolation method.
dictionary dict
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
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.
Foam::polyBoundaryMesh.
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual const scalarField & srcMask() const
Return the mask/weighting for the source patch.
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void clearGeom()
Clear geometry.
const vectorField & faceAreas0() const
Return access to the original patch face areas.
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
A list of faces which address into the list of points.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:300
tmp< Field< Type > > interpolate(const Field< Type > &fldCouple, const Field< Type > &fldNonOverlap) const
Interpolate field.
virtual transformType transform() const
Type of transform.
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
static const scalar tolerance_
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
virtual void initPatchFaceAreas() const
Initialise patch face areas.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118
const word & neighbPatchName() const
Neighbour patch name.
const word & nonOverlapPatchName() const
Non-overlapping patch name.
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.