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 Foam_polyMeshTetDecomposition_H
43 #define Foam_polyMeshTetDecomposition_H
44 
45 #include "polyMesh.H"
46 #include "coupledPolyPatch.H"
47 #include "syncTools.H"
48 #include "tetIndices.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 /*---------------------------------------------------------------------------*\
56  Class polyMeshTetDecomposition Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 {
61 public:
62 
63  // Static Data Members
64 
65  //- Minimum tetrahedron quality
66  static const scalar minTetQuality;
67 
68 
69  // Member Functions
70 
71  //- Given a face and cc and starting index for triangulation determine
72  //- the worst tet quality.
73  static scalar minQuality
74  (
75  const polyMesh& mesh,
76  const point& cC,
77  const label fI,
78  const bool isOwner,
79  const label faceBasePtI
80  );
81 
82  //- Given a face and starting index for triangulation determine
83  //- the worst tet quality (owner or neighbour)
84  static scalar minQuality
85  (
86  const polyMesh& mesh,
87  const label facei,
88  const label faceBasePtI
89  );
90 
91  //- Find the first suitable base point to use for a minimum
92  // triangle decomposition of the face, suiting owner and
93  // neighbour cells. Finds the first base point on the face
94  // whose worst quality tet from either cell is better than
95  // tolerance. Neighbour cell centre supplied. For coupled
96  // patches.
97  static label findSharedBasePoint
98  (
99  const polyMesh& mesh,
100  label fI,
101  const point& nCc,
102  scalar tol,
103  bool report = false
104  );
105 
106  //- As for findSharedBasePoint, but using neighbour cell
107  // centre from the mesh. For internal faces.
108  static label findSharedBasePoint
109  (
110  const polyMesh& mesh,
111  label fI,
112  scalar tol,
113  bool report = false
114  );
115 
116  //- Find the base point to use for a minimum triangle
117  // decomposition of the face, using only the owner
118  // information. For non-coupled boundary faces.
119  static label findBasePoint
120  (
121  const polyMesh& mesh,
122  label fI,
123  scalar tol,
124  bool report = false
125  );
126 
127  //- Find a suitable base point for each face for decomposition
128  //- into tets
130  (
131  const polyMesh& mesh,
132  scalar tol = minTetQuality,
133  bool report = false
134  );
135 
136  //- Check face-decomposition tet volume
137  static bool checkFaceTets
138  (
139  const polyMesh& mesh,
140  scalar tol = minTetQuality,
141  const bool report = false,
142  labelHashSet* setPtr = nullptr
143  );
144 
145  //- Return the tet decomposition of the given face, with
146  // respect to the given cell
148  (
149  const polyMesh& mesh,
150  label fI,
151  label cI
152  );
153 
154  //- Return the tet decomposition of the given cell, see
155  // findFacePt for the meaning of the indices
157  (
158  const polyMesh& mesh,
159  label cI
160  );
161 
162  //- Find the tet decomposition of the cell containing the given point
163  static tetIndices findTet
164  (
165  const polyMesh& mesh,
166  label cI,
167  const point& pt
168  );
169 
170 
171  //- Return an adjusted list of tet base points
173  (
174  const polyMesh& mesh,
175  const bool report = false
176  );
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
static labelList findFaceBasePts(const polyMesh &mesh, scalar tol=minTetQuality, bool report=false)
Find a suitable base point for each face for decomposition into tets.
static scalar minQuality(const polyMesh &mesh, const point &cC, const label fI, const bool isOwner, const label faceBasePtI)
Given a face and cc and starting index for triangulation determine the worst tet quality.
static label findBasePoint(const polyMesh &mesh, label fI, scalar tol, bool report=false)
Find the base point to use for a minimum triangle.
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
static tetIndices findTet(const polyMesh &mesh, label cI, const point &pt)
Find the tet decomposition of the cell containing the given point.
static bool checkFaceTets(const polyMesh &mesh, scalar tol=minTetQuality, const bool report=false, labelHashSet *setPtr=nullptr)
Check face-decomposition tet volume.
dynamicFvMesh & mesh
static labelList adjustTetBasePtIs(const polyMesh &mesh, const bool report=false)
Return an adjusted list of tet base points.
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.
Tools for performing the minimum decomposition of faces of the mesh into triangles so that the cells ...
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:78
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
static const scalar minTetQuality
Minimum tetrahedron quality.
Namespace for OpenFOAM.
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.