polyMeshTetDecomposition.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2019 OpenFOAM Foundation
9  Copyright (C) 2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::polyMeshTetDecomposition
29 
30 Description
31  Tools for performing the minimum decomposition of faces of the
32  mesh into triangles so that the cells may be tet decomposed.
33  Includes functions for finding variable face starting (base)
34  points on each face to avoid the decomposition of cells into tets
35  that have negative or zero volume.
36 
37 SourceFiles
38  polyMeshTetDecomposition.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef polyMeshTetDecomposition_H
43 #define polyMeshTetDecomposition_H
44 
45 #include "polyMesh.H"
46 #include "coupledPolyPatch.H"
47 #include "syncTools.H"
48 #include "tetPointRef.H"
49 #include "tetIndices.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class polyMeshTetDecomposition Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62 public:
63 
64  // Static Data Members
65 
66  //- Minimum tetrahedron quality
67  static const scalar minTetQuality;
68 
69 
70  // Member Functions
71 
72  //- Given a face and cc and starting index for triangulation determine
73  //- the worst tet quality.
74  static scalar minQuality
75  (
76  const polyMesh& mesh,
77  const point& cC,
78  const label fI,
79  const bool isOwner,
80  const label faceBasePtI
81  );
82 
83  //- Given a face and starting index for triangulation determine
84  //- the worst tet quality (owner or neighbour)
85  static scalar minQuality
86  (
87  const polyMesh& mesh,
88  const label facei,
89  const label faceBasePtI
90  );
91 
92  //- Find the first suitable base point to use for a minimum
93  // triangle decomposition of the face, suiting owner and
94  // neighbour cells. Finds the first base point on the face
95  // whose worst quality tet from either cell is better than
96  // tolerance. Neighbour cell centre supplied. For coupled
97  // patches.
98  static label findSharedBasePoint
99  (
100  const polyMesh& mesh,
101  label fI,
102  const point& nCc,
103  scalar tol,
104  bool report = false
105  );
106 
107  //- As for findSharedBasePoint, but using neighbour cell
108  // centre from the mesh. For internal faces.
109  static label findSharedBasePoint
110  (
111  const polyMesh& mesh,
112  label fI,
113  scalar tol,
114  bool report = false
115  );
116 
117  //- Find the base point to use for a minimum triangle
118  // decomposition of the face, using only the owner
119  // information. For non-coupled boundary faces.
120  static label findBasePoint
121  (
122  const polyMesh& mesh,
123  label fI,
124  scalar tol,
125  bool report = false
126  );
127 
128  //- Find a suitable base point for each face for decomposition
129  //- into tets
131  (
132  const polyMesh& mesh,
133  scalar tol = minTetQuality,
134  bool report = false
135  );
136 
137  //- Check face-decomposition tet volume
138  static bool checkFaceTets
139  (
140  const polyMesh& mesh,
141  scalar tol = minTetQuality,
142  const bool report = false,
143  labelHashSet* setPtr = nullptr
144  );
145 
146  //- Return the tet decomposition of the given face, with
147  // respect to the given cell
149  (
150  const polyMesh& mesh,
151  label fI,
152  label cI
153  );
154 
155  //- Return the tet decomposition of the given cell, see
156  // findFacePt for the meaning of the indices
158  (
159  const polyMesh& mesh,
160  label cI
161  );
162 
163  //- Find the tet decomposition of the cell containing the given point
164  static tetIndices findTet
165  (
166  const polyMesh& mesh,
167  label cI,
168  const point& pt
169  );
170 
171 
172  //- Return an adjusted list of tet base points
174  (
175  const polyMesh& mesh,
176  const bool report = false
177  );
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #endif
188 
189 // ************************************************************************* //
Foam::polyMeshTetDecomposition::checkFaceTets
static bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=nullptr)
Check face-decomposition tet volume.
Definition: polyMeshTetDecomposition.C:384
Foam::polyMeshTetDecomposition::minTetQuality
static const scalar minTetQuality
Minimum tetrahedron quality.
Definition: polyMeshTetDecomposition.H:66
Foam::polyMeshTetDecomposition
Tools for performing the minimum decomposition of faces of the mesh into triangles so that the cells ...
Definition: polyMeshTetDecomposition.H:59
Foam::polyMeshTetDecomposition::findFaceBasePts
static labelList findFaceBasePts(const polyMesh &mesh, scalar tol=minTetQuality, bool report=false)
Definition: polyMeshTetDecomposition.C:225
tetPointRef.H
polyMesh.H
Foam::HashSet< label, Hash< label > >
syncTools.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::polyMeshTetDecomposition::findSharedBasePoint
static label findSharedBasePoint(const polyMesh &mesh, label fI, const point &nCc, scalar tol, bool report=false)
Find the first suitable base point to use for a minimum.
Definition: polyMeshTetDecomposition.C:134
Foam::polyMeshTetDecomposition::findBasePoint
static label findBasePoint(const polyMesh &mesh, label fI, scalar tol, bool report=false)
Find the base point to use for a minimum triangle.
Definition: polyMeshTetDecomposition.C:189
coupledPolyPatch.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::polyMeshTetDecomposition::findTet
static tetIndices findTet(const polyMesh &mesh, label cI, const point &pt)
Find the tet decomposition of the cell containing the given point.
Definition: polyMeshTetDecomposition.C:595
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::polyMeshTetDecomposition::adjustTetBasePtIs
static labelList adjustTetBasePtIs(const polyMesh &mesh, const bool report=false)
Return an adjusted list of tet base points.
Definition: polyMeshTetDecomposition.C:637
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:83
Foam::Vector< scalar >
Foam::List< label >
Foam::polyMeshTetDecomposition::cellTetIndices
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
Definition: polyMeshTetDecomposition.C:566
Foam::polyMeshTetDecomposition::minQuality
static scalar minQuality(const polyMesh &mesh, const point &cC, const label fI, const bool isOwner, const label faceBasePtI)
Definition: polyMeshTetDecomposition.C:42
tetIndices.H
Foam::polyMeshTetDecomposition::faceTetIndices
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.
Definition: polyMeshTetDecomposition.C:542