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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2018 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::cyclicACMIPolyPatch
29 
30 Description
31  Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
32 
33 SourceFiles
34  cyclicACMIPolyPatch.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef cyclicACMIPolyPatch_H
39 #define cyclicACMIPolyPatch_H
40 
41 #include "cyclicAMIPolyPatch.H"
43 #include "polyBoundaryMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class cyclicACMIPolyPatch Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
56  public cyclicAMIPolyPatch
57 {
58 
59 private:
60 
61  // Private data
62 
63  //- Fraction of face area below which face is considered disconnected
64  static const scalar tolerance_;
65 
66  //- Name of non-overlapping patch
67  const word nonOverlapPatchName_;
68 
69  //- Index of non-overlapping patch
70  mutable label nonOverlapPatchID_;
71 
72  //- Mask/weighting for source patch
73  mutable scalarField srcMask_;
74 
75  //- Mask/weighting for target patch
76  mutable scalarField tgtMask_;
77 
78  //- Flag to indicate that AMI has been updated
79  mutable bool updated_;
80 
81 
82 protected:
83 
84  // Protected Member Functions
85 
86  //- Reset the AMI interpolator
87  virtual void resetAMI
88  (
91  ) const;
92 
93  //- Initialise the calculation of the patch geometry
94  virtual void initGeometry(PstreamBuffers&);
95 
96  //- Calculate the patch geometry
97  virtual void calcGeometry(PstreamBuffers&);
98 
99  //- Initialise the patches for moving points
100  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
101 
102  //- Correct patches after moving points
103  virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
104 
105  //- Initialise the update of the patch topology
106  virtual void initUpdateMesh(PstreamBuffers&);
107 
108  //- Update of the patch topology
109  virtual void updateMesh(PstreamBuffers&);
110 
111  //- Clear geometry
112  virtual void clearGeom();
113 
114  //- Return the mask/weighting for the source patch
115  virtual const scalarField& srcMask() const;
116 
117  //- Return the mask/weighting for the target patch
118  virtual const scalarField& tgtMask() const;
119 
120 
121 public:
122 
123  //- Runtime type information
124  TypeName("cyclicACMI");
125 
126 
127  // Constructors
128 
129  //- Construct from (base coupled patch) components
131  (
132  const word& name,
133  const label size,
134  const label start,
135  const label index,
136  const polyBoundaryMesh& bm,
137  const word& patchType,
139  );
140 
141  //- Construct from dictionary
143  (
144  const word& name,
145  const dictionary& dict,
146  const label index,
147  const polyBoundaryMesh& bm,
148  const word& patchType
149  );
150 
151  //- Construct as copy, resetting the boundary mesh
153  (
154  const cyclicACMIPolyPatch&,
155  const polyBoundaryMesh&
156  );
157 
158  //- Construct given the original patch and resetting the
159  // face list and boundary mesh information
161  (
162  const cyclicACMIPolyPatch& pp,
163  const polyBoundaryMesh& bm,
164  const label index,
165  const label newSize,
166  const label newStart,
167  const word& nbrPatchName,
169  );
170 
171  //- Construct given the original patch and a map
173  (
174  const cyclicACMIPolyPatch& pp,
175  const polyBoundaryMesh& bm,
176  const label index,
177  const labelUList& mapAddressing,
178  const label newStart
179  );
180 
181 
182  //- Construct and return a clone, resetting the boundary mesh
183  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
184  {
186  }
187 
188  //- Construct and return a clone, resetting the face list
189  // and boundary mesh
191  (
192  const polyBoundaryMesh& bm,
193  const label index,
194  const label newSize,
195  const label newStart
196  ) const
197  {
198  return autoPtr<polyPatch>
199  (
201  (
202  *this,
203  bm,
204  index,
205  newSize,
206  newStart,
207  neighbPatchName(),
208  nonOverlapPatchName_
209  )
210  );
211  }
212 
213  //- Construct and return a clone, resetting the face list
214  // and boundary mesh
216  (
217  const polyBoundaryMesh& bm,
218  const label index,
219  const labelUList& mapAddressing,
220  const label newStart
221  ) const
222  {
223  return autoPtr<polyPatch>
224  (
226  (
227  *this,
228  bm,
229  index,
230  mapAddressing,
231  newStart
232  )
233  );
234  }
235 
236 
237  //- Destructor
238  virtual ~cyclicACMIPolyPatch();
239 
240 
241  // Member Functions
242 
243  // Access
244 
245  //- Reset the updated flag
246  inline void setUpdated(bool flag) const;
247 
248  //- Return access to the updated flag
249  inline bool updated() const;
250 
251  //- Return a reference to the neighbour patch
252  virtual const cyclicACMIPolyPatch& neighbPatch() const;
253 
254  //- Non-overlapping patch name
255  inline const word& nonOverlapPatchName() const;
256 
257  //- Non-overlapping patch ID
258  virtual label nonOverlapPatchID() const;
259 
260  //- Return a const reference to the non-overlapping patch
261  inline const polyPatch& nonOverlapPatch() const;
262 
263  //- Return a reference to the non-overlapping patch
264  inline polyPatch& nonOverlapPatch();
265 
266  //- Mask field where 1 = overlap, 0 = no-overlap
267  inline const scalarField& mask() const;
268 
269  //- Overlap tolerance
270  inline static scalar tolerance();
271 
272 
273  //- Initialize ordering for primitivePatch. Does not
274  // refer to *this (except for name() and type() etc.)
275  virtual void initOrder
276  (
278  const primitivePatch&
279  ) const;
280 
281  //- Return new ordering for primitivePatch.
282  // Ordering is -faceMap: for every face
283  // index of the new face -rotation:for every new face the clockwise
284  // shift of the original face. Return false if nothing changes
285  // (faceMap is identity, rotation is 0), true otherwise.
286  virtual bool order
287  (
289  const primitivePatch&,
291  labelList& rotation
292  ) const;
293 
294  //- Write the polyPatch data as a dictionary
295  virtual void write(Ostream&) const;
296 };
297 
298 
299 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
300 
301 } // End namespace Foam
302 
303 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
304 
305 #include "cyclicACMIPolyPatchI.H"
306 
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
308 
309 #endif
310 
311 // ************************************************************************* //
Foam::AMIInterpolation::interpolationMethod
interpolationMethod
Enumeration specifying interpolation method.
Definition: AMIInterpolation.H:90
Foam::cyclicACMIPolyPatch::setUpdated
void setUpdated(bool flag) const
Reset the updated flag.
Definition: cyclicACMIPolyPatchI.H:30
Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch
virtual ~cyclicACMIPolyPatch()
Destructor.
Definition: cyclicACMIPolyPatch.C:471
Foam::cyclicACMIPolyPatch::calcGeometry
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: cyclicACMIPolyPatch.C:253
Foam::cyclicACMIPolyPatch::movePoints
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
Definition: cyclicACMIPolyPatch.C:283
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:94
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::polyBoundaryMesh
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Definition: polyBoundaryMesh.H:62
Foam::AMIInterpolation::imFaceAreaWeight
Definition: AMIInterpolation.H:94
Foam::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:88
Foam::cyclicACMIPolyPatch::tolerance
static scalar tolerance()
Overlap tolerance.
Definition: cyclicACMIPolyPatchI.H:79
Foam::cyclicACMIPolyPatch::updated
bool updated() const
Return access to the updated flag.
Definition: cyclicACMIPolyPatchI.H:36
Foam::AMIMethod
Base class for Arbitrary Mesh Interface (AMI) methods.
Definition: AMIMethod.H:60
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 coupled patch) components.
Definition: cyclicACMIPolyPatch.C:341
Foam::cyclicACMIPolyPatch::nonOverlapPatchName
const word & nonOverlapPatchName() const
Non-overlapping patch name.
Definition: cyclicACMIPolyPatchI.H:42
Foam::cyclicACMIPolyPatch::TypeName
TypeName("cyclicACMI")
Runtime type information.
Foam::cyclicACMIPolyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: cyclicACMIPolyPatch.C:306
Foam::cyclicACMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicACMIPolyPatch.C:572
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:62
Foam::Field< scalar >
Foam::cyclicACMIPolyPatch::resetAMI
virtual void resetAMI(const AMIPatchToPatchInterpolation::interpolationMethod &AMIMethod=AMIPatchToPatchInterpolation::imFaceAreaWeight) const
Reset the AMI interpolator.
Definition: cyclicACMIPolyPatch.C:49
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:326
Foam::coupledPolyPatch::UNKNOWN
Definition: coupledPolyPatch.H:61
Foam::cyclicACMIPolyPatch::clearGeom
virtual void clearGeom()
Clear geometry.
Definition: cyclicACMIPolyPatch.C:316
Foam::cyclicACMIPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: cyclicACMIPolyPatch.C:561
Foam::cyclicACMIPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: cyclicACMIPolyPatch.C:551
Foam::cyclicACMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicACMIPolyPatch.H:182
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::cyclicACMIPolyPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Definition: cyclicACMIPolyPatch.C:484
AMIPatchToPatchInterpolation.H
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::polyPatch::start
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:311
Foam::coupledPolyPatch::transform
virtual transformType transform() const
Type of transform.
Definition: coupledPolyPatch.H:258
cyclicAMIPolyPatch.H
Foam::cyclicACMIPolyPatch::initMovePoints
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
Definition: cyclicACMIPolyPatch.C:264
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cyclicACMIPolyPatch::neighbPatch
virtual const cyclicACMIPolyPatch & neighbPatch() const
Return a reference to the neighbour patch.
Definition: cyclicACMIPolyPatch.C:477
Foam::List< label >
Foam::UList< label >
Foam::cyclicAMIPolyPatch::neighbPatchName
const word & neighbPatchName() const
Neighbour patch name.
Definition: cyclicAMIPolyPatchI.H:30
polyBoundaryMesh.H
Foam::cyclicACMIPolyPatch::nonOverlapPatch
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
Definition: cyclicACMIPolyPatchI.H:48
Foam::cyclicACMIPolyPatch::tgtMask
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
Definition: cyclicACMIPolyPatch.C:332
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cyclicACMIPolyPatch
Cyclic patch for Arbitrarily Coupled Mesh Interface (ACMI)
Definition: cyclicACMIPolyPatch.H:53
cyclicACMIPolyPatchI.H
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:59
Foam::cyclicACMIPolyPatch::mask
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
Definition: cyclicACMIPolyPatchI.H:66
Foam::patchIdentifier::name
const word & name() const
Return the patch name.
Definition: patchIdentifier.H:109
Foam::patchIdentifier::index
label index() const
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: PrimitivePatch.H:90
Foam::cyclicACMIPolyPatch::initGeometry
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: cyclicACMIPolyPatch.C:237
Foam::cyclicACMIPolyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: cyclicACMIPolyPatch.C:296
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:53