opensurgsim
GaussLegendreQuadrature.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2012-2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
19 
20 #ifndef SURGSIM_MATH_GAUSSLEGENDREQUADRATURE_H
21 #define SURGSIM_MATH_GAUSSLEGENDREQUADRATURE_H
22 
23 #include <array>
24 #include <utility>
25 
26 namespace SurgSim
27 {
28 namespace Math
29 {
30 
33 {
34  gaussQuadraturePoint(double p, double w) : point(p), weight(w){}
35 
36  const double point;
37  const double weight;
38 };
39 
44 {
45  gaussQuadratureTrianglePoint(double xi, double eta, double w) : coordinateXi(xi), coordinateEta(eta), weight(w){}
46 
47  const double coordinateXi;
48  const double coordinateEta;
49  const double weight;
50 };
51 
59 extern const std::array<gaussQuadraturePoint, 1> gaussQuadrature1Point;
60 
68 extern const std::array<gaussQuadraturePoint, 2> gaussQuadrature2Points;
69 
77 extern const std::array<gaussQuadraturePoint, 3> gaussQuadrature3Points;
78 
86 extern const std::array<gaussQuadraturePoint, 4> gaussQuadrature4Points;
87 
95 extern const std::array<gaussQuadraturePoint, 5> gaussQuadrature5Points;
96 
104 extern const std::array<gaussQuadraturePoint, 100> gaussQuadrature100Points;
105 
106 // http://math2.uncc.edu/~shaodeng/TEACHING/math5172/Lectures/Lect_15.PDF
107 // "Quadrature Formulas in Two Dimensions"
108 // \int_0^1 \int_0^{1-eta} f(xi, eta) dxi deta = 1/2 sum_i w[i] f(xi[i], eta[i])
109 
118 extern const std::array<gaussQuadratureTrianglePoint, 3> gaussQuadrature2DTriangle3Points;
119 
128 extern const std::array<gaussQuadratureTrianglePoint, 6> gaussQuadrature2DTriangle6Points;
129 
138 extern const std::array<gaussQuadratureTrianglePoint, 12> gaussQuadrature2DTriangle12Points;
139 
140 }; // namespace Math
141 }; // namespace SurgSim
142 
143 #endif // SURGSIM_MATH_GAUSSLEGENDREQUADRATURE_H
Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui n...
Definition: AddRandomSphereBehavior.cpp:36
const double coordinateEta
, must verify
Definition: GaussLegendreQuadrature.h:48
const double coordinateXi
, must verify
Definition: GaussLegendreQuadrature.h:47
2D Gauss-Legendre quadrature on a triangle
Definition: GaussLegendreQuadrature.h:43
1D Gauss-Legendre quadrature
Definition: GaussLegendreQuadrature.h:32