PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
MomentFitting.h File Reference

Moment fitting for polynomial quadrature rules. More...

#include "Concepts.h"
#include "pbat/Aliases.h"
#include "pbat/common/ArgSort.h"
#include "pbat/common/Eigen.h"
#include "pbat/common/Indexing.h"
#include "pbat/math/polynomial/Basis.h"
#include "pbat/math/polynomial/Concepts.h"
#include <algorithm>
#include <exception>
#include <limits>
#include <tbb/parallel_for.h>
#include <tuple>
#include <unsupported/Eigen/NNLS>
#include <utility>

Go to the source code of this file.

Classes

struct  pbat::math::DynamicQuadrature< Dims, Order >
 Quadrature rule with variable points and weights. More...
 

Namespaces

namespace  pbat
 The main namespace of the library.
 
namespace  pbat::math
 Math related functionality.
 

Functions

template<polynomial::CBasis TBasis, CFixedPointPolynomialQuadratureRule TQuad>
Matrix< TBasis::kSize, TQuad::kPoints > pbat::math::ReferenceMomentFittingMatrix (TBasis const &Pb, TQuad const &Q)
 Compute the moment fitting matrix in the reference simplex space.
 
template<polynomial::CBasis TBasis, CPolynomialQuadratureRule TQuad>
Matrix< TBasis::kSize, Eigen::Dynamic > pbat::math::ReferenceMomentFittingMatrix (TBasis const &Pb, TQuad const &Q)
 Compute the moment fitting matrix in the reference simplex space.
 
template<polynomial::CBasis TBasis, class TDerivedXg>
Matrix< TBasis::kSize, Eigen::Dynamic > pbat::math::ReferenceMomentFittingMatrix (TBasis const &Pb, Eigen::MatrixBase< TDerivedXg > const &Xg)
 Compute the moment fitting matrix in the reference simplex space.
 
template<class TDerivedP, class TDerivedB>
VectorX pbat::math::MomentFittedWeights (Eigen::MatrixBase< TDerivedP > const &P, Eigen::DenseBase< TDerivedB > const &b, Index maxIterations=10, Scalar precision=std::numeric_limits< Scalar >::epsilon())
 Computes non-negative quadrature weights \( w \) by moment fitting.
 
template<polynomial::CBasis Polynomial, class TDerivedXg, class TDerivedWg>
Vector< Polynomial::kSize > pbat::math::Integrate (Polynomial const &P, Eigen::MatrixBase< TDerivedXg > const &Xg, Eigen::DenseBase< TDerivedWg > const &wg)
 Computes \( \int_{\Omega} P(x) \, d\Omega \) given an existing quadrature rule \((Xg,wg) \).
 
template<polynomial::CBasis Polynomial, class TDerivedXg1, class TDerivedXg2, class TDerivedWg2>
Vector< TDerivedXg1::ColsAtCompileTime > pbat::math::TransferQuadrature (Polynomial const &P, Eigen::MatrixBase< TDerivedXg1 > const &Xg1, Eigen::MatrixBase< TDerivedXg2 > const &Xg2, Eigen::DenseBase< TDerivedWg2 > const &wg2, Index maxIterations=10, Scalar precision=std::numeric_limits< Scalar >::epsilon())
 Obtain weights \( w_g^1 \) by transferring an existing quadrature rule \( X_g^2, w_g^2 \) defined on a simplex onto a new quadrature rule \( X_g^1, w_g^1 \) defined on the same simplex.
 
template<auto Order, class TDerivedS1, class TDerivedXi1, class TDerivedS2, class TDerivedXi2, class TDerivedWg2>
std::pair< VectorX, VectorXpbat::math::TransferQuadrature (Eigen::DenseBase< TDerivedS1 > const &S1, Eigen::MatrixBase< TDerivedXi1 > const &Xi1, Eigen::DenseBase< TDerivedS2 > const &S2, Eigen::MatrixBase< TDerivedXi2 > const &Xi2, Eigen::DenseBase< TDerivedWg2 > const &wi2, Index nSimplices=-1, bool bEvaluateError=false, Index maxIterations=10, Scalar precision=std::numeric_limits< Scalar >::epsilon())
 Obtain weights \( w_g^1 \) by transferring an existing quadrature rule \( X_g^2, w_g^2 \) defined on a domain of simplices onto a new quadrature rule \( X_g^1, w_g^1 \) defined on the same domain.
 
template<int Order, class TDerivedS1, class TDerivedX1, class TDerivedS2, class TDerivedX2, class TDerivedW2>
std::tuple< MatrixX, MatrixX, IndexVectorXpbat::math::ReferenceMomentFittingSystems (Eigen::DenseBase< TDerivedS1 > const &S1, Eigen::MatrixBase< TDerivedX1 > const &X1, Eigen::DenseBase< TDerivedS2 > const &S2, Eigen::MatrixBase< TDerivedX2 > const &X2, Eigen::DenseBase< TDerivedW2 > const &w2, Index nSimplices=Index(-1))
 Computes reference moment fitting systems for all simplices \( S_1 \), given an existing quadrature rule \( (X_g^2, w_g^2) \) defined on a domain of simplices. The quadrature points of the new rule \( X_g^1 \) are given and fixed.
 
template<class TDerivedM, class TDerivedP>
CSRMatrix pbat::math::BlockDiagonalReferenceMomentFittingSystem (Eigen::MatrixBase< TDerivedM > const &M, Eigen::DenseBase< TDerivedP > const &P)
 Block diagonalizes the given reference moment fitting systems (see ReferenceMomentFittingSystems()) into a large sparse matrix.
 

Detailed Description

Moment fitting for polynomial quadrature rules.

Author
Quoc-Minh Ton-That (tonth.nosp@m.at.q.nosp@m.uocmi.nosp@m.nh@g.nosp@m.mail..nosp@m.com)
Date
2025-02-11