nonConformalBoundary.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) 2022-2023 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::nonConformalBoundary
26 
27 Description
28  Mesh object that stores an all boundary patch and mapping to and from it
29  and the mesh and the individual patches
30 
31 SourceFiles
32  nonConformalBoundary.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef nonConformalBoundary_H
37 #define nonConformalBoundary_H
38 
39 #include "DemandDrivenMeshObject.H"
40 #include "polyMesh.H"
41 #include "indirectPrimitivePatch.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class nonConformalCoupledPolyPatch;
49 
50 /*---------------------------------------------------------------------------*\
51  Class nonConformalBoundary Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 :
57  <
58  polyMesh,
59  MoveableMeshObject,
60  nonConformalBoundary
61  >
62 {
63  // Private Data
64 
65  //- Primitive patch of the owner-orig boundary
66  indirectPrimitivePatch ownerOrigBoundary_;
67 
68  //- A map from owner-orig boundary point to mesh point
69  mutable autoPtr<labelList> meshPointOwnerOrigBoundaryPointPtr_;
70 
71  //- A map from owner-orig boundary point to mesh point
72  mutable autoPtr<labelList> ownerOrigBoundaryPointMeshPointPtr_;
73 
74  //- A map from owner-orig boundary edge to mesh edge
75  mutable autoPtr<labelList> ownerOrigBoundaryEdgeMeshEdgePtr_;
76 
77  //- Owner-orig boundary edges, referring to boundary points
78  mutable autoPtr<edgeList> ownerOrigBoundaryEdgesPtr_;
79 
80  //- Owner-orig boundary edges, referring to mesh points
81  mutable autoPtr<edgeList> ownerOrigBoundaryMeshEdgesPtr_;
82 
83  //- A map from patch point to owner-orig boundary points
84  mutable PtrList<labelList> patchPointOwnerOrigBoundaryPointsPtr_;
85 
86  //- A map from patch edge to owner-orig boundary edge
87  mutable PtrList<labelList> patchEdgeOwnerOrigBoundaryEdgesPtr_;
88 
89  //- Point normals for the owner-orig boundary
90  mutable autoPtr<vectorField> ownerOrigBoundaryPointNormalsPtr_;
91 
92  //- Old point normals for the owner-orig boundary
93  mutable autoPtr<vectorField> ownerOrigBoundaryPointNormals0Ptr_;
94 
95 
96  // Private Member Functions
97 
98  //- Construct a boundary for the given patch set
99  indirectPrimitivePatch boundary(const labelList& patches) const;
100 
101  //- Simple wrapper for a type and a method
102  template<class Type, class Method>
103  struct TypeMethod;
104 
105  //- Helper to construct a type-method
106  template<class Type, class Method>
107  static TypeMethod<Type, Method> typeMethod(const Method& method);
108 
109  //- Construct a list of non-conformal non-coupled patch indices
110  template<class ... NcPpTypeMethods>
111  labelList nonConformalOtherPatchIndices
112  (
113  const label side,
114  NcPpTypeMethods ... typeMethods
115  ) const;
116 
117  //- Construct a list of non-conformal non-coupled patch indices. Helper
118  // for the above overload.
119  template<class NcPpType, class NcPpMethod, class ... NcPpTypeMethods>
120  void nonConformalOtherPatchIndices
121  (
122  labelHashSet& origPatchIDTable,
123  DynamicList<label>& nonCoupledPatchIndices,
124  const label side,
125  const TypeMethod<NcPpType, NcPpMethod>& typeMethod,
126  NcPpTypeMethods ... typeMethods
127  ) const;
128 
129  //- Construct a list of non-conformal non-coupled patch indices. Helper
130  // for the above overload.
131  void nonConformalOtherPatchIndices
132  (
133  labelHashSet& origPatchIDTable,
134  DynamicList<label>& nonCoupledPatchIndices,
135  const label side
136  ) const;
137 
138  //- Get a map from mesh point to owner-orig boundary points. Non
139  // owner-orig boundary points are indicated by the value -1.
140  const labelList& meshPointOwnerOrigBoundaryPoint() const;
141 
142  //- Get point normals for the owner-orig boundary
143  const vectorField& ownerOrigBoundaryPointNormals() const;
144 
145  //- Get old point normals for the owner-orig boundary
146  const vectorField& ownerOrigBoundaryPointNormals0() const;
147 
148 
149 protected:
150 
151  friend class DemandDrivenMeshObject
152  <
153  polyMesh,
156  >;
157 
158  // Protected Constructors
159 
160  //- Construct from mesh
161  explicit nonConformalBoundary(const polyMesh& mesh);
162 
163 
164 public:
165 
166  //- Runtime type information
167  TypeName("nonConformalBoundary");
168 
169 
170  // Constructors
171 
172  //- Disallow default bitwise copy construction
174 
175 
176  //- Destructor
178 
179 
180  // Member Functions
181 
182  //- Update for mesh motion
183  virtual bool movePoints();
184 
185  //- Return a list of the orig patch indices
187 
188  //- Return a list of the error patch indices
190 
191  //- Return a list of the owner-orig patch indices
193 
194  //- Return a list of the owner error patch indices
196 
197  //- Get a map from owner-orig boundary point to mesh point
199 
200  //- Get a map from owner-orig boundary edge to mesh edge
202 
203  //- Get the owner-orig boundary edges, referring to boundary points
204  const edgeList& ownerOrigBoundaryEdges() const;
205 
206  //- Get the owner-orig boundary edges, referring to mesh points
207  const edgeList& ownerOrigBoundaryMeshEdges() const;
208 
209  //- Get a map from patch point to owner-orig boundary point
211  (
212  const label patchi
213  ) const;
214 
215  //- Get a map from patch edge to owner-orig boundary edge
217  (
218  const label patchi
219  ) const;
220 
221  //- Get parallel consistent point normals for the patch
223 
224  //- Get parallel consistent old-time point normals for the patch
226 
227 
228  // Member Operators
229 
230  //- Disallow default bitwise assignment
231  void operator=(const nonConformalBoundary&) = delete;
232 };
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Mesh object that stores an all boundary patch and mapping to and from it and the mesh and the individ...
labelList ownerOrigPatchIndices() const
Return a list of the owner-orig patch indices.
labelList ownerErrorPatchIndices() const
Return a list of the owner error patch indices.
virtual bool movePoints()
Update for mesh motion.
TypeName("nonConformalBoundary")
Runtime type information.
const edgeList & ownerOrigBoundaryMeshEdges() const
Get the owner-orig boundary edges, referring to mesh points.
tmp< vectorField > patchPointNormals(const label patchi) const
Get parallel consistent point normals for the patch.
labelList allOrigPatchIndices() const
Return a list of the orig patch indices.
const labelList & patchEdgeOwnerOrigBoundaryEdges(const label patchi) const
Get a map from patch edge to owner-orig boundary edge.
nonConformalBoundary(const polyMesh &mesh)
Construct from mesh.
const labelList & ownerOrigBoundaryEdgeMeshEdge() const
Get a map from owner-orig boundary edge to mesh edge.
const labelList & patchPointOwnerOrigBoundaryPoints(const label patchi) const
Get a map from patch point to owner-orig boundary point.
labelList allErrorPatchIndices() const
Return a list of the error patch indices.
tmp< vectorField > patchPointNormals0(const label patchi) const
Get parallel consistent old-time point normals for the patch.
void operator=(const nonConformalBoundary &)=delete
Disallow default bitwise assignment.
const labelList & ownerOrigBoundaryPointMeshPoint() const
Get a map from owner-orig boundary point to mesh point.
const edgeList & ownerOrigBoundaryEdges() const
Get the owner-orig boundary edges, referring to boundary points.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for managing temporary objects.
Definition: tmp.H:55
label patchi
const fvPatchList & patches
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
Simple wrapper for a type and a method.