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 "meshOctreeModifier.H"
41 //#include "volFields.H"
42 #include "patchRefinementList.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 // Forward declarations
55 /*---------------------------------------------------------------------------*\
56 Class meshOctreeCreator Declaration
57 \*---------------------------------------------------------------------------*/
59 class meshOctreeCreator
64 //- Reference to meshOctree
68 scalar scalingFactor_;
70 //- Dictionary containing information necessary to perform refinement
71 const IOdictionary* meshDictPtr_;
73 //- hex refinement flag
77 // Private member functions
80 //- refine boxes contained inside the objects for refinement
81 void refineBoxesContainedInObjects();
83 //- refine boxes near DATA boxes to get a nice smooth surface
84 void refineBoxesNearDataBoxes(const direction nLayers = 1);
86 //- refine boxes of the given flag to the given size
87 void refineBoxes(const direction refLevel, const direction cubeType);
89 // Private octree creation methods
90 void refineBoundary();
91 void createInsideOutsideInformation();
92 void refineInsideAndUnknownBoxes();
94 // Private member functions for parallel runs
95 //- move octree cubes from one processor to another until
96 //- each processor contains the same number of leaves
97 //- of the required type
98 void loadDistribution(const bool distributeUsed = false);
100 // information about octree refinement
101 //- ref level to achieve max cell size
102 direction globalRefLevel_;
104 //- this list contains ref level for each surface triangle
105 List<direction> surfRefLevel_;
107 //- set the boundBox such that maxCellSize is achieved
108 void setRootCubeSizeAndRefParameters();
110 // Private copy constructor
111 //- Disallow default bitwise copy construct
112 meshOctreeCreator(const meshOctreeCreator&);
114 //- Disallow default bitwise assignment
115 void operator=(const meshOctreeCreator&);
121 //- construct from meshOctree
122 meshOctreeCreator(meshOctree&);
124 //- Construct from meshOctree and dictionary
125 meshOctreeCreator(meshOctree& mo, const IOdictionary& dict);
127 //- Construct from surface, dictionary and cell sizes
131 const IOdictionary& dict,
132 const volScalarField& localCellSize
138 ~meshOctreeCreator();
142 //- set the scaling factor
143 void setScalingFactor(const scalar);
145 //- activate octree refinement which marks all sons of an octree box
146 //- for refinement in case a single son is marked for refinement
147 //- this type of refinement is necessary for creating hex meshes
148 void activateHexRefinement();
150 //- create octree boxes
151 void createOctreeBoxes();
153 //- refine boxes containing surface elements
154 //- this is used for proximity searches
155 void createOctreeWithRefinedBoundary
157 const direction maxLevel,
158 const label nTrianglesInLeaf = 15
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 } // End namespace Foam
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 // ************************************************************************* //