Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/localh.hpp
3206 views
1
#ifndef LOCALH
2
#define LOCALH
3
4
/**************************************************************************/
5
/* File: localh.hh */
6
/* Author: Joachim Schoeberl */
7
/* Date: 29. Jan. 97 */
8
/**************************************************************************/
9
10
11
12
13
/// box for grading
14
class GradingBox
15
{
16
/*
17
/// xmin
18
float x1[3];
19
/// xmax
20
float x2[3];
21
*/
22
/// xmid
23
float xmid[3];
24
/// half edgelength
25
float h2;
26
///
27
GradingBox * childs[8];
28
///
29
GradingBox * father;
30
///
31
double hopt;
32
///
33
struct
34
{
35
unsigned int cutboundary:1;
36
unsigned int isinner:1;
37
unsigned int oldcell:1;
38
unsigned int pinner:1;
39
} flags;
40
public:
41
///
42
GradingBox (const double * ax1, const double * ax2);
43
///
44
void DeleteChilds();
45
///
46
friend class LocalH;
47
48
49
static BlockAllocator ball;
50
void * operator new(size_t);
51
void operator delete (void *);
52
};
53
54
55
56
/**
57
Control of 3D mesh grading
58
*/
59
class LocalH
60
{
61
///
62
GradingBox * root;
63
///
64
double grading;
65
///
66
ARRAY<GradingBox*> boxes;
67
///
68
Box3d boundingbox;
69
public:
70
///
71
LocalH (const Point3d & pmin, const Point3d & pmax, double grading);
72
///
73
~LocalH();
74
///
75
void Delete();
76
///
77
void SetGrading (double agrading) { grading = agrading; }
78
///
79
void SetH (const Point3d & x, double h);
80
///
81
double GetH (const Point3d & x) const;
82
/// minimal h in box (pmin, pmax)
83
double GetMinH (const Point3d & pmin, const Point3d & pmax) const;
84
85
/// mark boxes intersecting with boundary-box
86
void CutBoundary (const Point3d & pmin, const Point3d & pmax)
87
{ CutBoundaryRec (pmin, pmax, root); }
88
89
/// find inner boxes
90
void FindInnerBoxes ( // int (*sameside)(const Point3d & p1, const Point3d & p2),
91
class AdFront3 * adfront,
92
int (*testinner)(const Point3d & p1));
93
94
/// clears all flags
95
void ClearFlags ()
96
{ ClearFlagsRec(root); }
97
98
/// widen refinement zone
99
void WidenRefinement ();
100
101
/// get points in inner elements
102
void GetInnerPoints (ARRAY<Point3d> & points);
103
104
/// get points in outer closure
105
void GetOuterPoints (ARRAY<Point3d> & points);
106
107
///
108
void Convexify ();
109
///
110
int GetNBoxes () { return boxes.Size(); }
111
const Box3d & GetBoundingBox () const
112
{ return boundingbox; }
113
///
114
void PrintMemInfo (ostream & ost) const;
115
private:
116
///
117
double GetMinHRec (const Point3d & pmin, const Point3d & pmax,
118
const GradingBox * box) const;
119
///
120
void CutBoundaryRec (const Point3d & pmin, const Point3d & pmax,
121
GradingBox * box);
122
123
///
124
void FindInnerBoxesRec ( int (*inner)(const Point3d & p),
125
GradingBox * box);
126
127
///
128
void FindInnerBoxesRec2 (GradingBox * box,
129
class AdFront3 * adfront,
130
ARRAY<Box3d> & faceboxes,
131
ARRAY<int> & finds, int nfinbox);
132
133
134
///
135
void SetInnerBoxesRec (GradingBox * box);
136
137
///
138
void ClearFlagsRec (GradingBox * box);
139
140
///
141
void ConvexifyRec (GradingBox * box);
142
};
143
144
145
#endif
146
147