All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2020 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 initCalcGeometry(PstreamBuffers&);
85 
86  //- Calculate the patch geometry
87  virtual void calcGeometry(PstreamBuffers&);
88 
89  //- Initialise the patches for moving points
90  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
91 
92  //- Return the mask/weighting for the source patch
93  virtual const scalarField& srcMask() const;
94 
95  //- Return the mask/weighting for the target patch
96  virtual const scalarField& tgtMask() const;
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("cyclicACMI");
103 
104 
105  // Constructors
106 
107  //- Construct from (base couped patch) components
109  (
110  const word& name,
111  const label size,
112  const label start,
113  const label index,
114  const polyBoundaryMesh& bm,
115  const word& patchType
116  );
117 
118  //- Construct from dictionary
120  (
121  const word& name,
122  const dictionary& dict,
123  const label index,
124  const polyBoundaryMesh& bm,
125  const word& patchType
126  );
127 
128  //- Construct as copy, resetting the boundary mesh
130  (
131  const cyclicACMIPolyPatch&,
132  const polyBoundaryMesh&
133  );
134 
135  //- Construct given the original patch and resetting the
136  // face list and boundary mesh information
138  (
139  const cyclicACMIPolyPatch& pp,
140  const polyBoundaryMesh& bm,
141  const label index,
142  const label newSize,
143  const label newStart,
144  const word& nbrPatchName,
145  const word& nonOverlapPatchName
146  );
147 
148  //- Construct given the original patch and a map
150  (
151  const cyclicACMIPolyPatch& pp,
152  const polyBoundaryMesh& bm,
153  const label index,
154  const labelUList& mapAddressing,
155  const label newStart
156  );
157 
158 
159  //- Construct and return a clone, resetting the boundary mesh
160  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
161  {
162  return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
163  }
164 
165  //- Construct and return a clone, resetting the face list
166  // and boundary mesh
168  (
169  const polyBoundaryMesh& bm,
170  const label index,
171  const label newSize,
172  const label newStart
173  ) const
174  {
175  return autoPtr<polyPatch>
176  (
178  (
179  *this,
180  bm,
181  index,
182  newSize,
183  newStart,
184  nbrPatchName(),
185  nonOverlapPatchName_
186  )
187  );
188  }
189 
190  //- Construct and return a clone, resetting the face list
191  // and boundary mesh
193  (
194  const polyBoundaryMesh& bm,
195  const label index,
196  const labelUList& mapAddressing,
197  const label newStart
198  ) const
199  {
200  return autoPtr<polyPatch>
201  (
203  (
204  *this,
205  bm,
206  index,
207  mapAddressing,
208  newStart
209  )
210  );
211  }
212 
213 
214  //- Destructor
215  virtual ~cyclicACMIPolyPatch();
216 
217 
218  // Member Functions
219 
220  // Access
221 
222  //- Reset the updated flag
223  inline void setUpdated(bool flag) const;
224 
225  //- Return access to the updated flag
226  inline bool updated() const;
227 
228  //- Return a reference to the neighbour patch
229  virtual const cyclicACMIPolyPatch& nbrPatch() const;
230 
231  //- Non-overlapping patch name
232  inline const word& nonOverlapPatchName() const;
233 
234  //- Non-overlapping patch ID
235  virtual label nonOverlapPatchID() const;
236 
237  //- Return a const reference to the non-overlapping patch
238  inline const polyPatch& nonOverlapPatch() const;
239 
240  //- Return a reference to the non-overlapping patch
241  inline polyPatch& nonOverlapPatch();
242 
243  //- Mask field where 1 = overlap, 0 = no-overlap
244  inline const scalarField& mask() const;
245 
246  //- Overlap tolerance
247  inline static scalar tolerance();
248 
249 
250  //- Initialize ordering for primitivePatch. Does not
251  // refer to *this (except for name() and type() etc.)
252  virtual void initOrder
253  (
255  const primitivePatch&
256  ) const;
257 
258  //- Return new ordering for primitivePatch.
259  // Ordering is -faceMap: for every face
260  // index of the new face -rotation:for every new face the clockwise
261  // shift of the original face. Return false if nothing changes
262  // (faceMap is identity, rotation is 0), true otherwise.
263  virtual bool order
264  (
266  const primitivePatch&,
268  labelList& rotation
269  ) const;
270 
271  //- Write the polyPatch data as a dictionary
272  virtual void write(Ostream&) const;
273 };
274 
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 } // End namespace Foam
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #include "cyclicACMIPolyPatchI.H"
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 #endif
287 
288 // ************************************************************************* //
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
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
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 void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
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.
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.
Cyclic patch for Arbitrary Mesh Interface (AMI)
cyclicACMIPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from (base couped patch) components.
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:54
TypeName("cyclicACMI")
Runtime type information.
virtual bool order(PstreamBuffers &, const primitivePatch &, labelList &faceMap, labelList &rotation) const
Return new ordering for primitivePatch.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
const scalarField & mask() const
Mask field where 1 = overlap, 0 = no-overlap.
virtual const cyclicACMIPolyPatch & nbrPatch() const
Return a reference to the neighbour patch.
virtual void resetAMI() const
Reset the AMI interpolator.
const word & nbrPatchName() const
Neighbour patch name.
virtual ~cyclicACMIPolyPatch()
Destructor.
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.