Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/meshing/improve3.hpp
3206 views
1
#ifndef FILE_IMPROVE3
2
#define FILE_IMPROVE3
3
4
5
6
7
///
8
class MeshOptimize3d
9
{
10
public:
11
void CombineImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
12
void SplitImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
13
void SwapImprove (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY,
14
const BitArray * working_elements = NULL);
15
void SwapImproveSurface (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY,
16
const BitArray * working_elements = NULL,
17
const ARRAY< ARRAY<int,PointIndex::BASE>* > * idmaps = NULL);
18
void SwapImprove2 (Mesh & mesh, OPTIMIZEGOAL goal = OPT_QUALITY);
19
};
20
21
22
23
extern double CalcBad (const Mesh::T_POINTS & points, const Element & elem,
24
double h);
25
26
extern double CalcTotalBad (const Mesh::T_POINTS & points,
27
const Mesh::T_VOLELEMENTS & elements);
28
29
extern int WrongOrientation (const Mesh::T_POINTS & points, const Element & el);
30
31
32
/* Functional depending of inner point inside triangular surface */
33
34
35
class MinFunctionSum : public MinFunction
36
{
37
protected:
38
ARRAY<MinFunction*> functions;
39
40
public:
41
42
virtual double Func (const Vector & x) const;
43
virtual void Grad (const Vector & x, Vector & g) const;
44
virtual double FuncGrad (const Vector & x, Vector & g) const;
45
virtual double FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const;
46
virtual double GradStopping (const Vector & x) const;
47
48
void AddFunction(MinFunction & fun);
49
50
const MinFunction & Function(int i) const;
51
MinFunction & Function(int i);
52
};
53
54
55
56
class PointFunction1 : public MinFunction
57
{
58
Mesh::T_POINTS & points;
59
const ARRAY<INDEX_3> & faces;
60
double h;
61
public:
62
PointFunction1 (Mesh::T_POINTS & apoints,
63
const ARRAY<INDEX_3> & afaces,
64
double ah);
65
66
virtual double Func (const Vector & x) const;
67
virtual double FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const;
68
virtual double FuncGrad (const Vector & x, Vector & g) const;
69
virtual double GradStopping (const Vector & x) const;
70
};
71
72
73
class JacobianPointFunction : public MinFunction
74
{
75
public:
76
Mesh::T_POINTS & points;
77
const Mesh::T_VOLELEMENTS & elements;
78
TABLE<INDEX> elementsonpoint;
79
PointIndex actpind;
80
81
bool onplane;
82
Vec<3> nv;
83
84
public:
85
JacobianPointFunction (Mesh::T_POINTS & apoints,
86
const Mesh::T_VOLELEMENTS & aelements);
87
88
virtual void SetPointIndex (PointIndex aactpind);
89
virtual double Func (const Vector & x) const;
90
virtual double FuncGrad (const Vector & x, Vector & g) const;
91
virtual double FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const;
92
93
inline void SetNV(const Vec<3> & anv) {nv = anv; onplane = true;}
94
inline void UnSetNV(void) {onplane = false;}
95
};
96
97
98
99
#endif
100
101