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-2020 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"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class cyclicACMIPolyPatch Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public cyclicAMIPolyPatch
58 {
59 
60 private:
61 
62  // Private data
63 
64  //- Name of non-overlapping patch
65  const word nonOverlapPatchName_;
66 
67  //- Index of non-overlapping patch
68  mutable label nonOverlapPatchID_;
69 
70  //- Mask/weighting for source patch
71  mutable scalarField srcMask_;
72 
73  //- Mask/weighting for target patch
74  mutable scalarField tgtMask_;
75 
76 
77 protected:
78 
79  // Protected Member Functions
80 
81  //- Report coverage statics, e.g. number of uncovered/blended/covered
82  //- faces
83  void reportCoverage
84  (
85  const word& name,
86  const scalarField& weightSum
87  ) const;
88 
89  //- Reset the AMI interpolator, supply patch points
90  virtual void resetAMI(const UList<point>& points) const;
91 
92  //- Reset the AMI interpolator, use current patch points
93  virtual void resetAMI() const;
94 
95  //- Scale patch face areas to maintain physical area
96  virtual void scalePatchFaceAreas();
97 
98  //- Scale patch face areas to maintain physical area
99  virtual void scalePatchFaceAreas(const cyclicACMIPolyPatch& acmipp);
100 
101  //- Initialise the calculation of the patch geometry
102  virtual void initGeometry(PstreamBuffers&);
103 
104  //- Calculate the patch geometry
105  virtual void calcGeometry(PstreamBuffers&);
106 
107  //- Initialise the patches for moving points
108  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
109 
110  //- Correct patches after moving points
111  virtual void movePoints(PstreamBuffers& pBufs, const pointField&);
112 
113  //- Initialise the update of the patch topology
114  virtual void initUpdateMesh(PstreamBuffers&);
115 
116  //- Update of the patch topology
117  virtual void updateMesh(PstreamBuffers&);
118 
119  //- Clear geometry
120  virtual void clearGeom();
121 
122 
123 public:
124 
125  //- Runtime type information
126  TypeName("cyclicACMI");
127 
128 
129  // Constructors
130 
131  //- Construct from (base coupled patch) components
133  (
134  const word& name,
135  const label size,
136  const label start,
137  const label index,
138  const polyBoundaryMesh& bm,
139  const word& patchType,
141  const word& defaultAMIMethod = partialFaceAreaWeightAMI::typeName
142  );
143 
144  //- Construct from dictionary
146  (
147  const word& name,
148  const dictionary& dict,
149  const label index,
150  const polyBoundaryMesh& bm,
151  const word& patchType,
152  const word& defaultAMIMethod = partialFaceAreaWeightAMI::typeName
153  );
154 
155  //- Construct as copy, resetting the boundary mesh
157  (
158  const cyclicACMIPolyPatch&,
159  const polyBoundaryMesh&
160  );
161 
162  //- Construct given the original patch and resetting the
163  // face list and boundary mesh information
165  (
166  const cyclicACMIPolyPatch& pp,
167  const polyBoundaryMesh& bm,
168  const label index,
169  const label newSize,
170  const label newStart,
171  const word& nbrPatchName,
173  );
174 
175  //- Construct given the original patch and a map
177  (
178  const cyclicACMIPolyPatch& pp,
179  const polyBoundaryMesh& bm,
180  const label index,
181  const labelUList& mapAddressing,
182  const label newStart
183  );
184 
185 
186  //- Construct and return a clone, resetting the boundary mesh
187  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
188  {
190  }
191 
192  //- Construct and return a clone, resetting the face list
193  // and boundary mesh
195  (
196  const polyBoundaryMesh& bm,
197  const label index,
198  const label newSize,
199  const label newStart
200  ) const
201  {
202  return autoPtr<polyPatch>
203  (
205  (
206  *this,
207  bm,
208  index,
209  newSize,
210  newStart,
211  neighbPatchName(),
212  nonOverlapPatchName_
213  )
214  );
215  }
216 
217  //- Construct and return a clone, resetting the face list
218  // and boundary mesh
220  (
221  const polyBoundaryMesh& bm,
222  const label index,
223  const labelUList& mapAddressing,
224  const label newStart
225  ) const
226  {
227  return autoPtr<polyPatch>
228  (
230  (
231  *this,
232  bm,
233  index,
234  mapAddressing,
235  newStart
236  )
237  );
238  }
239 
240 
241  //- Destructor
242  virtual ~cyclicACMIPolyPatch() = default;
243 
244 
245  // Member Functions
246 
247  // Access
248 
249  //- Return a reference to the neighbour patch
250  virtual const cyclicACMIPolyPatch& neighbPatch() const;
251 
252  //- Non-overlapping patch name
253  inline const word& nonOverlapPatchName() const;
254 
255  //- Non-overlapping patch ID
256  virtual label nonOverlapPatchID() const;
257 
258  //- Return a const reference to the non-overlapping patch
259  inline const polyPatch& nonOverlapPatch() const;
260 
261  //- Return a reference to the non-overlapping patch
262  inline polyPatch& nonOverlapPatch();
263 
264  //- Mask field where 1 = overlap(coupled), 0 = no-overlap
265  inline const scalarField& mask() const;
266 
267  //- Return the mask/weighting for the source patch
268  virtual const scalarField& srcMask() const;
269 
270  //- Return the mask/weighting for the target patch
271  virtual const scalarField& tgtMask() const;
272 
273  //- Overlap tolerance
274  inline static scalar tolerance();
275 
276 
277  //- Initialize ordering for primitivePatch. Does not
278  // refer to *this (except for name() and type() etc.)
279  virtual void initOrder
280  (
282  const primitivePatch&
283  ) const;
284 
285  //- Return new ordering for primitivePatch.
286  // Ordering is -faceMap: for every face
287  // index of the new face -rotation:for every new face the clockwise
288  // shift of the original face. Return false if nothing changes
289  // (faceMap is identity, rotation is 0), true otherwise.
290  virtual bool order
291  (
293  const primitivePatch&,
295  labelList& rotation
296  ) const;
297 
298  //- Write the polyPatch data as a dictionary
299  virtual void write(Ostream&) const;
300 };
301 
302 
303 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
304 
305 } // End namespace Foam
306 
307 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
308 
309 #include "cyclicACMIPolyPatchI.H"
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 #endif
314 
315 // ************************************************************************* //
Foam::cyclicACMIPolyPatch::calcGeometry
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
Definition: cyclicACMIPolyPatch.C:268
Foam::cyclicACMIPolyPatch::movePoints
virtual void movePoints(PstreamBuffers &pBufs, const pointField &)
Correct patches after moving points.
Definition: cyclicACMIPolyPatch.C:293
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeTopological.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::PstreamBuffers
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Definition: PstreamBuffers.H:88
Foam::cyclicACMIPolyPatch::tolerance
static scalar tolerance()
Overlap tolerance.
Definition: cyclicACMIPolyPatchI.H:65
Foam::cyclicACMIPolyPatch::resetAMI
virtual void resetAMI() const
Reset the AMI interpolator, use current patch points.
Definition: cyclicACMIPolyPatch.C:75
Foam::cyclicACMIPolyPatch::nonOverlapPatchName
const word & nonOverlapPatchName() const
Non-overlapping patch name.
Definition: cyclicACMIPolyPatchI.H:30
Foam::cyclicACMIPolyPatch::TypeName
TypeName("cyclicACMI")
Runtime type information.
Foam::cyclicACMIPolyPatch::~cyclicACMIPolyPatch
virtual ~cyclicACMIPolyPatch()=default
Destructor.
Foam::cyclicACMIPolyPatch::updateMesh
virtual void updateMesh(PstreamBuffers &)
Update of the patch topology.
Definition: cyclicACMIPolyPatch.C:313
Foam::cyclicACMIPolyPatch::write
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
Definition: cyclicACMIPolyPatch.C:576
Foam::Field< scalar >
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:67
Foam::cyclicACMIPolyPatch::srcMask
virtual const scalarField & srcMask() const
Return the mask/weighting for the source patch.
Definition: cyclicACMIPolyPatch.C:329
Foam::coupledPolyPatch::UNKNOWN
Definition: coupledPolyPatch.H:61
Foam::cyclicACMIPolyPatch::clearGeom
virtual void clearGeom()
Clear geometry.
Definition: cyclicACMIPolyPatch.C:321
Foam::cyclicACMIPolyPatch::order
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Definition: cyclicACMIPolyPatch.C:565
Foam::cyclicACMIPolyPatch::initOrder
virtual void initOrder(PstreamBuffers &, const primitivePatch &) const
Initialize ordering for primitivePatch. Does not.
Definition: cyclicACMIPolyPatch.C:555
Foam::cyclicACMIPolyPatch::clone
virtual autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
Definition: cyclicACMIPolyPatch.H:186
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::cyclicACMIPolyPatch::nonOverlapPatchID
virtual label nonOverlapPatchID() const
Non-overlapping patch ID.
Definition: cyclicACMIPolyPatch.C:488
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::PrimitivePatch::points
const Field< point_type > & points() const
Return reference to global points.
Definition: PrimitivePatch.H:305
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, const word &defaultAMIMethod=partialFaceAreaWeightAMI::typeName)
Construct from (base coupled patch) components.
Definition: cyclicACMIPolyPatch.C:344
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:312
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:277
Foam::cyclicACMIPolyPatch::scalePatchFaceAreas
virtual void scalePatchFaceAreas()
Scale patch face areas to maintain physical area.
Definition: cyclicACMIPolyPatch.C:160
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:481
Foam::List< label >
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:103
Foam::cyclicAMIPolyPatch::neighbPatchName
const word & neighbPatchName() const
Neighbour patch name.
Definition: cyclicAMIPolyPatchI.H:49
polyBoundaryMesh.H
Foam::cyclicACMIPolyPatch::nonOverlapPatch
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
Definition: cyclicACMIPolyPatchI.H:36
Foam::cyclicACMIPolyPatch::tgtMask
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
Definition: cyclicACMIPolyPatch.C:335
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:54
cyclicACMIPolyPatchI.H
Foam::coupledPolyPatch::transformType
transformType
Definition: coupledPolyPatch.H:59
Foam::cyclicACMIPolyPatch::mask
const scalarField & mask() const
Mask field where 1 = overlap(coupled), 0 = no-overlap.
Definition: cyclicACMIPolyPatchI.H:54
Foam::patchIdentifier::name
const word & name() const
The patch name.
Definition: patchIdentifier.H:134
Foam::patchIdentifier::index
label index() const
The index of this patch in the boundaryMesh.
Definition: patchIdentifier.H:158
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:85
partialFaceAreaWeightAMI.H
Foam::cyclicACMIPolyPatch::initGeometry
virtual void initGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
Definition: cyclicACMIPolyPatch.C:250
Foam::cyclicACMIPolyPatch::reportCoverage
void reportCoverage(const word &name, const scalarField &weightSum) const
Definition: cyclicACMIPolyPatch.C:47
Foam::cyclicACMIPolyPatch::initUpdateMesh
virtual void initUpdateMesh(PstreamBuffers &)
Initialise the update of the patch topology.
Definition: cyclicACMIPolyPatch.C:305
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:67