cyclicACMIPolyPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2019 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"
39 #include "AMIInterpolation.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  // Private Data
56 
57  //- Fraction of face area below which face is considered disconnected
58  static const scalar tolerance_;
59 
60  //- Name of non-overlapping patch
61  const word nonOverlapPatchName_;
62 
63  //- Index of non-overlapping patch
64  mutable label nonOverlapPatchID_;
65 
66  //- Mask/weighting for source patch
67  mutable scalarField srcMask_;
68 
69  //- Mask/weighting for target patch
70  mutable scalarField tgtMask_;
71 
72  //- Flag to indicate that AMI has been updated
73  mutable bool updated_;
74 
75 
76 protected:
77 
78  // Protected Member Functions
79 
80  //- Reset the AMI interpolator
81  virtual void resetAMI() const;
82 
83  //- Initialise the calculation of the patch geometry
84  virtual void initGeometry(PstreamBuffers&);
85 
86  //- Initialise the patches for moving points
87  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
88 
89  //- Return the mask/weighting for the source patch
90  virtual const scalarField& srcMask() const;
91 
92  //- Return the mask/weighting for the target patch
93  virtual const scalarField& tgtMask() const;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("cyclicACMI");
100 
101 
102  // Constructors
103 
104  //- Construct from (base couped patch) components
106  (
107  const word& name,
108  const label size,
109  const label start,
110  const label index,
111  const polyBoundaryMesh& bm,
112  const word& patchType,
114  );
115 
116  //- Construct from dictionary
118  (
119  const word& name,
120  const dictionary& dict,
121  const label index,
122  const polyBoundaryMesh& bm,
123  const word& patchType
124  );
125 
126  //- Construct as copy, resetting the boundary mesh
128  (
129  const cyclicACMIPolyPatch&,
130  const polyBoundaryMesh&
131  );
132 
133  //- Construct given the original patch and resetting the
134  // face list and boundary mesh information
136  (
137  const cyclicACMIPolyPatch& pp,
138  const polyBoundaryMesh& bm,
139  const label index,
140  const label newSize,
141  const label newStart,
142  const word& nbrPatchName,
143  const word& nonOverlapPatchName
144  );
145 
146  //- Construct given the original patch and a map
148  (
149  const cyclicACMIPolyPatch& pp,
150  const polyBoundaryMesh& bm,
151  const label index,
152  const labelUList& mapAddressing,
153  const label newStart
154  );
155 
156 
157  //- Construct and return a clone, resetting the boundary mesh
158  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
159  {
160  return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
161  }
162 
163  //- Construct and return a clone, resetting the face list
164  // and boundary mesh
166  (
167  const polyBoundaryMesh& bm,
168  const label index,
169  const label newSize,
170  const label newStart
171  ) const
172  {
173  return autoPtr<polyPatch>
174  (
176  (
177  *this,
178  bm,
179  index,
180  newSize,
181  newStart,
182  neighbPatchName(),
183  nonOverlapPatchName_
184  )
185  );
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 labelUList& mapAddressing,
195  const label newStart
196  ) const
197  {
198  return autoPtr<polyPatch>
199  (
201  (
202  *this,
203  bm,
204  index,
205  mapAddressing,
206  newStart
207  )
208  );
209  }
210 
211 
212  //- Destructor
213  virtual ~cyclicACMIPolyPatch();
214 
215 
216  // Member Functions
217 
218  // Access
219 
220  //- Reset the updated flag
221  inline void setUpdated(bool flag) const;
222 
223  //- Return access to the updated flag
224  inline bool updated() const;
225 
226  //- Return a reference to the neighbour patch
227  virtual const cyclicACMIPolyPatch& neighbPatch() const;
228 
229  //- Non-overlapping patch name
230  inline const word& nonOverlapPatchName() const;
231 
232  //- Non-overlapping patch ID
233  virtual label nonOverlapPatchID() const;
234 
235  //- Return a const reference to the non-overlapping patch
236  inline const polyPatch& nonOverlapPatch() const;
237 
238  //- Return a reference to the non-overlapping patch
239  inline polyPatch& nonOverlapPatch();
240 
241  //- Mask field where 1 = overlap, 0 = no-overlap
242  inline const scalarField& mask() const;
243 
244  //- Overlap tolerance
245  inline static scalar tolerance();
246 
247 
248  //- Calculate the patch geometry
249  virtual void calcGeometry
250  (
251  const primitivePatch& referPatch,
252  const pointField& thisCtrs,
253  const vectorField& thisAreas,
254  const pointField& thisCc,
255  const pointField& nbrCtrs,
256  const vectorField& nbrAreas,
257  const pointField& nbrCc
258  );
259 
260  //- Initialize ordering for primitivePatch. Does not
261  // refer to *this (except for name() and type() etc.)
262  virtual void initOrder
263  (
265  const primitivePatch&
266  ) const;
267 
268  //- Return new ordering for primitivePatch.
269  // Ordering is -faceMap: for every face
270  // index of the new face -rotation:for every new face the clockwise
271  // shift of the original face. Return false if nothing changes
272  // (faceMap is identity, rotation is 0), true otherwise.
273  virtual bool order
274  (
276  const primitivePatch&,
278  labelList& rotation
279  ) const;
280 
281  //- Write the polyPatch data as a dictionary
282  virtual void write(Ostream&) const;
283 };
284 
285 
286 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 
288 } // End namespace Foam
289 
290 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
291 
292 #include "cyclicACMIPolyPatchI.H"
293 
294 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
295 
296 #endif
297 
298 // ************************************************************************* //
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
virtual autoPtr< PrimitivePatch< FaceList, PointField > > clone() const
Construct and return a clone.
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)
const polyPatch & nonOverlapPatch() const
Return a const reference to the non-overlapping patch.
A list of faces which address into the list of 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:60
Foam::polyBoundaryMesh.
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 void resetAMI() const
Reset the AMI interpolator.
virtual void calcGeometry(const primitivePatch &referPatch, const pointField &thisCtrs, const vectorField &thisAreas, const pointField &thisCc, const pointField &nbrCtrs, const vectorField &nbrAreas, const pointField &nbrCc)
Calculate the patch geometry.
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.