Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
cfMesh is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Class
meshOctreeModifier
Description
Octree for mesh generation
SourceFiles
meshOctreeModifier.C
\*---------------------------------------------------------------------------*/
#ifndef meshOctreeModifier_H
#define meshOctreeModifier_H
#include "meshOctree.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class meshOctreeModifier Declaration
\*---------------------------------------------------------------------------*/
class meshOctreeModifier
{
// Private data
//- Reference to the octree
meshOctree& octree_;
// Private member functions
//- correct refinement such that it produces 1-irregular octree
void ensureCorrectRegularity(labelList& refineBox);
//- add additional refinement with the following rule. If a son
//- of a father box is refined, then refine all other sons
bool ensureCorrectRegularitySons(labelList& refineBox);
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Private copy constructor
//- Disallow default bitwise copy construct
meshOctreeModifier(const meshOctreeModifier&);
//- Disallow default bitwise assignment
void operator=(const meshOctreeModifier&);
public:
// Constructors
//- Construct from octree
meshOctreeModifier(meshOctree&);
// Destructor
~meshOctreeModifier();
// Member Functions
//- return octree
inline const meshOctree& octree() const;
//- return neighbour processors
inline labelList& neiProcsAccess();
//- return rootBox
inline boundBox& rootBoxAccess();
//- return isRootInitialised_
inline bool& isRootInitialisedAccess();
//- return search range
inline scalar& searchRangeAccess();
//- return the range of leaves at each processor
inline List<Pair<meshOctreeCubeCoordinates> >& neiRangeAccess();
//- return initial cube
inline meshOctreeCube& initialCubeAccess();
//- return octree slots
inline List<meshOctreeSlot>& dataSlotsAccess();
//- return the pointer to the meshOctreeCube at the given position
inline meshOctreeCube* findCubeForPosition
(
const meshOctreeCubeCoordinates&
) const;
//- find leaves contained in a given boundBox
inline void findLeavesContainedInBox
(
const boundBox&,
DynList<const meshOctreeCube*, 256>&
) const;
//- return leaves
inline LongList<meshOctreeCube*>& leavesAccess();
//- create leaves
inline void createListOfLeaves();
//- mark additional layers around the leaves selected for refinement
void markAdditionalLayers
(
labelList& refineBox,
const label nLayers = 1
//- mark additional layers around the leaves selected for refinement
void markAdditionalLayersOfFaceNeighbours
(
labelList& refineBox,
const label nLayers = 1
) const;
//- mark additional layers around the leaves selected for refinement
//- given on a box-by-box basis
//- returns the number of boxes selected for refinement
label markAdditionalLayers
(
labelList& nLayers,
List<direction>& targetRefLevel
) const;
//- refine leaves marked for refinement
//- hexRefinement is activated when it is required to refine all
//- sons of the same father, if a single son gets marked for refinement
void refineSelectedBoxes
(
//- refine selected boxes and the boxes within the given range
void refineSelectedBoxesAndAdditionalLayers
(
labelList& refineBox,
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// functions for parallel runs
//- distribute leaves of the initial octree to processors
//- each processor creates a list of neighbouring processors
void distributeLeavesToProcessors();
//- move octree cubes from one processor to another
void loadDistribution(const direction usedType = 0);
//- refine the tree to add cubes transferred from other processors
void refineTreeForCoordinates
(
const meshOctreeCubeCoordinates&,
const short procNo = Pstream::myProcNo(),
const direction cubeType = meshOctreeCubeBasic::UNKNOWN
);
void refineTreeForCoordinates
(
const meshOctreeCubeCoordinates&,
const labelList& containedTriangles,
const labelList& containedEdges,
const short procNo = Pstream::myProcNo(),
const direction cubeType = meshOctreeCubeBasic::UNKNOWN
);
//- update the communication pattern between the processors
//- this function is used for load balancing
void updateCommunicationPattern();
//- add an additional layer of boxes which belongs to the neighbouring
//- processors. This simplifies the process of extracting the mesh
//- template from the octree in a parallel run
void addLayerFromNeighbouringProcessors();
//- reduce memory consumption by deleting unnecessary data
void reduceMemoryConsumption();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "meshOctreeModifierI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //