Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/improve2.hpp
3206 views
1
#ifndef FILE_IMPROVE2
2
#define FILE_IMPROVE2
3
4
5
6
///
7
class MeshOptimize2d
8
{
9
int faceindex;
10
int improveedges;
11
double metricweight;
12
int writestatus;
13
14
public:
15
///
16
MeshOptimize2d ();
17
///
18
void ImproveMesh (Mesh & mesh2d);
19
void ImproveMeshJacobian (Mesh & mesh2d);
20
void ImproveVolumeMesh (Mesh & mesh);
21
void ProjectBoundaryPoints(ARRAY<int> & surfaceindex,
22
const ARRAY<Point<3>* > & from, ARRAY<Point<3>* > & dest);
23
24
void EdgeSwapping (Mesh & mesh, int usemetric);
25
void CombineImprove (Mesh & mesh);
26
27
void GenericImprove (Mesh & mesh);
28
29
30
void SetFaceIndex (int fi) { faceindex = fi; }
31
void SetImproveEdges (int ie) { improveedges = ie; }
32
void SetMetricWeight (double mw) { metricweight = mw; }
33
void SetWriteStatus (int ws) { writestatus = ws; }
34
35
36
37
///
38
virtual void SelectSurfaceOfPoint (const Point<3> & p,
39
const PointGeomInfo & gi);
40
///
41
virtual void ProjectPoint (INDEX /* surfind */, Point<3> & /* p */) const { };
42
43
/// project point, use gi as initial value, and compute new gi
44
virtual int ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
45
{ ProjectPoint (surfind, p); return CalcPointGeomInfo (surfind, gi, p); }
46
47
///
48
virtual void ProjectPoint2 (INDEX /* surfind */, INDEX /* surfind2 */, Point<3> & /* p */) const { };
49
50
/// liefert zu einem 3d-Punkt die geominfo (Dreieck) und liefert 1, wenn erfolgreich,
51
/// 0, wenn nicht (Punkt ausserhalb von chart)
52
virtual int CalcPointGeomInfo(PointGeomInfo& gi, const Point<3> & /*p3*/) const
53
{ gi.trignum = 1; return 1;};
54
55
virtual int CalcPointGeomInfo(int /* surfind */, PointGeomInfo& gi, const Point<3> & p3) const
56
{ return CalcPointGeomInfo (gi, p3); }
57
58
///
59
virtual void GetNormalVector(INDEX surfind, const Point<3> & p, PointGeomInfo & gi, Vec<3> & n) const;
60
virtual void GetNormalVector(INDEX surfind, const Point<3> & p, Vec<3> & n) const;
61
62
void CheckMeshApproximation (Mesh & mesh);
63
64
65
///
66
friend class Opti2SurfaceMinFunction;
67
///
68
friend class Opti2EdgeMinFunction;
69
///
70
friend double Opti2FunctionValueGrad (const Vector & x, Vector & grad);
71
///
72
friend double Opti2EdgeFunctionValueGrad (const Vector & x, Vector & grad);
73
74
75
76
};
77
78
79
extern void CalcTriangleBadness (double x2, double x3, double y3,
80
double metricweight,
81
double h, double & badness,
82
double & g1x, double & g1y);
83
84
85
86
87
extern double CalcTriangleBadness (const Point3d & p1,
88
const Point3d & p2,
89
const Point3d & p3,
90
double metricweight,
91
double h);
92
93
extern double CalcTriangleBadness (const Point3d & p1,
94
const Point3d & p2,
95
const Point3d & p3,
96
const Vec3d & n,
97
double metricweight,
98
double h);
99
100
#endif
101
102
103
104