tetDecomposer.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) 2012-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::tetDecomposer
29
30Description
31 Decomposes polyMesh into tets or pyramids.
32
33 Cells neighbouring decomposed cells are not decomposed themselves
34 so will be polyhedral.
35
36SourceFiles
37 tetDecomposer.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef tetDecomposer_H
42#define tetDecomposer_H
43
44#include "DynamicList.H"
45#include "bitSet.H"
46#include "boolList.H"
47#include "typeInfo.H"
48#include "Enum.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55class polyMesh;
56class polyTopoChange;
57class face;
58class mapPolyMesh;
59
60/*---------------------------------------------------------------------------*\
61 Class tetDecomposer Declaration
62\*---------------------------------------------------------------------------*/
64class tetDecomposer
65{
66public:
67
68 // Public data types
71 {
72 FACE_CENTRE_TRIS, //- Faces decomposed into triangles
73 // using face-centre
74 FACE_DIAG_TRIS, //- Faces decomposed into triangles diagonally
75 PYRAMID //- Faces not decomposed (generates pyramids)
76 };
78
79
80private:
81
82 // Private data
83
84 const polyMesh& mesh_;
85
86 //- From cell to tet point
87 labelList cellToPoint_;
88
89 //- From face to tet point
90 labelList faceToPoint_;
91
92
93 // Per face, per point (faceCentre) or triangle (faceDiag)
94 // the added tet on the owner side
95 labelListList faceOwnerCells_;
96
97 // Per face, per point (faceCentre) or triangle (faceDiag)
98 // the added tet on the neighbour side
99 labelListList faceNeighbourCells_;
100
101
102 // Private Member Functions
103
104 //- Modify a face
105 void modifyFace
106 (
107 polyTopoChange& meshMod,
108 const face& f,
109 const label facei,
110 const label own,
111 const label nei,
112 const label patchi,
113 const label zoneI,
114 const bool zoneFlip
115 ) const;
116
117 //- Add a face
118 void addFace
119 (
120 polyTopoChange& meshMod,
121 const face& f,
122 const label own,
123 const label nei,
124 const label masterPointID,
125 const label masterEdgeID,
126 const label masterFaceID,
127 const label patchi,
128 const label zoneI,
129 const bool zoneFlip
130 ) const;
131
132 //- Work out triangle index given the starting vertex in the face
133 label triIndex(const label facei, const label fp) const;
134
135 //- No copy construct
136 tetDecomposer(const tetDecomposer&) = delete;
137
138 //- No copy assignment
139 void operator=(const tetDecomposer&) = delete;
140
141
142public:
143
144 //- Runtime type information
145 ClassName("tetDecomposer");
146
147
148 // Constructors
149
150 //- Construct from mesh
151 tetDecomposer(const polyMesh&);
152
153
154 // Member Functions
155
156 // Access
157
158 //- From cell to tet point
159 const labelList& cellToPoint() const
160 {
161 return cellToPoint_;
162 }
163
164 //- From face to tet point (only for faceCentre)
165 const labelList& faceToPoint() const
166 {
167 return faceToPoint_;
168 }
169
170
171 //- Per face, per point (faceCentre) or triangle (faceDiag)
172 // the added tet on the owner side. For non-face (pyramid)
173 // size 1.
174 const labelListList& faceOwnerCells() const
175 {
176 return faceOwnerCells_;
177 }
178
179 //- Per face, per point (faceCentre) or triangle (faceDiag)
180 // the added tet on the neighbour side. For non-face (pyramid)
181 // size 1.
182 const labelListList& faceNeighbourCells() const
183 {
184 return faceNeighbourCells_;
185 }
186
187
188 // Edit
189
190 //- Insert all changes into meshMod to convert the polyMesh into
191 // tets.
192 void setRefinement
193 (
194 const decompositionType decomposeType,
195 const bitSet& decomposeCell,
196 polyTopoChange& meshMod
197 );
198
199 //- Force recalculation of locally stored data on topological change
200 void updateMesh(const mapPolyMesh&);
201};
202
203
204// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205
206} // End namespace Foam
207
208// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209
210#endif
211
212// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Definition: bitSet.H:66
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Direct mesh changes based on v1.3 polyTopoChange syntax.
Decomposes polyMesh into tets or pyramids.
Definition: tetDecomposer.H:64
const labelListList & faceNeighbourCells() const
Per face, per point (faceCentre) or triangle (faceDiag)
static const Enum< decompositionType > decompositionTypeNames
Definition: tetDecomposer.H:76
const labelList & faceToPoint() const
From face to tet point (only for faceCentre)
ClassName("tetDecomposer")
Runtime type information.
void setRefinement(const decompositionType decomposeType, const bitSet &decomposeCell, polyTopoChange &meshMod)
Insert all changes into meshMod to convert the polyMesh into.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
const labelList & cellToPoint() const
From cell to tet point.
const labelListList & faceOwnerCells() const
Per face, per point (faceCentre) or triangle (faceDiag)
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
Namespace for OpenFOAM.
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
labelList f(nPoints)