tetCreatorOctree.H
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 Class
25  tetCreatorOctree
26 
27 Description
28  A class which creates tets from the octree structure
29 
30 SourceFiles
31  tetCreatorOctree.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef tetCreatorOctree_H
36 #define tetCreatorOctree_H
37 
38 #include "polyMeshGenModifier.H"
39 #include "partTet.H"
40 #include "meshOctreeAddressing.H"
42 #include "VRWGraph.H"
43 #include "labelLongList.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class tetCreatorOctree Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class tetCreatorOctree
55 {
56  // Private data
57  //- helper for searching coordinates of cubes around an edge
58  static const meshOctreeCubeCoordinates edgeCoordinates_[12][4];
59 
60  //- helper for finding face centres of cubes sharing an edge
61  static const label faceCentreHelper_[3][4];
62 
63  //- reference to the octree
65 
66  //- points of the tetrahedrisation
68 
69  //- tetrahedra
71 
72  //- octree leaves sorted according to their level
74 
75  //- node labels of vertices created inside split-hex boxes
77 
78  //- cube centre label
80 
81  //- cube face label
83 
84  //- are tets created or not
85  bool created_;
86 
87  // Private member functions
88  //- deletes all pointer data
89  void clearOut();
90 
91  //- find elements which will be used as mesh cells
92  void selectElements();
93 
94  // Private member functions for creating tetrahedra
95  //- create tetPoints_ and necessary addressing
97 
98  //- create faceCentreLabelPtr_
100 
101  //- create tetrahedra from faces, owner and neighbour
102  void createTetsAroundEdges();
103 
104  //- create tetrahedra from split faces
106 
107  //- create tetrahedra from faces which share at least one edge
108  //- with a refined cube
110 
111  //- create tetrahedra from faces with split edges
113 
114  //- helper funtion which checks validity of a created tet and appends
115  //- it if valid
116  inline void checkAndAppendTet(const partTet);
117 
118  //- function containing the workflow
119  void createTets();
120 
121  // Private copy constructor
122  //- Disallow default bitwise copy construct
124 
125  //- Disallow default bitwise assignment
126  void operator=(const tetCreatorOctree&);
127 
128 public:
129 
130  // Constructors
131 
132  //- Construct from octree and IOdictionary
134  (
135  const meshOctree& octree,
136  const IOdictionary& meshDict
137  );
138 
139  // Destructor
140 
142 
143 
144  // Member Functions
145  const LongList<point>& tetPoints() const
146  {
147  if( !created_ )
149  (
150  "const LongList<point>& tetPoints() const"
151  ) << "Tets are not created!" << exit(FatalError);
152 
153  return tetPoints_;
154  }
155 
156  const LongList<partTet>& tets() const
157  {
158  if( !created_ )
160  (
161  "const LongList<point>& tets() const"
162  ) << "Tets are not created!" << exit(FatalError);
163 
164  return tets_;
165  }
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #include "tetCreatorOctreeI.H"
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
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::meshOctreeCubeCoordinates
Definition: meshOctreeCubeCoordinates.H:55
Foam::tetCreatorOctree::~tetCreatorOctree
~tetCreatorOctree()
Definition: tetCreatorOctree.C:175
VRWGraph.H
Foam::tetCreatorOctree::checkAndAppendTet
void checkAndAppendTet(const partTet)
Definition: tetCreatorOctreeI.H:33
Foam::tetCreatorOctree::createFaceCentreLabels
void createFaceCentreLabels()
create faceCentreLabelPtr_
Definition: tetCreatorOctreePointsAndAddressing.C:180
polyMeshGenModifier.H
Foam::tetCreatorOctree::selectElements
void selectElements()
find elements which will be used as mesh cells
Definition: tetCreatorOctreePointsAndAddressing.C:41
Foam::partTet
Definition: partTet.H:53
Foam::tetCreatorOctree::octreeCheck_
meshOctreeAddressing octreeCheck_
reference to the octree
Definition: tetCreatorOctree.H:63
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::LongList
Definition: LongList.H:55
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
meshOctreeCubeCoordinates.H
Foam::FatalError
error FatalError
Foam::tetCreatorOctree::operator=
void operator=(const tetCreatorOctree &)
Disallow default bitwise assignment.
Foam::tetCreatorOctree::createTetsAroundEdges
void createTetsAroundEdges()
create tetrahedra from faces, owner and neighbour
Definition: tetCreatorOctreeTetsAroundEdges.C:41
Foam::tetCreatorOctree::tetPoints
const LongList< point > & tetPoints() const
Definition: tetCreatorOctree.H:144
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
meshOctreeAddressing.H
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::tetCreatorOctree::tetPoints_
LongList< point > tetPoints_
points of the tetrahedrisation
Definition: tetCreatorOctree.H:66
Foam::meshOctreeAddressing
Definition: meshOctreeAddressing.H:59
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::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
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
labelLongList.H
Foam::tetCreatorOctree
Definition: tetCreatorOctree.H:53
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::tetCreatorOctree::tets_
LongList< partTet > tets_
tetrahedra
Definition: tetCreatorOctree.H:69
Foam::VRWGraph
Definition: VRWGraph.H:101
tetCreatorOctreeI.H
Foam::tetCreatorOctree::cubeLabelPtr_
labelList * cubeLabelPtr_
cube centre label
Definition: tetCreatorOctree.H:78
Foam::tetCreatorOctree::tets
const LongList< partTet > & tets() const
Definition: tetCreatorOctree.H:155
partTet.H