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-2018 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  //- Fraction of face area below which face is considered disconnected
61  static const scalar tolerance_;
62 
63  //- Name of non-overlapping patch
64  const word nonOverlapPatchName_;
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  // Protected Member Functions
82 
83  //- Reset the AMI interpolator
84  virtual void resetAMI() const;
85 
86  //- Initialise the calculation of the patch geometry
87  virtual void initGeometry(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,
117  );
118 
119  //- Construct from dictionary
121  (
122  const word& name,
123  const dictionary& dict,
124  const label index,
125  const polyBoundaryMesh& bm,
126  const word& patchType
127  );
128 
129  //- Construct as copy, resetting the boundary mesh
131  (
132  const cyclicACMIPolyPatch&,
133  const polyBoundaryMesh&
134  );
135 
136  //- Construct given the original patch and resetting the
137  // face list and boundary mesh information
139  (
140  const cyclicACMIPolyPatch& pp,
141  const polyBoundaryMesh& bm,
142  const label index,
143  const label newSize,
144  const label newStart,
145  const word& nbrPatchName,
146  const word& nonOverlapPatchName
147  );
148 
149  //- Construct given the original patch and a map
151  (
152  const cyclicACMIPolyPatch& pp,
153  const polyBoundaryMesh& bm,
154  const label index,
155  const labelUList& mapAddressing,
156  const label newStart
157  );
158 
159 
160  //- Construct and return a clone, resetting the boundary mesh
161  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
162  {
163  return autoPtr<polyPatch>(new cyclicACMIPolyPatch(*this, bm));
164  }
165 
166  //- Construct and return a clone, resetting the face list
167  // and boundary mesh
169  (
170  const polyBoundaryMesh& bm,
171  const label index,
172  const label newSize,
173  const label newStart
174  ) const
175  {
176  return autoPtr<polyPatch>
177  (
179  (
180  *this,
181  bm,
182  index,
183  newSize,
184  newStart,
185  neighbPatchName(),
186  nonOverlapPatchName_
187  )
188  );
189  }
190 
191  //- Construct and return a clone, resetting the face list
192  // and boundary mesh
194  (
195  const polyBoundaryMesh& bm,
196  const label index,
197  const labelUList& mapAddressing,
198  const label newStart
199  ) const
200  {
201  return autoPtr<polyPatch>
202  (
204  (
205  *this,
206  bm,
207  index,
208  mapAddressing,
209  newStart
210  )
211  );
212  }
213 
214 
215  //- Destructor
216  virtual ~cyclicACMIPolyPatch();
217 
218 
219  // Member Functions
220 
221  // Access
222 
223  //- Reset the updated flag
224  inline void setUpdated(bool flag) const;
225 
226  //- Return access to the updated flag
227  inline bool updated() const;
228 
229  //- Return a reference to the neighbour patch
230  virtual const cyclicACMIPolyPatch& neighbPatch() const;
231 
232  //- Non-overlapping patch name
233  inline const word& nonOverlapPatchName() const;
234 
235  //- Non-overlapping patch ID
236  virtual label nonOverlapPatchID() const;
237 
238  //- Return a const reference to the non-overlapping patch
239  inline const polyPatch& nonOverlapPatch() const;
240 
241  //- Return a reference to the non-overlapping patch
242  inline polyPatch& nonOverlapPatch();
243 
244  //- Mask field where 1 = overlap, 0 = no-overlap
245  inline const scalarField& mask() const;
246 
247  //- Overlap tolerance
248  inline static scalar tolerance();
249 
250 
251  //- Calculate the patch geometry
252  virtual void calcGeometry
253  (
254  const primitivePatch& referPatch,
255  const pointField& thisCtrs,
256  const vectorField& thisAreas,
257  const pointField& thisCc,
258  const pointField& nbrCtrs,
259  const vectorField& nbrAreas,
260  const pointField& nbrCc
261  );
262 
263  //- Initialize ordering for primitivePatch. Does not
264  // refer to *this (except for name() and type() etc.)
265  virtual void initOrder
266  (
268  const primitivePatch&
269  ) const;
270 
271  //- Return new ordering for primitivePatch.
272  // Ordering is -faceMap: for every face
273  // index of the new face -rotation:for every new face the clockwise
274  // shift of the original face. Return false if nothing changes
275  // (faceMap is identity, rotation is 0), true otherwise.
276  virtual bool order
277  (
279  const primitivePatch&,
281  labelList& rotation
282  ) const;
283 
284  //- Write the polyPatch data as a dictionary
285  virtual void write(Ostream&) const;
286 };
287 
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 } // End namespace Foam
292 
293 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
294 
295 #include "cyclicACMIPolyPatchI.H"
296 
297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
298 
299 #endif
300 
301 // ************************************************************************* //
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:137
virtual const scalarField & tgtMask() const
Return the mask/weighting for the target patch.
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:61
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 autoPtr< polyPatch > clone(const polyBoundaryMesh &bm) const
Construct and return a clone, resetting the boundary mesh.
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.