Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/meshing2.hpp
3206 views
1
#ifndef FILE_MESHING2
2
#define FILE_MESHING2
3
4
/**************************************************************************/
5
/* File: meshing2.hpp */
6
/* Author: Joachim Schoeberl */
7
/* Date: 01. Okt. 95 */
8
/**************************************************************************/
9
10
11
12
enum MESHING2_RESULT
13
{
14
MESHING2_OK = 0,
15
MESHING2_GIVEUP = 1,
16
};
17
18
19
/*
20
21
The basis class for 2D mesh generation.
22
Has the method GenerateMesh
23
24
For surface mesh generation, or non-Euklidean meshing,
25
derive from Meshing2, and replace transformation.
26
27
*/
28
29
class Meshing2
30
{
31
/// the current advancing front
32
AdFront2 * adfront;
33
/// rules for mesh generation
34
ARRAY<netrule*> rules;
35
/// statistics
36
ARRAY<int> ruleused, canuse, foundmap;
37
///
38
Box<3> boundingbox;
39
///
40
double starttime;
41
///
42
double maxarea;
43
44
public:
45
///
46
Meshing2 (const Box<3> & aboundingbox);
47
48
///
49
virtual ~Meshing2 ();
50
51
/// Load rules, either from file, or compiled rules
52
void LoadRules (const char * filename);
53
54
///
55
MESHING2_RESULT GenerateMesh (Mesh & mesh, double gh, int facenr);
56
57
///
58
void AddPoint (const Point3d & p, PointIndex globind, MultiPointGeomInfo * mgi = NULL,
59
bool pointonsurface = true);
60
61
///
62
void AddBoundaryElement (INDEX i1, INDEX i2,
63
const PointGeomInfo & gi1, const PointGeomInfo & gi2);
64
65
///
66
void SetStartTime (double astarttime);
67
68
///
69
void SetMaxArea (double amaxarea);
70
71
protected:
72
///
73
virtual void StartMesh ();
74
///
75
virtual void EndMesh ();
76
///
77
virtual double CalcLocalH (const Point3d & p, double gh) const;
78
79
///
80
virtual void DefineTransformation (const Point3d & p1, const Point3d & p2,
81
const PointGeomInfo * geominfo1,
82
const PointGeomInfo * geominfo2);
83
///
84
virtual void TransformToPlain (const Point3d & locpoint, const MultiPointGeomInfo & geominfo,
85
Point2d & plainpoint, double h, int & zone);
86
/// return 0 .. ok
87
/// return >0 .. cannot transform point to true surface
88
virtual int TransformFromPlain (Point2d & plainpoint,
89
Point3d & locpoint,
90
PointGeomInfo & geominfo,
91
double h);
92
93
/// projects to surface
94
/// return 0 .. ok
95
virtual int BelongsToActiveChart (const Point3d & p,
96
const PointGeomInfo & gi);
97
98
/// computes geoinfo data for line with respect to
99
/// selected chart
100
virtual int ComputePointGeomInfo (const Point3d & p,
101
PointGeomInfo & gi);
102
103
/// Tries to select unique geominfo on active chart
104
/// return 0: success
105
/// return 1: failed
106
virtual int ChooseChartPointGeomInfo (const MultiPointGeomInfo & mpgi,
107
PointGeomInfo & pgi);
108
109
110
111
/*
112
tests, whether endpoint (= 1 or 2) of line segment p1-p2
113
is inside of the selected chart. The endpoint must be on the
114
chart
115
*/
116
virtual int IsLineVertexOnChart (const Point3d & p1, const Point3d & p2,
117
int endpoint, const PointGeomInfo & geominfo);
118
119
/*
120
get (projected) boundary of current chart
121
*/
122
virtual void GetChartBoundary (ARRAY<Point2d> & points,
123
ARRAY<Point3d> & points3d,
124
ARRAY<INDEX_2> & lines, double p) const;
125
126
virtual double Area () const;
127
128
129
/** Applies 2D rules.
130
Tests all 2D rules */
131
int ApplyRules (ARRAY<Point2d> & lpoints,
132
ARRAY<int> & legalpoints,
133
int maxlegalpoint,
134
ARRAY<INDEX_2> & llines,
135
int maxlegelline,
136
ARRAY<Element2d> & elements, ARRAY<INDEX> & dellines,
137
int tolerance);
138
139
140
};
141
142
143
144
145
146
147
148
149
#endif
150
151
152
153
154
155
156
157
158