LehrFEM++ 1.0.0
A simple Finite Element Library for teaching
Loading...
Searching...
No Matches
Quick Reference - Quadrature

Edit on GitHub

Attention
The contents of this page is discussed in Lecture Document Paragraph 2.7.5.39. Please read this section before using the quick reference.

Overview

LehrFEM++ provides a number of quadrature rules for the numerical integration of functions over reference elements. General entities can be mapped to the reference element using the methods described in the Geometry quick reference.

Working with Quadrature Rules

The quad namespace has some useful functions for instantiating quadrature rules for a given reference element. The following code snippet shows how to get a quadrature rule for a triangle of degree >= 3 using lf::quad::make_QuadRule.

It is also possible to get a quadrature rule which only uses the nodes of the reference element to approximate the integral using lf::quad::make_QuadRuleNodal.

Another possibility is to define a quadrature rule by specifying the nodes and weights manually. This can be done using the lf::quad::QuadRule constructor.

Eigen::MatrixXd points(2, 3);
points << 0.166667, 0.666667, 0.166667, 0.166667, 0.166667, 0.666667;
Eigen::Vector3d weights;
weights << 0.166667, 0.166667, 0.166667;
lf::quad::QuadRule qr(ref_tria, points, weights, 2);

Lastly LehrFEM++ also provides a few more specialized quadrature rules. A list can be found on the Quadrature Rules Namespace page.

Using a Quadrature Rule

// Get degree of quadrature rule
int degree = qr.Degree();
// Get the order of a quadrature rule (degree + 1)
int order = qr.Order();
// Get points as columns of a matrix
Eigen::MatrixXd points = qr.Points();
// Get weights as a vector
Eigen::VectorXd weights = qr.Weights();