Implemented piecewise polynomial approximation of functions on arbitrary domains.
From e296f3d6:
The commit adds data structures to produce a piecewise polynomial (global) function approximation. A single high-order polynomial might be insufficient and the coefficient computation can be slow. A kd-tree is used for space partitioning (subdividing an axis-aligned bounding box (AABB) that captures the targeted domain). Each subdomain then approximates the function locally with a polynomial. To improve accuracy, the polynomial interpolation can be configured to also include points that are located outside the bounds of the local subdomain by temporary extension of the subdomain for construction of the polynomial. During evaluation at some point P, the unique enclosing subdomain is found with a tree-search and then the local polynomial is evaluated. No continuity between subdomains is enforced, though.
One application is the memory efficient approximate transfer of data between different meshes. The KDTree equipped with the polynomials can be serialized and deserialized from and to file. For instance (that is the reason for this implementation), some data from a simulation can be approximated, serialized and then later be deserialized as, e.g., a forcing term or initial condition on any other grid. If the approximation is sufficient - this can be much cheaper, universal, and straightforward than loading the original data and then interpolating in an application.
Concrete changes:
- some changes to the LSQP classes (those are more flexible now as the number of points does not have to be known a priori)
- a generic serializable kd-tree implementation
- some helpers to setup the piecewise LSQPs
- a test that demonstrates all the features on example FE functions
Some example images from the test
u | u_poly_eval | error
check the value ranges