The quadraturerules Rust library is available on crates.io. It can be installed by running:
cargo install quadraturerules
To use the latest version of quadraturerules in your crate, add the following to the [dependencies] section of your Cargo.toml file:
quadraturerules = "0.7.3"
The library's function single_integral_quadrature can be used to get the points and weights of quadrature rules for a single integral. For example the following snippet will create an order 3 Xiao–Gimbutas rule on a triangle:
use quadraturerules::{Domain, QuadratureRule, single_integral_quadrature};
let (points, weights) = single_integral_quadrature(
QuadratureRule::XiaoGimbutas,
Domain::Triangle,
3,
).unwrap();
Note that the points returned by the library are represented using barycentric coordinates.
The Rust quadraturerules library can be generated from the templates in the online encyclopedia of quadrature rules GitHub repo. First clone the repo and move into the library directory:
git clone https://github.com/quadraturerules/quadraturerules.git
cd quadraturerules/library
The Rust library can then be generated by running:
python build.py rust
This will create a directory called rust.build containing the Rust source code.
Tests can then be run by moving into this folder and using cargo:
cd rust.build
cargo test