Skip to content

Add collision handling and snow behavior validation - #177

Merged
utilForever merged 6 commits into
mainfrom
collision-handling
Aug 9, 2026
Merged

Add collision handling and snow behavior validation#177
utilForever merged 6 commits into
mainfrom
collision-handling

Conversation

@utilForever

@utilForever utilForever commented Aug 9, 2026

Copy link
Copy Markdown
Owner

This revision includes:

Summary by CodeRabbit

  • New Features

    • Added configurable closed-domain boundaries for snow simulations in 2D and 3D.
    • Exposed boundary configuration through the Python API.
    • Improved particle and grid handling at domain boundaries, colliders, and frictional surfaces.
  • Bug Fixes

    • Improved collision handling for particles exactly touching collider surfaces.
    • More reliably prevents particle penetration and constrains positions and velocities.
  • Tests

    • Added coverage for boundary settings, moving colliders, friction, exact-surface collisions, and simulation stability.

@utilForever utilForever self-assigned this Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0b4a6650-ff8a-48a7-a4eb-dfa8bee185f1

📥 Commits

Reviewing files that changed from the base of the PR and between 386806d and 4f6f332.

📒 Files selected for processing (1)
  • Includes/Core/Solver/Particle/MPM/SnowMPMSolver-Impl.hpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • Includes/Core/Solver/Particle/MPM/SnowMPMSolver-Impl.hpp
📜 Recent review details
⏰ Context from checks skipped due to timeout. (16)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: 🍎 Build - macOS 15.7.4 + Xcode 16.4
  • GitHub Check: 🍎 Build - macOS 26.3 + Xcode 26.3
  • GitHub Check: 🐧 CUDA Build - Ubuntu 24.04 + gcc-12 + CUDA 12.6.3
  • GitHub Check: 🐧 Build - Ubuntu 24.04 + gcc-13
  • GitHub Check: 🐧 Build - Ubuntu 24.04 + clang-17
  • GitHub Check: 🐧 Build - Ubuntu 24.04 + clang-16
  • GitHub Check: 🐧 Build - Ubuntu 24.04 + gcc-14
  • GitHub Check: 🐧 Build - Ubuntu 24.04 + gcc-12
  • GitHub Check: 🐧 Build - Ubuntu 24.04 + clang-18
  • GitHub Check: 🧪 Code Coverage - Codecov (Ubuntu 24.04 + gcc-14, ubuntu-24.04, gcc, 14)
  • GitHub Check: 🪟 CUDA Build - Windows Server 2025 + Visual Studio 2026 + CUDA 13.2.0 (Release)
  • GitHub Check: 🌞 Static Analysis - SonarCloud (Ubuntu 24.04 + gcc-14, ubuntu-24.04, gcc, 14)
  • GitHub Check: 🪟 CUDA Build - Windows Server 2022 + Visual Studio 2022 + CUDA 12.6.3 (Release)
  • GitHub Check: 🪟 Build - Windows Server 2022 + Visual Studio 2022
  • GitHub Check: 🪟 Build - Windows Server 2025 + Visual Studio 2026

📝 Walkthrough

Walkthrough

Snow MPM now supports configurable closed-domain boundaries, grid and particle constraints, inclusive collider contact detection, Python property access, and validation for walls, moving colliders, friction, exact contact, and finite simulation state.

Changes

Snow MPM constraints and validation

Layer / File(s) Summary
Closed-domain boundary API
Includes/Core/Solver/Particle/MPM/SnowMPMSolver.hpp, Includes/Core/Solver/Particle/MPM/SnowMPMSolver-Impl.hpp, Sources/API/Python/Solver/Particle/MPM/SnowMPMSolver.cpp, Tests/PythonTests/test_snow_mpm_solver.py
SnowMPMSolver stores a closedDomainBoundaryFlag initialized to DIRECTION_ALL. C++ and Python accessors expose the setting.
Time-step boundary and collider constraints
Includes/Core/Solver/Particle/MPM/SnowMPMSolver.hpp, Includes/Core/Solver/Particle/MPM/SnowMPMSolver-Impl.hpp, Tests/UnitTests/SnowMPMSolverTests.cpp
The solver constrains grid velocities before deformation updates and projects particle positions and velocities after grid transfer. Tests cover 2D and 3D walls, moving colliders, friction, and open versus closed boundaries.
Inclusive contact and behavior validation
Sources/Core/Geometry/Collider.cpp, Tests/UnitTests/RigidbodyCollider2Tests.cpp, Tests/UnitTests/RigidbodyCollider3Tests.cpp, Tests/ManualTests/SnowMPMSolverTests.cpp
Collider detection includes exact surface contact and exact radius distance. Tests cover zero-radius contact and finite frictional Snow MPM state.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SnowMPMSolver
  participant Grid
  participant Collider
  participant Particles
  SnowMPMSolver->>Grid: constrain grid velocities
  Grid->>Collider: resolve collider contact
  Collider-->>Grid: return corrected velocity
  Grid-->>Particles: transfer constrained motion
  SnowMPMSolver->>Particles: project positions and velocities
Loading

Possibly related PRs

Poem

A rabbit checks the snowy grid,
Each wall holds fast as it was bid.
Colliders turn each closing glide,
Exact-touch tests stand beside.
The particles stay safely inside.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes cover collision handling, boundaries, penetration prevention, collider tests, and finite-state validation, but do not clearly verify hardening and yield-limit behavior required by issue #164. Add focused tests for compression hardening and permanent deformation from tensile and compressive yield limits.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the pull request’s collision-handling and snow-validation changes.
Out of Scope Changes check ✅ Passed The collider comparison change, Snow MPM API updates, implementation changes, and tests directly support the linked issue objectives.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch collision-handling

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 44 complexity · 6 duplication

Metric Results
Complexity 44
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.62%. Comparing base (cb2b1cf) to head (4f6f332).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #177      +/-   ##
==========================================
+ Coverage   83.57%   83.62%   +0.04%     
==========================================
  Files         418      418              
  Lines       23807    23855      +48     
==========================================
+ Hits        19897    19948      +51     
+ Misses       3910     3907       -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

@utilForever
utilForever merged commit 693bebb into main Aug 9, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add collision handling and snow behavior validation

1 participant