Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/ElmerGUI/netgen/libsrc/geom2d/geom2dmesh.cpp
3206 views
1
#include <mystdlib.h>
2
3
#include <csg.hpp>
4
#include <geometry2d.hpp>
5
#include <meshing.hpp>
6
7
namespace netgen
8
{
9
10
Refinement2d :: Refinement2d (const SplineGeometry2d & ageometry)
11
: Refinement(), geometry(ageometry)
12
{
13
;
14
}
15
16
Refinement2d :: ~Refinement2d ()
17
{
18
;
19
}
20
21
22
void Refinement2d ::
23
PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
24
int surfi,
25
const PointGeomInfo & gi1,
26
const PointGeomInfo & gi2,
27
Point<3> & newp, PointGeomInfo & newgi)
28
{
29
newp = p1+secpoint*(p2-p1);
30
newgi.trignum = 1;
31
}
32
33
34
35
void Refinement2d ::
36
PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint,
37
int surfi1, int surfi2,
38
const EdgePointGeomInfo & ap1,
39
const EdgePointGeomInfo & ap2,
40
Point<3> & newp, EdgePointGeomInfo & newgi)
41
{
42
Point<2> p2d;
43
44
p2d = geometry.GetSplines().Get(ap1.edgenr) ->
45
GetPoint (((1-secpoint)*ap1.dist+secpoint*ap2.dist));
46
47
// (*testout) << "refine 2d line, ap1.dist, ap2.dist = " << ap1.dist << ", " << ap2.dist << endl;
48
// (*testout) << "p1, p2 = " << p1 << p2 << ", newp = " << p2d << endl;
49
50
newp = Point3d (p2d(0), p2d(1), 0);
51
newgi.edgenr = ap1.edgenr;
52
newgi.dist = ((1-secpoint)*ap1.dist+secpoint*ap2.dist);
53
};
54
55
56
57
Vec<3> Refinement2d :: GetTangent (const Point<3> & p, int surfi1, int surfi2,
58
const EdgePointGeomInfo & ap1) const
59
{
60
Vec<2> t2d = geometry.GetSplines().Get(ap1.edgenr) -> GetTangent(ap1.dist);
61
return Vec<3> (t2d(0), t2d(1), 0);
62
}
63
64
Vec<3> Refinement2d :: GetNormal (const Point<3> & p, int surfi1,
65
const PointGeomInfo & gi) const
66
{
67
return Vec<3> (0,0,1);
68
}
69
70
71
void Refinement2d :: ProjectToSurface (Point<3> & p, int surfi, const PointGeomInfo & /* gi */)
72
{
73
p(2) = 0;
74
}
75
76
77
void Refinement2d :: ProjectToEdge (Point<3> & p, int surfi1, int surfi2,
78
const EdgePointGeomInfo & egi) const
79
{
80
Point<2> p2d (p(0), p(1)), pp;
81
double t;
82
geometry.GetSplines().Get(egi.edgenr) -> Project (p2d, pp, t);
83
p = Point<3> (pp(0), pp(1), 0);
84
}
85
}
86
87