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 Creates octree for mesh generation
33 \*---------------------------------------------------------------------------*/
35 #ifndef meshOctreeCreator_H
36 #define meshOctreeCreator_H
40 #include "IOdictionary.H"
41 #include "meshOctreeModifier.H"
42 #include "patchRefinementList.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declarations
54 /*---------------------------------------------------------------------------*\
55 Class meshOctreeCreator Declaration
56 \*---------------------------------------------------------------------------*/
58 class meshOctreeCreator
63 //- Reference to meshOctree
67 scalar scalingFactor_;
69 //- Dictionary containing information necessary to perform refinement
70 const IOdictionary* meshDictPtr_;
72 //- hex refinement flag
76 // Private member functions
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&);
128 //- construct from meshOctree
129 meshOctreeCreator(meshOctree&);
131 //- Construct from meshOctree and dictionary
132 meshOctreeCreator(meshOctree& mo, const IOdictionary& dict);
136 ~meshOctreeCreator();
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
155 const direction maxLevel,
156 const label nTrianglesInLeaf = 15
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 } // End namespace Foam
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 // ************************************************************************* //