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 | Copyright (C) 2012-2016 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 mapPolyMesh;
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  //- Disallow default bitwise copy construct
131 
132  //- Disallow default bitwise assignment
133  void operator=(const tetDecomposer&);
134 
135 
136 public:
137 
138  //- Runtime type information
139  ClassName("tetDecomposer");
140 
141 
142  // Constructors
143 
144  //- Construct from mesh
145  tetDecomposer(const polyMesh&);
146 
147 
148  // Member Functions
149 
150  // Access
151 
152  //- From cell to tet point
153  const labelList& cellToPoint() const
154  {
155  return cellToPoint_;
156  }
157 
158  //- From face to tet point
159  const labelList& faceToPoint() const
160  {
161  return faceToPoint_;
162  }
163 
164 
165  //- Per face, per point (faceCentre) or triangle (faceDiag)
166  // the added tet on the owner side
167  const labelListList& faceOwnerCells() const
168  {
169  return faceOwnerCells_;
170  }
171 
172  //- Per face, per point (faceCentre) or triangle (faceDiag)
173  // the added tet on the neighbour side
174  const labelListList& faceNeighbourCells() const
175  {
176  return faceNeighbourCells_;
177  }
178 
179 
180  // Edit
181 
182  //- Insert all changes into meshMod to convert the polyMesh into
183  // tets.
184  void setRefinement
185  (
186  const decompositionType decomposeType,
187  polyTopoChange& meshMod
188  );
189 
190  //- Force recalculation of locally stored data on topological change
191  void updateMesh(const mapPolyMesh&);
192 };
193 
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 } // End namespace Foam
198 
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 
201 #endif
202 
203 // ************************************************************************* //
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
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.
Decomposes polyMesh into tets.
Definition: tetDecomposer.H:57
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
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.
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:74
const labelList & faceToPoint() const
From face to tet point.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
const labelListList & faceOwnerCells() const
Per face, per point (faceCentre) or triangle (faceDiag)
Namespace for OpenFOAM.