Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / octrees / meshOctree / meshOctreeCreator / meshOctreeCreator.H
blob6e8ba30822684ba5f6bf2ca7c2ce8ea7663ba57a
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     meshOctreeCreator
27 Description
28     Creates octree for mesh generation
30 SourceFiles
31     meshOctreeCreator.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef meshOctreeCreator_H
36 #define meshOctreeCreator_H
38 #include "boolList.H"
39 #include "DynList.H"
40 #include "IOdictionary.H"
41 #include "meshOctreeModifier.H"
42 #include "patchRefinementList.H"
44 #include <map>
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 // Forward declarations
52 class meshOctreeCube;
54 /*---------------------------------------------------------------------------*\
55                     Class meshOctreeCreator Declaration
56 \*---------------------------------------------------------------------------*/
58 class meshOctreeCreator
60 protected:
62     // Protected data
63         //- Reference to meshOctree
64         meshOctree& octree_;
66         //- Scaling factor
67         scalar scalingFactor_;
69         //- Dictionary containing information necessary to perform refinement
70         const IOdictionary* meshDictPtr_;
72         //- hex refinement flag
73         bool hexRefinement_;
75 private:
76     // Private member functions
78     // Octree refinement
79         //- refine boxes contained inside the objects for refinement
80         void refineBoxesContainedInObjects();
82         //- refine boxes intersected by surface meshes
83         //- used as refinement sources
84         void refineBoxesIntersectingSurfaces();
86         //- refine boxes by edge meshes
87         //- used as refinement sources
88         void refineBoxesIntersectingEdgeMeshes();
90         //- refine boxes near DATA boxes to get a nice smooth surface
91         void refineBoxesNearDataBoxes(const label nLayers = 1);
93         //- refine boxes of the given flag to the given size
94         void refineBoxes(const direction refLevel, const direction cubeType);
96         // Private octree creation methods
97         void refineBoundary();
98         void createInsideOutsideInformation();
99         void refineInsideAndUnknownBoxes();
101     // Private member functions for parallel runs
102         //- move octree cubes from one processor to another until
103         //- each processor contains the same number of leaves
104         //- of the required type
105         void loadDistribution(const bool distributeUsed = false);
107         // information about octree refinement
108         //- ref level to achieve max cell size
109         direction globalRefLevel_;
111         //- this list contains ref level for each surface triangle
112         List<DynList<std::pair<direction, scalar> > > surfRefLevel_;
114         //- set the boundBox such that maxCellSize is achieved
115         void setRootCubeSizeAndRefParameters();
117     // Private copy constructor
118         //- Disallow default bitwise copy construct
119         meshOctreeCreator(const meshOctreeCreator&);
121         //- Disallow default bitwise assignment
122         void operator=(const meshOctreeCreator&);
124 public:
126     // Constructors
128         //- construct from meshOctree
129         meshOctreeCreator(meshOctree&);
131         //- Construct from meshOctree and dictionary
132         meshOctreeCreator(meshOctree& mo, const IOdictionary& dict);
134     // Destructor
136         ~meshOctreeCreator();
139     // Member Functions
140         //- set the scaling factor
141         void setScalingFactor(const scalar);
143         //- activate octree refinement which marks all sons of an octree box
144         //- for refinement in case a single son is marked for refinement
145         //- this type of refinement is necessary for creating hex meshes
146         void activateHexRefinement();
148         //- create octree boxes
149         void createOctreeBoxes();
151         //- refine boxes containing surface elements
152         //- this is used for proximity searches
153         void createOctreeWithRefinedBoundary
154         (
155             const direction maxLevel,
156             const label nTrianglesInLeaf = 15
157         );
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 } // End namespace Foam
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 #endif
169 // ************************************************************************* //