Add masked particle resets to SolverVBD - #1
Draft
mmichelis wants to merge 1 commit into
Draft
Conversation
mmichelis
temporarily deployed
to
external-pr-approval
July 3, 2026 16:32 — with
GitHub Actions
Inactive
mmichelis
temporarily deployed
to
external-pr-approval
July 3, 2026 16:32 — with
GitHub Actions
Inactive
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add masked deformable (cloth and volumetric soft body) reset support to
SolverVBD.reset(), addressing the particle half of newton-physics#3256 (the rigid half is newton-physics#3316).Note
Stacked on newton-physics#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 newton-physics#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