Forward compatibility: flex
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / tetrahedra / tetCreatorOctree / tetCreatorOctree.H
blob0c7f159ff8e60176a5fd51e1e380515b39dd3fea
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.
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
19     for more details.
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/>.
24 Class
25     tetCreatorOctree
27 Description
28     A class which creates tets from the octree structure
30 SourceFiles
31     tetCreatorOctree.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef tetCreatorOctree_H
36 #define tetCreatorOctree_H
38 #include "polyMeshGenModifier.H"
39 #include "partTet.H"
40 #include "meshOctreeAddressing.H"
41 #include "meshOctreeCubeCoordinates.H"
42 #include "VRWGraph.H"
43 #include "labelLongList.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 /*---------------------------------------------------------------------------*\
51                     Class tetCreatorOctree Declaration
52 \*---------------------------------------------------------------------------*/
54 class tetCreatorOctree
56     // Private data
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_;
69         //- tetrahedra
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_;
78         //- cube centre label
79         labelList* cubeLabelPtr_;
81         //- cube face label
82         VRWGraph* faceCentreLabelPtr_;
84         //- are tets created or not
85         bool created_;
87     // Private member functions
88         //- deletes all pointer data
89         void clearOut();
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
115         //- it if valid
116         inline void checkAndAppendTet(const partTet);
118         //- function containing the workflow
119         void createTets();
121     // Private copy constructor
122         //- Disallow default bitwise copy construct
123         tetCreatorOctree(const tetCreatorOctree&);
125         //- Disallow default bitwise assignment
126         void operator=(const tetCreatorOctree&);
128 public:
130     // Constructors
132         //- Construct from octree and IOdictionary
133         tetCreatorOctree
134         (
135             const meshOctree& octree,
136             const IOdictionary& meshDict
137         );
139     // Destructor
141         ~tetCreatorOctree();
144     // Member Functions
145         const LongList<point>& tetPoints() const
146         {
147             if( !created_ )
148                 FatalErrorIn
149                 (
150                     "const LongList<point>& tetPoints() const"
151                 ) << "Tets are not created!" << exit(FatalError);
153             return tetPoints_;
154         }
156         const LongList<partTet>& tets() const
157         {
158             if( !created_ )
159                 FatalErrorIn
160                 (
161                     "const LongList<point>& tets() const"
162                 ) << "Tets are not created!" << exit(FatalError);
164             return tets_;
165         }
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 } // End namespace Foam
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 #include "tetCreatorOctreeI.H"
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 #endif
181 // ************************************************************************* //