MCPcopy Index your code
hub / github.com/dimforge/salva

github.com/dimforge/salva @v0.7.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.7.0 ↗ · + Follow
341 symbols 848 edges 65 files 163 documented · 48%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

crates.io

<a href="https://discord.gg/vt9DJSW">
    <img src="https://img.shields.io/discord/507548572338880513.svg?logo=discord&colorB=7289DA">
</a>
<a href="https://crates.io/crates/salva2d">
     <img src="https://img.shields.io/crates/v/salva2d.svg?style=flat-square&label=crates.io%20(salva2d)" alt="crates.io (salva2d)">
</a>
<a href="https://crates.io/crates/salva3d">
     <img src="https://img.shields.io/crates/v/salva3d.svg?style=flat-square&label=crates.io%20(salva3d)" alt="crates.io (salva3d)">
</a>
<a href="https://travis-ci.org/dimforge/salva">
    <img src="https://travis-ci.org/dimforge/salva.svg?branch=master" alt="Build status">
</a>






<strong>
    <a href="https://salva.rs">Users guide</a> | <a href="https://docs.rs/salva2d/latest/salva2d">2D Documentation</a> | <a href="https://docs.rs/salva3d/latest/salva3d">3D Documentation</a> | <a href="https://discourse.nphysics.org">Forum</a>
</strong>

Salva is a 2 and 3-dimensional particle-based fluid simulation engine for games and animations. It uses nalgebra for vector/matrix math and can optionally interface with nphysics for two-way coupling with rigid bodies, multibodies, and deformable bodies. 2D and 3D implementations both share (mostly) the same code!

Examples are available in the examples2d and examples3d directories. Because those demos are based on WASM and WebGl 1.0 they should work on most modern browsers. Feel free to ask for help and discuss features on the official user forum.

Why the name Salva?

The name of this library is inspired from the famous surrealist artist Salvador Dalì. The logo of Salva is inspired from its renown painting The Persistence of Memory.

Features

  • Pressure resolution: DFSPH and IISPH.
  • Viscosity: DFSPH viscosity, Artificial viscosity, and XSPH viscosity.
  • Surface tension: WCSPH surface tension, and methods from He et al. 2014 and Akinci et al. 2013
  • Elasticity: method from Becker et al. 2009
  • Multiphase fluids: mix several fluids with different characteristics (densities, viscosities, etc.)
  • Optional two-way coupling with bodies from nphysics.
  • WASM support

Extension points exported contracts — how you extend this code

NonPressureForce (Interface)
Trait implemented by non-pressure forces. This includes all non-pressure forces internal to a same fluid, or acting bet [9 …
src/solver/nonpressure_force.rs
Kernel (Interface)
Kernel functions for performing approximations within the PBF/SPH methods. [4 implementers]
src/kernel/kernel.rs
CouplingManager (Interface)
Trait that needs to be implemented by middlewares responsible for coupling bodies from a rigid-body physic framework (np [2 …
src/coupling/coupling_manager.rs
PressureSolver (Interface)
Trait implemented by pressure solvers. [2 implementers]
src/solver/pressure/pressure_solver.rs

Core symbols most depended-on inside this repo

iter
called by 93
src/object/contiguous_arena.rs
particle_contacts
called by 50
src/geometry/contacts.rs
len
called by 45
src/geometry/contacts.rs
insert
called by 27
src/geometry/hgrid.rs
particle_mass
called by 27
src/object/fluid.rs
num_particles
called by 24
src/object/fluid.rs
dt
called by 19
src/timestep_manager.rs
filter_from_mask
called by 17
src/helper.rs

Shape

Method 239
Function 54
Class 40
Enum 4
Interface 4

Languages

Rust100%

Modules by API surface

src/geometry/hgrid.rs20 symbols
src/solver/pressure/dfsph_solver.rs19 symbols
src/object/fluid.rs19 symbols
src/geometry/contacts.rs19 symbols
src/solver/pressure/iisph_solver.rs18 symbols
src/integrations/rapier/testbed_plugin.rs18 symbols
src/object/contiguous_arena.rs17 symbols
src/liquid_world.rs16 symbols
src/integrations/rapier/fluids_pipeline.rs12 symbols
src/solver/viscosity/dfsph_viscosity.rs11 symbols
src/counters/timer.rs10 symbols
src/timestep_manager.rs9 symbols

For agents

$ claude mcp add salva \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact