| 7 | : m_mesh(mesh), m_shape_func(shape_func) { } |
| 8 | |
| 9 | Float LinearTriangleIntegrator::integrate_func(size_t elem_idx, |
| 10 | size_t local_func_i, size_t local_func_j) { |
| 11 | // Note the following magic number comes from evaluating |
| 12 | // (shape_func_i * shape_func_j) at Gaussian quadrature points over |
| 13 | // triangle. |
| 14 | const Float coeff_ii = 1.0 / 6.0; |
| 15 | const Float coeff_ij = 1.0 / 12.0; |
| 16 | const Float vol = m_mesh->getElementVolume(elem_idx); |
| 17 | if (local_func_i == local_func_j) { |
| 18 | return coeff_ii * vol; |
| 19 | } else { |
| 20 | return coeff_ij * vol; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | Float LinearTriangleIntegrator::integrate_grad(size_t elem_idx, |
| 25 | size_t local_func_i, size_t local_func_j) { |