Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/csg/specpoin.hpp
3206 views
1
#ifndef FILE_SPECPOIN
2
#define FILE_SPECPOIN
3
4
5
/**************************************************************************/
6
/* File: specpoin.hpp */
7
/* Author: Joachim Schoeberl */
8
/* Date: 01. Okt. 95 */
9
/**************************************************************************/
10
11
/*
12
13
Special Point Calculation
14
15
*/
16
17
class Surface;
18
class Solid;
19
20
/// Special point.
21
class SpecialPoint
22
{
23
public:
24
/// coordinates
25
Point<3> p;
26
/// tangential to edge
27
Vec<3> v;
28
///
29
int layer;
30
/// point must be used in mesh
31
bool unconditional;
32
33
/// surfaces defining edge
34
int s1, s2;
35
/// if s1 and s2 are only representatives, then these are the original indices
36
int s1_orig, s2_orig;
37
int nr;
38
///
39
SpecialPoint () : p(0,0,0), v(0,0,0), layer(0), unconditional(0), s1(0), s2(0), s1_orig(0), s2_orig(0)
40
{ ; }
41
42
///
43
SpecialPoint (const SpecialPoint & sp2);
44
45
///
46
SpecialPoint & operator= (const SpecialPoint & sp2);
47
48
///
49
void Print (ostream & str) const;
50
51
52
int GetLayer() const { return layer; }
53
54
///
55
bool HasSurfaces (int as1, int as2) const
56
{
57
return (s1 == as1 && s2 == as2 || s1 == as2 && s2 == as1);
58
}
59
};
60
61
inline ostream & operator<< (ostream & ost, const SpecialPoint & sp)
62
{
63
sp.Print (ost);
64
return ost;
65
}
66
67
68
69
70
///
71
class SpecialPointCalculation
72
{
73
private:
74
///
75
const CSGeometry * geometry;
76
///
77
ARRAY<MeshPoint> * points;
78
///
79
ARRAY<long int> boxesinlevel;
80
81
///
82
double size;
83
///
84
double relydegtest; // maximal dimension of bisection intervall for
85
/// test of degeneration parameters
86
double cpeps1, epeps1, epeps2, epspointdist2;
87
88
double ideps;
89
90
public:
91
92
///
93
SpecialPointCalculation ();
94
95
///
96
void SetIdEps(const double epsin) {ideps = epsin;}
97
98
///
99
void CalcSpecialPoints (const CSGeometry & ageometry,
100
ARRAY<MeshPoint> & points);
101
///
102
void AnalyzeSpecialPoints (const CSGeometry & geometry,
103
ARRAY<MeshPoint> & points,
104
ARRAY<SpecialPoint> & specpoints);
105
106
protected:
107
///
108
void CalcSpecialPointsRec (const Solid * sol, int layer,
109
const BoxSphere<3> & box,
110
int level,
111
bool calccp, bool calcep);
112
113
114
///
115
bool CrossPointNewtonConvergence (const Surface * f1, const Surface * f2,
116
const Surface * f3, const BoxSphere<3> & box);
117
///
118
bool CrossPointDegenerated (const Surface * f1, const Surface * f2,
119
const Surface * f3, const BoxSphere<3> & box) const;
120
///
121
void CrossPointNewton (const Surface * f1, const Surface * f2,
122
const Surface * f3, Point<3> & p);
123
124
bool EdgeNewtonConvergence (const Surface * f1, const Surface * f2,
125
const Point<3> & p);
126
///
127
bool EdgeDegenerated (const Surface * f1, const Surface * f2,
128
const BoxSphere<3> & box) const;
129
///
130
void EdgeNewton (const Surface * f1, const Surface * f2,
131
Point<3> & p);
132
///
133
bool IsEdgeExtremalPoint (const Surface * f1, const Surface * f2,
134
const Point<3> & p, Point<3> & pp, double rad);
135
136
137
138
/*
139
///
140
bool ExtremalPointPossible (const Surface * f1, const Surface * f2,
141
int dir, const BoxSphere<3> & box);
142
///
143
bool ExtremalPointDegenerated (const Surface * f1, const Surface * f2,
144
int dir, const BoxSphere<3> & box);
145
///
146
bool ExtremalPointNewtonConvergence (const Surface * f1, const Surface * f2,
147
int dir, const BoxSphere<3> & box);
148
*/
149
///
150
void ExtremalPointNewton (const Surface * f1, const Surface * f2,
151
int dir, Point<3> & p);
152
153
154
///
155
bool AddPoint (const Point<3> & p, int layer);
156
157
void ComputeExtremalPoints (const Plane * plane,
158
const QuadraticSurface * quadric,
159
ARRAY<Point<3> > & pts);
160
161
void ComputeCrossPoints (const Plane * plane1,
162
const Plane * plane2,
163
const Plane * plane3,
164
ARRAY<Point<3> > & pts);
165
166
void ComputeCrossPoints (const Plane * plane1,
167
const Plane * plane2,
168
const QuadraticSurface * quadratic,
169
ARRAY<Point<3> > & pts);
170
};
171
172
#endif
173
174
175
176