Skip to content

Factorized FEM, per-point quadrature data, and variable-length summations (1.1.1) - #4

Open
w1th0utnam3 wants to merge 7 commits into
InteractiveComputerGraphics:mainfrom
w1th0utnam3:advanced-fem
Open

w1th0utnam3 wants to merge 7 commits into
InteractiveComputerGraphics:mainfrom
w1th0utnam3:advanced-fem

Conversation

@w1th0utnam3

Copy link
Copy Markdown
Member

Features

  • Factorized FEM potentials (add_potential_fem, FemEnergySplit): the material density is differentiated with respect to an abstract F, and the nodal gradient and Hessian come from compact loop kernels. The results match add_potential up to round-off, with much smaller generated code and much faster compilation for high-order elements.
    • Supports rectangular B (n×r, r = 1/2/3) for lines, membranes, and shells.
    • Detects nonlinear per-node position maps and includes their exact geometric stiffness.
    • Supports conditional potentials and branching materials; works with the first-order optimizer and the adjoint solver.
    • New helpers: fem_shape_gradients, fem_deformation_gradient_B.
  • Per-point quadrature data: make_quadrature_scalar/vector/matrix() bind element-specific data to each integration point.
  • Variable-length summations: make_summation(offsets) / add_for_each(offsets, …) allow a different number of points per element (scalar kernels only).
  • Symbolic substitution for scalars, vectors, and matrices (substitute.h).
  • Per-potential energy/gradient breakdown: evaluate_P_components(), evaluate_P__dP_du_components(), and FirstOrderOptimizer::get_compiled().

Performance and fixes

  • Direct LLT builds the sparse matrix directly from the blocked Hessian, reuses its storage while the pattern is unchanged, and copies values in parallel.
  • Expressions::eval memoizes shared subexpressions (previously exponential on shared graphs).
  • Branches that are not reachable from the outputs no longer count towards the branch limit.

Build

  • Behavior change: SYMX_ENABLE_MKL is now AUTO/ON/OFF (default AUTO, previously OFF), with automatic discovery of oneAPI installations.
  • Behavior change: new SYMX_USE_SYSTEM_FMT (default OFF), so an installed fmt is no longer used automatically.
  • Bundled fmt updated from 10.0.0 to 12.2.0 (fixes libc++ deprecation warnings on macOS); fmt version detection now reads base.h and falls back to core.h.
  • Uses CMAKE_DL_LIBS for platform loader libraries; Eigen version read from Eigen/Version.

Docs, examples, tests

  • New "Advanced FEM and Integration" page, with cross-links from related pages; energy-breakdown section; updated MKL/fmt setup docs.
  • Rubber extrusion example: RubberExtrusionMode selects shared-rule, indexed-quadrature, or factorized FEM definitions.
  • New tests: test_factorized_fem, test_quadrature_data, test_dynamic_summation, test_substitute, plus energy-breakdown and direct-LLT pattern-reuse tests.

Advanced FEM and integration:
- Add factorized FEM potentials (add_potential_fem, FemEnergySplit)
  with exact derivatives for node-local position maps, including
  dedicated scalar codegen (compile_factorized*) and solver paths.
- Add per-point quadrature data (make_quadrature_*) and
  variable-length summations per element (make_summation(offsets)).
- Add symbolic substitution for scalars, vectors, and matrices.
- Only count branches reachable from requested outputs in Sequence,
  so unused branches left by substitution don't use up the branch limit.
- Keep compiled artifacts of factorized and standard potentials
  separate (checksum and artifact suffixes).
- Add fem_shape_gradients and fem_deformation_gradient_B.
- Rubber extrusion example: select shared-rule, indexed-quadrature,
  or factorized FEM definitions via RubberExtrusionMode.

Solver:
- Add per-potential energy and gradient breakdowns
  (evaluate_P_components, evaluate_P__dP_du_components) and expose
  FirstOrderOptimizer::get_compiled().
- Direct LLT: build the CSR directly from the blocked Hessian, reuse
  storage and symbolic analysis while the block pattern is unchanged,
  and refresh values in parallel.
- Memoize Expressions::eval over shared subexpressions.

Build:
- SYMX_ENABLE_MKL is now AUTO/ON/OFF (default AUTO) with discovery
  of standard and versioned oneAPI installations.
- Add SYMX_USE_SYSTEM_FMT (default OFF); prefer the bundled fmt so
  that unrelated installations (e.g. Conda) are not linked.
- Use CMAKE_DL_LIBS and read the Eigen version from Eigen/Version.

Docs and tests:
- Add the "Advanced FEM and Integration" page and cross-links, the
  energy breakdown section, and updated MKL/fmt setup instructions.
- Add tests for substitution, quadrature data, dynamic summation,
  factorized FEM, energy breakdowns, and direct LLT pattern reuse.
- Add the gallery generation script and captions, plus a Sphinx
  helper script.
@w1th0utnam3
w1th0utnam3 force-pushed the advanced-fem branch 4 times, most recently from 69df6e5 to 68d418b Compare November 2, 2026 20:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant