PolyFEM
Loading...
Searching...
No Matches
TriQuadrature.cpp
Go to the documentation of this file.
1#include "TriQuadrature.hpp"
2#include "LineQuadrature.hpp"
3
4#include <vector>
5#include <cassert>
6#include <cmath>
7
8namespace polyfem
9{
10 namespace quadrature
11 {
12 namespace
13 {
14 void get_weight_and_points(const int order, const bool use_corner_quadrature, Eigen::MatrixXd &points, Eigen::VectorXd &weights)
15 {
16 if (use_corner_quadrature)
17 {
18 switch (order)
19 {
21
22 default:
23 assert(false);
24 };
25 }
26 else
27 {
28 switch (order)
29 {
31
32 default:
33 assert(false);
34 };
35 }
36 }
37 } // namespace
38
39 TriQuadrature::TriQuadrature(bool use_corner_quadrature) : use_corner_quadrature_(use_corner_quadrature)
40 {
41 }
42
43 void TriQuadrature::get_quadrature(const int order, Quadrature &quad)
44 {
45 Quadrature tmp;
46
47 get_weight_and_points(order, use_corner_quadrature_, quad.points, quad.weights);
48
49 assert(use_corner_quadrature_ || fabs(quad.weights.sum() - 1) < 1e-14);
50 assert(quad.points.minCoeff() >= 0 && quad.points.maxCoeff() <= 1);
51
52 assert(quad.points.rows() == quad.weights.size());
53
54 quad.weights /= 2;
55 }
56 } // namespace quadrature
57} // namespace polyfem
Quadrature quadrature
void get_quadrature(const int order, Quadrature &quad)
TriQuadrature(bool use_corner_quadrature=false)