Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/adfront2.hpp
3206 views
1
#ifndef FILE_ADFRONT2
2
#define FILE_ADFRONT2
3
4
/**************************************************************************/
5
/* File: adfront2.hpp */
6
/* Author: Joachim Schoeberl */
7
/* Date: 01. Okt. 95 */
8
/**************************************************************************/
9
10
11
/**
12
13
Advancing front class for surfaces
14
15
*/
16
class AdFront2
17
{
18
19
///
20
class FrontPoint2
21
{
22
/// coordinates
23
Point<3> p;
24
/// global node index
25
PointIndex globalindex;
26
/// number of front lines connected to point
27
int nlinetopoint;
28
/// distance to original boundary
29
int frontnr;
30
31
bool onsurface;
32
33
public:
34
///
35
MultiPointGeomInfo * mgi;
36
37
///
38
FrontPoint2 ()
39
{
40
globalindex = -1;
41
nlinetopoint = 0;
42
frontnr = INT_MAX-10; // attention: overflow on calculating INT_MAX + 1
43
mgi = NULL;
44
onsurface = true;
45
}
46
47
///
48
FrontPoint2 (const Point<3> & ap, PointIndex agi,
49
MultiPointGeomInfo * amgi, bool aonsurface = true);
50
///
51
~FrontPoint2 () { ; }
52
53
///
54
const Point<3> & P () const { return p; }
55
///
56
operator const Point<3> & () const { return p; }
57
///
58
PointIndex GlobalIndex () const { return globalindex; }
59
60
///
61
void AddLine () { nlinetopoint++; }
62
///
63
void RemoveLine ()
64
{
65
nlinetopoint--;
66
if (nlinetopoint == 0)
67
nlinetopoint = -1;
68
}
69
70
///
71
bool Valid () const
72
{ return nlinetopoint >= 0; }
73
74
///
75
bool OnSurface() const
76
{ return onsurface; }
77
78
///
79
void DecFrontNr (int afrontnr)
80
{
81
if (frontnr > afrontnr) frontnr = afrontnr;
82
}
83
84
///
85
int FrontNr () const { return frontnr; }
86
};
87
88
89
///
90
class FrontLine
91
{
92
private:
93
/// Point Indizes
94
INDEX_2 l;
95
/// quality class
96
int lineclass;
97
/// geometry specific data
98
PointGeomInfo geominfo[2];
99
public:
100
101
FrontLine ()
102
{
103
lineclass = 1;
104
}
105
106
///
107
FrontLine (const INDEX_2 & al)
108
{
109
l = al;
110
lineclass = 1;
111
}
112
113
114
///
115
const INDEX_2 & L () const
116
{
117
return l;
118
}
119
120
///
121
int LineClass() const
122
{
123
return lineclass;
124
}
125
126
///
127
void IncrementClass ()
128
{
129
lineclass++;
130
}
131
///
132
void ResetClass ()
133
{
134
lineclass = 1;
135
}
136
137
///
138
bool Valid () const
139
{
140
return l.I1() != -1;
141
}
142
///
143
void Invalidate ()
144
{
145
l.I1() = -1;
146
l.I2() = -1;
147
lineclass = 1000;
148
}
149
150
void SetGeomInfo (const PointGeomInfo & gi1, const PointGeomInfo & gi2)
151
{
152
geominfo[0] = gi1;
153
geominfo[1] = gi2;
154
}
155
156
const PointGeomInfo * GetGeomInfo () const
157
{ return geominfo; }
158
159
const PointGeomInfo & GetGeomInfo (int endp) const
160
{ return geominfo[endp-1]; }
161
162
friend class AdFront2;
163
};
164
165
166
167
///
168
ARRAY<FrontPoint2> points; /// front points
169
ARRAY<FrontLine> lines; /// front lines
170
171
Box3d boundingbox;
172
Box3dTree linesearchtree; /// search tree for lines
173
Point3dTree pointsearchtree; /// search tree for points
174
Point3dTree cpointsearchtree; /// search tree for cone points (not used ???)
175
176
ARRAY<int> delpointl; /// list of deleted front points
177
ARRAY<int> dellinel; /// list of deleted front lines
178
179
int nfl; /// number of front lines;
180
INDEX_2_HASHTABLE<int> * allflines; /// all front lines ever have been
181
182
183
int minval;
184
int starti;
185
186
public:
187
///
188
// AdFront2 ();
189
AdFront2 (const Box3d & aboundingbox);
190
///
191
~AdFront2 ();
192
193
///
194
// void GetPoints (ARRAY<Point<3> > & apoints) const;
195
///
196
void Print (ostream & ost) const;
197
198
///
199
bool Empty () const
200
{
201
return nfl == 0;
202
}
203
///
204
int GetNFL () const { return nfl; }
205
///
206
int SelectBaseLine (Point<3> & p1, Point<3> & p2,
207
const PointGeomInfo *& geominfo1,
208
const PointGeomInfo *& geominfo2,
209
int & qualclass);
210
211
///
212
int GetLocals (int baseline,
213
ARRAY<Point3d> & locpoints,
214
ARRAY<MultiPointGeomInfo> & pgeominfo,
215
ARRAY<INDEX_2> & loclines, // local index
216
ARRAY<int> & pindex,
217
ARRAY<int> & lindex,
218
double xh);
219
220
///
221
void DeleteLine (int li);
222
///
223
int AddPoint (const Point<3> & p, PointIndex globind,
224
MultiPointGeomInfo * mgi = NULL,
225
bool pointonsurface = true);
226
///
227
int AddLine (int pi1, int pi2,
228
const PointGeomInfo & gi1, const PointGeomInfo & gi2);
229
///
230
int ExistsLine (int gpi1, int gpi2);
231
232
///
233
void IncrementClass (int li)
234
{
235
lines[li].IncrementClass();
236
}
237
238
///
239
void ResetClass (int li)
240
{
241
lines[li].ResetClass();
242
}
243
244
///
245
const PointGeomInfo & GetLineGeomInfo (int li, int lend) const
246
{ return lines[li].GetGeomInfo (lend); }
247
///
248
249
PointIndex GetGlobalIndex (int pi) const
250
{
251
return points[pi].GlobalIndex();
252
}
253
///
254
void SetStartFront ();
255
///
256
void PrintOpenSegments (ostream & ost) const;
257
};
258
259
260
261
#endif
262
263
264
265
266