-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntegration.h
More file actions
192 lines (170 loc) · 7.21 KB
/
Integration.h
File metadata and controls
192 lines (170 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
//
// Created by simonepanzeri on 25/11/2021.
//
#ifndef DEV_FDAPDE_INTEGRATION_H
#define DEV_FDAPDE_INTEGRATION_H
#include "FdaPDE.h"
#include "Point.h"
struct IntegratorTriangleP1 {
//Number of nodes
static constexpr UInt NNODES = 1;
static constexpr std::array<Real, NNODES> WEIGHTS{{1}};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<2>, NNODES> NODES {
Point<2>({1./3, 1./3})
};
};
struct IntegratorTriangleP2 {
//Number of nodes
static constexpr UInt NNODES = 3;
static constexpr std::array<Real, NNODES> WEIGHTS{{1./3, 1./3, 1./3}};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<2>, NNODES> NODES {
Point<2>({1./6, 1./6}),
Point<2>({2./3, 1./6}),
Point<2>({1./6, 2./3})
};
};
struct IntegratorTriangleP4 {
//Number of nodes
static constexpr UInt NNODES = 6;
static constexpr std::array<Real, NNODES> WEIGHTS {
{0.223381589678011,
0.223381589678011,
0.223381589678011,
0.109951743655322,
0.109951743655322,
0.109951743655322}
};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<2>, NNODES> NODES {
Point<2>({0.445948490915965, 0.445948490915965}),
Point<2>({0.445948490915965, 0.108103018168070}),
Point<2>({0.108103018168070, 0.445948490915965}),
Point<2>({0.091576213509771, 0.091576213509771}),
Point<2>({0.091576213509771, 0.816847572980459}),
Point<2>({0.816847572980459, 0.091576213509771})
};
};
struct IntegratorTriangleP5 {
//Number of nodes
static constexpr UInt NNODES = 7;
static constexpr std::array<Real, NNODES> WEIGHTS{
{0.225000000000000,
0.125939180544827,
0.125939180544827,
0.125939180544827,
0.132394152788506,
0.132394152788506,
0.132394152788506}
};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<2>, NNODES> NODES {
Point<2>({0.333333333333333, 0.333333333333333}),
Point<2>({0.101286507323456, 0.101286507323456}),
Point<2>({0.101286507323456, 0.797426985353087}),
Point<2>({0.797426985353087, 0.101286507323456}),
Point<2>({0.470142064105115, 0.470142064105115}),
Point<2>({0.470142064105115, 0.059715871789770}),
Point<2>({0.059715871789770, 0.470142064105115}),
};
};
struct IntegratorTetrahedronP1 {
//Number of nodes
static constexpr UInt NNODES = 1;
static constexpr std::array<Real,NNODES> WEIGHTS{{1}};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<3>, NNODES> NODES {
Point<3>({1./4, 1./4, 1./4})
};
};
struct IntegratorTetrahedronP2 {
//Number of nodes
static constexpr UInt NNODES = 4;
static constexpr std::array<Real, NNODES> WEIGHTS{{1./4, 1./4, 1./4, 1./4}};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<3>, NNODES> NODES {
Point<3>({0.585410196624969, 0.138196601125011, 0.138196601125011}),
Point<3>({0.138196601125011, 0.138196601125011, 0.138196601125011}),
Point<3>({0.138196601125011, 0.138196601125011, 0.585410196624969}),
Point<3>({0.138196601125011, 0.585410196624969, 0.138196601125011})
};
};
struct IntegratorTetrahedronP4 {
//Number of nodes
static constexpr UInt NNODES = 14;
static constexpr std::array<Real, NNODES> WEIGHTS {
{0.008501593297035,
0.008501593297035,
0.008501593297035,
0.008501593297035,
0.050615550377161,
0.050615550377161,
0.050615550377161,
0.050615550377161,
0.127255237550536,
0.127255237550536,
0.127255237550536,
0.127255237550536,
0.127255237550536,
0.127255237550536}
};
//Point locations (in barycentric coordinates)
static constexpr std::array<Point<3>, NNODES> NODES {
Point<3>({1./3, 1./3, 1./3}),
Point<3>({ 0, 1./3, 1./3}),
Point<3>({1./3, 0, 1./3}),
Point<3>({1./3, 1./3, 0}),
Point<3>({0.076284841942834, 0.076284841942834, 0.076284841942834}),
Point<3>({0.771145474171499, 0.076284841942834, 0.076284841942834}),
Point<3>({0.076284841942834, 0.771145474171499, 0.076284841942834}),
Point<3>({0.076284841942834, 0.076284841942834, 0.771145474171499}),
Point<3>({0.405500312564648, 0.094499687435353, 0.094499687435353}),
Point<3>({0.094499687435353, 0.405500312564648, 0.094499687435353}),
Point<3>({0.094499687435353, 0.094499687435353, 0.405500312564648}),
Point<3>({0.405500312564648, 0.405500312564648, 0.094499687435353}),
Point<3>({0.405500312564648, 0.094499687435353, 0.405500312564648}),
Point<3>({0.094499687435353, 0.405500312564648, 0.405500312564648})
};
};
struct ElementIntegratorHelper {
template<UInt NNODES, UInt mydim>
using Integrator = typename std::conditional<mydim==2,
typename std::conditional<NNODES==3, IntegratorTriangleP1, IntegratorTriangleP2>::type,
typename std::conditional<NNODES==4, IntegratorTetrahedronP1, IntegratorTetrahedronP2>::type>::type;
};
struct SpaceIntegratorHelper {
template<UInt ORDER, UInt mydim>
using Integrator = typename std::conditional<mydim==2,
typename std::conditional<ORDER==1, IntegratorTriangleP2, IntegratorTriangleP4>::type,
typename std::conditional<ORDER==1, IntegratorTetrahedronP2, IntegratorTetrahedronP4>::type>::type;
};
struct DensityIntegratorHelper {
template<UInt mydim>
using Integrator = typename std::conditional<mydim==2, IntegratorTriangleP4, IntegratorTetrahedronP4>::type;
};
struct IntegratorGaussP3 {
static constexpr UInt ORDER = 1;
//Number of nodes
static constexpr UInt NNODES = 2;
//Point locations
static constexpr std::array<Real, NNODES> WEIGHTS{{1., 1.}};
static constexpr std::array<Real, NNODES> NODES{{-0.577350269189626, 0.577350269189626}};
};
struct IntegratorGaussP5 {
static constexpr UInt ORDER = 1;
//Number of nodes
static constexpr UInt NNODES = 3;
//Point locations
static constexpr std::array<Real, NNODES> WEIGHTS{{5./9, 8./9, 5./9}};
static constexpr std::array<Real, NNODES> NODES{{-0.774596669241483, 0, 0.774596669241483}};
};
struct IntegratorGaussP9 {
static constexpr UInt ORDER = 1;
//Number of nodes
static constexpr UInt NNODES = 5;
//Point locations
static constexpr std::array<Real, NNODES> WEIGHTS{{0.236926885056189, 0.478628670499366, 128./225, 0.478628670499366, 0.236926885056189}};
static constexpr std::array<Real, NNODES> NODES{{-0.906179845938664, -0.538469310105683, 0, 0.538469310105683, 0.906179845938664}};
};
#endif //DEV_FDAPDE_INTEGRATION_H