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