Newer
Older
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
/**
* \author Norihiro Watanabe
* \date 2013-08-13
*
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include "GaussLegendre.h"
namespace MathLib
{
std::pair<double, double> GaussLegendre::getPoint(unsigned n_sample_points, unsigned point_id)
{
switch (n_sample_points)
{
case 1:
return std::make_pair(0.0, 2.0);
case 2:
switch (point_id)
{
case 0:
return std::make_pair(0.577350269189626, 1.0);
case 1:
return std::make_pair(-0.577350269189626, 1.0);
}
break;
case 3:
switch (point_id)
{
case 0:
return std::make_pair(0.774596669241483, 0.555555555555556);
case 1:
return std::make_pair(0.0, 0.888888888888889);
case 2:
return std::make_pair(-0.774596669241483, 0.555555555555556);
}
break;
case 4:
switch (point_id)
{
case 0:
return std::make_pair(0.861136311594053, 0.347854845137454);
case 1:
return std::make_pair(0.339981043584856, 0.652145154862546);
case 2:
return std::make_pair(-0.339981043584856, 0.652145154862546);
case 3:
return std::make_pair(-0.861136311594053, 0.347854845137454);
}
break;
}
Norihiro Watanabe
committed
return std::make_pair(0.0, 0.0);