Chi-Tech
pwl_polygon_01_reftriangle.cc
Go to the documentation of this file.
2
4{
5
7 const chi_mesh::Vector3& qpoint,
8 bool on_surface /*false*/)
9{
10 double xi;
11 double eta;
12 if (!on_surface)
13 {
14 xi = qpoint.x;
15 eta = qpoint.y;
16 }
17 else
18 {
19 xi = qpoint.x;
20 eta = 0.0;
21 }
22
23 double value = 0.0;
24 if (index == 0) value = 1.0 - xi - eta;
25 else if (index == 1)
26 value = xi;
27 else if (index == 2)
28 value = eta;
29
30 return value;
31}
32
33//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Varphi_x
34/**Precomputation of the shape function at a quadrature point.*/
35double
37 uint32_t i,
38 const chi_mesh::Vector3& qpoint,
39 bool on_surface /*=false*/) const
40{
41 int index = node_to_side_map_[i][side];
42 double value = 0.0;
43 if (index == 0 or index == 1) value = TriShape(index, qpoint, on_surface);
44
45 value += beta_ * TriShape(2, qpoint, on_surface);
46
47 return value;
48}
49
50//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GradVarphi_x
51/**Precomputation of the partial derivative along x of the
52 * shape function at a quadrature point.*/
54 uint32_t i) const
55{
56 int index = node_to_side_map_[i][side];
57 double value = 0;
58 if (index == 0)
59 {
60
61 value = sides_[side].JTinv.GetIJ(0, 0) * -1.0 +
62 sides_[side].JTinv.GetIJ(0, 1) * -1.0;
63 }
64 if (index == 1)
65 {
66
67 value = sides_[side].JTinv.GetIJ(0, 0) * 1.0 +
68 sides_[side].JTinv.GetIJ(0, 1) * 0.0;
69 }
70
71 value += beta_ * (sides_[side].JTinv.GetIJ(0, 0) * 0.0 +
72 sides_[side].JTinv.GetIJ(0, 1) * 1.0);
73
74 return value;
75}
76
77//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GradVarphi_y
78/**Precomputation of the partial derivative along y of the
79 * shape function at a quadrature point.*/
81 uint32_t i) const
82{
83 int index = node_to_side_map_[i][side];
84 double value = 0;
85 if (index == 0)
86 {
87
88 value = sides_[side].JTinv.GetIJ(1, 0) * -1.0 +
89 sides_[side].JTinv.GetIJ(1, 1) * -1.0;
90 }
91 if (index == 1)
92 {
93
94 value = sides_[side].JTinv.GetIJ(1, 0) * 1.0 +
95 sides_[side].JTinv.GetIJ(1, 1) * 0.0;
96 }
97
98 value += beta_ * (sides_[side].JTinv.GetIJ(1, 0) * 0.0 +
99 sides_[side].JTinv.GetIJ(1, 1) * 1.0);
100
101 return value;
102}
103
104} // namespace chi_math::cell_mapping
double SideShape(uint32_t side, uint32_t i, const chi_mesh::Vector3 &qpoint, bool on_surface=false) const
static double TriShape(uint32_t index, const chi_mesh::Vector3 &qpoint, bool on_surface=false)
double x
Element-0.
double y
Element-1.