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
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(),
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 // ************************************************************************* //
Foam::AMIInterpolation::interpolationMethod
interpolationMethod
Enumeration specifying interpolation method.
Definition: AMIInterpolation.H:86
Foam::cyclicACMIPolyPatch::setUpdated
void setUpdated(bool flag) const
Reset the updated flag.
Definition: cyclicACMIPolyPatchI.H:28
Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch
virtual ~cyclicACMIPolyPatch()
Destructor.
Definition: cyclicACMIPolyPatch.C:359
Foam::cyclicACMIPolyPatch::faceAreas0_
vectorField faceAreas0_
Copy of the original patch face areas.
Definition: cyclicACMIPolyPatch.H:60
Foam::cyclicACMIPolyPatch::calcGeometry
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: cyclicACMIPolyPatch.C:157
Foam::cyclicACMIPolyPatch::movePoints
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
Definition: cyclicACMIPolyPatch.C:180
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:90
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::polyBoundaryMesh
Foam::polyBoundaryMesh.
Definition: polyBoundaryMesh.H:60
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::AMIInterpolation::imFaceAreaWeight
@ imFaceAreaWeight
Definition: AMIInterpolation.H:90
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:85
Foam::cyclicACMIPolyPatch::faceAreas0
const vectorField & faceAreas0() const
Return access to the original patch face areas.
Definition: cyclicACMIPolyPatchI.H:40
Foam::cyclicACMIPolyPatch::updated
bool updated() const
Return access to the updated flag.
Definition: cyclicACMIPolyPatchI.H:34
Foam::cyclicACMIPolyPatch::nonOverlapPatchName_
const word nonOverlapPatchName_
Name of non-overlapping patch.
Definition: cyclicACMIPolyPatch.H:63
Foam::cyclicACMIPolyPatch::interpolate
tmp< Field< Type > > interpolate(const Field< Type > &fldCouple, const Field< Type > &fldNonOverlap) const
Interpolate field.
Foam::AMIMethod
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:55
Foam::cyclicACMIPolyPatch::cyclicACMIPolyPatch
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.
Definition: cyclicACMIPolyPatch.C:222
Foam::cyclicACMIPolyPatch::nonOverlapPatchName
const word & nonOverlapPatchName() const
Non-overlapping patch name.
Definition: cyclicACMIPolyPatchI.H:46
Foam::cyclicACMIPolyPatch::nonOverlapPatch
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
Definition: cyclicACMIPolyPatchI.H:52
Foam::cyclicACMIPolyPatch::TypeName
TypeName("cyclicACMI")
Runtime type information.
Foam::cyclicACMIPolyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: cyclicACMIPolyPatch.C:195
Foam::cyclicACMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicACMIPolyPatch.C:484
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::cyclicACMIPolyPatch::tolerance_
static const scalar tolerance_
Definition: cyclicACMIPolyPatch.H:80
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::cyclicACMIPolyPatch::resetAMI
virtual void resetAMI(const AMIPatchToPatchInterpolation::interpolationMethod &AMIMethod=AMIPatchToPatchInterpolation::imFaceAreaWeight) const
Reset the AMI interpolator.
Definition: cyclicACMIPolyPatch.C:71
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::cyclicACMIPolyPatch::srcMask
virtual const scalarField & srcMask() const
Return the mask/weighting for the source patch.
Definition: cyclicACMIPolyPatch.C:207
Foam::cyclicACMIPolyPatch::tgtMask_
scalarField tgtMask_
Mask/weighting for target patch.
Definition: cyclicACMIPolyPatch.H:72
Foam::cyclicACMIPolyPatch::updated_
bool updated_
Flag to indicate that AMI has been updated.
Definition: cyclicACMIPolyPatch.H:75
Foam::coupledPolyPatch::UNKNOWN
@ UNKNOWN
Definition: coupledPolyPatch.H:59
Foam::cyclicACMIPolyPatch::clearGeom
virtual void clearGeom()
Clear geometry.
Definition: cyclicACMIPolyPatch.C:201
Foam::cyclicACMIPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: cyclicACMIPolyPatch.C:473
Foam::cyclicACMIPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: cyclicACMIPolyPatch.C:463
Foam::cyclicACMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicACMIPolyPatch.H:188
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::cyclicACMIPolyPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Definition: cyclicACMIPolyPatch.C:372
AMIPatchToPatchInterpolation.H
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::cyclicACMIPolyPatch::setNeighbourFaceAreas
virtual void setNeighbourFaceAreas() const
Set neighbour ACMI patch areas.
Definition: cyclicACMIPolyPatch.C:117
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::cyclicACMIPolyPatch::initMovePoints
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
Definition: cyclicACMIPolyPatch.C:164
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::cyclicACMIPolyPatch::nonOverlapPatchID_
label nonOverlapPatchID_
Index of non-overlapping patch.
Definition: cyclicACMIPolyPatch.H:66
Foam::cyclicACMIPolyPatch::neighbPatch
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
Definition: cyclicACMIPolyPatch.C:365
Foam::List< Type >
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::cyclicACMIPolyPatch::srcMask_
scalarField srcMask_
Mask/weighting for source patch.
Definition: cyclicACMIPolyPatch.H:69
Foam::cyclicAMIPolyPatch::neighbPatchName
const word & neighbPatchName() const
Neighbour patch name.
Definition: cyclicAMIPolyPatchI.H:28
Foam::cyclicACMIPolyPatch::initPatchFaceAreas
virtual void initPatchFaceAreas() const
Initialise patch face areas.
Definition: cyclicACMIPolyPatch.C:45
polyBoundaryMesh.H
Foam::cyclicACMIPolyPatch::tgtMask
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
Definition: cyclicACMIPolyPatch.C:213
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::cyclicACMIPolyPatch
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
Definition: cyclicACMIPolyPatch.H:50
cyclicACMIPolyPatchI.H
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:57
cyclicACMIPolyPatchTemplates.C
Foam::cyclicACMIPolyPatch::mask
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
Definition: cyclicACMIPolyPatchI.H:70
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::cyclicACMIPolyPatch::initGeometry
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: cyclicACMIPolyPatch.C:145
Foam::cyclicACMIPolyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: cyclicACMIPolyPatch.C:189
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:51