1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
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.
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
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/>.
28 A class which creates tets from the octree structure
33 \*---------------------------------------------------------------------------*/
35 #ifndef tetCreatorOctree_H
36 #define tetCreatorOctree_H
38 #include "polyMeshGenModifier.H"
40 #include "meshOctreeAddressing.H"
41 #include "meshOctreeCubeCoordinates.H"
43 #include "labelLongList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class tetCreatorOctree Declaration
52 \*---------------------------------------------------------------------------*/
54 class tetCreatorOctree
57 //- helper for searching coordinates of cubes around an edge
58 static const meshOctreeCubeCoordinates edgeCoordinates_[12][4];
60 //- helper for finding face centres of cubes sharing an edge
61 static const label faceCentreHelper_[3][4];
63 //- reference to the octree
64 meshOctreeAddressing octreeCheck_;
66 //- points of the tetrahedrisation
67 LongList<point> tetPoints_;
70 LongList<partTet> tets_;
72 //- octree leaves sorted according to their level
73 List<labelLongList> sortedLeaves_;
75 //- node labels of vertices created inside split-hex boxes
76 VRWGraph* subNodeLabelsPtr_;
79 labelList* cubeLabelPtr_;
82 VRWGraph* faceCentreLabelPtr_;
84 //- are tets created or not
87 // Private member functions
88 //- deletes all pointer data
91 //- find elements which will be used as mesh cells
92 void selectElements();
94 // Private member functions for creating tetrahedra
95 //- create tetPoints_ and necessary addressing
96 void createPointsAndAddressing();
98 //- create faceCentreLabelPtr_
99 void createFaceCentreLabels();
101 //- create tetrahedra from faces, owner and neighbour
102 void createTetsAroundEdges();
104 //- create tetrahedra from split faces
105 void createTetsFromSplitFaces();
107 //- create tetrahedra from faces which share at least one edge
108 //- with a refined cube
109 void createTetsFromFacesWithCentreNode();
111 //- create tetrahedra from faces with split edges
112 void createTetsAroundSplitEdges();
114 //- helper funtion which checks validity of a created tet and appends
116 inline void checkAndAppendTet(const partTet);
118 //- function containing the workflow
121 // Private copy constructor
122 //- Disallow default bitwise copy construct
123 tetCreatorOctree(const tetCreatorOctree&);
125 //- Disallow default bitwise assignment
126 void operator=(const tetCreatorOctree&);
132 //- Construct from octree and IOdictionary
135 const meshOctree& octree,
136 const IOdictionary& meshDict
145 const LongList<point>& tetPoints() const
150 "const LongList<point>& tetPoints() const"
151 ) << "Tets are not created!" << exit(FatalError);
156 const LongList<partTet>& tets() const
161 "const LongList<point>& tets() const"
162 ) << "Tets are not created!" << exit(FatalError);
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 } // End namespace Foam
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 #include "tetCreatorOctreeI.H"
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 // ************************************************************************* //