nonConformalCyclicPolyPatch.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) 2021-2022 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::nonConformalCyclicPolyPatch
26 
27 Description
28  Non-conformal cyclic poly patch. As nonConformalCoupledPolyPatch, but the
29  neighbouring patch is local and known and is made available by this class.
30 
31 See also
32  Foam::nonConformalCoupledPolyPatch
33 
34 SourceFiles
35  nonConformalCyclicPolyPatch.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef nonConformalCyclicPolyPatch_H
40 #define nonConformalCyclicPolyPatch_H
41 
42 #include "cyclicPolyPatch.H"
45 #include "raysPatchToPatch.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class nonConformalCyclicPolyPatch Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public cyclicPolyPatch,
60 {
61 protected:
62 
63  // Protected data
64 
65  //- Is the intersection engine up to date?
66  mutable bool intersectionIsValid_;
67 
68  //- Patch-to-patch intersection engine
70 
71  //- Is the intersection engine up to date?
72  mutable bool raysIsValid_;
73 
74  //- Patch-to-patch intersection engine
76 
77 
78  // Protected Member Functions
79 
80  //- Initialise the calculation of the patch geometry
81  virtual void initCalcGeometry(PstreamBuffers&);
82 
83  //- Calculate the patch geometry
84  virtual void calcGeometry(PstreamBuffers&);
85 
86  //- Initialise the patches for moving points
87  virtual void initMovePoints(PstreamBuffers& pBufs, const pointField&);
88 
89  //- Initialise the update of the patch topology
90  virtual void initTopoChange(PstreamBuffers&);
91 
92  //- Clear geometry
93  virtual void clearGeom();
94 
95  //- Reset the patch name
96  virtual void rename(const wordList& newNames);
97 
98  //- Reset the patch index
99  virtual void reorder(const labelUList& newToOldIndex);
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("nonConformalCyclic");
106 
107 
108  // Constructors
109 
110  //- Construct from components
112  (
113  const word& name,
114  const label size,
115  const label start,
116  const label index,
117  const polyBoundaryMesh& bm,
118  const word& patchType
119  );
120 
121  //- Construct from components
123  (
124  const word& name,
125  const label size,
126  const label start,
127  const label index,
128  const polyBoundaryMesh& bm,
129  const word& patchType,
130  const word& nbrPatchName,
131  const word& origPatchName,
133  );
134 
135  //- Construct from dictionary
137  (
138  const word& name,
139  const dictionary& dict,
140  const label index,
141  const polyBoundaryMesh& bm,
142  const word& patchType
143  );
144 
145  //- Construct as copy, resetting the boundary mesh
147  (
149  const polyBoundaryMesh&
150  );
151 
152  //- Construct given the original patch and resetting the
153  // face list and boundary mesh information
155  (
156  const nonConformalCyclicPolyPatch& pp,
157  const polyBoundaryMesh& bm,
158  const label index,
159  const label newSize,
160  const label newStart,
161  const word& nbrPatchName,
162  const word& origPatchName
163  );
164 
165  //- Construct given the original patch and a map
167  (
168  const nonConformalCyclicPolyPatch& pp,
169  const polyBoundaryMesh& bm,
170  const label index,
171  const labelUList& mapAddressing,
172  const label newStart
173  );
174 
175  //- Construct and return a clone, resetting the boundary mesh
176  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
177  {
178  return autoPtr<polyPatch>
179  (
180  new nonConformalCyclicPolyPatch(*this, bm)
181  );
182  }
183 
184  //- Construct and return a clone, resetting the face list
185  // and boundary mesh
187  (
188  const polyBoundaryMesh& bm,
189  const label index,
190  const label newSize,
191  const label newStart
192  ) const
193  {
194  return autoPtr<polyPatch>
195  (
197  (
198  *this,
199  bm,
200  index,
201  newSize,
202  newStart,
203  nbrPatchName(),
204  origPatchName()
205  )
206  );
207  }
208 
209  //- Construct and return a clone, resetting the face list
210  // and boundary mesh
212  (
213  const polyBoundaryMesh& bm,
214  const label index,
215  const labelUList& mapAddressing,
216  const label newStart
217  ) const
218  {
219  return autoPtr<polyPatch>
220  (
222  (
223  *this,
224  bm,
225  index,
226  mapAddressing,
227  newStart
228  )
229  );
230  }
231 
232 
233  //- Destructor
235 
236 
237  // Member Functions
238 
239  //- Neighbour patch
240  const nonConformalCyclicPolyPatch& nbrPatch() const;
241 
242  //- Inherit the cyclic owner method
244 
245  //- Inherit the cyclic neighbour method
247 
248  //- Inherit the cyclic transform method
250 
251  //- Is this patch coupled? Returns false. For NCC patches the poly
252  // mesh is considered non-coupled whilst the finite volume mesh is
253  // considered coupled.
254  virtual bool coupled() const;
255 
256  //- Access the intersection engine
258 
259  //- Access the rays engine
260  const patchToPatches::rays& rays() const;
261 
262  //- Compute a ray intersection across the coupling
264  (
265  const scalar fraction,
266  const label origFacei,
267  const vector& p,
268  const vector& n,
269  point& nbrP
270  ) const;
271 
272  //- Write the polyPatch data as a dictionary
273  virtual void write(Ostream&) const;
274 };
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #endif
284 
285 // ************************************************************************* //
dictionary dict
Non-conformal coupled poly patch. As nonConformalPolyPatch, but this patch is coupled to another non-...
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Structure to conveniently store processor and face indices.
Definition: patchToPatch.H:60
const patchToPatches::intersection & intersection() const
Access the intersection engine.
const word & origPatchName() const
Original patch name.
const transformer & transform() const
Return transformation between the coupled patches.
const word & nbrPatchName() const
Neighbour patch name.
patchToPatches::rays rays_
Patch-to-patch intersection engine.
virtual const transformer & transform() const
Return transformation between the coupled patches.
Class to generate patchToPatch coupling geometry. A full geometric intersection is done between a fac...
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual bool owner() const
Does this side own the patch ?
A class for handling words, derived from string.
Definition: word.H:59
patchToPatches::intersection intersection_
Patch-to-patch intersection engine.
Cyclic plane patch.
patchToPatch::procFace ray(const scalar fraction, const label origFacei, const vector &p, const vector &n, point &nbrP) const
Compute a ray intersection across the coupling.
virtual void clearGeom()
Clear geometry.
Non-conformal cyclic poly patch. As nonConformalCoupledPolyPatch, but the neighbouring patch is local...
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.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
virtual bool neighbour() const
Does the coupled side own the patch ?
bool intersectionIsValid_
Is the intersection engine up to date?
TypeName("nonConformalCyclic")
Runtime type information.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
autoPtr< PrimitivePatch< FaceList, PointField > > clone() const
Construct and return a clone.
bool raysIsValid_
Is the intersection engine up to date?
const nonConformalCyclicPolyPatch & nbrPatch() const
Neighbour patch.
label n
virtual bool coupled() const
Is this patch coupled? Returns false. For NCC patches the poly.
virtual void rename(const wordList &newNames)
Reset the patch name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Cyclic plane transformation.
volScalarField & p
nonConformalCyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
Namespace for OpenFOAM.
const patchToPatches::rays & rays() const
Access the rays engine.