Conversation
Add a VERTEX_DERIVATIVE_LAYOUT constant to ipc::config and include Eigen. Update local_to_global.hpp to parameterize all assembly helpers (gradient, sparse gradient, Hessian triplets, Jacobian triplets, MatrixCache Hessian) with an optional GlobalOrder template (defaulting to VERTEX_DERIVATIVE_LAYOUT). Implement both RowMajor and ColMajor indexing code paths and add static_asserts and detailed doc comments. Also include ipc/config.hpp, convert LocalThreadMatStorage to a struct with docs, and adjust MatrixCache-based hessian assembly to respect the chosen global ordering.
* Add barrier stiffness and simplify tangential API Introduce a barrier stiffness (kappa) to BarrierPotential: new constructors, member, getters/setters, and scale operator/gradient/hessian by stiffness. Remove the redundant normal_stiffness parameter from tangential collision constructors and tangential potential interfaces, updating all call sites, headers, and implementations accordingly. Update Python bindings, tutorials, examples (ogc, solver), and tests (test_ipc) to match the new API and default stiffness usage; also move a notebook to python/examples. Miscellaneous formatting/import cleanups and adjustments to pybind argument lists to reflect the simplified tangential API.
Disable Eigen vectorization to avoid alignment issues. Place EIGEN_DONT_VECTORIZE on the ipc_toolkit target as PUBLIC because setting it on the Eigen target or making it PRIVATE caused crashes.
Detect lbvh.size() == 1 and treat the root as a leaf in both single and batched query traversals, performing intersection tests and adding candidate collisions as appropriate
* Integrate analytic plane-vertex primitives into the collision pipeline. * Add PlaneVertexCandidate, normal and tangential plane-vertex collisions, and pv handling in builders. * Add CollisionMesh::planes and Python bindings (Hyperplane, PlaneVertex*). * Remove old implicits module and update CMake, tests, and small API/format fixes. * Refactor conservative rescaling initialization in CCD classes and update documentation
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable degree-of-freedom (DOF) ordering to the gradient, Hessian, and Jacobian assembly utilities in local_to_global.hpp. It introduces a VERTEX_DERIVATIVE_LAYOUT constant (defaulting to Eigen::RowMajor) in ipc/config.hpp.in and parametrizes all five local-to-global assembly helpers with a GlobalOrder template non-type parameter so callers can opt into either interleaved (RowMajor: [x0,y0,z0, x1,y1,z1,…]) or blocked (ColMajor: [x0,x1,…, y0,y1,…]) global DOF ordering. Because VERTEX_DERIVATIVE_LAYOUT defaults to Eigen::RowMajor, no existing callers are affected when using the default.
Changes:
- Adds
VERTEX_DERIVATIVE_LAYOUT = Eigen::RowMajortoconfig.hpp.in(with an<Eigen/Core>include). - Parametrizes all five local-to-global assembly helpers with an
int GlobalOrdertemplate parameter and implements both RowMajor and ColMajor index mapping code paths viaif constexpr. - Converts
LocalThreadMatStoragefromclasstostructand adds doxygen comments to all functions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
src/ipc/config.hpp.in |
Adds <Eigen/Core> include and VERTEX_DERIVATIVE_LAYOUT constant |
src/ipc/utils/local_to_global.hpp |
Adds GlobalOrder template parameter to all assembly helpers, implements ColMajor index paths, converts LocalThreadMatStorage to struct, adds doxygen docs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
==========================================
- Coverage 97.18% 97.18% -0.01%
==========================================
Files 160 160
Lines 24721 24734 +13
Branches 890 890
==========================================
+ Hits 24025 24037 +12
- Misses 696 697 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Use total global vertex/row/col counts when computing column-major indices and validate buffer sizes. Add optional n_total_verts, n_total_rows and n_total_cols parameters (default -1) that are required for ColMajor storage and throw an error if omitted. Include logger header, assert grad size divisibility, and update MatrixCache/triplet indexing accordingly. Add test_local_to_global.cpp to tests CMakeLists.
Add tests/dof_layout.hpp with helpers to flatten, unflatten, and reorder gradients/hessians so finite-difference tests work for both VERTEX_DERIVATIVE_LAYOUT settings. Pass mesh.num_vertices() (n_total_verts) into shape_derivative and local_*_to_global_triplets so global DOF indices are computed correctly for column-major layouts.
Use VERTEX_DERIVATIVE_LAYOUT to map vertex-level sparse matrices into per-dof sparse matrices, computing triplets with n_rows/n_cols and constructing M_dof with the correct dimensions. Move the function declaration in the header and add unit tests (including Catch2 generators and config include) that verify sparsity pattern and the M_dof * x == flatten(M_V * V) semantics.
Introduce IPC_TOOLKIT_VERTEX_DERIVATIVE_LAYOUT CMake cache option (default RowMajor) with allowed values ColMajor and RowMajor, and mark it advanced. Export the value into src/ipc/config.hpp.in so VERTEX_DERIVATIVE_LAYOUT is set to the chosen Eigen layout at configure time.
Describe row-major default and new CMake cache option IPC_TOOLKIT_VERTEX_DERIVATIVE_LAYOUT (RowMajor or ColMajor), with build examples, affected APIs, and an experimental feature warning.
Description
VERTEX_DERIVATIVE_LAYOUTconstant toipc/config.hppand include Eigen.ipc/config.hpp, convertLocalThreadMatStorageto a struct with docs, and adjustMatrixCache-based hessian assembly to respect the chosen global ordering.Type of change