tetCreatorOctree.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "tetCreatorOctree.H"
29 #include "meshOctree.H"
30 #include "demandDrivenData.H"
31 
32 //#define DEBUGTets
33 
34 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 
36 namespace Foam
37 {
38 
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
42  {
43  { //- edge 0
44  meshOctreeCubeCoordinates(0, 0, 1, 0),
45  meshOctreeCubeCoordinates(0, -1, 1, 0),
46  meshOctreeCubeCoordinates(0, -1, 0, 0),
47  meshOctreeCubeCoordinates(0, 0, 0, 0)
48  },
49  { //- edge 1
50  meshOctreeCubeCoordinates(0, 0, 0, 0),
51  meshOctreeCubeCoordinates(0, -1, 0, 0),
52  meshOctreeCubeCoordinates(0, -1, -1, 0),
53  meshOctreeCubeCoordinates(0, 0, -1, 0)
54  },
55  { //- edge 2
56  meshOctreeCubeCoordinates(0, 1, 0, 0),
57  meshOctreeCubeCoordinates(0, 0, 0, 0),
58  meshOctreeCubeCoordinates(0, 0, -1, 0),
59  meshOctreeCubeCoordinates(0, 1, -1, 0)
60  },
61  { //- edge 3
62  meshOctreeCubeCoordinates(0, 1, 1, 0),
63  meshOctreeCubeCoordinates(0, 0, 1, 0),
64  meshOctreeCubeCoordinates(0, 0, 0, 0),
65  meshOctreeCubeCoordinates(0, 1, 0, 0)
66  },
67  { //- edge 4
68  meshOctreeCubeCoordinates(0, 0, 0, 0),
69  meshOctreeCubeCoordinates(0, 0, 1, 0),
70  meshOctreeCubeCoordinates(1, 0, 1, 0),
71  meshOctreeCubeCoordinates(1, 0, 0, 0)
72  },
73  { //- edge 5
74  meshOctreeCubeCoordinates(0, 0, -1, 0),
75  meshOctreeCubeCoordinates(0, 0, 0, 0),
76  meshOctreeCubeCoordinates(1, 0, 0, 0),
77  meshOctreeCubeCoordinates(1, 0, -1, 0)
78  },
79  { //- edge 6
80  meshOctreeCubeCoordinates(-1, 0, -1, 0),
81  meshOctreeCubeCoordinates(-1, 0, 0, 0),
82  meshOctreeCubeCoordinates(0, 0, 0, 0),
83  meshOctreeCubeCoordinates(0, 0, -1, 0)
84  },
85  { //- edge 7
86  meshOctreeCubeCoordinates(-1, 0, 0, 0),
87  meshOctreeCubeCoordinates(-1, 0, 1, 0),
88  meshOctreeCubeCoordinates(0, 0, 1, 0),
89  meshOctreeCubeCoordinates(0, 0, 0, 0)
90  },
91  { //- edge 8
92  meshOctreeCubeCoordinates(-1, 0, 0, 0),
93  meshOctreeCubeCoordinates(-1, -1, 0, 0),
94  meshOctreeCubeCoordinates(0, -1, 0, 0),
95  meshOctreeCubeCoordinates(0, 0, 0, 0)
96  },
97  { //- edge 9
98  meshOctreeCubeCoordinates(0, 0, 0, 0),
99  meshOctreeCubeCoordinates(0, -1, 0, 0),
100  meshOctreeCubeCoordinates(1, -1, 0, 0),
101  meshOctreeCubeCoordinates(1, 0, 0, 0)
102  },
103  { //- edge 10
104  meshOctreeCubeCoordinates(0, 1, 0, 0),
105  meshOctreeCubeCoordinates(0, 0, 0, 0),
106  meshOctreeCubeCoordinates(1, 0, 0, 0),
107  meshOctreeCubeCoordinates(1, 1, 0, 0)
108  },
109  { //- edge 11
110  meshOctreeCubeCoordinates(-1, 1, 0, 0),
111  meshOctreeCubeCoordinates(-1, 0, 0, 0),
112  meshOctreeCubeCoordinates(0, 0, 0, 0),
113  meshOctreeCubeCoordinates(0, 1, 0, 0)
114  }
115  };
116 
118  {
119  {3, 5, 2, 4},
120  {5, 1, 4, 0},
121  {1, 3, 0, 2}
122  };
123 
125 {
127 
129 
131 
133 
135 
136  clearOut();
137  sortedLeaves_.setSize(0);
138 
139  created_ = true;
140 }
141 
143 {
144  sortedLeaves_.clear();
148 }
149 
150 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
151 
152 // Construct from octree and mesh data
154 (
155  const meshOctree& octree,
156  const IOdictionary& meshDict
157 )
158 :
159  octreeCheck_(octree, meshDict, true),
160  tetPoints_(),
161  tets_(),
162  sortedLeaves_(),
163  subNodeLabelsPtr_(NULL),
164  cubeLabelPtr_(NULL),
165  faceCentreLabelPtr_(NULL),
166  created_(false)
167 {
168  createTets();
169 
170  clearOut();
171 }
172 
173 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
174 
176 {
177  clearOut();
178 }
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace Foam
186 
187 // ************************************************************************* //
Foam::tetCreatorOctree::clearOut
void clearOut()
deletes all pointer data
Definition: tetCreatorOctree.C:142
Foam::IOdictionary
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
Foam::tetCreatorOctree::createTetsFromSplitFaces
void createTetsFromSplitFaces()
create tetrahedra from split faces
Definition: tetCreatorOctreeTetsFromSplitFaces.C:40
Foam::tetCreatorOctree::createPointsAndAddressing
void createPointsAndAddressing()
create tetPoints_ and necessary addressing
Definition: tetCreatorOctreePointsAndAddressing.C:78
Foam::tetCreatorOctree::~tetCreatorOctree
~tetCreatorOctree()
Definition: tetCreatorOctree.C:175
demandDrivenData.H
Template functions to aid in the implementation of demand driven data.
meshOctree.H
tetCreatorOctree.H
Foam::tetCreatorOctree::createTetsFromFacesWithCentreNode
void createTetsFromFacesWithCentreNode()
Definition: tetCreatorOctreeFromFacesWithCentreNode.C:40
Foam::tetCreatorOctree::tetCreatorOctree
tetCreatorOctree(const tetCreatorOctree &)
Disallow default bitwise copy construct.
Foam::tetCreatorOctree::edgeCoordinates_
static const meshOctreeCubeCoordinates edgeCoordinates_[12][4]
helper for searching coordinates of cubes around an edge
Definition: tetCreatorOctree.H:57
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
Foam::label
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
Foam::tetCreatorOctree::faceCentreLabelPtr_
VRWGraph * faceCentreLabelPtr_
cube face label
Definition: tetCreatorOctree.H:81
Foam::tetCreatorOctree::created_
bool created_
are tets created or not
Definition: tetCreatorOctree.H:84
Foam::tetCreatorOctree::createTetsAroundEdges
void createTetsAroundEdges()
create tetrahedra from faces, owner and neighbour
Definition: tetCreatorOctreeTetsAroundEdges.C:41
Foam::tetCreatorOctree::subNodeLabelsPtr_
VRWGraph * subNodeLabelsPtr_
node labels of vertices created inside split-hex boxes
Definition: tetCreatorOctree.H:75
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
meshOctreeCubeCoordinates
A cube stores information needed for mesh generation.
Foam::tetCreatorOctree::createTets
void createTets()
function containing the workflow
Definition: tetCreatorOctree.C:124
Foam::tetCreatorOctree::faceCentreHelper_
static const label faceCentreHelper_[3][4]
helper for finding face centres of cubes sharing an edge
Definition: tetCreatorOctree.H:60
Foam::meshOctree
Definition: meshOctree.H:55
Foam::tetCreatorOctree::sortedLeaves_
List< labelLongList > sortedLeaves_
octree leaves sorted according to their level
Definition: tetCreatorOctree.H:72
Foam::tetCreatorOctree::createTetsAroundSplitEdges
void createTetsAroundSplitEdges()
create tetrahedra from faces with split edges
Definition: tetCreatorOctreeTetsAroundSplitEdges.C:41
Foam::tetCreatorOctree::cubeLabelPtr_
labelList * cubeLabelPtr_
cube centre label
Definition: tetCreatorOctree.H:78