The source code of the quadraturerules C++ library can be downloaded from the latest release on GitHub. It can be installed by running:
wget https://github.com/quadraturerules/quadraturerules/releases/download/0.7.3/quadraturerules-cpp-0.7.3.tar.gz
mkdir src
tar -xvf quadraturerules-cpp-0.7.3.tar.gz -C src
mkdir build
cd build
cmake ../src
make
make install
Once the library is installed, you can run the tests by running:
python src/test/run_tests.py
Or you can run individual tests:
cd src/test/{TEST_NAME}
cmake .
make .
./{TEST_NAME}
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:
#include <quadraturerules.h>
using quadraturerules;
auto [points, weights] = single_integral_quadrature(
QuadratureRule::XiaoGimbutas,
Domain::Triangle,
3,
);
Note that the points returned by the library are represented using barycentric coordinates.
The C++ 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 C++ library can then be generated by running:
python build.py cpp
This will create a directory called cpp.build containing the C++ source code.