|
CMP++: Uncertainty Quantification & Bayesian Calibration
|
Multi-dimensional tensor product quadrature integrator. More...
#include <integrator.h>
Public Member Functions | |
| TensorIntegrator (int dim, int pointsPerDim) | |
| double | integrate (const std::function< double(const Eigen::VectorXd &)> &f) const |
| double | integrate (const std::function< double(const Eigen::VectorXd &)> &f, const Eigen::VectorXd &p1, const Eigen::VectorXd &p2) const |
Public Attributes | |
| Eigen::MatrixXd | gridNodes |
| Matrix of joint tensor product quadrature nodes (totalPoints x dim). | |
| Eigen::VectorXd | gridWeights |
| Vector of joint tensor product weights (totalPoints). | |
Multi-dimensional tensor product quadrature integrator.
Mathematical Formulation: A multi-dimensional integral over a tensor-product domain $\Omega = [a_1, b_1] \times \dots \times [a_d, b_d]$ is approximated by the tensor product of 1D quadrature rules:
\[ \int_{\Omega} f(\mathbf{x}) \, d\mathbf{x} \approx \sum_{i_1=0}^{N-1} \dots \sum_{i_d=0}^{N-1} \left( \prod_{j=1}^{d} w_{i_j} \right) f(x_{i_1}, \dots, x_{i_d}) \]
where $w_{i_j}$ and $x_{i_j}$ are the 1D quadrature weights and nodes along dimension $j$. For physical domain integration over custom bounds $[p_{1,d}, p_{2,d}]$, a coordinate transformation maps the canonical nodes $\xi \in [-1, 1]$ (or the canonical domain of the basis) to $x \in [p_{1,d}, p_{2,d}]$ via:
\[ x = \text{mapToPhysical}(\xi, p_{1,d}, p_{2,d}) \]
The integration automatically incorporates any scaling factors (Jacobian of the transformation) if required by the basis.
Implementation Algorithm:
Quadrature1D<BasisType> with the specified pointsPerDim.pointsPerDim and $d$ is dim.integrate overloads:integrate(f): computes $\sum_{i} W_i f(\mathbf{x}_i)$.integrate(f, p1, p2): maps canonical nodes to physical coordinates using BasisType::mapToPhysical for each dimension before evaluating $f$ and summing with weights.
|
inline |
|
inline |
Canonical Integration: Integrates a function defined in the canonical domain using tensor product quadrature.
| f | Function to integrate, defined in the canonical domain. |
|
inline |
Physical Integration: Integrates a function defined in the physical domain by automatically mapping to the canonical domain.
| f | Function to integrate, defined in the physical domain. |
| p1 | Lower bounds of the physical domain for each dimension. |
| p2 | Upper bounds of the physical domain for each dimension. |
| Eigen::MatrixXd cmp::TensorIntegrator< BasisType >::gridNodes |
Matrix of joint tensor product quadrature nodes (totalPoints x dim).
| Eigen::VectorXd cmp::TensorIntegrator< BasisType >::gridWeights |
Vector of joint tensor product weights (totalPoints).