Add masked particle resets to SolverVBD - #3345
Conversation
Signed-off-by: JC Chang <jumyungc@nvidia.com>
Signed-off-by: JC Chang <jumyungc@nvidia.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR adds masked reset support to SolverVBD: a new ChangesMasked reset support for SolverVBD
Estimated code review effort: 4 (Complex) | ~75 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant SolverVBD
participant reset_particle_state
participant reset_rigid_state
participant ForwardStep as forward_step_rigid_bodies
Caller->>SolverVBD: reset(state, world_mask, flags)
SolverVBD->>SolverVBD: validate state/world_mask/flags
alt particle flags set
SolverVBD->>reset_particle_state: copy model_particle_q/qd
end
alt owns rigid bodies
SolverVBD->>reset_rigid_state: reset body pose/vel, mark rebaseline mask, mark contact reset pending
end
Caller->>SolverVBD: step()
SolverVBD->>ForwardStep: forward_step_rigid_bodies(pose_rebaseline_mask)
ForwardStep-->>SolverVBD: rebaselined body_q_prev
SolverVBD->>SolverVBD: clear pose_rebaseline_mask
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Superseded by the stacked PR against the parent branch: jumyungc#1 |
Description
Add masked deformable (cloth and volumetric soft body) reset support to
SolverVBD.reset(), addressing the particle half of #3256 (the rigid half is #3316).Note
Stacked on #3316 — this branch contains the rigid-reset commits; only the final commit (
Fix: Reset particles in VBD solver) belongs to this PR. Review that commit's diff, and merge after #3316 lands.reset()now honorsStateFlags.PARTICLE_Q/StateFlags.PARTICLE_QD: a newreset_particle_statekernel copiesmodel.particle_q/model.particle_qdinto the state for particles in worlds selected byworld_mask, with the same semantics as the rigid path (world_mask=Nonealso resets globalworld == -1particles; an explicit mask excludes them). The particle reset also runs when an external solver integrates the bodies, and for particle-only models.No solver history plumbing is needed on the particle side:
particle_q_previs rebaselined from the incoming state at the start of everystep(), self-contact and body-particle contact buffers are rebuilt per step (init_body_particle_contactscold-startsbody_particle_contact_penalty_kon every contact refresh, with no match-index warm-start path), and tet/cloth elasticity is stateless. Cloth and volumetric deformables therefore share this single reset path. The previous "particle resets are not supported" warning is removed and the docstring documents the particle behavior, including regenerating contacts after moving particles andrebuild_bvhfor large displacements with self-contact.Checklist
CHANGELOG.mdhas been updated (if user-facing change)Test plan
test_particle_reset_state_flags_and_masks: two-world cloth plus a global particle; verifies masked restore of the selected world only,PARTICLE_Q-only /PARTICLE_QD-only /flags=0selectivity, that an explicit all-true mask excludes global particles whileworld_mask=Noneincludes them, and that a post-reset step stays finite.test_particle_reset_soft_body: two-world tet soft grid; masked restore and post-reset step with tet elasticity.Tests were verified to fail without the implementation (TDD), pass on CPU and CUDA, and the full VBD suite (60 tests) passes. Pre-commit is clean.
New feature / API change
Summary by CodeRabbit
New Features
Bug Fixes
Tests