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 rays engine up to date?
72  mutable bool raysIsValid_;
73 
74  //- Patch-to-patch rays 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 and return a clone, resetting the boundary mesh
166  virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
167  {
168  return autoPtr<polyPatch>
169  (
170  new nonConformalCyclicPolyPatch(*this, bm)
171  );
172  }
173 
174  //- Construct and return a clone, resetting the face list
175  // and boundary mesh
176  virtual autoPtr<polyPatch> clone
177  (
178  const polyBoundaryMesh& bm,
179  const label index,
180  const label newSize,
181  const label newStart
182  ) const
183  {
184  return autoPtr<polyPatch>
185  (
187  (
188  *this,
189  bm,
190  index,
191  newSize,
192  newStart,
193  nbrPatchName(),
194  origPatchName()
195  )
196  );
197  }
198 
199 
200  //- Destructor
202 
203 
204  // Member Functions
205 
206  //- Neighbour patch
207  const nonConformalCyclicPolyPatch& nbrPatch() const;
208 
209  //- Inherit the cyclic owner method
211 
212  //- Inherit the cyclic neighbour method
214 
215  //- Inherit the cyclic transform method
217 
218  //- Is this patch coupled? Returns false. For NCC patches the poly
219  // mesh is considered non-coupled whilst the finite volume mesh is
220  // considered coupled.
221  virtual bool coupled() const;
222 
223  //- Access the intersection engine
225 
226  //- Access the rays engine
227  const patchToPatches::rays& rays() const;
228 
229  //- Compute a ray intersection across the coupling
230  remote ray
231  (
232  const scalar fraction,
233  const label origFacei,
234  const vector& p,
235  const vector& n,
236  point& nbrP
237  ) const;
238 
239  //- Write the polyPatch data as a dictionary
240  virtual void write(Ostream&) const;
241 };
242 
243 
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
245 
246 } // End namespace Foam
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 #endif
251 
252 // ************************************************************************* //
label n
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
autoPtr< PrimitivePatch< SubList< face >, const pointField & > > clone() const
Construct and return a clone.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
label size() const
Return the number of elements in the UList.
Definition: UListI.H:311
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Cyclic plane patch.
virtual bool owner() const
Does this side own the patch ?
const word & nbrPatchName() const
Neighbour patch name.
virtual const transformer & transform() const
Return transformation between the coupled patches.
virtual bool neighbour() const
Does the coupled side own the patch ?
Cyclic plane transformation.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Non-conformal coupled poly patch. As nonConformalPolyPatch, but this patch is coupled to another non-...
Non-conformal cyclic poly patch. As nonConformalCoupledPolyPatch, but the neighbouring patch is local...
patchToPatches::intersection intersection_
Patch-to-patch intersection engine.
TypeName("nonConformalCyclic")
Runtime type information.
virtual void initMovePoints(PstreamBuffers &pBufs, const pointField &)
Initialise the patches for moving points.
patchToPatches::rays rays_
Patch-to-patch rays engine.
virtual void write(Ostream &) const
Write the polyPatch data as a dictionary.
remote 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 rename(const wordList &newNames)
Reset the patch name.
virtual void clearGeom()
Clear geometry.
bool intersectionIsValid_
Is the intersection engine up to date?
virtual void calcGeometry(PstreamBuffers &)
Calculate the patch geometry.
const patchToPatches::rays & rays() const
Access the rays engine.
virtual void reorder(const labelUList &newToOldIndex)
Reset the patch index.
nonConformalCyclicPolyPatch(const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm, const word &patchType)
Construct from components.
virtual void initCalcGeometry(PstreamBuffers &)
Initialise the calculation of the patch geometry.
virtual const transformer & transform() const
Inherit the cyclic transform method.
virtual bool coupled() const
Is this patch coupled? Returns false. For NCC patches the poly.
const patchToPatches::intersection & intersection() const
Access the intersection engine.
bool raysIsValid_
Is the rays engine up to date?
const nonConformalCyclicPolyPatch & nbrPatch() const
Neighbour patch.
virtual void initTopoChange(PstreamBuffers &)
Initialise the update of the patch topology.
const word & origPatchName() const
Original patch name.
label index() const
Return the index of this patch in the boundaryMesh.
const word & name() const
Return name.
Class to generate patchToPatch coupling geometry. A full geometric intersection is done between a fac...
Foam::polyBoundaryMesh.
label start() const
Return start label of this patch in the polyMesh face list.
Definition: polyPatch.H:280
Struct for keeping processor, element (cell, face, point) index.
Definition: remote.H:57
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
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
dictionary dict
volScalarField & p