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