GaussianQuadrature_1d.h
Go to the documentation of this file.
1 //
2 // This file is part of the FFEA simulation package
3 //
4 // Copyright (c) by the Theory and Development FFEA teams,
5 // as they appear in the README.md file.
6 //
7 // FFEA is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // FFEA is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with FFEA. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // To help us fund FFEA development, we humbly ask that you cite
21 // the research papers on the package.
22 //
23 
24 #ifndef GAUSSIANQUADRATURE_1D_H_INCLUDED
25 #define GAUSSIANQUADRATURE_1D_H_INCLUDED
26 
27 #include <math.h>
28 #include "mat_vec_types.h"
29 
30 typedef struct {
33 
37 
38 
39 static gauss_point_1d gq_line[] = {
40  /* 1 point - precision 1 */
41  {2.0, 0.0},
42 
43  /* 2 point - precision 2 */
44  {1.0, 1.0 / sqrt(3)},
45  {1.0, -1.0 / sqrt(3)},
46 
47  /* 3 point - precision 3 */
48  {8.0 / 9.0, 0.0},
49  {5.0 / 9.0, sqrt(3.0 / 5.0)},
50  {5.0 / 9.0, -sqrt(3.0 / 5.0)},
51 
52  /* 4 point - precision 4 */
53  {0.652145154862546, 0.339981043584856},
54  {0.652145154862546, -0.339981043584856},
55  {0.347854845137454, 0.861136311594053},
56  {0.347854845137454, -0.861136311594053},
57 
58  /* 5 point - precision 5 */
59  {0.568888888888889, 0.0},
60  {0.478628670499366, 0.538469310105683},
61  {0.478628670499366, -0.538469310105683},
62  {0.236926885056189, 0.906179845938664},
63  {0.236926885056189, -0.906179845938664},
64 
65  /* 6 Point - precision 6 */
66  {0.467913934572691, 0.238619186083197},
67  {0.467913934572691, -0.238619186083197},
68  {0.360761573048139, 0.661209386466265},
69  {0.360761573048139, -0.661209386466265},
70  {0.171324492379170, 0.932469514203152},
71  {0.171324492379170, -0.932469514203152}
72 
73 };
74 
75 static int gq_precision_index[] = {
76  0, // Ignore this line (no precision 0)
77  0, // Precision 1: Starts at index 0, 1 point
78  1, // Precision 2: Starts at index 1, 2 point
79  3, // Precision 3: Starts at index 3, 3 points
80  6, // Precision 4: Starts at index 6, 4 points
81  10, // Precision 5: Starts at index 10, 5 points
82  15, // Precision 6: Starts at index 15, 6 points
83 };
84 
86 public:
87 
89  }
90 
91  /* Integrates function f(x) in the limits a to b, at the given precision */
92  scalar integrate_function_1d(scalar a, scalar b, int precision);
93 
94  scalar integrate_function_1d_tri(scalar theta_max, scalar L_perp, scalar theta_star, int precision);
95 
96 protected:
97  virtual scalar f_1d(scalar r) = 0;
98 };
99 #endif
scalar integrate_function_1d(scalar a, scalar b, int precision)
Definition: GaussianQuadrature_1d.cpp:26
virtual ~GaussianQuadrature_1d()
Definition: GaussianQuadrature_1d.h:88
scalar integrate_function_1d_tri(scalar theta_max, scalar L_perp, scalar theta_star, int precision)
Definition: GaussianQuadrature_1d.cpp:35
static int gq_precision_index[]
Definition: GaussianQuadrature_1d.h:75
virtual scalar f_1d(scalar r)=0
static gauss_point_1d gq_line[]
Definition: GaussianQuadrature_1d.h:39
Definition: GaussianQuadrature_1d.h:30
scalar zeta
Definition: GaussianQuadrature_1d.h:35
Definition: GaussianQuadrature_1d.h:85
double scalar
Definition: mat_vec_types.h:36
scalar W
Definition: GaussianQuadrature_1d.h:32